#include <BaseFab.H>
Public Types | |
typedef T | value_type |
Public Member Functions | |
BaseFab () | |
Construct an invalid `BaseFab'. | |
BaseFab (const BaseFab &) | |
BaseFab & | operator= (const BaseFab &) |
BaseFab & | operator= (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 Box & | box () 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 IntVect & | smallEnd () const |
Returns the lower corner of the domain. | |
const IntVect & | bigEnd () 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. | |
T | min (int comp=0) const |
Minimum value of given component. | |
T | min (const Box &subbox, int comp=0) const |
Minimum value of given component in given subbox. | |
T | max (int comp=0) const |
Maximum value of given component. | |
T | 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. | |
T | sum (int comp, int numcomp=1) const |
Compute sum of given component of FAB state vector. | |
T | 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 |
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.
typedef T BaseFab< T >::value_type |
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.
References BaseFab< T >::box(), BaseFab< T >::define(), BaseFab< T >::domain, BaseFab< T >::dptr, BaseFab< T >::nComp(), Box::numPts(), BaseFab< T >::numpts, and BaseFab< T >::nvar.
Referenced by FArrayBox::operator=().
References BaseFab< T >::setVal().
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().
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().
int BaseFab< T >::nComp | ( | ) | const [inline] |
Returns the number of components.
References BaseFab< T >::nvar.
Referenced by BaseFab< T >::copy(), BaseFab< T >::copyRev(), BoxLib::linInterpFillFab(), FArrayBox::norm(), BaseFab< T >::norm(), operator<<(), BaseFab< T >::operator=(), BaseFab< T >::performCopy(), FArrayBox::skipFAB(), FABio::write_header(), and FArrayBox::writeOn().
Returns the domain (box) where the array is defined.
References BaseFab< T >::domain.
Referenced by BaseFab< T >::contains(), BaseFab< T >::copy(), BoxLib::linInterpFillFab(), BaseFab< T >::operator=(), BaseFab< T >::performCopy(), BaseFab< T >::setVal(), FArrayBox::skipFAB(), and FABio::write_header().
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().
Returns the lower corner of the domain.
See class `Box' for analogue.
References BaseFab< T >::domain, and Box::smallEnd().
Returns the upper corner of the domain.
See class `Box' for analogue.
References Box::bigEnd(), and BaseFab< T >::domain.
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().
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().
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.
Returns true if bx is totally contained within the domain of this `BaseFab'.
References BaseFab< T >::box(), and Box::contains().
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().
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.
bool BaseFab< T >::isAllocated | ( | ) | const [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.
Same as above, except returns component 0.
References BL_ASSERT, Box::contains(), BaseFab< T >::domain, BaseFab< T >::dptr, and Box::index().
Same as above except works on const FAB's.
References BL_ASSERT, Box::contains(), BaseFab< T >::domain, BaseFab< T >::dptr, Box::index(), BaseFab< T >::numpts, and BaseFab< T >::nvar.
Same as above, except returns component 0.
References BL_ASSERT, Box::contains(), BaseFab< T >::domain, BaseFab< T >::dptr, and Box::index().
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().
Same as above, except that starts at component 0 and copies ALL comps.
References BaseFab< T >::getVal(), and BaseFab< T >::nvar.
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().
Same as above, except the number of modified components is one.
N is the component to be modified.
References BaseFab< T >::performSetVal().
void BaseFab< T >::setVal | ( | T | x, | |
int | N | |||
) | [inline] |
Same as above, except the subbox defaults to the entire domain.
References BaseFab< T >::domain, and BaseFab< T >::performSetVal().
void BaseFab< T >::setVal | ( | T | x | ) | [inline] |
Same as above, except ALL components are set.
References BaseFab< T >::box(), BaseFab< T >::nvar, and BaseFab< T >::performSetVal().
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().
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().
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().
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().
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().
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.
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().
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().
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().
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().
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().
void BaseFab< T >::abs | ( | ) | [inline] |
void BaseFab< T >::abs | ( | int | comp, | |
int | numcomp = 1 | |||
) | [inline] |
void BaseFab< T >::abs | ( | const Box & | subbox, | |
int | comp = 0 , |
|||
int | numcomp = 1 | |||
) | [inline] |
Calculate abs() on subbox for given component range.
T BaseFab< T >::min | ( | int | comp = 0 |
) | const [inline] |
T BaseFab< T >::max | ( | int | comp = 0 |
) | const [inline] |
Find location of minimum value in given component.
References BaseFab< T >::domain, and Box::smallEnd().
Find location of maximum value in given component.
References BaseFab< T >::domain, and Box::smallEnd().
int BaseFab< T >::maskLT | ( | BaseFab< int > & | mask, | |
T | 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().
int BaseFab< T >::maskLE | ( | BaseFab< int > & | mask, | |
T | 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().
int BaseFab< T >::maskEQ | ( | BaseFab< int > & | mask, | |
T | 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().
int BaseFab< T >::maskGT | ( | BaseFab< int > & | mask, | |
T | 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().
int BaseFab< T >::maskGE | ( | BaseFab< int > & | mask, | |
T | 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().
void BaseFab< T >::patternFill | ( | int | mark = 0 |
) | [inline] |
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().
T BaseFab< T >::sum | ( | int | comp, | |
int | numcomp = 1 | |||
) | const [inline] |
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.
BaseFab< T > & BaseFab< T >::invert | ( | T | v, | |
const Box & | subbox, | |||
int | comp = 0 , |
|||
int | numcomp = 1 | |||
) | [inline] |
Most general version, specify subbox and which components.
BaseFab< T > & BaseFab< T >::negate | ( | const Box & | subbox, | |
int | comp = 0 , |
|||
int | numcomp = 1 | |||
) | [inline] |
Negate BaseFab, most general.
BaseFab< T > & BaseFab< T >::plus | ( | T | r, | |
const Box & | b, | |||
int | comp = 0 , |
|||
int | numcomp = 1 | |||
) | [inline] |
Scalar addition (a[i] <- a[i] + r), most general.
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().
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.
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.
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.
Scalar subtraction (a[i] <- a[i] - r).
Note: use plus(-r) for more general operations.
References BaseFab< T >::operator+=().
Referenced by BaseFab< T >::minus().
FAB subtraction (a[i] <- a[i] - b[i]). The same as -= operator.
References BaseFab< T >::operator-=().
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.
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.
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.
Scalar multiplication (a[i] <- a[i] * r), in place.
References ForAllThis.
Referenced by BaseFab< T >::mult().
BaseFab< T > & BaseFab< T >::mult | ( | T | r, | |
const Box & | b, | |||
int | comp = 0 , |
|||
int | numcomp = 1 | |||
) | [inline] |
As above, except specify sub-box.
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.
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.
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.
Scalar division (a[i] <- a[i] / r), in place.
References ForAllThis.
Referenced by BaseFab< T >::divide().
BaseFab< T > & BaseFab< T >::divide | ( | T | r, | |
const Box & | b, | |||
int | comp = 0 , |
|||
int | numcomp = 1 | |||
) | [inline] |
As above except specify sub-box.
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.
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.
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.
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().
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.
void BaseFab< T >::define | ( | ) | [inline, protected] |
References Arena::alloc(), BL_ASSERT, BaseFab< T >::dptr, BaseFab< T >::numpts, BaseFab< T >::nvar, BoxLib::The_Arena(), and BaseFab< T >::truesize.
Referenced by BaseFab< T >::BaseFab(), BaseFab< T >::operator=(), and BaseFab< T >::resize().
void BaseFab< T >::undefine | ( | ) | [inline, protected] |
References BaseFab< T >::dptr, Arena::free(), BoxLib::The_Arena(), and BaseFab< T >::truesize.
Referenced by BaseFab< T >::clear(), BaseFab< T >::resize(), and BaseFab< T >::~BaseFab().
void BaseFab< T >::performSetVal | ( | T | x, | |
const Box & | bx, | |||
int | nstart, | |||
int | numcomp | |||
) | [inline, protected] |
References BL_ASSERT, Box::contains(), BaseFab< T >::domain, BaseFab< T >::dptr, BaseFab< T >::numpts, and BaseFab< T >::nvar.
Referenced by BaseFab< T >::setComplement(), and BaseFab< T >::setVal().
Referenced by BaseFab< T >::BaseFab(), BaseFab< T >::bigEnd(), BaseFab< T >::box(), BaseFab< T >::clear(), BaseFab< T >::copy(), BaseFab< T >::divide(), BaseFab< T >::getVal(), BaseFab< T >::hiVect(), BaseFab< T >::length(), BaseFab< T >::loVect(), BaseFab< T >::maskEQ(), BaseFab< T >::maskGE(), BaseFab< T >::maskGT(), BaseFab< T >::maskLE(), BaseFab< T >::maskLT(), BaseFab< T >::max(), BaseFab< T >::maxIndex(), BaseFab< T >::min(), BaseFab< T >::minIndex(), BaseFab< T >::minus(), BaseFab< T >::mult(), FArrayBox::norm(), BaseFab< T >::norm(), BaseFab< T >::operator()(), BaseFab< T >::operator=(), BaseFab< T >::performSetVal(), BaseFab< T >::plus(), BaseFab< T >::resize(), BaseFab< T >::setComplement(), BaseFab< T >::setVal(), BaseFab< T >::shift(), BaseFab< T >::shiftHalf(), BaseFab< T >::smallEnd(), and BaseFab< T >::sum().
Referenced by BaseFab< T >::BaseFab(), BaseFab< T >::clear(), BaseFab< T >::contains(), BaseFab< T >::copy(), BaseFab< T >::define(), BaseFab< T >::getVal(), BaseFab< T >::nComp(), BaseFab< T >::operator()(), BaseFab< T >::operator=(), BaseFab< T >::performSetVal(), BaseFab< T >::resize(), and BaseFab< T >::setVal().
Referenced by BaseFab< T >::define(), BaseFab< T >::resize(), and BaseFab< T >::undefine().
Referenced by BaseFab< T >::BaseFab(), BaseFab< T >::clear(), BaseFab< T >::dataPtr(), BaseFab< T >::define(), BaseFab< T >::getVal(), BaseFab< T >::isAllocated(), BaseFab< T >::operator()(), BaseFab< T >::operator=(), BaseFab< T >::performSetVal(), BaseFab< T >::resize(), and BaseFab< T >::undefine().