BaseFab< T > Class Template Reference

: A Fortran Array-like Object More...

#include <BaseFab.H>

Inheritance diagram for BaseFab< T >:

Inheritance graph
[legend]
Collaboration diagram for BaseFab< T >:

Collaboration graph
[legend]

List of all members.

Public Types

typedef T value_type

Public Member Functions

 BaseFab ()
 Construct an invalid `BaseFab'.
 BaseFab (const BaseFab &)
BaseFaboperator= (const BaseFab &)
BaseFaboperator= (const T &)
 BaseFab (const Box &bx, int n=1)
 Make BaseFab with desired domain and number of components.
 ~BaseFab ()
 The destructor deletes the array memory.
void resize (const Box &b, int N=1)
 This function resizes a `BaseFab' so it covers the `Box' B with N components.
void clear ()
 The function returns the `BaseFab' to the invalid state.
int nComp () const
 Returns the number of components.
const Boxbox () const
 Returns the domain (box) where the array is defined.
const int * length () const
 Returns a pointer to an array of SPACEDIM integers giving the length of the domain in each direction.
const IntVectsmallEnd () const
 Returns the lower corner of the domain.
const IntVectbigEnd () const
 Returns the upper corner of the domain.
const int * loVect () const
 Returns the lower corner of the domain.
const int * hiVect () const
 Returns the upper corner of the domain.
bool contains (const BaseFab< T > &fab) const
 Returns true if the domain of fab is totally contained within the domain of this `BaseFab'.
bool contains (const Box &bx) const
 Returns true if bx is totally contained within the domain of this `BaseFab'.
T * dataPtr (int N=0)
 Returns a pointer to an object of type T that is the value of the Nth component associated with the cell at the low end of the domain.
const T * dataPtr (int N=0) const
 Same as above except works on const FAB's.
bool isAllocated () const
 Returns true if the data for the FAB has been allocated.
T & operator() (const IntVect &p, int N)
 Returns a reference to the Nth component value defined at position p in the domain.
T & operator() (const IntVect &p)
 Same as above, except returns component 0.
const T & operator() (const IntVect &p, int N) const
 Same as above except works on const FAB's.
const T & operator() (const IntVect &p) const
 Same as above, except returns component 0.
void getVal (T *data, const IntVect &pos, int N, int numcomp) const
 This function puts numcomp component values, starting at component N, from position pos in the domain into array data, that must be allocated by the user.
void getVal (T *data, const IntVect &pos) const
 Same as above, except that starts at component 0 and copies ALL comps.
void setVal (T x, const Box &bx, int nstart, int ncomp)
 The setVal functions set subregions in the `BaseFab' to a constant value.
void setVal (T x, const Box &bx, int N)
 Same as above, except the number of modified components is one.
void setVal (T x, int N)
 Same as above, except the subbox defaults to the entire domain.
void setVal (T x)
 Same as above, except ALL components are set.
void setComplement (T x, const Box &b, int ns, int num)
 This function is analogous to the fourth form of setVal above, except that instead of setting values on the `Box' b, values are set on the complement of b in the domain.
BaseFab< T > & copy (const BaseFab< T > &src, const Box &srcbox, int srccomp, const Box &destbox, int destcomp, int numcomp)
 The `copy' functions copy the contents of one `BaseFab' into another.
BaseFab< T > & copy (const BaseFab< T > &src, int srccomp, int destcomp, int numcomp=1)
 As above, except the destination `Box' and the source `Box' are taken to be the entire domain of the destination.
BaseFab< T > & copy (const BaseFab< T > &src, const Box &destbox)
 As above, except that the destination `Box' is specified, but the source `Box' is taken to the equal to the source `Box', and all components of the destination `BaseFab' are copied.
BaseFab< T > & copy (const BaseFab< T > &src)
 As above, except that the destbox defaults to the entire domain of the destination BaseFab, and all components are copied.
BaseFab< T > & shift (const IntVect &v)
 Perform shifts upon the domain of the `BaseFab'.
BaseFab< T > & shift (int idir, int n_cell)
 Perform shifts upon the domain of the `BaseFab'.
BaseFab< T > & shiftHalf (int dir, int num_halfs)
 Perform shifts upon the domain of the `BaseFab'.
BaseFab< T > & shiftHalf (const IntVect &num_halfs)
 Perform shifts upon the domain of the `BaseFab'.
Real norm (int p, int scomp=0, int ncomp=1) const
 Compute the Lp-norm of this FAB using components (scomp : scomp+ncomp-1).
Real norm (const Box &subbox, int p, int scomp=0, int ncomp=1) const
 Same as above except only on given subbox.
void abs ()
 Compute absolute value for all components of this FAB.
void abs (int comp, int numcomp=1)
 Same as above except only for components (comp: comp+numcomp-1).
void abs (const Box &subbox, int comp=0, int numcomp=1)
 Calculate abs() on subbox for given component range.
min (int comp=0) const
 Minimum value of given component.
min (const Box &subbox, int comp=0) const
 Minimum value of given component in given subbox.
max (int comp=0) const
 Maximum value of given component.
max (const Box &subbox, int comp=0) const
 Maximum value of given component in given subbox.
IntVect minIndex (int comp=0) const
 Find location of minimum value in given component.
IntVect minIndex (const Box &subbox, int comp=0) const
 Find location of minimum value in given component in given subbox.
IntVect maxIndex (int comp=0) const
 Find location of maximum value in given component.
IntVect maxIndex (const Box &subbox, int comp=0) const
 Find location of maximum value in given component in given subbox.
int maskLT (BaseFab< int > &mask, T val, int comp=0) const
 Compute mask array with value of 1 in cells where BaseFab has value less than val, 0 otherwise.
int maskLE (BaseFab< int > &mask, T val, int comp=0) const
 Same as above except mark cells with value less than or equal to val.
int maskEQ (BaseFab< int > &mask, T val, int comp=0) const
 Same as above except mark cells with value equal to val.
int maskGT (BaseFab< int > &mask, T val, int comp=0) const
 Same as above except mark cells with value greater than val.
int maskGE (BaseFab< int > &mask, T val, int comp=0) const
 Same as above except mark cells with value greater than or equal to val.
void patternFill (int mark=0)
 Fill with a pattern of numbers.
void copyRev (const Box &destbox, const BaseFab< T > &src, const Box &srcbox, int reversal_index, T *multiplier)
 Copies with index reversal from srcbox region of src into destbox region of this FAB.
sum (int comp, int numcomp=1) const
 Compute sum of given component of FAB state vector.
sum (const Box &subbox, int comp, int numcomp=1) const
 Compute sum of given component of FAB state vector in given subbox.
BaseFab< T > & invert (T v, const Box &subbox, int comp=0, int numcomp=1)
 Most general version, specify subbox and which components.
BaseFab< T > & invert (T v, int comp, int numcomp=1)
 As above except on entire domain.
BaseFab< T > & invert (T v)
 As above except on entire domain, all components.
BaseFab< T > & negate (const Box &subbox, int comp=0, int numcomp=1)
 Negate BaseFab, most general.
BaseFab< T > & negate (int comp, int numcomp=1)
 As above, except on entire domain.
BaseFab< T > & negate ()
 As above, except on entire domain and all components.
BaseFab< T > & plus (T r, const Box &b, int comp=0, int numcomp=1)
 Scalar addition (a[i] <- a[i] + r), most general.
BaseFab< T > & plus (T r, int comp, int numcomp=1)
 As above, except on entire domain.
BaseFab< T > & plus (T r)
 As above, except on entire domain and all components.
BaseFab< T > & operator+= (T r)
 Addition in place.
BaseFab< T > & operator+= (const BaseFab< T > &f)
 FAB addition (a[i] <- a[i] + b[i]) in place.
BaseFab< T > & plus (const BaseFab< T > &src)
 FAB addition (a[i] <- a[i] + b[i]). The same as += operator.
BaseFab< T > & plus (const BaseFab< T > &src, int srccomp, int destcomp, int numcomp=1)
 Add src components (srccomp:srccomp+numcomp-1) to this FAB's components (destcomp:destcomp+numcomp-1) where the two FABs intersect.
BaseFab< T > & plus (const BaseFab< T > &src, const Box &subbox, int srccomp, int destcomp, int numcomp=1)
 Same as above except addition is restricted to intersection of subbox and src FAB.
BaseFab< T > & plus (const BaseFab< T > &src, const Box &srcbox, const Box &destbox, int srccomp, int destcomp, int numcomp=1)
 Add srcbox region of src FAB to destbox region of this FAB.
BaseFab< T > & operator-= (T r)
 Scalar subtraction (a[i] <- a[i] - r).
BaseFab< T > & operator-= (const BaseFab< T > &f)
 FAB subtraction (a[i] <- a[i] - b[i]), in place.
BaseFab< T > & minus (const BaseFab< T > &src)
 FAB subtraction (a[i] <- a[i] - b[i]). The same as -= operator.
BaseFab< T > & minus (const BaseFab< T > &src, int srccomp, int destcomp, int numcomp=1)
 Subtract src components (srccomp:srccomp+numcomp-1) to this FAB's components (destcomp:destcomp+numcomp-1) where the two FABs intersect.
BaseFab< T > & minus (const BaseFab< T > &src, const Box &subbox, int srccomp, int destcomp, int numcomp=1)
 Same as above except subtraction is restricted to intersection of subbox and src FAB.
BaseFab< T > & minus (const BaseFab< T > &src, const Box &srcbox, const Box &destbox, int srccomp, int destcomp, int numcomp=1)
 Subtract srcbox region of src FAB from destbox region of this FAB.
BaseFab< T > & operator*= (T r)
 Scalar multiplication (a[i] <- a[i] * r), in place.
BaseFab< T > & mult (T r)
 Scalar multiplication (a[i] <- a[i] * r). The same as *=.
BaseFab< T > & mult (T r, int comp, int numcomp=1)
 Scalar multiplication, except control which components are multiplied.
BaseFab< T > & mult (T r, const Box &b, int comp=0, int numcomp=1)
 As above, except specify sub-box.
BaseFab< T > & operator*= (const BaseFab< T > &f)
 FAB multiplication (a[i] <- a[i] * b[i]), in place.
BaseFab< T > & mult (const BaseFab< T > &src)
 As above.
BaseFab< T > & mult (const BaseFab< T > &src, int srccomp, int destcomp, int numcomp=1)
 Multiply src components (srccomp:srccomp+numcomp-1) with this FAB's components (destcomp:destcomp+numcomp-1) where the two FABs intersect.
BaseFab< T > & mult (const BaseFab< T > &src, const Box &subbox, int srccomp, int destcomp, int numcomp=1)
 Same as above except multiplication is restricted to intersection of subbox and src FAB.
BaseFab< T > & mult (const BaseFab< T > &src, const Box &srcbox, const Box &destbox, int srccomp, int destcomp, int numcomp=1)
 Multiply srcbox region of src FAB with destbox region of this FAB.
BaseFab< T > & operator/= (T r)
 Scalar division (a[i] <- a[i] / r), in place.
BaseFab< T > & divide (T r)
 Scalar division (a[i] <- a[i] / r), in place.
BaseFab< T > & divide (T r, int comp, int numcomp=1)
 As above except specify which components.
BaseFab< T > & divide (T r, const Box &b, int comp=0, int numcomp=1)
 As above except specify sub-box.
BaseFab< T > & operator/= (const BaseFab< T > &src)
 FAB division, in place.
BaseFab< T > & divide (const BaseFab< T > &src)
 Same as above.
BaseFab< T > & divide (const BaseFab< T > &src, int srccomp, int destcomp, int numcomp=1)
 This FAB is numerator, src FAB is denominator divide src components (srccomp:srccomp+numcomp-1) into this FAB's components (destcomp:destcomp+numcomp-1) where the two FABs intersect.
BaseFab< T > & divide (const BaseFab< T > &src, const Box &subbox, int srccomp, int destcomp, int numcomp=1)
 Same as above except division is restricted to intersection of subbox and src FAB.
BaseFab< T > & divide (const BaseFab< T > &src, const Box &srcbox, const Box &destbox, int srccomp, int destcomp, int numcomp=1)
 destbox region of this FAB is numerator.
BaseFab< T > & linInterp (const BaseFab< T > &f1, const Box &b1, int comp1, const BaseFab< T > &f2, const Box &b2, int comp2, Real t1, Real t2, Real t, const Box &b, int comp, int numcomp=1)
 Linear interpolation / extrapolation.
BaseFab< T > & linComb (const BaseFab< T > &f1, const Box &b1, int comp1, const BaseFab< T > &f2, const Box &b2, int comp2, Real alpha, Real beta, const Box &b, int comp, int numcomp=1)
 Linear combination.

Protected Member Functions

void define ()
void undefine ()
void performCopy (const BaseFab< T > &src, const Box &srcbox, int srccomp, const Box &destbox, int destcomp, int numcomp)
void performSetVal (T x, const Box &bx, int nstart, int numcomp)

Protected Attributes

Box domain
int nvar
long numpts
long truesize
T * dptr


Detailed Description

template<class T>
class BaseFab< T >

: A Fortran Array-like Object

BaseFab emulates the Fortran array concept. Useful operations can be performed upon BaseFab's in C++, and they provide a convenient interface to Fortran when it is necessary to retreat into that language.

`BaseFab' is a template class. Through use of the template, a `BaseFab' may be based upon any class. So far at least, most applications have been based upon simple types like `integer''s, `real*4''s, or `real*8''s. Most applications do not use BaseFab's directly, but utilize specialized classes derived from BaseFab.

It will be easier to use a `BaseFab' if you understand the following concepts. `BaseFab' objects depend on the dimensionality of space (indirectly through the DOMAIN `Box' member). It is typical to define the macro `SPACEDIM' to be 1, 2, or 3 to indicate the dimension of space. See the discussion of class `Box' for more information. A `BaseFab' contains a `Box' DOMAIN, which indicates the integer indexing space over which the array is defined. A `BaseFab' also has NVAR components. By components, we mean that for each point in the rectangular indexing space, there are NVAR values associated with that point. A Fortran array corresponding to a `BaseFab' would have (SPACEDIM+1) dimensions.

By design, the array layout in a `BaseFab' mirrors that of a Fortran array. The first index (x direction for example) varies most rapidly, the next index (y direction), if any, varies next fastest. The component index varies last, after all the spatial indices.

It is sometimes convenient to be able to treat a sub-array within an existing `BaseFab' as a `BaseFab' in its own right. This is often referred to as 'aliasing' the `BaseFab'. Note that when aliasing is used, the BaseFab's domain will not, in general, be the same as the parent BaseFab's domain, nor will the number of components. BaseFab is a dimension dependent class, so SPACEDIM must be defined as either 1, 2, or 3 when compiling.

This is NOT a polymorphic class.

It does NOT provide a copy constructor or assignment operator.

T MUST have a default constructor and an assignment operator.


Member Typedef Documentation

template<class T>
typedef T BaseFab< T >::value_type


Constructor & Destructor Documentation

template<class T>
BaseFab< T >::BaseFab (  )  [inline]

Construct an invalid `BaseFab'.

The domain is invalid, the number of components is zero, and no actually array memory is allocated. An invalid `BaseFab' must be resized (see `BaseFabresize') before use.

template<class T>
BaseFab< T >::BaseFab ( const BaseFab< T > &  fab  )  [inline]

template<class T>
BaseFab< T >::BaseFab ( const Box bx,
int  n = 1 
) [inline, explicit]

Make BaseFab with desired domain and number of components.

References BaseFab< T >::define().

template<class T>
BaseFab< T >::~BaseFab (  )  [inline]

The destructor deletes the array memory.

References BaseFab< T >::undefine().


Member Function Documentation

template<class T>
BaseFab< T > & BaseFab< T >::operator= ( const BaseFab< T > &  fab  )  [inline]

template<class T>
BaseFab< T > & BaseFab< T >::operator= ( const T &  t  )  [inline]

template<class T>
void BaseFab< T >::resize ( const Box b,
int  N = 1 
) [inline]

This function resizes a `BaseFab' so it covers the `Box' B with N components.

The default action is that under resize()ing, the memory allocated for the `BaseFab' only grows and never shrinks. This function is particularly useful when a `BaseFab' is used as a temporary space which must be a different size whenever it is used. Resize()ing a temp will often be faster than re-allocating a `BaseFab' because memory allocation can often be avoided.

Reimplemented in FArrayBox.

References BaseFab< T >::define(), BaseFab< T >::domain, BaseFab< T >::dptr, Box::numPts(), BaseFab< T >::numpts, BaseFab< T >::nvar, BaseFab< T >::truesize, and BaseFab< T >::undefine().

Referenced by BaseFab< T >::maskEQ(), BaseFab< T >::maskGE(), BaseFab< T >::maskGT(), BaseFab< T >::maskLE(), BaseFab< T >::maskLT(), and FArrayBox::resize().

template<class T>
void BaseFab< T >::clear (  )  [inline]

The function returns the `BaseFab' to the invalid state.

(See comments for constructors above.) The memory is freed.

References BaseFab< T >::domain, BaseFab< T >::dptr, BaseFab< T >::numpts, BaseFab< T >::nvar, and BaseFab< T >::undefine().

template<class T>
int BaseFab< T >::nComp (  )  const [inline]

template<class T>
const Box & BaseFab< T >::box (  )  const [inline]

template<class T>
const int * BaseFab< T >::length (  )  const [inline]

Returns a pointer to an array of SPACEDIM integers giving the length of the domain in each direction.

References BaseFab< T >::domain, IntVect::getVect(), and Box::length().

Referenced by BaseFab< T >::performCopy().

template<class T>
const IntVect & BaseFab< T >::smallEnd (  )  const [inline]

Returns the lower corner of the domain.

See class `Box' for analogue.

References BaseFab< T >::domain, and Box::smallEnd().

template<class T>
const IntVect & BaseFab< T >::bigEnd (  )  const [inline]

Returns the upper corner of the domain.

See class `Box' for analogue.

References Box::bigEnd(), and BaseFab< T >::domain.

template<class T>
const int * BaseFab< T >::loVect (  )  const [inline]

Returns the lower corner of the domain.

Instead of returning them in the form of INTVECT's, as in smallEnd and bigEnd, it returns the values as a pointer to an array of constant integers. This is useful when interfacing to Fortran subroutines.

References BaseFab< T >::domain, and Box::loVect().

Referenced by BaseFab< T >::performCopy().

template<class T>
const int * BaseFab< T >::hiVect (  )  const [inline]

Returns the upper corner of the domain.

Instead of returning them in the form of INTVECT's, as in smallEnd and bigEnd, it returns the values as a pointer to an array of constant integers. This is useful when interfacing to Fortran subroutines.

References BaseFab< T >::domain, and Box::hiVect().

template<class T>
bool BaseFab< T >::contains ( const BaseFab< T > &  fab  )  const [inline]

Returns true if the domain of fab is totally contained within the domain of this `BaseFab'.

References BaseFab< T >::box(), Box::contains(), and BaseFab< T >::nvar.

template<class T>
bool BaseFab< T >::contains ( const Box bx  )  const [inline]

Returns true if bx is totally contained within the domain of this `BaseFab'.

References BaseFab< T >::box(), and Box::contains().

template<class T>
T * BaseFab< T >::dataPtr ( int  N = 0  )  [inline]

Returns a pointer to an object of type T that is the value of the Nth component associated with the cell at the low end of the domain.

This is commonly used to get a pointer to data in the array which is then handed off to a Fortran subroutine. Remember that data is stored in Fortran array order, with the component index coming last. In other words, `dataPtr' returns a pointer to all the Nth components.

References BL_ASSERT, BaseFab< T >::dptr, and BaseFab< T >::numpts.

Referenced by BaseFab< T >::maskEQ(), BaseFab< T >::maskGE(), BaseFab< T >::maskGT(), BaseFab< T >::maskLE(), BaseFab< T >::maskLT(), and BaseFab< T >::performCopy().

template<class T>
const T * BaseFab< T >::dataPtr ( int  N = 0  )  const [inline]

Same as above except works on const FAB's.

References BL_ASSERT, BaseFab< T >::dptr, and BaseFab< T >::numpts.

template<class T>
bool BaseFab< T >::isAllocated (  )  const [inline]

Returns true if the data for the FAB has been allocated.

References BaseFab< T >::dptr.

template<class T>
T & BaseFab< T >::operator() ( const IntVect p,
int  N 
) [inline]

Returns a reference to the Nth component value defined at position p in the domain.

This operator may be inefficient if the C++ compiler is unable to optimize the C++ code.

References BL_ASSERT, Box::contains(), BaseFab< T >::domain, BaseFab< T >::dptr, Box::index(), BaseFab< T >::numpts, and BaseFab< T >::nvar.

template<class T>
T & BaseFab< T >::operator() ( const IntVect p  )  [inline]

Same as above, except returns component 0.

References BL_ASSERT, Box::contains(), BaseFab< T >::domain, BaseFab< T >::dptr, and Box::index().

template<class T>
const T & BaseFab< T >::operator() ( const IntVect p,
int  N 
) const [inline]

template<class T>
const T & BaseFab< T >::operator() ( const IntVect p  )  const [inline]

Same as above, except returns component 0.

References BL_ASSERT, Box::contains(), BaseFab< T >::domain, BaseFab< T >::dptr, and Box::index().

template<class T>
void BaseFab< T >::getVal ( T *  data,
const IntVect pos,
int  N,
int  numcomp 
) const [inline]

This function puts numcomp component values, starting at component N, from position pos in the domain into array data, that must be allocated by the user.

References BL_ASSERT, BaseFab< T >::domain, BaseFab< T >::dptr, Box::index(), Box::numPts(), and BaseFab< T >::nvar.

Referenced by BaseFab< T >::getVal().

template<class T>
void BaseFab< T >::getVal ( T *  data,
const IntVect pos 
) const [inline]

Same as above, except that starts at component 0 and copies ALL comps.

References BaseFab< T >::getVal(), and BaseFab< T >::nvar.

template<class T>
void BaseFab< T >::setVal ( x,
const Box bx,
int  nstart,
int  ncomp 
) [inline]

The setVal functions set subregions in the `BaseFab' to a constant value.

This most general form specifies the sub-box, the starting component number, and the number of components to be set.

References BaseFab< T >::performSetVal().

Referenced by FArrayBox::FArrayBox(), BaseFab< T >::maskEQ(), BaseFab< T >::maskGE(), BaseFab< T >::maskGT(), BaseFab< T >::maskLE(), BaseFab< T >::maskLT(), BaseFab< T >::operator=(), and FArrayBox::resize().

template<class T>
void BaseFab< T >::setVal ( x,
const Box bx,
int  N 
) [inline]

Same as above, except the number of modified components is one.

N is the component to be modified.

References BaseFab< T >::performSetVal().

template<class T>
void BaseFab< T >::setVal ( x,
int  N 
) [inline]

Same as above, except the subbox defaults to the entire domain.

References BaseFab< T >::domain, and BaseFab< T >::performSetVal().

template<class T>
void BaseFab< T >::setVal ( x  )  [inline]

Same as above, except ALL components are set.

References BaseFab< T >::box(), BaseFab< T >::nvar, and BaseFab< T >::performSetVal().

template<class T>
void BaseFab< T >::setComplement ( x,
const Box b,
int  ns,
int  num 
) [inline]

This function is analogous to the fourth form of setVal above, except that instead of setting values on the `Box' b, values are set on the complement of b in the domain.

References BoxList::begin(), BoxLib::boxDiff(), BaseFab< T >::domain, BoxList::end(), and BaseFab< T >::performSetVal().

Referenced by VisMF::Write().

template<class T>
BaseFab< T > & BaseFab< T >::copy ( const BaseFab< T > &  src,
const Box srcbox,
int  srccomp,
const Box destbox,
int  destcomp,
int  numcomp 
) [inline]

The `copy' functions copy the contents of one `BaseFab' into another.

The destination `BaseFab' is always the object which invokes the function. This, the most general form of copy, specifies the contents of any sub-box srcbox in `BaseFab' src may be copied into a (possibly different) destbox in the destination `BaseFab'. Note that although the srcbox and the destbox may be disjoint, they must be the same size and shape. If the sizes differ, the copy is undefined and a runtime error results. This copy function is the only one of the copy functions to allow a copy between differing boxes. The user also specifies how many components are copied, starting at component srccomp in src and stored starting at component destcomp. Note that the actual copy is made by the function `performCopy' of this class. The results are UNDEFINED if the src and dest are the same and the srcbox and destbox overlap.

References BL_ASSERT, BaseFab< T >::box(), Box::contains(), BaseFab< T >::domain, BoxLib::Error(), BaseFab< T >::nComp(), BaseFab< T >::nvar, BaseFab< T >::performCopy(), and Box::sameSize().

template<class T>
BaseFab< T > & BaseFab< T >::copy ( const BaseFab< T > &  src,
int  srccomp,
int  destcomp,
int  numcomp = 1 
) [inline]

As above, except the destination `Box' and the source `Box' are taken to be the entire domain of the destination.

A copy of the intersecting region is performed. Note that the actual copy is made by the function `performCopy' of this class.

References BL_ASSERT, BaseFab< T >::domain, BaseFab< T >::nvar, Box::ok(), and BaseFab< T >::performCopy().

template<class T>
BaseFab< T > & BaseFab< T >::copy ( const BaseFab< T > &  src,
const Box destbox 
) [inline]

As above, except that the destination `Box' is specified, but the source `Box' is taken to the equal to the source `Box', and all components of the destination `BaseFab' are copied.

Note that the actual copy is made by the function `performCopy' of this class.

References BL_ASSERT, Box::contains(), BaseFab< T >::domain, BaseFab< T >::nvar, and BaseFab< T >::performCopy().

template<class T>
BaseFab< T > & BaseFab< T >::copy ( const BaseFab< T > &  src  )  [inline]

As above, except that the destbox defaults to the entire domain of the destination BaseFab, and all components are copied.

Note that the actual copy is made by the function `performCopy' of this class.

References BL_ASSERT, BaseFab< T >::domain, BaseFab< T >::nvar, BaseFab< T >::performCopy(), and Box::sameType().

template<class T>
BaseFab< T > & BaseFab< T >::shift ( const IntVect v  )  [inline]

Perform shifts upon the domain of the `BaseFab'.

They are completely analogous to the corresponding `Box' functions. There is no effect upon the array memory.

References BaseFab< T >::domain.

template<class T>
BaseFab< T > & BaseFab< T >::shift ( int  idir,
int  n_cell 
) [inline]

Perform shifts upon the domain of the `BaseFab'.

They are completely analogous to the corresponding `Box' functions. There is no effect upon the array memory.

References BaseFab< T >::domain, and Box::shift().

template<class T>
BaseFab< T > & BaseFab< T >::shiftHalf ( int  dir,
int  num_halfs 
) [inline]

Perform shifts upon the domain of the `BaseFab'.

They are completely analogous to the corresponding `Box' functions. There is no effect upon the array memory.

References BaseFab< T >::domain, and Box::shiftHalf().

template<class T>
BaseFab< T > & BaseFab< T >::shiftHalf ( const IntVect num_halfs  )  [inline]

Perform shifts upon the domain of the `BaseFab'.

They are completely analogous to the corresponding `Box' functions. There is no effect upon the array memory.

References BaseFab< T >::domain, and Box::shiftHalf().

template<class T>
Real BaseFab< T >::norm ( int  p,
int  scomp = 0,
int  ncomp = 1 
) const [inline]

Compute the Lp-norm of this FAB using components (scomp : scomp+ncomp-1).

p < 0 -> ERROR p = 0 -> infinity norm (max norm) p = 1 -> sum of ABS(FAB)

Reimplemented in FArrayBox.

References BaseFab< T >::domain.

Referenced by FArrayBox::norm().

template<class T>
Real BaseFab< T >::norm ( const Box subbox,
int  p,
int  scomp = 0,
int  ncomp = 1 
) const [inline]

Same as above except only on given subbox.

Reimplemented in FArrayBox.

References BL_ASSERT, BoxLib::Error(), BoxLib::max(), and BaseFab< T >::nComp().

template<class T>
void BaseFab< T >::abs (  )  [inline]

Compute absolute value for all components of this FAB.

References ForAllThis.

template<class T>
void BaseFab< T >::abs ( int  comp,
int  numcomp = 1 
) [inline]

Same as above except only for components (comp: comp+numcomp-1).

References ForAllThisNN.

template<class T>
void BaseFab< T >::abs ( const Box subbox,
int  comp = 0,
int  numcomp = 1 
) [inline]

Calculate abs() on subbox for given component range.

template<class T>
T BaseFab< T >::min ( int  comp = 0  )  const [inline]

Minimum value of given component.

References BaseFab< T >::domain, and BoxLib::min().

template<class T>
T BaseFab< T >::min ( const Box subbox,
int  comp = 0 
) const [inline]

Minimum value of given component in given subbox.

References BoxLib::min().

template<class T>
T BaseFab< T >::max ( int  comp = 0  )  const [inline]

Maximum value of given component.

References BaseFab< T >::domain, and BoxLib::max().

template<class T>
T BaseFab< T >::max ( const Box subbox,
int  comp = 0 
) const [inline]

Maximum value of given component in given subbox.

References BoxLib::max().

template<class T>
IntVect BaseFab< T >::minIndex ( int  comp = 0  )  const [inline]

Find location of minimum value in given component.

References BaseFab< T >::domain, and Box::smallEnd().

template<class T>
IntVect BaseFab< T >::minIndex ( const Box subbox,
int  comp = 0 
) const [inline]

Find location of minimum value in given component in given subbox.

References Box::smallEnd().

template<class T>
IntVect BaseFab< T >::maxIndex ( int  comp = 0  )  const [inline]

Find location of maximum value in given component.

References BaseFab< T >::domain, and Box::smallEnd().

template<class T>
IntVect BaseFab< T >::maxIndex ( const Box subbox,
int  comp = 0 
) const [inline]

Find location of maximum value in given component in given subbox.

References Box::smallEnd().

template<class T>
int BaseFab< T >::maskLT ( BaseFab< int > &  mask,
val,
int  comp = 0 
) const [inline]

Compute mask array with value of 1 in cells where BaseFab has value less than val, 0 otherwise.

mask is resized by this function. The number of cells marked with 1 returned.

References BaseFab< T >::dataPtr(), BaseFab< T >::domain, BaseFab< T >::resize(), and BaseFab< T >::setVal().

template<class T>
int BaseFab< T >::maskLE ( BaseFab< int > &  mask,
val,
int  comp = 0 
) const [inline]

Same as above except mark cells with value less than or equal to val.

References BaseFab< T >::dataPtr(), BaseFab< T >::domain, BaseFab< T >::resize(), and BaseFab< T >::setVal().

template<class T>
int BaseFab< T >::maskEQ ( BaseFab< int > &  mask,
val,
int  comp = 0 
) const [inline]

Same as above except mark cells with value equal to val.

References BaseFab< T >::dataPtr(), BaseFab< T >::domain, BaseFab< T >::resize(), and BaseFab< T >::setVal().

template<class T>
int BaseFab< T >::maskGT ( BaseFab< int > &  mask,
val,
int  comp = 0 
) const [inline]

Same as above except mark cells with value greater than val.

References BaseFab< T >::dataPtr(), BaseFab< T >::domain, BaseFab< T >::resize(), and BaseFab< T >::setVal().

template<class T>
int BaseFab< T >::maskGE ( BaseFab< int > &  mask,
val,
int  comp = 0 
) const [inline]

Same as above except mark cells with value greater than or equal to val.

References BaseFab< T >::dataPtr(), BaseFab< T >::domain, BaseFab< T >::resize(), and BaseFab< T >::setVal().

template<class T>
void BaseFab< T >::patternFill ( int  mark = 0  )  [inline]

Fill with a pattern of numbers.

References ForAllThis.

template<class T>
void BaseFab< T >::copyRev ( const Box destbox,
const BaseFab< T > &  src,
const Box srcbox,
int  reversal_index,
T *  multiplier 
) [inline]

Copies with index reversal from srcbox region of src into destbox region of this FAB.

All components are copied and multiplied by corresponding multiplier.

References BaseFab< T >::nComp().

template<class T>
T BaseFab< T >::sum ( int  comp,
int  numcomp = 1 
) const [inline]

Compute sum of given component of FAB state vector.

References BaseFab< T >::domain.

template<class T>
T BaseFab< T >::sum ( const Box subbox,
int  comp,
int  numcomp = 1 
) const [inline]

Compute sum of given component of FAB state vector in given subbox.

template<class T>
BaseFab< T > & BaseFab< T >::invert ( v,
const Box subbox,
int  comp = 0,
int  numcomp = 1 
) [inline]

Most general version, specify subbox and which components.

template<class T>
BaseFab< T > & BaseFab< T >::invert ( v,
int  comp,
int  numcomp = 1 
) [inline]

As above except on entire domain.

References ForAllThisNN.

template<class T>
BaseFab< T > & BaseFab< T >::invert ( v  )  [inline]

As above except on entire domain, all components.

References ForAllThis.

template<class T>
BaseFab< T > & BaseFab< T >::negate ( const Box subbox,
int  comp = 0,
int  numcomp = 1 
) [inline]

Negate BaseFab, most general.

template<class T>
BaseFab< T > & BaseFab< T >::negate ( int  comp,
int  numcomp = 1 
) [inline]

As above, except on entire domain.

References ForAllThisNN.

template<class T>
BaseFab< T > & BaseFab< T >::negate (  )  [inline]

As above, except on entire domain and all components.

References ForAllThis.

template<class T>
BaseFab< T > & BaseFab< T >::plus ( r,
const Box b,
int  comp = 0,
int  numcomp = 1 
) [inline]

Scalar addition (a[i] <- a[i] + r), most general.

template<class T>
BaseFab< T > & BaseFab< T >::plus ( r,
int  comp,
int  numcomp = 1 
) [inline]

As above, except on entire domain.

References ForAllThisNN.

template<class T>
BaseFab< T > & BaseFab< T >::plus ( r  )  [inline]

As above, except on entire domain and all components.

References BaseFab< T >::operator+=().

template<class T>
BaseFab< T > & BaseFab< T >::operator+= ( r  )  [inline]

Addition in place.

This will often be more efficient than making new BaseFab for result.

References ForAllThis.

Referenced by BaseFab< T >::operator-=(), and BaseFab< T >::plus().

template<class T>
BaseFab< T > & BaseFab< T >::operator+= ( const BaseFab< T > &  f  )  [inline]

FAB addition (a[i] <- a[i] + b[i]) in place.

References ForAllThisXC.

template<class T>
BaseFab< T > & BaseFab< T >::plus ( const BaseFab< T > &  src  )  [inline]

FAB addition (a[i] <- a[i] + b[i]). The same as += operator.

References BaseFab< T >::operator+=().

template<class T>
BaseFab< T > & BaseFab< T >::plus ( const BaseFab< T > &  src,
int  srccomp,
int  destcomp,
int  numcomp = 1 
) [inline]

Add src components (srccomp:srccomp+numcomp-1) to this FAB's components (destcomp:destcomp+numcomp-1) where the two FABs intersect.

References BaseFab< T >::domain.

template<class T>
BaseFab< T > & BaseFab< T >::plus ( const BaseFab< T > &  src,
const Box subbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
) [inline]

Same as above except addition is restricted to intersection of subbox and src FAB.

NOTE: subbox must be contained in this FAB.

template<class T>
BaseFab< T > & BaseFab< T >::plus ( const BaseFab< T > &  src,
const Box srcbox,
const Box destbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
) [inline]

Add srcbox region of src FAB to destbox region of this FAB.

The srcbox and destbox must be same size.

template<class T>
BaseFab< T > & BaseFab< T >::operator-= ( r  )  [inline]

Scalar subtraction (a[i] <- a[i] - r).

Note: use plus(-r) for more general operations.

References BaseFab< T >::operator+=().

Referenced by BaseFab< T >::minus().

template<class T>
BaseFab< T > & BaseFab< T >::operator-= ( const BaseFab< T > &  f  )  [inline]

FAB subtraction (a[i] <- a[i] - b[i]), in place.

References ForAllThisXC.

template<class T>
BaseFab< T > & BaseFab< T >::minus ( const BaseFab< T > &  src  )  [inline]

FAB subtraction (a[i] <- a[i] - b[i]). The same as -= operator.

References BaseFab< T >::operator-=().

template<class T>
BaseFab< T > & BaseFab< T >::minus ( const BaseFab< T > &  src,
int  srccomp,
int  destcomp,
int  numcomp = 1 
) [inline]

Subtract src components (srccomp:srccomp+numcomp-1) to this FAB's components (destcomp:destcomp+numcomp-1) where the two FABs intersect.

References BaseFab< T >::domain.

template<class T>
BaseFab< T > & BaseFab< T >::minus ( const BaseFab< T > &  src,
const Box subbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
) [inline]

Same as above except subtraction is restricted to intersection of subbox and src FAB.

NOTE: subbox must be contained in this FAB.

template<class T>
BaseFab< T > & BaseFab< T >::minus ( const BaseFab< T > &  src,
const Box srcbox,
const Box destbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
) [inline]

Subtract srcbox region of src FAB from destbox region of this FAB.

srcbox and destbox must be same size.

template<class T>
BaseFab< T > & BaseFab< T >::operator*= ( r  )  [inline]

Scalar multiplication (a[i] <- a[i] * r), in place.

References ForAllThis.

Referenced by BaseFab< T >::mult().

template<class T>
BaseFab< T > & BaseFab< T >::mult ( r  )  [inline]

Scalar multiplication (a[i] <- a[i] * r). The same as *=.

References BaseFab< T >::operator*=().

template<class T>
BaseFab< T > & BaseFab< T >::mult ( r,
int  comp,
int  numcomp = 1 
) [inline]

Scalar multiplication, except control which components are multiplied.

References ForAllThisNN.

template<class T>
BaseFab< T > & BaseFab< T >::mult ( r,
const Box b,
int  comp = 0,
int  numcomp = 1 
) [inline]

As above, except specify sub-box.

template<class T>
BaseFab< T > & BaseFab< T >::operator*= ( const BaseFab< T > &  f  )  [inline]

FAB multiplication (a[i] <- a[i] * b[i]), in place.

References ForAllThisXC.

template<class T>
BaseFab< T > & BaseFab< T >::mult ( const BaseFab< T > &  src  )  [inline]

As above.

References BaseFab< T >::operator*=().

template<class T>
BaseFab< T > & BaseFab< T >::mult ( const BaseFab< T > &  src,
int  srccomp,
int  destcomp,
int  numcomp = 1 
) [inline]

Multiply src components (srccomp:srccomp+numcomp-1) with this FAB's components (destcomp:destcomp+numcomp-1) where the two FABs intersect.

References BaseFab< T >::domain.

template<class T>
BaseFab< T > & BaseFab< T >::mult ( const BaseFab< T > &  src,
const Box subbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
) [inline]

Same as above except multiplication is restricted to intersection of subbox and src FAB.

NOTE: subbox must be contained in this FAB.

template<class T>
BaseFab< T > & BaseFab< T >::mult ( const BaseFab< T > &  src,
const Box srcbox,
const Box destbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
) [inline]

Multiply srcbox region of src FAB with destbox region of this FAB.

The srcbox and destbox must be same size.

template<class T>
BaseFab< T > & BaseFab< T >::operator/= ( r  )  [inline]

Scalar division (a[i] <- a[i] / r), in place.

References ForAllThis.

Referenced by BaseFab< T >::divide().

template<class T>
BaseFab< T > & BaseFab< T >::divide ( r  )  [inline]

Scalar division (a[i] <- a[i] / r), in place.

References BaseFab< T >::operator/=().

template<class T>
BaseFab< T > & BaseFab< T >::divide ( r,
int  comp,
int  numcomp = 1 
) [inline]

As above except specify which components.

References ForAllThisNN.

template<class T>
BaseFab< T > & BaseFab< T >::divide ( r,
const Box b,
int  comp = 0,
int  numcomp = 1 
) [inline]

As above except specify sub-box.

template<class T>
BaseFab< T > & BaseFab< T >::operator/= ( const BaseFab< T > &  src  )  [inline]

FAB division, in place.

References ForAllThisXC.

template<class T>
BaseFab< T > & BaseFab< T >::divide ( const BaseFab< T > &  src  )  [inline]

Same as above.

References BaseFab< T >::operator/=().

template<class T>
BaseFab< T > & BaseFab< T >::divide ( const BaseFab< T > &  src,
int  srccomp,
int  destcomp,
int  numcomp = 1 
) [inline]

This FAB is numerator, src FAB is denominator divide src components (srccomp:srccomp+numcomp-1) into this FAB's components (destcomp:destcomp+numcomp-1) where the two FABs intersect.

References BaseFab< T >::domain.

template<class T>
BaseFab< T > & BaseFab< T >::divide ( const BaseFab< T > &  src,
const Box subbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
) [inline]

Same as above except division is restricted to intersection of subbox and src FAB.

NOTE: subbox must be contained in this FAB.

template<class T>
BaseFab< T > & BaseFab< T >::divide ( const BaseFab< T > &  src,
const Box srcbox,
const Box destbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
) [inline]

destbox region of this FAB is numerator.

srcbox regions of src FAB is denominator. srcbox and destbox must be same size.

template<class T>
BaseFab< T > & BaseFab< T >::linInterp ( const BaseFab< T > &  f1,
const Box b1,
int  comp1,
const BaseFab< T > &  f2,
const Box b2,
int  comp2,
Real  t1,
Real  t2,
Real  t,
const Box b,
int  comp,
int  numcomp = 1 
) [inline]

Linear interpolation / extrapolation.

Result is (t2-t)/(t2-t1)*f1 + (t-t1)/(t2-t1)*f2 Data is taken from b1 region of f1, b2 region of f2 and stored in b region of this FAB. Boxes b, b1 and b2 must be the same size. Data is taken from component comp1 of f1, comp2 of f2, and stored in component comp of this FAB. This FAB is returned as a reference for chaining.

Referenced by BoxLib::linInterpFillFab().

template<class T>
BaseFab< T > & BaseFab< T >::linComb ( const BaseFab< T > &  f1,
const Box b1,
int  comp1,
const BaseFab< T > &  f2,
const Box b2,
int  comp2,
Real  alpha,
Real  beta,
const Box b,
int  comp,
int  numcomp = 1 
) [inline]

Linear combination.

Result is alpha*f1 + beta*f2. Data is taken from b1 region of f1, b2 region of f2 and stored in b region of this FAB. Boxes b, b1 and b2 must be the same size. Data is taken from component comp1 of f1, comp2 of f2, and stored in component comp of this FAB. This FAB is returned as a reference for chaining.

template<class T>
void BaseFab< T >::define (  )  [inline, protected]

template<class T>
void BaseFab< T >::undefine (  )  [inline, protected]

template<class T>
void BaseFab< T >::performCopy ( const BaseFab< T > &  src,
const Box srcbox,
int  srccomp,
const Box destbox,
int  destcomp,
int  numcomp 
) [inline, protected]

template<class T>
void BaseFab< T >::performSetVal ( x,
const Box bx,
int  nstart,
int  numcomp 
) [inline, protected]


Member Data Documentation

template<class T>
Box BaseFab< T >::domain [protected]

template<class T>
int BaseFab< T >::nvar [protected]

template<class T>
long BaseFab< T >::numpts [protected]

template<class T>
long BaseFab< T >::truesize [protected]

template<class T>
T* BaseFab< T >::dptr [protected]


The documentation for this class was generated from the following file:

Generated on Fri Nov 21 10:11:01 2008 for AMRParticlePaths by  doxygen 1.5.5