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 template <
class T>
inline 89 m_ebgraph = a_ebGraph;
95 m_fab.resize(minbox, 1);
100 for (ivsit.
reset(); ivsit.
ok(); ++ivsit)
102 m_nVoFs += m_ebgraph.numVoFs(ivsit());
111 m_data.resize(m_nVoFs*m_nComp);
112 T* currentLoc = &m_data[0];
113 for (ivsit.
reset(); ivsit.
ok(); ++ivsit)
115 int numVoFs = m_ebgraph.numVoFs(ivsit());
116 m_fab(ivsit(), 0) = currentLoc;
117 currentLoc += numVoFs;
123 template <
class T>
inline 127 for (
int ivec = 0; ivec < m_nVoFs*m_nComp; ivec++)
129 m_data[ivec] = a_value;
134 template <
class T>
inline 141 int ioffset = ivar*m_nVoFs;
142 for (
int ivec = 0; ivec < m_nVoFs; ivec ++)
144 m_data[ivec+ioffset] = a_value;
148 template <
class T>
inline 158 if ( !m_ivs.isEmpty() )
161 ivsIntersect &= a_box;
163 for (
VoFIterator vofit(ivsIntersect, m_ebgraph); vofit.
ok(); ++vofit)
166 for (
int icomp = a_nstart; icomp < a_numcomp; icomp++)
168 thisFAB(vof, icomp) = a_value;
174 template <
class T>
inline 192 CH_assert( (a_fromBox == a_toBox) || m_ebgraph.getDomain().isPeriodic() );
193 Box intBox = a_fromBox;
195 ivsIntersect &= a_src.
m_ivs;
196 ivsIntersect &= intBox;
198 int compSize = a_srcInterval.
size();
199 for (
VoFIterator vofit(ivsIntersect, m_ebgraph); vofit.
ok(); ++vofit)
202 for (
int icomp = 0; icomp < compSize; icomp++)
204 int isrccomp = a_srcInterval.
begin() + icomp;
205 int idstcomp = a_dstInterval.
begin() + icomp;
206 thisFAB(vof, idstcomp) = a_src(vof, isrccomp);
212 template <
class T>
inline 231 for (
int ivof = 0; ivof < vofs.
size(); ivof++)
235 IntVect iv = vofs[ivof].gridIndex();
236 pout() <<
"BaseIVFAB::size vof " << vofs[ivof] <<
" Is irregular? " << m_ebgraph.isIrregular(iv) << endl;
238 for (
int icomp = a_comps.
begin(); icomp <= a_comps.
end(); icomp++)
240 const T& dataPt = (*this)(vofs[ivof], icomp);
242 datasize += pointsize;
247 int retval = vofsize + datasize;
250 pout() <<
"BaseIVFAB::size " << retval << endl;
255 template <
class T>
inline 264 pout() <<
"" << endl;
265 pout() <<
"BaseIVFAB<T>::linearOut " <<
" for box " << a_region << endl;
275 unsigned char* charbuffer = (
unsigned char *) a_buf;
280 for (
int ivof = 0; ivof < vofs.
size(); ivof++)
285 pout() <<
"vof " << vof << endl;
287 for (
int icomp = a_comps.
begin(); icomp <= a_comps.
end(); icomp++)
289 const T& dataPt = (*this)(vof, icomp);
297 template <
class T>
inline 305 pout() <<
"" << endl;
306 pout() <<
"BaseIVFAB<T>::linearIn " <<
" for box " << a_region << endl;
309 unsigned char* charbuffer = (
unsigned char *) a_buf;
314 for (
int ivof = 0; ivof < vofs.
size(); ivof++)
319 pout() <<
"vof " << vof << endl;
321 for (
int icomp = a_comps.
begin(); icomp <= a_comps.
end(); icomp++)
323 T& dataPt = (*this)(vof, icomp);
331 template <
class T>
inline 337 CH_assert((a_comp >= 0) && (a_comp < m_nComp));
339 T* dataPtr = (T*)(m_fab(a_vof.
gridIndex(), 0));
341 dataPtr += a_comp*m_nVoFs;
345 template <
class T>
inline 361 template <
class T>
inline 365 return (m_isDefined);
368 template <
class T>
inline 375 template <
class T>
inline 381 static T* dummy = NULL;
382 if (m_nVoFs == 0)
return dummy;
384 T* retval = &(m_data[a_comp*m_nVoFs]);
388 template <
class T>
inline 394 static T* dummy = NULL;
395 if (m_nVoFs == 0)
return dummy;
396 const T* retval = &(m_data[a_comp*m_nVoFs]);
401 template <
class T>
inline 408 template <
class T>
inline 416 T* dataPtr = getIndex(a_ndin, a_comp);
420 template <
class T>
inline 423 const int& a_comp)
const 429 T* dataPtr = getIndex(a_ndin, a_comp);
433 template <
class T>
inline 444 #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:435
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:176
void linearListOut(void *const a_outBuf, const Vector< T > &a_inputT)
Definition: SPMDI.H:255
int size() const
Definition: Interval.H:64
void setVal(const T &value)
Definition: BaseIVFABI.H:125
int begin() const
Definition: Interval.H:86
const IntVect & gridIndex() const
Definition: VolIndex.H:119
bool isDefined() const
Definition: BaseIVFABI.H:363
int size(const Box &R, const Interval &comps) const
Definition: BaseIVFABI.H:213
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:432
Structure for passing component ranges in code.
Definition: Interval.H:23
void linearOut(void *const a_outBuf, const T &inputT)
Definition: SPMDI.H:32
int linearSize(const T &inputT)
Definition: SPMDI.H:20
virtual void clear()
Definition: BaseIVFABI.H:347
virtual void define(const IntVectSet &a_region, const EBGraph &a_ebgraph, const int &a_nvarin)
Definition: BaseIVFABI.H:79
size_t size() const
Definition: Vector.H:177
void linearOut(void *buf, const Box &R, const Interval &comps) const
Definition: BaseIVFABI.H:256
virtual T * getIndex(const VolIndex &a_vof, const int &a_comp) const
get index into vector
Definition: BaseIVFABI.H:333
const EBGraph & getEBGraph() const
Definition: BaseIVFABI.H:44
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
int m_nComp
Definition: BaseIVFAB.H:254
void linearListIn(Vector< T > &a_outputT, const void *const a_inBuf)
Definition: SPMDI.H:226
Iterator for all vofs within an IntVectSet and an Ebgraph.
Definition: VoFIterator.H:27
int cellIndex() const
Definition: VolIndex.H:127
void linearIn(void *buf, const Box &R, const Interval &comps)
Definition: BaseIVFABI.H:298
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
int linearListSize(const Vector< T > &a_input)
Definition: SPMDI.H:287
T * dataPtr(int a_dataType, int a_ivar)
Definition: BaseIVFAB.H:64
T & operator()(const VolIndex &a_vof, const int &varlocin)
Definition: BaseIVFABI.H:410
Volume of Fluid Index.
Definition: VolIndex.H:31
int end() const
Definition: Interval.H:91
Iterator for an IntVectSet.
Definition: IntVectSet.H:640
void linearIn(T &a_outputT, const void *const inBuf)
Definition: SPMDI.H:26
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:403
int numVoFs() const
Definition: BaseIVFABI.H:370
Definition: BaseIVFAB.H:32