13 #ifndef _BASEEBCELLFABI_H_ 14 #define _BASEEBCELLFABI_H_ 18 #include "NamespaceHeader.H" 25 const bool& a_doMulti)
30 if (m_ebisBox.isAllRegular())
34 else if (m_ebisBox.isAllCovered())
36 m_regFAB.setVal(a_val, a_comp);
43 if (m_ebisBox.isCovered(iv))
45 m_regFAB(iv, a_comp) = a_val;
54 m_regFAB(iv, a_comp) = a_val;
83 const T* src = a_src.
m_irrFAB.dataPtr(0);
84 T* dest = m_irrFAB.dataPtr(0);
85 T* end = dest + m_irrFAB.numVoFs()*m_nComp;
86 for (; dest<end ; src++, dest++)
96 Box overlap(m_region);
99 this->copy(overlap,comps,overlap,a_src,comps);
112 const Box& a_RegionTo,
116 CH_TIME(
"BaseEBCellFAB::copy");
125 Box intersect = a_RegionFrom & domain.domainBox();
126 if ( (!isPeriodic) &&
128 (!m_ebisBox.getRegion().contains(intersect)) )
130 MayDay::Error(
"BaseEBCellFAB::copy: I was probably defined with too small an ebisBox");
133 CH_assert( (a_RegionFrom == a_RegionTo) || isPeriodic);
135 CH_TIME(
"BaseEBCellFAB::regcopy");
136 m_regFAB.copy(a_RegionFrom, a_dstInt, a_RegionTo, a_src.
m_regFAB, a_srcInt);
141 CH_TIME(
"BaseEBCellFAB::irrcopy");
142 m_irrFAB.copy(a_RegionFrom, a_dstInt, a_RegionTo, a_src.
m_irrFAB, a_srcInt);
152 int retval = m_regFAB.size(R, comps);
153 retval += m_irrFAB.size(R, comps);
163 unsigned char* buffer = (
unsigned char*)buf;
164 m_regFAB.linearOut(buffer, R, comps);
165 buffer+= m_regFAB.size(R, comps);
166 m_irrFAB.linearOut(buffer, R, comps);
174 unsigned char* buffer = (
unsigned char*)buf;
175 m_regFAB.linearIn(buffer, R, comps);
176 buffer+= m_regFAB.size(R, comps);
177 m_irrFAB.linearIn(buffer, R, comps);
187 return m_irrFAB.getIVS();
202 const Box& a_region,
int a_nVar)
205 define(a_ebisBox, a_region, a_nVar);
213 const Box& a_region,
int a_nVar)
220 m_region = a_region & a_ebisBox.
getRegion();
223 m_ebisBox = a_ebisBox;
227 m_regFAB.resize(a_region, m_nComp);
233 m_hasMultiCells = !m_multiCells.
isEmpty();
236 m_irrFAB.define(m_multiCells, m_ebisBox.getEBGraph(), m_nComp);
256 m_multiCells.makeEmpty();
266 m_irrFAB.setVal(value);
267 m_regFAB.setVal(value);
275 m_irrFAB.setVal(ivar, value);
276 m_regFAB.setVal(value, m_regFAB.box(), ivar, 1);
289 m_irrFAB.setVal(a_value,a_box,a_nstart,a_numcomp);
290 m_regFAB.setVal(a_value,a_box,a_nstart,a_numcomp);
300 return (m_isDefined);
382 int a_isKnownMultiValued )
const 387 CH_assert((a_nVarLoc >= 0)&&(a_nVarLoc < m_nComp));
389 || (a_isKnownMultiValued == 0)
390 || (a_isKnownMultiValued == +1) );
392 const T* returnval = NULL;
394 switch( a_isKnownMultiValued )
397 returnval = &(m_regFAB(a_ndin.
gridIndex(), a_nVarLoc));
400 returnval = &(m_irrFAB(a_ndin,a_nVarLoc));
404 if ( m_multiCells.contains(a_ndin.
gridIndex()) )
406 returnval = &(m_irrFAB(a_ndin,a_nVarLoc));
409 returnval = &(m_regFAB(a_ndin.
gridIndex(), a_nVarLoc));
424 int a_isKnownMultiValued )
428 CH_assert((a_nVarLoc >= 0)&&(a_nVarLoc < m_nComp));
431 || (a_isKnownMultiValued == 0)
432 || (a_isKnownMultiValued == +1) );
436 if ( (a_isKnownMultiValued == -1) || m_multiCells.isEmpty())
438 returnval = &(m_regFAB(a_ndin.
gridIndex(), a_nVarLoc));
440 else if (a_isKnownMultiValued == 1)
442 returnval = &(m_irrFAB(a_ndin,a_nVarLoc));
444 else if (a_isKnownMultiValued == 0)
446 if ( m_multiCells.contains(a_ndin.
gridIndex()) )
448 returnval = &(m_irrFAB(a_ndin,a_nVarLoc));
452 returnval = &(m_regFAB(a_ndin.
gridIndex(), a_nVarLoc));
472 if (m_multiCells.contains(a_ndin.
gridIndex()))
474 const T* val = &(m_irrFAB(a_ndin,a_comps.
begin()));
475 for (
int i=0; i<a_comps.
size(); i++)
484 int numPts = m_regFAB.box().numPts();
485 for (
int i=0; i<a_comps.
size(); i++)
487 array[i] = val[i*numPts];
504 if (m_multiCells.contains(a_ndin.
gridIndex()))
506 T* val = &(m_irrFAB(a_ndin,a_comps.
begin()));
507 for (
int i=0; i<a_comps.
size(); i++)
516 int numPts = m_regFAB.box().numPts();
517 for (
int i=0; i<a_comps.
size(); i++)
519 val[i*numPts] = array[i];
544 #include "NamespaceFooter.H" bool ok()
Definition: BoxIterator.H:215
#define CH_TIMERS(name)
Definition: CH_Timer.H:70
void linearIn(void *buf, const Box &R, const Interval &comps)
Definition: BaseEBCellFABI.H:172
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
void fill(T *array, const VolIndex &a_ndin, const Interval &a_comps) const
Definition: BaseEBCellFABI.H:466
void linearOut(void *buf, const Box &R, const Interval &comps) const
Definition: BaseEBCellFABI.H:160
bool cellCentered() const
Definition: Box.H:1940
IntVectSet getMultiCells(const Box &a_subbox) const
int size() const
Definition: Interval.H:64
int begin() const
Definition: Interval.H:86
#define CH_START(tpointer)
Definition: CH_Timer.H:78
const IntVect & gridIndex() const
Definition: VolIndex.H:119
const BaseIVFAB< T > & getMultiValuedFAB() const
Definition: BaseEBCellFABI.H:333
const BaseFab< T > & getSingleValuedFAB() const
Definition: BaseEBCellFABI.H:354
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:110
const Box & getRegion() const
Definition: BaseEBCellFABI.H:315
bool ok() const
returns true if this iterator is still in its IntVectSet
Definition: IntVectSet.H:711
#define CH_TIMER(name, tpointer)
Definition: CH_Timer.H:55
const EBISBox & getEBISBox() const
Definition: BaseEBCellFABI.H:539
const Box & box() const
Definition: BaseEBCellFABI.H:324
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:59
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:381
virtual void define(const EBISBox &a_ebisBox, const Box &a_region, int a_nVar)
Definition: BaseEBCellFABI.H:212
const IntVectSet & getMultiCells() const
Definition: BaseEBCellFABI.H:184
void setVal(const T &value)
Definition: BaseEBCellFABI.H:264
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:875
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:150
virtual ~BaseEBCellFAB()
Definition: BaseEBCellFABI.H:243
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
const Box & getRegion() const
#define CH_STOP(tpointer)
Definition: CH_Timer.H:80
void setDefaultValues()
Definition: BaseEBCellFABI.H:530
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
void clear()
Definition: BaseEBCellFABI.H:252
BaseEBCellFAB()
Definition: BaseEBCellFABI.H:193
Volume of Fluid Index.
Definition: VolIndex.H:31
bool isDefined() const
Definition: BaseEBCellFABI.H:298
int end() const
Definition: Interval.H:91
int nComp() const
Definition: BaseEBCellFABI.H:306
bool isEmpty() const
{ Comparison Functions}
Definition: Box.H:1863
Iterator for an IntVectSet.
Definition: IntVectSet.H:640
int m_nComp
Definition: BaseEBCellFAB.H:266
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:496
Definition: BaseIVFAB.H:32
BaseFab< T > m_regFAB
data at single-valued cells
Definition: BaseEBCellFAB.H:262
Box m_region
region over which the BaseEBCellFAB exists
Definition: BaseEBCellFAB.H:269