12 #ifndef _BASEFABIMPLEM_H_ 13 #define _BASEFABIMPLEM_H_ 21 #include "NamespaceHeader.H" 46 if (blerg.
nComp() != 1)
48 pout() <<
"ncomp busted" << endl;
53 pout() <<
"box return busted" << endl;
56 for (
int idir = 0; idir <
SpaceDim; idir++)
58 if (blerg.
size()[idir] != 2)
60 pout() <<
"size busted" <<endl;
67 pout() <<
"smallend busted" <<endl;
72 pout() <<
"bigend busted" <<endl;
79 int retval = testBoxAndComp();
87 :m_domain(std::move(a_in.m_domain)),
89 m_numpts(a_in.m_numpts),
90 m_truesize(a_in.m_truesize),
92 m_aliased(a_in.m_aliased)
95 m_mdarray(a_in.m_mdarray)
103 m_domain = std::move(a_in.m_domain);
105 m_numpts=a_in.m_numpts;
106 std::swap(m_truesize,a_in.m_truesize);
107 std::swap(m_dptr,a_in.m_dptr);
108 std::swap(m_aliased,a_in.m_aliased);
110 m_mdarray=a_in.m_mdarray;
235 template<
unsigned int C>
239 m_domain = getBox(a_original.box());
243 m_dptr = &a_original(a_original.box().low());
301 long int ind = ind1 + ind2;
344 for (
int k = 0; k < a_numcomp; k++)
346 a_data[k] =
m_dptr[loc+(a_n+k)*size];
429 const Box& a_destbox,
436 CH_assert(a_srccomp >= 0 && a_srccomp+a_numcomp <= a_src.
nComp());
439 performCopy(a_src,a_srcbox,a_srccomp,a_destbox,a_destcomp,a_numcomp);
458 performCopy(a_src,overlap,a_srccomp,overlap,a_destcomp,a_numcomp);
466 const Box& a_destbox)
471 Box overlap(a_destbox);
474 if (!overlap.isEmpty())
491 if (!overlap.isEmpty())
501 const Box& a_RegionTo,
505 if ((
this == &a_src) && (a_RegionFrom == a_RegionTo) && (a_Cdest == a_Csrc) )
512 copy(a_src, a_RegionFrom, a_Csrc.
begin(), a_RegionTo,
565 return a_box.
numPts() * (
sizeof(T) * a_comps.
size());
578 T* buffer = (T*)a_buf;
580 ForAllThisCBNN(T,a_R,a_comps.
begin(),a_comps.
size())
585 return (
void*)buffer;
600 T* buffer = (T*)a_buf;
602 ForAllThisBNN(T,a_R,a_comps.
begin(),a_comps.
size())
608 return (
void*) buffer;
615 char * bufptr =
static_cast<char*
>(a_outBuf) ;
621 bufptr +=
sizeof(int) ;
631 char * bufptr =
static_cast<char*
>(
const_cast<void*
>(a_buf)) ;
638 bufptr +=
sizeof( ncomps );
646 T* buffer = (T*)bufptr;
647 for (
int icomp = 0; icomp < ncomps; icomp++)
652 (*this)(iv, icomp) = *buffer;
680 #ifdef CH_USE_MEMORY_TRACKING 702 #ifdef CH_USE_MEMORY_TRACKING 722 for (
long int i = 0; i <
m_truesize; i++, ptr++)
747 for (
long int i = 0; i <
m_truesize; i++, ptr++)
754 #ifdef CH_USE_MEMORY_TRACKING 755 ch_memcount -= m_truesize *
sizeof(T) +
sizeof(
BaseFab<T>);
765 std::string rtn = (
typeid(T)).name();
774 const Box& a_destbox,
781 CH_assert(a_srccomp >= 0 && a_srccomp + a_numcomp <= a_src.
nComp());
784 ForAllThisBNNXCBN(T, a_destbox, a_destcomp, a_numcomp, a_src, a_srcbox, a_srccomp)
802 for (
long i = 0,
N = a_numcomp *
m_numpts; i <
N; i++)
809 ForAllThisBNN(T,a_bx,a_nstart,a_numcomp)
828 template <
class T>
void 834 this->
box().
degenerate( degenerateBox, a_sliceSpec, &outofbounds );
840 a_slice.
copy( *
this, degenerateBox );
843 #include "NamespaceFooter.H" std::ostream & pout()
Use this in place of std::cout for program output.
bool ok()
Definition: BoxIterator.H:281
void clear()
Definition: BaseFabImplem.H:252
void degenerate(BaseFab< T > &a_slice, const SliceSpec &a_sliceSpec) const
Definition: BaseFabImplem.H:829
bool contains(const BaseFab< T > &a_fab) const
{ comparison functions}
Definition: BaseFabImplem.H:389
IntVect size() const
size functions
Definition: Box.H:1803
const int * hiVect() const
Definition: Box.H:1830
static Arena * s_Arena
Definition: BaseFab.H:594
#define CH_assert(cond)
Definition: CHArray.H:37
bool sameSize(const Box &b) const
Definition: Box.H:1896
virtual void linearOut(void *a_buf, const Box &a_R, const Interval &a_comps) const
Definition: BaseFabImplem.H:568
void setVal(T a_x, const Box &a_bx, int a_nstart, int a_numcomp)
{ data modification functions}
Definition: BaseFabImplem.H:399
virtual ~BaseFab()
Definition: BaseFabImplem.H:168
int size() const
Definition: Interval.H:75
BaseFab< T > & shift(const IntVect &a_v)
{ domain modification functions}
Definition: BaseFabImplem.H:516
int begin() const
Definition: Interval.H:97
const int * loVect() const
Definition: Box.H:1823
virtual void linearIn(void *a_buf, const Box &a_R, const Interval &a_comps)
Definition: BaseFabImplem.H:588
Definition: SliceSpec.H:41
bool contains(const IntVect &p) const
Definition: Box.H:1871
Box & shiftHalf(int dir, int num_halfs)
static std::string name()
Definition: BaseFabImplem.H:763
Box m_domain
Definition: BaseFab.H:596
iterates through the IntVects of a Box
Definition: BoxIterator.H:37
const IntVect & bigEnd() const
Definition: BaseFabImplem.H:286
int m_nvar
Definition: BaseFab.H:597
const Box & box() const
Definition: BaseFabImplem.H:271
A Concrete Class for Dynamic Memory Management.
Definition: Arena.H:124
int linearSize(void) const
Definition: BaseFabImplem.H:667
BaseFab< T > & operator=(BaseFab< T > &&) noexcept
move assignment
Definition: BaseFabImplem.H:101
const int * nCompPtr() const
Definition: BaseFabImplem.H:366
const int SpaceDim
Definition: SPACE.H:38
BaseFab()
Definition: BaseFabImplem.H:115
virtual void * alloc(size_t a_sz)=0
void const char const int const int const int const Real const Real const int const Real const int const Real Real * C
Definition: Lapack.H:83
virtual void * linearOut2(void *a_buf, const Box &a_R, const Interval &a_comps) const
Same as linearOut, but returns the current location in the buffer.
Definition: BaseFabImplem.H:574
bool isAliased() const
Definition: BaseFabImplem.H:817
virtual void free(void *a_pt)=0
void getVal(T *a_data, const IntVect &a_pos, int a_N, int a_numcomp) const
Definition: BaseFabImplem.H:333
const IntVect & bigEnd() const
Definition: Box.H:1768
BaseFab< T > & shiftHalf(int a_dir, int a_numHalfs)
Definition: BaseFabImplem.H:539
Structure for passing component ranges in code.
Definition: Interval.H:23
static const IntVect Unit
Definition: IntVect.H:659
const IntVect & smallEnd() const
{ Accessors}
Definition: Box.H:1754
void linearOut(void *const a_outBuf, const T &inputT)
Definition: SPMDI.H:33
virtual void define(const Box &a_box, int a_comps, T *a_alias=NULL)
Definition: BaseFab.H:169
A Virtual Base Class for Dynamic Memory Managemen.
Definition: Arena.H:40
double Real
Definition: REAL.H:33
void define()
Definition: BaseFabImplem.H:672
virtual void performCopy(const BaseFab< T > &a_src, const Box &a_srcbox, int a_srccomp, const Box &a_destbox, int a_destcomp, int a_numcomp)
Definition: BaseFabImplem.H:771
const int * hiVect() const
Definition: BaseFabImplem.H:361
BaseFab< T > & copy(const BaseFab< T > &a_src, const Box &a_srcbox, int a_srccomp, const Box &a_destbox, int a_destcomp, int a_numcomp)
Definition: BaseFabImplem.H:426
Interval interval() const
Definition: BaseFab.H:223
int linearSize(const T &inputT)
Definition: SPMDI.H:21
static void Error(const char *const a_msg=m_nullString, int m_exitCode=CH_DEFAULT_ERROR_CODE)
Print out message to cerr and exit with the specified exit code.
const IntVect & smallEnd() const
Definition: BaseFabImplem.H:281
T * dataPtr(int a_n=0)
Definition: BaseFabImplem.H:373
static const IntVect Zero
Definition: IntVect.H:654
T *__restrict m_dptr
Definition: BaseFab.H:601
static void Warning(const char *const a_msg=m_nullString)
Print out message to cerr and continue.
bool sameType(const Box &b) const
Definition: Box.H:1880
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
long index(const IntVect &v) const
Definition: Box.H:1931
bool m_aliased
Definition: BaseFab.H:602
long m_truesize
Definition: BaseFab.H:599
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
T & operator()(const IntVect &a_p, int a_N)
Definition: BaseFabImplem.H:291
const int * loVect() const
{ Fortran interface functions}
Definition: BaseFabImplem.H:356
Box & shift(int dir, int nzones)
shift functions
Definition: Box.H:2067
int nComp() const
{ accessors}
Definition: BaseFabImplem.H:264
void const char const int const int * N
Definition: Lapack.H:83
void resize(const Box &a_b, int a_n=1, T *a_alias=NULL)
Definition: BaseFabImplem.H:173
void undefine()
Definition: BaseFabImplem.H:728
static int testBoxAndComp()
regression test
Definition: BaseFabImplem.H:39
void performSetVal(T a_x, const Box &a_bx, int a_nstart, int a_numcomp)
Definition: BaseFabImplem.H:790
static int test()
regression test
Definition: BaseFabImplem.H:77
bool isEmpty() const
{ Comparison Functions}
Definition: Box.H:1846
void linearIn(T &a_outputT, const void *const inBuf)
Definition: SPMDI.H:27
virtual void * linearIn2(void *a_buf, const Box &a_R, const Interval &a_comps)
same as linearIn, but returns the current location in the buffer
Definition: BaseFabImplem.H:596
IntVect size() const
Definition: BaseFabImplem.H:276
long m_numpts
Definition: BaseFab.H:598
void degenerate(Box &a_to, const SliceSpec &a_sliceSpec, bool *a_outofbounds=0) const
bool isUsable() const
Definition: BaseFabImplem.H:823