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 #if defined(__ICC) || defined(__INTEL_COMPILER) 110 #pragma intel optimization_level 0 112 template <
class T>
inline 116 const int& a_direction,
124 m_direction = a_direction;
126 m_ebgraph = a_ebgraph;
150 int numVoFsHere = m_ebgraph.numVoFs(iv);
152 nVoFs += numVoFsHere;
154 if (!doneThat(iv, 0))
156 doneThat(iv, 0) =
true;
158 bool onLoBoundary =
false;
163 int numFacesLoSide = numVoFsHere;
166 int numVoFsLo = m_ebgraph.numVoFs(ivLo);
167 numFacesLoSide = numVoFsHere*numVoFsLo;
170 faceLocFab(iv, 0) = m_nFaces;
171 m_nFaces += numFacesLoSide;
173 if (!doneThat(ivHi, 0))
175 doneThat(ivHi, 0) =
true;
177 bool onHiBoundary =
false;
180 onHiBoundary = iv[m_direction] == domain.
domainBox().
bigEnd(m_direction);
182 int numFacesHiSide = numVoFsHere;
185 int numVoFsHi = m_ebgraph.numVoFs(ivHi);
186 numFacesHiSide = numVoFsHere*numVoFsHi;
189 faceLocFab(ivHi, 0) = m_nFaces;
190 m_nFaces += numFacesHiSide;
198 #ifdef CH_USE_MEMORY_TRACKING 215 m_truesize = m_nFaces*m_nComp;
219 m_data.
resize(m_truesize);
222 #ifdef CH_USE_MEMORY_TRACKING 231 if (m_nFaces==0)
return;
233 T* startLoc = &m_data[0];
237 if (!doneThat(iv, 0))
239 doneThat(iv, 0) =
true;
240 int iface = faceLocFab(iv, 0);
243 m_fab(iv, 0) = startLoc + iface;
247 if (!doneThat(ivHi, 0))
249 doneThat(ivHi, 0) =
true;
250 int iface = faceLocFab(ivHi, 0);
253 m_fab(ivHi, 0) = startLoc + iface;
259 template <
class T>
inline 266 template <
class T>
inline 273 template <
class T>
inline 278 for (
int ivec = 0; ivec < m_nFaces*m_nComp; ivec++)
280 m_data[ivec] = a_value;
284 template <
class T>
inline 292 for (
int ivec = ivar; ivec < m_nFaces*m_nComp; ivec += m_nComp)
294 m_data[ivec] = a_value;
298 template <
class T>
inline 316 CH_assert( (a_fromBox == a_toBox) || m_ebgraph.getDomain().isPeriodic() );
322 getBoxAndIVS(intBox, ivsIntersect, a_toBox);
324 ivsIntersect &= a_src.
m_ivs;
325 int compSize = a_srcInterval.
size();
328 FaceIterator faceit(ivsIntersect, m_ebgraph, m_direction, stopCrit);
329 for (faceit.
reset(); faceit.
ok(); ++faceit)
334 if (useThisFace(a_toBox, face))
336 for (
int icomp = 0; icomp < compSize; icomp++)
338 int isrccomp = a_srcInterval.
begin() + icomp;
339 int idstcomp = a_dstInterval.
begin() + icomp;
340 (*this)(face, idstcomp) = a_src(face, isrccomp);
347 template <
class T>
inline 354 int faceLoc = getLocalVecIndex(a_face);
356 dataPtr += m_nFaces*a_comp;
360 template <
class T>
inline 373 retval = loCell + xlen*hiCell;
380 CH_assert(((loCell == -1)&&(hiCell > -1))||
381 ((hiCell == -1)&&(loCell > -1)));
383 retval =
Max(loCell, hiCell);
388 template <
class T>
inline 410 template <
class T>
inline 414 return (m_isDefined);
417 template <
class T>
inline 424 template <
class T>
inline 431 template <
class T>
inline 443 T* dataPtr = getIndex(a_ndin, a_comp);
447 template <
class T>
inline 450 const int& a_comp)
const 459 T* dataPtr = getIndex(a_ndin, a_comp);
463 template <
class T>
inline 469 static T* dummy = NULL;
470 if (m_nFaces==0)
return dummy;
472 return &(m_data[0]) + a_comp*m_nFaces;
476 template <
class T>
inline 482 static T* dummy = NULL;
483 if (m_nFaces==0)
return dummy;
485 return &(m_data[0]) + a_comp*m_nFaces;
488 template <
class T>
inline 500 template <
class T>
inline 510 getBoxAndIVS(intBox, subIVS, a_region);
513 FaceIterator faceit(subIVS, m_ebgraph, m_direction, stopCrit);
519 pout() <<
"baseiffab facesize = " << facesize << endl;
523 for (
int iface = 0; iface < faces.
size(); iface++)
527 if (useThisFace(a_region, faces[iface]))
530 for (
int icomp = a_comps.
begin(); icomp <= a_comps.
end(); icomp++)
532 const T& dataPt = (*this)(faces[iface], icomp);
534 datasize += pointsize;
540 pout() <<
"baseiffab datasize = " << datasize << endl;
542 pout() <<
"baseiffab iused = " << iused << endl;
544 int retval = facesize + datasize;
548 pout() <<
"###############" << std::endl;
549 pout() <<
"BaseIFFAB size() for region " << m_ebgraph.getRegion() << std::endl;
550 pout() <<
" a_comps = (" << a_comps.
begin() <<
"," << a_comps.
end() <<
")," 551 <<
" a_region = " << a_region <<
" subIVS = ";
553 pout() <<
"m_ivs = ";
555 pout() <<
"size = " << retval << std::endl;
556 pout() <<
"###############" << std::endl;
562 template <
class T>
inline 572 getBoxAndIVS(intBox, subIVS, a_region);
575 FaceIterator faceit(subIVS, m_ebgraph, m_direction, stopCrit);
579 unsigned char* charbuffer = (
unsigned char *) a_buf;
585 for (
int iface = 0; iface < faces.
size(); iface++)
589 if (useThisFace(a_region, faces[iface]))
592 for (
int icomp = a_comps.
begin(); icomp <= a_comps.
end(); icomp++)
595 const T& dataPt = thisFAB(face, icomp);
604 template <
class T>
inline 614 getBoxAndIVS(intBox, subIVS, a_region);
617 FaceIterator faceit(subIVS, m_ebgraph, m_direction, stopCrit);
620 unsigned char* charbuffer = (
unsigned char *) a_buf;
624 for (
int iface = 0; iface < faces.
size(); iface++)
628 if (useThisFace(a_region, faces[iface]))
631 for (
int icomp = a_comps.
begin(); icomp <= a_comps.
end(); icomp++)
634 T& dataPt = (*this)(face, icomp);
645 #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:605
int nComp() const
Definition: BaseIFFABI.H:426
T * dataPtr(const int &a_comp)
Definition: BaseIFFABI.H:465
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:501
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:99
Iterator over faces within an IntVectSet and an Ebgraph.
Definition: FaceIterator.H:67
void clear()
Definition: BaseIFFABI.H:390
Definition: FaceIterator.H:48
void setVal(const T &value)
Definition: BaseIFFABI.H:275
const ProblemDomain & getDomain() const
Definition: EBGraph.H:939
bool contains(const IntVect &p) const
Definition: Box.H:1887
const IntVect & gridIndex(const Side::LoHiSide &a_sd) const
IntVect BASISV(int dir)
Definition: IntVect.H:1285
~BaseIFFAB()
Definition: BaseIFFABI.H:91
int getLocalVecIndex(const FaceIndex &a_face) const
Definition: BaseIFFABI.H:362
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:1784
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:412
const IntVect & smallEnd() const
{ Accessors}
Definition: Box.H:1770
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:2161
int linearSize(const T &inputT)
Definition: SPMDI.H:21
int direction() const
Definition: BaseIFFABI.H:268
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:490
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
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:563
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:300
T Max(const T &a_a, const T &a_b)
Definition: Misc.H:39
Box & grow(int i)
grow functions
Definition: Box.H:2263
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:433
int end() const
Definition: Interval.H:104
void define(const IntVectSet &a_region, const EBGraph &a_ebgraph, const int &a_direction, const int &a_nvarin)
Definition: BaseIFFABI.H:114
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:349
const Box & minBox() const
Returns the minimum enclosing box of this IntVectSet.
int numFaces() const
Definition: BaseIFFABI.H:419
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:261