11 #ifndef _BASEIFFABI_H_ 12 #define _BASEIFFABI_H_ 17 #include "NamespaceHeader.H" 27 s_doSurroundingNodeSemantic = a_useSurr;
41 pout() <<
"usethisface: face = " << a_face <<
", a_region = " << a_toBox << endl;
56 const Box& a_toBox)
const 58 Box grownBox = a_toBox;
59 if (s_doSurroundingNodeSemantic)
61 grownBox.
grow(m_direction, 1);
64 a_ivsIntersect = m_ivs;
65 a_ivsIntersect &= a_intBox;
71 template <
class T>
inline void 74 s_verbose = a_verbose;
77 template <
class T>
inline 84 template <
class T>
inline 90 template <
class T>
inline 96 template <
class T>
inline 99 const int& a_direction,
103 define(a_ivsin, a_ebgraph, a_direction, a_nvarin);
109 #pragma intel optimization_level 0 110 template <
class T>
inline 114 const int& a_direction,
122 m_direction = a_direction;
124 m_ebgraph = a_ebgraph;
148 int numVoFsHere = m_ebgraph.numVoFs(iv);
150 nVoFs += numVoFsHere;
152 if (!doneThat(iv, 0))
154 doneThat(iv, 0) =
true;
156 bool onLoBoundary =
false;
161 int numFacesLoSide = numVoFsHere;
164 int numVoFsLo = m_ebgraph.numVoFs(ivLo);
165 numFacesLoSide = numVoFsHere*numVoFsLo;
168 faceLocFab(iv, 0) = m_nFaces;
169 m_nFaces += numFacesLoSide;
171 if (!doneThat(ivHi, 0))
173 doneThat(ivHi, 0) =
true;
175 bool onHiBoundary =
false;
178 onHiBoundary = iv[m_direction] == domain.
domainBox().
bigEnd(m_direction);
180 int numFacesHiSide = numVoFsHere;
183 int numVoFsHi = m_ebgraph.numVoFs(ivHi);
184 numFacesHiSide = numVoFsHere*numVoFsHi;
187 faceLocFab(ivHi, 0) = m_nFaces;
188 m_nFaces += numFacesHiSide;
196 #ifdef CH_USE_MEMORY_TRACKING 213 m_truesize = m_nFaces*m_nComp;
217 m_data.
resize(m_truesize);
220 #ifdef CH_USE_MEMORY_TRACKING 229 if (m_nFaces==0)
return;
231 T* startLoc = &m_data[0];
235 if (!doneThat(iv, 0))
237 doneThat(iv, 0) =
true;
238 int iface = faceLocFab(iv, 0);
241 m_fab(iv, 0) = startLoc + iface;
245 if (!doneThat(ivHi, 0))
247 doneThat(ivHi, 0) =
true;
248 int iface = faceLocFab(ivHi, 0);
251 m_fab(ivHi, 0) = startLoc + iface;
257 template <
class T>
inline 264 template <
class T>
inline 271 template <
class T>
inline 276 for (
int ivec = 0; ivec < m_nFaces*m_nComp; ivec++)
278 m_data[ivec] = a_value;
282 template <
class T>
inline 290 for (
int ivec = ivar; ivec < m_nFaces*m_nComp; ivec += m_nComp)
292 m_data[ivec] = a_value;
296 template <
class T>
inline 314 CH_assert( (a_fromBox == a_toBox) || m_ebgraph.getDomain().isPeriodic() );
320 getBoxAndIVS(intBox, ivsIntersect, a_toBox);
322 ivsIntersect &= a_src.
m_ivs;
323 int compSize = a_srcInterval.
size();
326 FaceIterator faceit(ivsIntersect, m_ebgraph, m_direction, stopCrit);
327 for (faceit.
reset(); faceit.
ok(); ++faceit)
332 if (useThisFace(a_toBox, face))
334 for (
int icomp = 0; icomp < compSize; icomp++)
336 int isrccomp = a_srcInterval.
begin() + icomp;
337 int idstcomp = a_dstInterval.
begin() + icomp;
338 (*this)(face, idstcomp) = a_src(face, isrccomp);
345 template <
class T>
inline 352 int faceLoc = getLocalVecIndex(a_face);
354 dataPtr += m_nFaces*a_comp;
358 template <
class T>
inline 371 retval = loCell + xlen*hiCell;
378 CH_assert(((loCell == -1)&&(hiCell > -1))||
379 ((hiCell == -1)&&(loCell > -1)));
381 retval =
Max(loCell, hiCell);
386 template <
class T>
inline 408 template <
class T>
inline 412 return (m_isDefined);
415 template <
class T>
inline 422 template <
class T>
inline 429 template <
class T>
inline 441 T* dataPtr = getIndex(a_ndin, a_comp);
445 template <
class T>
inline 448 const int& a_comp)
const 457 T* dataPtr = getIndex(a_ndin, a_comp);
461 template <
class T>
inline 467 static T* dummy = NULL;
468 if (m_nFaces==0)
return dummy;
470 return &(m_data[0]) + a_comp*m_nFaces;
474 template <
class T>
inline 480 static T* dummy = NULL;
481 if (m_nFaces==0)
return dummy;
483 return &(m_data[0]) + a_comp*m_nFaces;
486 template <
class T>
inline 498 template <
class T>
inline 508 getBoxAndIVS(intBox, subIVS, a_region);
511 FaceIterator faceit(subIVS, m_ebgraph, m_direction, stopCrit);
517 pout() <<
"baseiffab facesize = " << facesize << endl;
521 for (
int iface = 0; iface < faces.
size(); iface++)
525 if (useThisFace(a_region, faces[iface]))
528 for (
int icomp = a_comps.
begin(); icomp <= a_comps.
end(); icomp++)
530 const T& dataPt = (*this)(faces[iface], icomp);
532 datasize += pointsize;
538 pout() <<
"baseiffab datasize = " << datasize << endl;
540 pout() <<
"baseiffab iused = " << iused << endl;
542 int retval = facesize + datasize;
546 pout() <<
"###############" << std::endl;
547 pout() <<
"BaseIFFAB size() for region " << m_ebgraph.getRegion() << std::endl;
548 pout() <<
" a_comps = (" << a_comps.
begin() <<
"," << a_comps.
end() <<
")," 549 <<
" a_region = " << a_region <<
" subIVS = ";
551 pout() <<
"m_ivs = ";
553 pout() <<
"size = " << retval << std::endl;
554 pout() <<
"###############" << std::endl;
560 template <
class T>
inline 570 getBoxAndIVS(intBox, subIVS, a_region);
573 FaceIterator faceit(subIVS, m_ebgraph, m_direction, stopCrit);
577 unsigned char* charbuffer = (
unsigned char *) a_buf;
583 for (
int iface = 0; iface < faces.
size(); iface++)
587 if (useThisFace(a_region, faces[iface]))
590 for (
int icomp = a_comps.
begin(); icomp <= a_comps.
end(); icomp++)
593 const T& dataPt = thisFAB(face, icomp);
602 template <
class T>
inline 612 getBoxAndIVS(intBox, subIVS, a_region);
615 FaceIterator faceit(subIVS, m_ebgraph, m_direction, stopCrit);
618 unsigned char* charbuffer = (
unsigned char *) a_buf;
622 for (
int iface = 0; iface < faces.
size(); iface++)
626 if (useThisFace(a_region, faces[iface]))
629 for (
int icomp = a_comps.
begin(); icomp <= a_comps.
end(); icomp++)
632 T& dataPt = (*this)(face, icomp);
643 #include "NamespaceFooter.H" std::ostream & pout()
Use this in place of std::cout for program output.
void linearIn(void *buf, const Box &R, const Interval &comps)
Definition: BaseIFFABI.H:603
int nComp() const
Definition: BaseIFFABI.H:424
T * dataPtr(const int &a_comp)
Definition: BaseIFFABI.H:463
static void setVerbose(bool a_verbose)
Definition: BaseIFFABI.H:72
int m_nComp
Definition: BaseIFFAB.H:223
An irregular domain on an integer lattice.
Definition: IntVectSet.H:44
#define CH_assert(cond)
Definition: CHArray.H:37
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
int size(const Box &R, const Interval &comps) const
Definition: BaseIFFABI.H:499
void setVal(T a_x, const Box &a_bx, int a_nstart, int a_numcomp)
{ data modification functions}
Definition: BaseFabImplem.H:399
Definition: FaceIndex.H:28
void linearListOut(void *const a_outBuf, const Vector< T > &a_inputT)
Definition: SPMDI.H:258
int size() const
Definition: Interval.H:75
int begin() const
Definition: Interval.H:97
Iterator over faces within an IntVectSet and an Ebgraph.
Definition: FaceIterator.H:67
void clear()
Definition: BaseIFFABI.H:388
Definition: FaceIterator.H:48
void setVal(const T &value)
Definition: BaseIFFABI.H:273
const ProblemDomain & getDomain() const
Definition: EBGraph.H:939
bool contains(const IntVect &p) const
Definition: Box.H:1871
const IntVect & gridIndex(const Side::LoHiSide &a_sd) const
IntVect BASISV(int dir)
Definition: IntVect.H:1266
~BaseIFFAB()
Definition: BaseIFFABI.H:91
int getLocalVecIndex(const FaceIndex &a_face) const
Definition: BaseIFFABI.H:360
const int & direction() const
bool ok() const
returns true if this iterator is still in its IntVectSet
Definition: IntVectSet.H:711
Definition: LoHiSide.H:31
Geometric description within a box.
Definition: EBGraph.H:427
const int SpaceDim
Definition: SPACE.H:38
const bool & isBoundary() const
const IntVect & bigEnd() const
Definition: Box.H:1768
IntVectSet m_ivs
Definition: BaseIFFAB.H:229
Structure for passing component ranges in code.
Definition: Interval.H:23
const Vector< FaceIndex > & getVector() const
bool isDefined() const
Definition: BaseIFFABI.H:410
const IntVect & smallEnd() const
{ Accessors}
Definition: Box.H:1754
void linearOut(void *const a_outBuf, const T &inputT)
Definition: SPMDI.H:33
static void setSurroundingNodeSemantic(bool a_useSurr)
Definition: BaseIFFABI.H:25
A Virtual Base Class for Dynamic Memory Managemen.
Definition: Arena.H:40
Box surroundingNodes(const Box &b, int dir)
Definition: Box.H:2145
int linearSize(const T &inputT)
Definition: SPMDI.H:21
int direction() const
Definition: BaseIFFABI.H:266
bool isPeriodic(int a_dir) const
Returns true if BC is periodic in direction a_dir.
Definition: ProblemDomain.H:894
size_t size() const
Definition: Vector.H:192
bool useThisFace(const Box &a_toBox, const FaceIndex &a_face) const
Definition: BaseIFFABI.H:34
void setDefaultValues()
Definition: BaseIFFABI.H:488
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
Definition: BaseIFFAB.H:34
void linearListIn(Vector< T > &a_outputT, const void *const a_inBuf)
Definition: SPMDI.H:229
BaseIFFAB()
Definition: BaseIFFABI.H:85
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
Definition: LoHiSide.H:30
int linearListSize(const Vector< T > &a_input)
Definition: SPMDI.H:290
void linearOut(void *buf, const Box &R, const Interval &comps) const
Definition: BaseIFFABI.H:561
void copy(const Box &a_intBox, const Interval &a_destInterval, const Box &a_toBox, const BaseIFFAB< T > &a_src, const Interval &a_srcInterval)
Definition: BaseIFFABI.H:298
T Max(const T &a_a, const T &a_b)
Definition: Misc.H:39
Box & grow(int i)
grow functions
Definition: Box.H:2247
void resize(const Box &a_b, int a_n=1, T *a_alias=NULL)
Definition: BaseFabImplem.H:173
T & operator()(const FaceIndex &a_face, const int &varlocin)
Definition: BaseIFFABI.H:431
int end() const
Definition: Interval.H:102
void define(const IntVectSet &a_region, const EBGraph &a_ebgraph, const int &a_direction, const int &a_nvarin)
Definition: BaseIFFABI.H:112
const Box & domainBox() const
Returns the logical computational domain.
Definition: ProblemDomain.H:887
void getBoxAndIVS(Box &a_intBox, IntVectSet &a_ivsIntersect, const Box &a_toBox) const
Definition: BaseIFFABI.H:54
Iterator for an IntVectSet.
Definition: IntVectSet.H:640
void linearIn(T &a_outputT, const void *const inBuf)
Definition: SPMDI.H:27
T * getIndex(const FaceIndex &a_face, const int &a_comp) const
Definition: BaseIFFABI.H:347
const Box & minBox() const
Returns the minimum enclosing box of this IntVectSet.
int numFaces() const
Definition: BaseIFFABI.H:417
const int & cellIndex(const Side::LoHiSide &a_sd) const
bool isEmpty() const
Returns true if no IntVects are in this IntVectSet.
WhichFaces
Definition: FaceIterator.H:45
const EBGraph & getEBGraph() const
Definition: BaseIFFABI.H:79
const IntVectSet & getIVS() const
Definition: BaseIFFABI.H:259