11 #ifndef _BASEIFFABI_H_ 12 #define _BASEIFFABI_H_ 16 #include "NamespaceHeader.H" 26 s_doSurroundingNodeSemantic = a_useSurr;
50 const Box& a_toBox)
const 52 Box grownBox = a_toBox;
53 if (s_doSurroundingNodeSemantic)
55 grownBox.
grow(m_direction, 1);
58 a_ivsIntersect = m_ivs;
59 a_ivsIntersect &= a_intBox;
65 template <
class T>
inline void 68 s_verbose = a_verbose;
71 template <
class T>
inline 78 template <
class T>
inline 84 template <
class T>
inline 90 template <
class T>
inline 93 const int& a_direction,
97 define(a_ivsin, a_ebgraph, a_direction, a_nvarin);
103 template <
class T>
inline 107 const int& a_direction,
115 m_direction = a_direction;
117 m_ebgraph = a_ebgraph;
141 int numVoFsHere = m_ebgraph.numVoFs(iv);
143 nVoFs += numVoFsHere;
145 if (!doneThat(iv, 0))
147 doneThat(iv, 0) =
true;
149 bool onLoBoundary =
false;
154 int numFacesLoSide = numVoFsHere;
157 int numVoFsLo = m_ebgraph.numVoFs(ivLo);
158 numFacesLoSide = numVoFsHere*numVoFsLo;
161 faceLocFab(iv, 0) = m_nFaces;
162 m_nFaces += numFacesLoSide;
164 if (!doneThat(ivHi, 0))
166 doneThat(ivHi, 0) =
true;
168 bool onHiBoundary =
false;
171 onHiBoundary = iv[m_direction] == domain.
domainBox().
bigEnd(m_direction);
173 int numFacesHiSide = numVoFsHere;
176 int numVoFsHi = m_ebgraph.numVoFs(ivHi);
177 numFacesHiSide = numVoFsHere*numVoFsHi;
180 faceLocFab(ivHi, 0) = m_nFaces;
181 m_nFaces += numFacesHiSide;
189 #ifdef CH_USE_MEMORY_TRACKING 206 m_truesize = m_nFaces*m_nComp;
210 m_data.
resize(m_truesize);
213 #ifdef CH_USE_MEMORY_TRACKING 222 if (m_nFaces==0)
return;
224 T* startLoc = &m_data[0];
228 if (!doneThat(iv, 0))
230 doneThat(iv, 0) =
true;
231 int iface = faceLocFab(iv, 0);
234 m_fab(iv, 0) = startLoc + iface;
238 if (!doneThat(ivHi, 0))
240 doneThat(ivHi, 0) =
true;
241 int iface = faceLocFab(ivHi, 0);
244 m_fab(ivHi, 0) = startLoc + iface;
250 template <
class T>
inline 257 template <
class T>
inline 264 template <
class T>
inline 269 for (
int ivec = 0; ivec < m_nFaces*m_nComp; ivec++)
271 m_data[ivec] = a_value;
275 template <
class T>
inline 283 for (
int ivec = ivar; ivec < m_nFaces*m_nComp; ivec += m_nComp)
285 m_data[ivec] = a_value;
289 template <
class T>
inline 307 CH_assert( (a_fromBox == a_toBox) || m_ebgraph.getDomain().isPeriodic() );
313 getBoxAndIVS(intBox, ivsIntersect, a_toBox);
315 ivsIntersect &= a_src.
m_ivs;
316 int compSize = a_srcInterval.
size();
319 FaceIterator faceit(ivsIntersect, m_ebgraph, m_direction, stopCrit);
320 for (faceit.
reset(); faceit.
ok(); ++faceit)
325 if (useThisFace(a_toBox, face))
327 for (
int icomp = 0; icomp < compSize; icomp++)
329 int isrccomp = a_srcInterval.
begin() + icomp;
330 int idstcomp = a_dstInterval.
begin() + icomp;
331 (*this)(face, idstcomp) = a_src(face, isrccomp);
338 template <
class T>
inline 345 int faceLoc = getLocalVecIndex(a_face);
347 dataPtr += m_nFaces*a_comp;
351 template <
class T>
inline 364 retval = loCell + xlen*hiCell;
371 CH_assert(((loCell == -1)&&(hiCell > -1))||
372 ((hiCell == -1)&&(loCell > -1)));
374 retval =
Max(loCell, hiCell);
379 template <
class T>
inline 401 template <
class T>
inline 405 return (m_isDefined);
408 template <
class T>
inline 415 template <
class T>
inline 422 template <
class T>
inline 434 T* dataPtr = getIndex(a_ndin, a_comp);
438 template <
class T>
inline 441 const int& a_comp)
const 450 T* dataPtr = getIndex(a_ndin, a_comp);
454 template <
class T>
inline 460 static T* dummy = NULL;
461 if (m_nFaces==0)
return dummy;
463 return &(m_data[0]) + a_comp*m_nFaces;
467 template <
class T>
inline 473 static T* dummy = NULL;
474 if (m_nFaces==0)
return dummy;
476 return &(m_data[0]) + a_comp*m_nFaces;
479 template <
class T>
inline 491 template <
class T>
inline 501 getBoxAndIVS(intBox, subIVS, a_region);
504 FaceIterator faceit(subIVS, m_ebgraph, m_direction, stopCrit);
512 for (
int iface = 0; iface < faces.
size(); iface++)
516 if (useThisFace(a_region, faces[iface]))
518 for (
int icomp = a_comps.
begin(); icomp <= a_comps.
end(); icomp++)
520 const T& dataPt = (*this)(faces[iface], icomp);
522 datasize += pointsize;
527 int retval = facesize + datasize;
531 pout() <<
"###############" << std::endl;
532 pout() <<
"BaseIFFAB size() for region " << m_ebgraph.getRegion() << std::endl;
533 pout() <<
" a_comps = (" << a_comps.
begin() <<
"," << a_comps.
end() <<
")," 534 <<
" a_region = " << a_region <<
" subIVS = ";
536 pout() <<
"m_ivs = ";
538 pout() <<
"size = " << retval << std::endl;
539 pout() <<
"###############" << std::endl;
545 template <
class T>
inline 555 getBoxAndIVS(intBox, subIVS, a_region);
558 FaceIterator faceit(subIVS, m_ebgraph, m_direction, stopCrit);
562 unsigned char* charbuffer = (
unsigned char *) a_buf;
568 for (
int iface = 0; iface < faces.
size(); iface++)
572 if (useThisFace(a_region, faces[iface]))
575 for (
int icomp = a_comps.
begin(); icomp <= a_comps.
end(); icomp++)
578 const T& dataPt = thisFAB(face, icomp);
587 template <
class T>
inline 597 getBoxAndIVS(intBox, subIVS, a_region);
600 FaceIterator faceit(subIVS, m_ebgraph, m_direction, stopCrit);
603 unsigned char* charbuffer = (
unsigned char *) a_buf;
607 for (
int iface = 0; iface < faces.
size(); iface++)
611 if (useThisFace(a_region, faces[iface]))
614 for (
int icomp = a_comps.
begin(); icomp <= a_comps.
end(); icomp++)
617 T& dataPt = (*this)(face, icomp);
628 #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:588
int nComp() const
Definition: BaseIFFABI.H:417
T * dataPtr(const int &a_comp)
Definition: BaseIFFABI.H:456
static void setVerbose(bool a_verbose)
Definition: BaseIFFABI.H:66
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:130
int size(const Box &R, const Interval &comps) const
Definition: BaseIFFABI.H:492
void setVal(T a_x, const Box &a_bx, int a_nstart, int a_numcomp)
{ data modification functions}
Definition: BaseFabImplem.H:326
Definition: FaceIndex.H:28
void linearListOut(void *const a_outBuf, const Vector< T > &a_inputT)
Definition: SPMDI.H:255
int size() const
Definition: Interval.H:64
int begin() const
Definition: Interval.H:86
Iterator over faces within an IntVectSet and an Ebgraph.
Definition: FaceIterator.H:67
void clear()
Definition: BaseIFFABI.H:381
Definition: FaceIterator.H:48
void setVal(const T &value)
Definition: BaseIFFABI.H:266
const ProblemDomain & getDomain() const
Definition: EBGraph.H:934
bool contains(const IntVect &p) const
Definition: Box.H:1888
const IntVect & gridIndex(const Side::LoHiSide &a_sd) const
IntVect BASISV(int dir)
Definition: IntVect.H:1183
~BaseIFFAB()
Definition: BaseIFFABI.H:85
int getLocalVecIndex(const FaceIndex &a_face) const
Definition: BaseIFFABI.H:353
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:432
const int SpaceDim
Definition: SPACE.H:39
const bool & isBoundary() const
const IntVect & bigEnd() const
Definition: Box.H:1779
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:403
const IntVect & smallEnd() const
{ Accessors}
Definition: Box.H:1765
void linearOut(void *const a_outBuf, const T &inputT)
Definition: SPMDI.H:32
static void setSurroundingNodeSemantic(bool a_useSurr)
Definition: BaseIFFABI.H:24
A Virtual Base Class for Dynamic Memory Managemen.
Definition: Arena.H:40
Box surroundingNodes(const Box &b, int dir)
Definition: Box.H:2166
int linearSize(const T &inputT)
Definition: SPMDI.H:20
int direction() const
Definition: BaseIFFABI.H:259
bool isPeriodic(int a_dir) const
Returns true if BC is periodic in direction a_dir.
Definition: ProblemDomain.H:875
size_t size() const
Definition: Vector.H:177
bool useThisFace(const Box &a_toBox, const FaceIndex &a_face) const
Definition: BaseIFFABI.H:33
void setDefaultValues()
Definition: BaseIFFABI.H:481
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:226
BaseIFFAB()
Definition: BaseIFFABI.H:79
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:287
void linearOut(void *buf, const Box &R, const Interval &comps) const
Definition: BaseIFFABI.H:546
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:291
T Max(const T &a_a, const T &a_b)
Definition: Misc.H:39
Box & grow(int i)
grow functions
Definition: Box.H:2268
void resize(const Box &a_b, int a_n=1, T *a_alias=NULL)
Definition: BaseFabImplem.H:135
T & operator()(const FaceIndex &a_face, const int &varlocin)
Definition: BaseIFFABI.H:424
int end() const
Definition: Interval.H:91
void define(const IntVectSet &a_region, const EBGraph &a_ebgraph, const int &a_direction, const int &a_nvarin)
Definition: BaseIFFABI.H:105
const Box & domainBox() const
Returns the logical computational domain.
Definition: ProblemDomain.H:868
void getBoxAndIVS(Box &a_intBox, IntVectSet &a_ivsIntersect, const Box &a_toBox) const
Definition: BaseIFFABI.H:48
Iterator for an IntVectSet.
Definition: IntVectSet.H:640
void linearIn(T &a_outputT, const void *const inBuf)
Definition: SPMDI.H:26
T * getIndex(const FaceIndex &a_face, const int &a_comp) const
Definition: BaseIFFABI.H:340
const Box & minBox() const
Returns the minimum enclosing box of this IntVectSet.
int numFaces() const
Definition: BaseIFFABI.H:410
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:73
const IntVectSet & getIVS() const
Definition: BaseIFFABI.H:252