13 #ifndef _BASEEBCELLFABI_H_ 14 #define _BASEEBCELLFABI_H_ 18 #include "NamespaceHeader.H" 25 const bool& a_doMulti)
27 CH_TIME(
"BaseEBCellFAB::setCoveredCellVal");
31 if (m_ebisBox.isAllRegular())
35 else if (m_ebisBox.isAllCovered())
37 m_regFAB.setVal(a_val, a_comp);
44 if (m_ebisBox.isCovered(iv))
46 m_regFAB(iv, a_comp) = a_val;
49 if (a_doMulti && m_irrFAB.numVoFs()>0)
52 for (
int i=0; i< vofs.
size(); i++)
54 const IntVect& iv = vofs[i].gridIndex();
55 m_regFAB(iv, a_comp) = a_val;
64 :m_irrFAB(a_interval,a_original.m_irrFAB),
65 m_regFAB(a_interval,a_original.m_regFAB),
66 m_ebisBox(a_original.m_ebisBox),
67 m_region(a_original.m_region),
68 m_hasMultiCells(a_original.m_hasMultiCells),
69 m_isDefined(a_original.m_isDefined)
96 const T* src = a_src.
m_irrFAB.dataPtr(0);
98 T* end = dest +
m_irrFAB.numVoFs()*ncomp;
99 for (; dest<end ; src++, dest++)
112 this->
copy(overlap,comps,overlap,a_src,comps);
125 const Box& a_RegionTo,
129 CH_TIME(
"BaseEBCellFAB::copy");
137 Box intersect = a_RegionFrom & domain.domainBox();
138 if ( (!isPeriodic) &&
142 MayDay::Error(
"BaseEBCellFAB::copy: I was probably defined with too small an ebisBox");
145 CH_assert( (a_RegionFrom == a_RegionTo) || isPeriodic);
147 CH_TIME(
"BaseEBCellFAB::regcopy");
148 m_regFAB.copy(a_RegionFrom, a_dstInt, a_RegionTo, a_src.
m_regFAB, a_srcInt);
153 CH_TIME(
"BaseEBCellFAB::irrcopy");
154 m_irrFAB.copy(a_RegionFrom, a_dstInt, a_RegionTo, a_src.
m_irrFAB, a_srcInt);
164 CH_TIME(
"BaseEBCellFAB::size");
165 int retval =
m_regFAB.size(R, comps);
176 CH_TIME(
"BaseEBCellFAB::linearOut");
177 unsigned char* buffer = (
unsigned char*)buf;
178 m_regFAB.linearOut(buffer, R, comps);
180 m_irrFAB.linearOut(buffer, R, comps);
188 CH_TIME(
"BaseEBCellFAB::linearIn");
189 unsigned char* buffer = (
unsigned char*)buf;
190 m_regFAB.linearIn(buffer, R, comps);
192 m_irrFAB.linearIn(buffer, R, comps);
222 const Box& a_region,
int a_nVar)
225 define(a_ebisBox, a_region, a_nVar);
233 const Box& a_region,
int a_nVar)
235 CH_TIME(
"BaseEBCellFAB::define");
308 m_irrFAB.setVal(a_value,a_box,a_nstart,a_numcomp);
309 m_regFAB.setVal(a_value,a_box,a_nstart,a_numcomp);
401 int a_isKnownMultiValued )
const 408 || (a_isKnownMultiValued == 0)
409 || (a_isKnownMultiValued == +1) );
411 const T* returnval = NULL;
413 switch( a_isKnownMultiValued )
419 returnval = &(
m_irrFAB(a_ndin,a_nVarLoc));
425 returnval = &(
m_irrFAB(a_ndin,a_nVarLoc));
443 int a_isKnownMultiValued )
450 || (a_isKnownMultiValued == 0)
451 || (a_isKnownMultiValued == +1) );
459 else if (a_isKnownMultiValued == 1)
461 returnval = &(
m_irrFAB(a_ndin,a_nVarLoc));
463 else if (a_isKnownMultiValued == 0)
467 returnval = &(
m_irrFAB(a_ndin,a_nVarLoc));
487 CH_TIME(
"BaseEBCellFAB::fill");
495 for (
int i=0; i<a_comps.
size(); i++)
504 int numPts =
m_regFAB.box().numPts();
505 for (
int i=0; i<a_comps.
size(); i++)
507 array[i] = val[i*numPts];
520 CH_TIME(
"BaseEBCellFAB::assign");
528 for (
int i=0; i<a_comps.
size(); i++)
537 int numPts =
m_regFAB.box().numPts();
538 for (
int i=0; i<a_comps.
size(); i++)
540 val[i*numPts] = array[i];
565 #include "NamespaceFooter.H" bool m_hasMultiCells
Definition: BaseEBCellFAB.H:268
bool ok()
Definition: BoxIterator.H:281
#define CH_TIMERS(name)
Definition: CH_Timer.H:133
void linearIn(void *buf, const Box &R, const Interval &comps)
Definition: BaseEBCellFABI.H:186
EBISBox m_ebisBox
Definition: BaseEBCellFAB.H:264
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
bool isCovered(const IntVect &a_iv) const
Definition: EBISBox.H:399
const EBGraph & getEBGraph() const
void fill(T *array, const VolIndex &a_ndin, const Interval &a_comps) const
Definition: BaseEBCellFABI.H:485
void linearOut(void *buf, const Box &R, const Interval &comps) const
Definition: BaseEBCellFABI.H:173
bool cellCentered() const
Definition: Box.H:1939
Vector< VolIndex > getMultiCells() const
has to be by value because sometimes the vector does not exist.
Definition: BaseEBCellFABI.H:199
IntVectSet getMultiCells(const Box &a_subbox) const
const ProblemDomain & getDomain() const
int size() const
Definition: Interval.H:75
int begin() const
Definition: Interval.H:99
bool isMultiValued(const IntVect &a_iv) const
Definition: EBISBox.H:405
#define CH_START(tpointer)
Definition: CH_Timer.H:145
const IntVect & gridIndex() const
Definition: VolIndex.H:125
const BaseIVFAB< T > & getMultiValuedFAB() const
Definition: BaseEBCellFABI.H:352
bool contains(const IntVect &p) const
Definition: Box.H:1887
const BaseFab< T > & getSingleValuedFAB() const
Definition: BaseEBCellFABI.H:373
iterates through the IntVects of a Box
Definition: BoxIterator.H:37
void copy(const Box &RegionFrom, const Interval &destInt, const Box &RegionTo, const BaseEBCellFAB< T > &source, const Interval &srcInt)
Definition: BaseEBCellFABI.H:123
const Box & getRegion() const
Definition: BaseEBCellFABI.H:334
#define CH_TIMER(name, tpointer)
Definition: CH_Timer.H:63
const EBISBox & getEBISBox() const
Definition: BaseEBCellFABI.H:560
const Box & box() const
Definition: BaseEBCellFABI.H:343
virtual void setCoveredCellVal(const T &a_val, const int &a_comp, const bool &a_doMulti=true)
Definition: BaseEBCellFABI.H:23
#define CH_TIME(name)
Definition: CH_Timer.H:82
Structure for passing component ranges in code.
Definition: Interval.H:23
const T & operator()(const VolIndex &a_ndin, int a_nVarLoc, int a_isKnownMultiValued=0) const
Definition: BaseEBCellFABI.H:400
virtual void define(const EBISBox &a_ebisBox, const Box &a_region, int a_nVar)
Definition: BaseEBCellFABI.H:232
void setVal(const T &value)
Definition: BaseEBCellFABI.H:283
Array defined at the VolIndexs of an Box in an EBIS.
Definition: BaseEBCellFAB.H:40
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
MiniIVFAB< T > m_irrFAB
data at multi-valued cells
Definition: BaseEBCellFAB.H:259
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.
int size(const Box &R, const Interval &comps) const
Definition: BaseEBCellFABI.H:162
virtual ~BaseEBCellFAB()
Definition: BaseEBCellFABI.H:262
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
bool m_isDefined
has full define function been called?
Definition: BaseEBCellFAB.H:271
const Box & getRegion() const
#define CH_STOP(tpointer)
Definition: CH_Timer.H:150
void setDefaultValues()
Definition: BaseEBCellFABI.H:551
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
void clear()
Definition: BaseEBCellFABI.H:271
BaseEBCellFAB()
Definition: BaseEBCellFABI.H:213
Volume of Fluid Index.
Definition: VolIndex.H:31
bool isDefined() const
Definition: BaseEBCellFABI.H:317
int nComp() const
Definition: BaseEBCellFABI.H:325
bool isEmpty() const
{ Comparison Functions}
Definition: Box.H:1862
bool isEmpty() const
Returns true if no IntVects are in this IntVectSet.
void assign(const T *array, const VolIndex &a_ndin, const Interval &a_comps)
Definition: BaseEBCellFABI.H:516
Definition: BaseIVFAB.H:32
BaseFab< T > m_regFAB
data at single-valued cells
Definition: BaseEBCellFAB.H:262
Box m_region
Definition: BaseEBCellFAB.H:266