11 #ifndef _BASEIVFABI_H_ 12 #define _BASEIVFABI_H_ 21 #include "NamespaceHeader.H" 30 s_verbose = a_verbose;
39 s_verboseDebug = a_verboseDebug;
42 template <
class T>
inline 49 template <
class T>
inline 56 template <
class T>
inline 62 template <
class T>
inline 68 template <
class T>
inline 74 define(a_ivsin, a_ebgraph, a_nvarin);
77 #if defined(__ICC) || defined(__INTEL_COMPILER) 78 #pragma intel optimization_level 0 80 template <
class T>
inline 92 m_ebgraph = a_ebGraph;
98 m_fab.resize(minbox, 1);
103 for (ivsit.
reset(); ivsit.
ok(); ++ivsit)
105 m_nVoFs += m_ebgraph.numVoFs(ivsit());
114 m_data.resize(m_nVoFs*m_nComp);
115 T* currentLoc = &m_data[0];
116 for (ivsit.
reset(); ivsit.
ok(); ++ivsit)
118 int numVoFs = m_ebgraph.numVoFs(ivsit());
119 m_fab(ivsit(), 0) = currentLoc;
120 currentLoc += numVoFs;
126 template <
class T>
inline 130 for (
int ivec = 0; ivec < m_nVoFs*m_nComp; ivec++)
132 m_data[ivec] = a_value;
137 template <
class T>
inline 144 int ioffset = ivar*m_nVoFs;
145 for (
int ivec = 0; ivec < m_nVoFs; ivec ++)
147 m_data[ivec+ioffset] = a_value;
151 template <
class T>
inline 161 if ( !m_ivs.isEmpty() )
164 ivsIntersect &= a_box;
166 for (
VoFIterator vofit(ivsIntersect, m_ebgraph); vofit.
ok(); ++vofit)
169 for (
int icomp = a_nstart; icomp < a_numcomp; icomp++)
171 thisFAB(vof, icomp) = a_value;
177 template <
class T>
inline 195 CH_assert( (a_fromBox == a_toBox) || m_ebgraph.getDomain().isPeriodic() );
196 Box intBox = a_fromBox;
198 ivsIntersect &= a_src.
m_ivs;
199 ivsIntersect &= intBox;
201 int compSize = a_srcInterval.
size();
202 for (
VoFIterator vofit(ivsIntersect, m_ebgraph); vofit.
ok(); ++vofit)
205 for (
int icomp = 0; icomp < compSize; icomp++)
207 int isrccomp = a_srcInterval.
begin() + icomp;
208 int idstcomp = a_dstInterval.
begin() + icomp;
209 thisFAB(vof, idstcomp) = a_src(vof, isrccomp);
215 template <
class T>
inline 234 for (
unsigned int ivof = 0; ivof < vofs.
size(); ivof++)
238 IntVect iv = vofs[ivof].gridIndex();
239 pout() <<
"BaseIVFAB::size vof " << vofs[ivof] <<
" Is irregular? " << m_ebgraph.isIrregular(iv) << endl;
241 for (
int icomp = a_comps.
begin(); icomp <= a_comps.
end(); icomp++)
243 const T& dataPt = (*this)(vofs[ivof], icomp);
245 datasize += pointsize;
250 int retval = vofsize + datasize;
253 pout() <<
"BaseIVFAB::size " << retval << endl;
258 template <
class T>
inline 264 CH_TIME(
"BaseIVFAB::linearout");
267 pout() <<
"" << endl;
268 pout() <<
"BaseIVFAB<T>::linearOut " <<
" for box " << a_region << endl;
278 unsigned char* charbuffer = (
unsigned char *) a_buf;
283 for (
unsigned int ivof = 0; ivof < vofs.
size(); ivof++)
288 pout() <<
"vof " << vof << endl;
290 for (
int icomp = a_comps.
begin(); icomp <= a_comps.
end(); icomp++)
292 const T& dataPt = (*this)(vof, icomp);
300 template <
class T>
inline 304 CH_TIME(
"BaseIVFAB::linearin");
309 pout() <<
"" << endl;
310 pout() <<
"BaseIVFAB<T>::linearIn " <<
" for box " << a_region << endl;
313 unsigned char* charbuffer = (
unsigned char *) a_buf;
318 for (
unsigned int ivof = 0; ivof < vofs.
size(); ivof++)
323 pout() <<
"vof " << vof << endl;
325 for (
int icomp = a_comps.
begin(); icomp <= a_comps.
end(); icomp++)
327 T& dataPt = (*this)(vof, icomp);
335 template <
class T>
inline 341 CH_assert((a_comp >= 0) && (a_comp < m_nComp));
343 T* dataPtr = (T*)(m_fab(a_vof.
gridIndex(), 0));
345 dataPtr += a_comp*m_nVoFs;
349 template <
class T>
inline 365 template <
class T>
inline 369 return (m_isDefined);
372 template <
class T>
inline 379 template <
class T>
inline 385 static T* dummy = NULL;
386 if (m_nVoFs == 0)
return dummy;
388 T* retval = &(m_data[a_comp*m_nVoFs]);
392 template <
class T>
inline 398 static T* dummy = NULL;
399 if (m_nVoFs == 0)
return dummy;
400 const T* retval = &(m_data[a_comp*m_nVoFs]);
405 template <
class T>
inline 412 template <
class T>
inline 420 T* dataPtr = getIndex(a_ndin, a_comp);
424 template <
class T>
inline 427 const int& a_comp)
const 433 T* dataPtr = getIndex(a_ndin, a_comp);
437 template <
class T>
inline 448 #include "NamespaceFooter.H" std::ostream & pout()
Use this in place of std::cout for program output.
static void setVerbose(bool a_verbose)
Definition: BaseIVFABI.H:28
virtual ~BaseIVFAB()
Definition: BaseIVFABI.H:63
An irregular domain on an integer lattice.
Definition: IntVectSet.H:44
#define CH_assert(cond)
Definition: CHArray.H:37
IntVectSet m_ivs
Definition: BaseIVFAB.H:261
BaseIVFAB()
Definition: BaseIVFABI.H:57
virtual void setDefaultValues()
Definition: BaseIVFABI.H:439
void copy(const Box &a_fromBox, const Interval &a_destInterval, const Box &a_toBox, const BaseIVFAB< T > &a_src, const Interval &a_srcInterval)
Definition: BaseIVFABI.H:179
void linearListOut(void *const a_outBuf, const Vector< T > &a_inputT)
Definition: SPMDI.H:258
int size() const
Definition: Interval.H:75
void setVal(const T &value)
Definition: BaseIVFABI.H:128
int begin() const
Definition: Interval.H:99
const IntVect & gridIndex() const
Definition: VolIndex.H:125
bool isDefined() const
Definition: BaseIVFABI.H:367
int size(const Box &R, const Interval &comps) const
Definition: BaseIVFABI.H:216
const Vector< VolIndex > getVector() const
const IntVectSet & getIVS() const
Definition: BaseIVFABI.H:51
static void setVerboseDebug(bool a_verboseDebug)
Definition: BaseIVFABI.H:37
void reset()
same as begin()
Definition: IntVectSet.H:722
bool ok() const
returns true if this iterator is still in its IntVectSet
Definition: IntVectSet.H:711
Geometric description within a box.
Definition: EBGraph.H:427
#define CH_TIME(name)
Definition: CH_Timer.H:82
Structure for passing component ranges in code.
Definition: Interval.H:23
void linearOut(void *const a_outBuf, const T &inputT)
Definition: SPMDI.H:33
int linearSize(const T &inputT)
Definition: SPMDI.H:21
virtual void clear()
Definition: BaseIVFABI.H:351
virtual void define(const IntVectSet &a_region, const EBGraph &a_ebgraph, const int &a_nvarin)
Definition: BaseIVFABI.H:82
size_t size() const
Definition: Vector.H:192
void linearOut(void *buf, const Box &R, const Interval &comps) const
Definition: BaseIVFABI.H:259
virtual T * getIndex(const VolIndex &a_vof, const int &a_comp) const
get index into vector
Definition: BaseIVFABI.H:337
const EBGraph & getEBGraph() const
Definition: BaseIVFABI.H:44
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
int m_nComp
Definition: BaseIVFAB.H:254
void linearListIn(Vector< T > &a_outputT, const void *const a_inBuf)
Definition: SPMDI.H:229
Iterator for all vofs within an IntVectSet and an Ebgraph.
Definition: VoFIterator.H:27
int cellIndex() const
Definition: VolIndex.H:133
void linearIn(void *buf, const Box &R, const Interval &comps)
Definition: BaseIVFABI.H:301
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
int linearListSize(const Vector< T > &a_input)
Definition: SPMDI.H:290
T * dataPtr(int a_dataType, int a_ivar)
Definition: BaseIVFAB.H:64
T & operator()(const VolIndex &a_vof, const int &varlocin)
Definition: BaseIVFABI.H:414
Volume of Fluid Index.
Definition: VolIndex.H:31
int end() const
Definition: Interval.H:104
Iterator for an IntVectSet.
Definition: IntVectSet.H:640
void linearIn(T &a_outputT, const void *const inBuf)
Definition: SPMDI.H:27
const Box & minBox() const
Returns the minimum enclosing box of this IntVectSet.
bool isEmpty() const
Returns true if no IntVects are in this IntVectSet.
int nComp() const
Definition: BaseIVFABI.H:407
int numVoFs() const
Definition: BaseIVFABI.H:374
Definition: BaseIVFAB.H:32