Block-Structured AMR Software Framework
amrex::BaseFab< T > Class Template Reference

A FortranArrayBox(FAB)-like object. More...

#include <AMReX_BaseFab.H>

Inheritance diagram for amrex::BaseFab< T >:
amrex::DataAllocator

Public Types

using value_type = T
 

Public Member Functions

 BaseFab () noexcept=default
 Construct an empty BaseFab, which must be resized (see BaseFab::resize) before use. More...
 
 BaseFab (Arena *ar) noexcept
 
 BaseFab (const Box &bx, int n, Arena *ar)
 
 BaseFab (const Box &bx, int n=1, bool alloc=true, bool shared=false, Arena *ar=nullptr)
 Make BaseFab with desired domain (box) and number of components. More...
 
 BaseFab (const BaseFab< T > &rhs, MakeType make_type, int scomp, int ncomp)
 
 BaseFab (const Box &bx, int ncomp, T *p)
 Create an NON-OWNING BaseFab. Thus BaseFab is not responsible for memory management. And it's caller's responsibility that p points to a chunk of memory large enough. More...
 
 BaseFab (const Box &bx, int ncomp, T const *p)
 
 BaseFab (Array4< T > const &a) noexcept
 
 BaseFab (Array4< T > const &a, IndexType t) noexcept
 
 BaseFab (Array4< T const > const &a) noexcept
 
 BaseFab (Array4< T const > const &a, IndexType t) noexcept
 
virtual ~BaseFab () noexcept
 The destructor deletes the array memory. More...
 
 BaseFab (const BaseFab< T > &rhs)=delete
 
BaseFab< T > & operator= (const BaseFab< T > &rhs)=delete
 
 BaseFab (BaseFab< T > &&rhs) noexcept
 
BaseFab< T > & operator= (BaseFab< T > &&rhs) noexcept
 
template<RunOn run_on>
BaseFaboperator= (T const &) noexcept
 
void resize (const Box &b, int N=1, Arena *ar=nullptr)
 This function resizes a BaseFab so it covers the Box b with N components. More...
 
template<class U = T, std::enable_if_t< std::is_trivially_destructible_v< U >, int > = 0>
Elixir elixir () noexcept
 
void clear () noexcept
 The function returns the BaseFab to the invalid state. The memory is freed. More...
 
std::unique_ptr< T, DataDeleterrelease () noexcept
 Release ownership of memory. More...
 
std::size_t nBytes () const noexcept
 Returns how many bytes used. More...
 
std::size_t nBytesOwned () const noexcept
 
std::size_t nBytes (const Box &bx, int ncomps) const noexcept
 Returns bytes used in the Box for those components. More...
 
int nComp () const noexcept
 Returns the number of components. More...
 
const intnCompPtr () const noexcept
 for calls to fortran. More...
 
Long numPts () const noexcept
 Returns the number of points. More...
 
Long size () const noexcept
 Returns the total number of points of all components. More...
 
const Boxbox () const noexcept
 Returns the domain (box) where the array is defined. More...
 
IntVect length () const noexcept
 Returns a pointer to an array of SPACEDIM integers giving the length of the domain in each direction. More...
 
const IntVectsmallEnd () const noexcept
 Returns the lower corner of the domain See class Box for analogue. More...
 
const IntVectbigEnd () const noexcept
 Returns the upper corner of the domain. See class Box for analogue. More...
 
const intloVect () const noexcept
 Returns the lower corner of the domain. More...
 
const inthiVect () const noexcept
 Returns the upper corner of the domain. More...
 
bool contains (const BaseFab< T > &fab) const noexcept
 Returns true if the domain of fab is totally contained within the domain of this BaseFab. More...
 
bool contains (const Box &bx) const noexcept
 Returns true if bx is totally contained within the domain of this BaseFab. More...
 
T * dataPtr (int n=0) noexcept
 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. More...
 
const T * dataPtr (int n=0) const noexcept
 Same as above except works on const FABs. More...
 
T * dataPtr (const IntVect &p, int n=0) noexcept
 
const T * dataPtr (const IntVect &p, int n=0) const noexcept
 
void setPtr (T *p, Long sz) noexcept
 
void prefetchToHost () const noexcept
 
void prefetchToDevice () const noexcept
 
AMREX_FORCE_INLINE Array4< T const > array () const noexcept
 
AMREX_FORCE_INLINE Array4< T const > array (int start_comp) const noexcept
 
AMREX_FORCE_INLINE Array4< T const > array (int start_comp, int num_comps) const noexcept
 
AMREX_FORCE_INLINE Array4< T > array () noexcept
 
AMREX_FORCE_INLINE Array4< T > array (int start_comp) noexcept
 
AMREX_FORCE_INLINE Array4< T > array (int start_comp, int num_comps) noexcept
 
AMREX_FORCE_INLINE Array4< T const > const_array () const noexcept
 
AMREX_FORCE_INLINE Array4< T const > const_array (int start_comp) const noexcept
 
AMREX_FORCE_INLINE Array4< T const > const_array (int start_comp, int num_comps) const noexcept
 
bool isAllocated () const noexcept
 Returns true if the data for the FAB has been allocated. More...
 
T & operator() (const IntVect &p, int N) noexcept
 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. More...
 
T & operator() (const IntVect &p) noexcept
 Same as above, except returns component 0. More...
 
const T & operator() (const IntVect &p, int N) const noexcept
 Same as above except works on const FABs. More...
 
const T & operator() (const IntVect &p) const noexcept
 Same as above, except returns component 0. More...
 
void getVal (T *data, const IntVect &pos, int N, int numcomp) const noexcept
 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. More...
 
void getVal (T *data, const IntVect &pos) const noexcept
 Same as above, except that starts at component 0 and copies all comps. More...
 
template<RunOn run_on, class U = T, std::enable_if_t< std::is_same_v< U, float >||std::is_same_v< U, double >, int > FOO = 0>
void fill_snan () noexcept
 
template<RunOn run_on>
void setVal (T const &x, const Box &bx, int dcomp, int ncomp) noexcept
 The setVal functions set sub-regions 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. More...
 
template<RunOn run_on>
void setVal (T const &x, const Box &bx, int N=0) noexcept
 Same as above, except the number of modified components is one. N is the component to be modified. More...
 
template<RunOn run_on>
void setVal (T const &x, int N) noexcept
 Same as above, except the sub-box defaults to the entire domain. More...
 
template<RunOn run_on>
void setValIfNot (T const &val, const Box &bx, const BaseFab< int > &mask, int nstart, int num) noexcept
 
template<RunOn run_on>
void setComplement (T const &x, const Box &b, int ns, int num) noexcept
 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. More...
 
template<RunOn run_on>
BaseFab< T > & copy (const BaseFab< T > &src, const Box &srcbox, int srccomp, const Box &destbox, int destcomp, int numcomp) noexcept
 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. The results are UNDEFINED if the src and dest are the same and the srcbox and destbox overlap. More...
 
template<RunOn run_on>
BaseFab< T > & copy (const BaseFab< T > &src, int srccomp, int destcomp, int numcomp=1) noexcept
 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. class. More...
 
template<RunOn run_on>
BaseFab< T > & copy (const BaseFab< T > &src, const Box &destbox) noexcept
 As above, except that the destination Box is specified, but the source Box is taken to the equal to the destination Box, and all components of the destination BaseFab are copied. More...
 
template<RunOn run_on>
std::size_t copyToMem (const Box &srcbox, int srccomp, int numcomp, void *dst) const noexcept
 Copy from the srcbox of this Fab to raw memory and return the number of bytes copied. More...
 
template<RunOn run_on, typename BUF = T>
std::size_t copyFromMem (const Box &dstbox, int dstcomp, int numcomp, const void *src) noexcept
 Copy from raw memory to the dstbox of this Fab and return the number of bytes copied. More...
 
template<RunOn run_on, typename BUF = T>
std::size_t addFromMem (const Box &dstbox, int dstcomp, int numcomp, const void *src) noexcept
 Add from raw memory to the dstbox of this Fab and return the number of bytes copied. More...
 
BaseFab< T > & shift (const IntVect &v) noexcept
 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. More...
 
BaseFab< T > & shift (int idir, int n_cell) noexcept
 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. More...
 
BaseFab< T > & shiftHalf (int dir, int n_cell) noexcept
 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. More...
 
BaseFab< T > & shiftHalf (const IntVect &v) noexcept
 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. More...
 
template<RunOn run_on>
Real norminfmask (const Box &subbox, const BaseFab< int > &mask, int scomp=0, int ncomp=1) const noexcept
 
template<RunOn run_on>
Real norm (int p, int scomp=0, int numcomp=1) const noexcept
 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) More...
 
template<RunOn run_on>
Real norm (const Box &subbox, int p, int scomp=0, int numcomp=1) const noexcept
 Same as above except only on given subbox. More...
 
template<RunOn run_on>
void abs () noexcept
 Compute absolute value for all components of this FAB. More...
 
template<RunOn run_on>
void abs (int comp, int numcomp=1) noexcept
 Same as above except only for components (comp: comp+numcomp-1) More...
 
template<RunOn run_on>
void abs (const Box &subbox, int comp=0, int numcomp=1) noexcept
 Calculate abs() on subbox for given component range. More...
 
template<RunOn run_on>
min (int comp=0) const noexcept
 
template<RunOn run_on>
min (const Box &subbox, int comp=0) const noexcept
 
template<RunOn run_on>
max (int comp=0) const noexcept
 
template<RunOn run_on>
max (const Box &subbox, int comp=0) const noexcept
 
template<RunOn run_on>
std::pair< T, T > minmax (int comp=0) const noexcept
 
template<RunOn run_on>
std::pair< T, T > minmax (const Box &subbox, int comp=0) const noexcept
 
template<RunOn run_on>
maxabs (int comp=0) const noexcept
 
template<RunOn run_on>
maxabs (const Box &subbox, int comp=0) const noexcept
 
template<RunOn run_on>
IntVect indexFromValue (const Box &subbox, int comp, T const &value) const noexcept
 
template<RunOn run_on>
IntVect minIndex (int comp=0) const noexcept
 
template<RunOn run_on>
IntVect minIndex (const Box &subbox, int comp=0) const noexcept
 
template<RunOn run_on>
void minIndex (const Box &subbox, Real &min_val, IntVect &min_idx, int comp=0) const noexcept
 
template<RunOn run_on>
IntVect maxIndex (int comp=0) const noexcept
 
template<RunOn run_on>
IntVect maxIndex (const Box &subbox, int comp=0) const noexcept
 
template<RunOn run_on>
void maxIndex (const Box &subbox, Real &max_value, IntVect &max_idx, int comp=0) const noexcept
 
template<RunOn run_on>
int maskLT (BaseFab< int > &mask, T const &val, int comp=0) const noexcept
 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. More...
 
template<RunOn run_on>
int maskLE (BaseFab< int > &mask, T const &val, int comp=0) const noexcept
 Same as above except mark cells with value less than or equal to val. More...
 
template<RunOn run_on>
int maskEQ (BaseFab< int > &mask, T const &val, int comp=0) const noexcept
 Same as above except mark cells with value equal to val. More...
 
template<RunOn run_on>
int maskGT (BaseFab< int > &mask, T const &val, int comp=0) const noexcept
 Same as above except mark cells with value greater than val. More...
 
template<RunOn run_on>
int maskGE (BaseFab< int > &mask, T const &val, int comp=0) const noexcept
 Same as above except mark cells with value greater than or equal to val. More...
 
template<RunOn run_on>
sum (int comp, int numcomp=1) const noexcept
 Returns sum of given component of FAB state vector. More...
 
template<RunOn run_on>
sum (const Box &subbox, int comp, int numcomp=1) const noexcept
 Compute sum of given component of FAB state vector in given subbox. More...
 
template<RunOn run_on>
BaseFab< T > & invert (T const &r, const Box &b, int comp=0, int numcomp=1) noexcept
 Most general version, specify subbox and which components. More...
 
template<RunOn run_on>
BaseFab< T > & invert (T const &r, int comp, int numcomp=1) noexcept
 As above except on entire domain. More...
 
template<RunOn run_on>
BaseFab< T > & negate (const Box &b, int comp=0, int numcomp=1) noexcept
 Negate BaseFab, most general. More...
 
template<RunOn run_on>
BaseFab< T > & negate (int comp, int numcomp=1) noexcept
 As above, except on entire domain. More...
 
template<RunOn run_on>
BaseFab< T > & plus (T const &r, const Box &b, int comp=0, int numcomp=1) noexcept
 Scalar addition (a[i] <- a[i] + r), most general. More...
 
template<RunOn run_on>
BaseFab< T > & plus (T const &r, int comp, int numcomp=1) noexcept
 As above, except on entire domain. More...
 
template<RunOn run_on>
BaseFab< T > & plus (const BaseFab< T > &src, int srccomp, int destcomp, int numcomp=1) noexcept
 Add src components (srccomp:srccomp+numcomp-1) to this FABs components (destcomp:destcomp+numcomp-1) where the two FABs intersect. More...
 
template<RunOn run_on>
BaseFab< T > & plus (const BaseFab< T > &src, const Box &subbox, int srccomp, int destcomp, int numcomp=1) noexcept
 Same as above except addition is restricted to intersection of subbox and src FAB. NOTE: subbox must be contained in this FAB. More...
 
template<RunOn run_on>
BaseFab< T > & plus (const BaseFab< T > &src, const Box &srcbox, const Box &destbox, int srccomp, int destcomp, int numcomp=1) noexcept
 Add srcbox region of src FAB to destbox region of this FAB. The srcbox and destbox must be same size. More...
 
template<RunOn run_on>
BaseFab< T > & atomicAdd (const BaseFab< T > &x) noexcept
 Atomic FAB addition (a[i] <- a[i] + b[i]). More...
 
template<RunOn run_on>
BaseFab< T > & atomicAdd (const BaseFab< T > &src, int srccomp, int destcomp, int numcomp=1) noexcept
 Atomically add src components (srccomp:srccomp+numcomp-1) to this FABs components (destcomp:destcomp+numcomp-1) where the two FABs intersect. More...
 
template<RunOn run_on>
BaseFab< T > & atomicAdd (const BaseFab< T > &src, const Box &subbox, int srccomp, int destcomp, int numcomp=1) noexcept
 Same as above except addition is restricted to intersection of subbox and src FAB. NOTE: subbox must be contained in this FAB. More...
 
template<RunOn run_on>
BaseFab< T > & atomicAdd (const BaseFab< T > &src, const Box &srcbox, const Box &destbox, int srccomp, int destcomp, int numcomp=1) noexcept
 Atomically add srcbox region of src FAB to destbox region of this FAB. The srcbox and destbox must be same size. More...
 
template<RunOn run_on>
BaseFab< T > & lockAdd (const BaseFab< T > &src, const Box &srcbox, const Box &destbox, int srccomp, int destcomp, int numcomp) noexcept
 Atomically add srcbox region of src FAB to destbox region of this FAB. The srcbox and destbox must be same size. When OMP is on, this uses OMP locks in the implementation and it's usually faster than atomicAdd. More...
 
template<RunOn run_on>
BaseFab< T > & saxpy (T a, const BaseFab< T > &x, const Box &srcbox, const Box &destbox, int srccomp, int destcomp, int numcomp=1) noexcept
 FAB SAXPY (y[i] <- y[i] + a * x[i]), in place. More...
 
template<RunOn run_on>
BaseFab< T > & saxpy (T a, const BaseFab< T > &x) noexcept
 FAB SAXPY (y[i] <- y[i] + a * x[i]), in place. All components. More...
 
template<RunOn run_on>
BaseFab< T > & xpay (T a, const BaseFab< T > &x, const Box &srcbox, const Box &destbox, int srccomp, int destcomp, int numcomp=1) noexcept
 FAB XPAY (y[i] <- x[i] + a * y[i]) More...
 
template<RunOn run_on>
BaseFab< T > & addproduct (const Box &destbox, int destcomp, int numcomp, const BaseFab< T > &src1, int comp1, const BaseFab< T > &src2, int comp2) noexcept
 y[i] <- y[i] + x1[i] * x2[i]) More...
 
template<RunOn run_on>
BaseFab< T > & minus (const BaseFab< T > &src, int srccomp, int destcomp, int numcomp=1) noexcept
 Subtract src components (srccomp:srccomp+numcomp-1) to this FABs components (destcomp:destcomp+numcomp-1) where the two FABs intersect. More...
 
template<RunOn run_on>
BaseFab< T > & minus (const BaseFab< T > &src, const Box &subbox, int srccomp, int destcomp, int numcomp=1) noexcept
 Same as above except subtraction is restricted to intersection of subbox and src FAB. NOTE: subbox must be contained in this FAB. More...
 
template<RunOn run_on>
BaseFab< T > & minus (const BaseFab< T > &src, const Box &srcbox, const Box &destbox, int srccomp, int destcomp, int numcomp=1) noexcept
 Subtract srcbox region of src FAB from destbox region of this FAB. srcbox and destbox must be same size. More...
 
template<RunOn run_on>
BaseFab< T > & mult (T const &r, int comp, int numcomp=1) noexcept
 Scalar multiplication, except control which components are multiplied. More...
 
template<RunOn run_on>
BaseFab< T > & mult (T const &r, const Box &b, int comp=0, int numcomp=1) noexcept
 As above, except specify sub-box. More...
 
template<RunOn run_on>
BaseFab< T > & mult (const BaseFab< T > &src, int srccomp, int destcomp, int numcomp=1) noexcept
 Multiply src components (srccomp:srccomp+numcomp-1) with this FABs components (destcomp:destcomp+numcomp-1) where the two FABs intersect. More...
 
template<RunOn run_on>
BaseFab< T > & mult (const BaseFab< T > &src, const Box &subbox, int srccomp, int destcomp, int numcomp=1) noexcept
 Same as above except multiplication is restricted to intersection of subbox and src FAB. NOTE: subbox must be contained in this FAB. More...
 
template<RunOn run_on>
BaseFab< T > & mult (const BaseFab< T > &src, const Box &srcbox, const Box &destbox, int srccomp, int destcomp, int numcomp=1) noexcept
 Multiply srcbox region of src FAB with destbox region of this FAB. The srcbox and destbox must be same size. More...
 
template<RunOn run_on>
BaseFab< T > & divide (T const &r, int comp, int numcomp=1) noexcept
 As above except specify which components. More...
 
template<RunOn run_on>
BaseFab< T > & divide (T const &r, const Box &b, int comp=0, int numcomp=1) noexcept
 As above except specify sub-box. More...
 
template<RunOn run_on>
BaseFab< T > & divide (const BaseFab< T > &src, int srccomp, int destcomp, int numcomp=1) noexcept
 This FAB is numerator, src FAB is denominator divide src components (srccomp:srccomp+numcomp-1) into this FABs components (destcomp:destcomp+numcomp-1) where the two FABs intersect. More...
 
template<RunOn run_on>
BaseFab< T > & divide (const BaseFab< T > &src, const Box &subbox, int srccomp, int destcomp, int numcomp=1) noexcept
 Same as above except division is restricted to intersection of subbox and src FAB. NOTE: subbox must be contained in this FAB. More...
 
template<RunOn run_on>
BaseFab< T > & divide (const BaseFab< T > &src, const Box &srcbox, const Box &destbox, int srccomp, int destcomp, int numcomp=1) noexcept
 destbox region of this FAB is numerator. srcbox regions of src FAB is denominator. srcbox and destbox must be same size. More...
 
template<RunOn run_on>
BaseFab< T > & protected_divide (const BaseFab< T > &src) noexcept
 Divide wherever "src" is "true" or "non-zero". More...
 
template<RunOn run_on>
BaseFab< T > & protected_divide (const BaseFab< T > &src, int srccomp, int destcomp, int numcomp=1) noexcept
 Divide wherever "src" is "true" or "non-zero". This FAB is numerator, src FAB is denominator divide src components (srccomp:srccomp+numcomp-1) into this FABs components (destcomp:destcomp+numcomp-1) where the two FABs intersect. More...
 
template<RunOn run_on>
BaseFab< T > & protected_divide (const BaseFab< T > &src, const Box &subbox, int srccomp, int destcomp, int numcomp=1) noexcept
 Divide wherever "src" is "true" or "non-zero". Same as above except division is restricted to intersection of subbox and src FAB. NOTE: subbox must be contained in this FAB. More...
 
template<RunOn run_on>
BaseFab< T > & protected_divide (const BaseFab< T > &src, const Box &srcbox, const Box &destbox, int srccomp, int destcomp, int numcomp=1) noexcept
 
template<RunOn run_on>
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) noexcept
 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. More...
 
template<RunOn run_on>
BaseFab< T > & linInterp (const BaseFab< T > &f1, int comp1, const BaseFab< T > &f2, int comp2, Real t1, Real t2, Real t, const Box &b, int comp, int numcomp=1) noexcept
 Version of linInterp() in which b, b1, & b2 are the same. More...
 
template<RunOn run_on>
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) noexcept
 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. More...
 
template<RunOn run_on>
dot (const Box &xbx, int xcomp, const BaseFab< T > &y, const Box &ybx, int ycomp, int numcomp=1) const noexcept
 Dot product of x (i.e.,this) and y. More...
 
template<RunOn run_on>
dotmask (const BaseFab< int > &mask, const Box &xbx, int xcomp, const BaseFab< T > &y, const Box &ybx, int ycomp, int numcomp) const noexcept
 
void SetBoxType (const IndexType &typ) noexcept
 Change the Box type without change the length. More...
 
template<RunOn run_on>
void setVal (T const &val) noexcept
 Set value on the whole domain and all components. More...
 
template<RunOn run_on>
void setVal (T const &x, Box const &bx, DestComp dcomp, NumComps ncomp) noexcept
 Do nothing if bx is empty. More...
 
template<RunOn run_on>
void setValIf (T const &val, const BaseFab< int > &mask) noexcept
 
template<RunOn run_on>
void setValIf (T const &val, Box const &bx, const BaseFab< int > &mask, DestComp dcomp, NumComps ncomp) noexcept
 Do nothing if bx is empty. More...
 
template<RunOn run_on>
void setValIfNot (T const &val, const BaseFab< int > &mask) noexcept
 
template<RunOn run_on>
void setValIfNot (T const &val, Box const &bx, const BaseFab< int > &mask, DestComp dcomp, NumComps ncomp) noexcept
 Do nothing if bx is empty. More...
 
template<RunOn run_on>
void setComplement (T const &x, Box const &bx, DestComp dcomp, NumComps ncomp) noexcept
 setVal on the complement of bx in the fab's domain More...
 
template<RunOn run_on>
BaseFab< T > & copy (const BaseFab< T > &src) noexcept
 
template<RunOn run_on>
BaseFab< T > & copy (const BaseFab< T > &src, Box bx, SrcComp scomp, DestComp dcomp, NumComps ncomp) noexcept
 Do nothing if bx does not intersect with src fab. More...
 
template<RunOn run_on>
BaseFab< T > & plus (T const &val) noexcept
 Scalar addition on the whole domain and all components. More...
 
template<RunOn run_on>
BaseFab< T > & operator+= (T const &val) noexcept
 
template<RunOn run_on>
BaseFab< T > & plus (T const &val, Box const &bx, DestComp dcomp, NumComps ncomp) noexcept
 Do nothing if bx is empty. More...
 
template<RunOn run_on>
BaseFab< T > & plus (const BaseFab< T > &src) noexcept
 
template<RunOn run_on>
BaseFab< T > & operator+= (const BaseFab< T > &src) noexcept
 
template<RunOn run_on>
BaseFab< T > & plus (const BaseFab< T > &src, Box bx, SrcComp scomp, DestComp dcomp, NumComps ncomp) noexcept
 Do nothing if bx does not intersect with src fab. More...
 
template<RunOn run_on>
BaseFab< T > & minus (T const &val) noexcept
 Scalar subtraction on the whole domain and all components. More...
 
template<RunOn run_on>
BaseFab< T > & operator-= (T const &val) noexcept
 
template<RunOn run_on>
BaseFab< T > & minus (T const &val, Box const &bx, DestComp dcomp, NumComps ncomp) noexcept
 Do nothing if bx is empty. More...
 
template<RunOn run_on>
BaseFab< T > & minus (const BaseFab< T > &src) noexcept
 
template<RunOn run_on>
BaseFab< T > & operator-= (const BaseFab< T > &src) noexcept
 
template<RunOn run_on>
BaseFab< T > & minus (const BaseFab< T > &src, Box bx, SrcComp scomp, DestComp dcomp, NumComps ncomp) noexcept
 Do nothing if bx does not intersect with src fab. More...
 
template<RunOn run_on>
BaseFab< T > & mult (T const &val) noexcept
 Scalar multiplication on the whole domain and all components. More...
 
template<RunOn run_on>
BaseFab< T > & operator*= (T const &val) noexcept
 
template<RunOn run_on>
BaseFab< T > & mult (T const &val, Box const &bx, DestComp dcomp, NumComps ncomp) noexcept
 Do nothing if bx is empty. More...
 
template<RunOn run_on>
BaseFab< T > & mult (const BaseFab< T > &src) noexcept
 
template<RunOn run_on>
BaseFab< T > & operator*= (const BaseFab< T > &src) noexcept
 
template<RunOn run_on>
BaseFab< T > & mult (const BaseFab< T > &src, Box bx, SrcComp scomp, DestComp dcomp, NumComps ncomp) noexcept
 Do nothing if bx does not intersect with src fab. More...
 
template<RunOn run_on>
BaseFab< T > & divide (T const &val) noexcept
 Scalar division on the whole domain and all components. More...
 
template<RunOn run_on>
BaseFab< T > & operator/= (T const &val) noexcept
 
template<RunOn run_on>
BaseFab< T > & divide (T const &val, Box const &bx, DestComp dcomp, NumComps ncomp) noexcept
 Do nothing if bx is empty. More...
 
template<RunOn run_on>
BaseFab< T > & divide (const BaseFab< T > &src) noexcept
 
template<RunOn run_on>
BaseFab< T > & operator/= (const BaseFab< T > &src) noexcept
 
template<RunOn run_on>
BaseFab< T > & divide (const BaseFab< T > &src, Box bx, SrcComp scomp, DestComp dcomp, NumComps ncomp) noexcept
 Do nothing if bx does not intersect with src fab. More...
 
template<RunOn run_on>
BaseFab< T > & negate () noexcept
 on the whole domain and all components More...
 
template<RunOn run_on>
BaseFab< T > & negate (const Box &bx, DestComp dcomp, NumComps ncomp) noexcept
 
template<RunOn run_on>
BaseFab< T > & invert (T const &r) noexcept
 Fab <- Fab/r on the whole domain and all components. More...
 
template<RunOn run_on>
BaseFab< T > & invert (T const &r, const Box &bx, DestComp dcomp, NumComps ncomp) noexcept
 
template<RunOn run_on>
sum (const Box &bx, DestComp dcomp, NumComps ncomp) const noexcept
 Sum. More...
 
template<RunOn run_on>
dot (const BaseFab< T > &src, const Box &bx, SrcComp scomp, DestComp dcomp, NumComps ncomp) const noexcept
 Dot product of two Fabs. More...
 
template<RunOn run_on>
dot (const Box &bx, int destcomp, int numcomp) const noexcept
 Int wrapper for dot. More...
 
template<RunOn run_on>
dot (const Box &bx, DestComp dcomp, NumComps ncomp) const noexcept
 Dot product. More...
 
template<RunOn run_on>
dotmask (const BaseFab< T > &src, const Box &bx, const BaseFab< int > &mask, SrcComp scomp, DestComp dcomp, NumComps ncomp) const noexcept
 Dot product of two Fabs with mask. More...
 
template<RunOn run_on>
BaseFab< T > & operator= (T const &t) noexcept
 
- Public Member Functions inherited from amrex::DataAllocator
 DataAllocator () noexcept=default
 
 DataAllocator (Arena *ar) noexcept
 
void * alloc (std::size_t sz) const noexcept
 
void free (void *pt) const noexcept
 
Arenaarena () const noexcept
 

Static Public Member Functions

static void Initialize ()
 
static void Finalize ()
 

Protected Member Functions

void define ()
 Allocates memory for the BaseFab<T>. More...
 

Protected Attributes

T * dptr = nullptr
 The data pointer. More...
 
Box domain
 My index space. More...
 
int nvar = 0
 Number components. More...
 
Long truesize = 0L
 nvar*numpts that was allocated on heap. More...
 
bool ptr_owner = false
 Owner of T*? More...
 
bool shared_memory = false
 Is the memory allocated in shared memory? More...
 
gpuStream_t alloc_stream {}
 

Friends

template<class U >
class BaseFab
 

Additional Inherited Members

- Public Attributes inherited from amrex::DataAllocator
Arenam_arena = nullptr
 

Detailed Description

template<class T>
class amrex::BaseFab< T >

A FortranArrayBox(FAB)-like object.

BaseFab emulates the Fortran array concept. Useful operations can be performed upon BaseFabs 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 integers, real*4s, or real*8s. Most applications do not use BaseFabs directly, but utilize specialized classes derived from BaseFab.

Classes derived from BaseFab include FArrayBox, IArrayBox, TagBox, Mask, EBFArrayBox, EBCellFlag and CutFab.

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 BaseFabs domain will not, in general, be the same as the parent BaseFabs 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.

Template Parameters
TMUST have a default constructor and an assignment operator.

Member Typedef Documentation

◆ value_type

template<class T >
using amrex::BaseFab< T >::value_type = T

Constructor & Destructor Documentation

◆ BaseFab() [1/13]

template<class T >
amrex::BaseFab< T >::BaseFab ( )
defaultnoexcept

Construct an empty BaseFab, which must be resized (see BaseFab::resize) before use.

◆ BaseFab() [2/13]

template<class T >
amrex::BaseFab< T >::BaseFab ( Arena ar)
explicitnoexcept

◆ BaseFab() [3/13]

template<class T >
amrex::BaseFab< T >::BaseFab ( const Box bx,
int  n,
Arena ar 
)

◆ BaseFab() [4/13]

template<class T >
amrex::BaseFab< T >::BaseFab ( const Box bx,
int  n = 1,
bool  alloc = true,
bool  shared = false,
Arena ar = nullptr 
)
explicit

Make BaseFab with desired domain (box) and number of components.

◆ BaseFab() [5/13]

template<class T >
amrex::BaseFab< T >::BaseFab ( const BaseFab< T > &  rhs,
MakeType  make_type,
int  scomp,
int  ncomp 
)

◆ BaseFab() [6/13]

template<class T >
amrex::BaseFab< T >::BaseFab ( const Box bx,
int  ncomp,
T *  p 
)

Create an NON-OWNING BaseFab. Thus BaseFab is not responsible for memory management. And it's caller's responsibility that p points to a chunk of memory large enough.

◆ BaseFab() [7/13]

template<class T >
amrex::BaseFab< T >::BaseFab ( const Box bx,
int  ncomp,
T const *  p 
)

◆ BaseFab() [8/13]

template<class T >
amrex::BaseFab< T >::BaseFab ( Array4< T > const &  a)
explicitnoexcept

◆ BaseFab() [9/13]

template<class T >
amrex::BaseFab< T >::BaseFab ( Array4< T > const &  a,
IndexType  t 
)
explicitnoexcept

◆ BaseFab() [10/13]

template<class T >
amrex::BaseFab< T >::BaseFab ( Array4< T const > const &  a)
explicitnoexcept

◆ BaseFab() [11/13]

template<class T >
amrex::BaseFab< T >::BaseFab ( Array4< T const > const &  a,
IndexType  t 
)
explicitnoexcept

◆ ~BaseFab()

template<class T >
amrex::BaseFab< T >::~BaseFab
virtualnoexcept

The destructor deletes the array memory.

◆ BaseFab() [12/13]

template<class T >
amrex::BaseFab< T >::BaseFab ( const BaseFab< T > &  rhs)
delete

◆ BaseFab() [13/13]

template<class T >
amrex::BaseFab< T >::BaseFab ( BaseFab< T > &&  rhs)
noexcept

Member Function Documentation

◆ abs() [1/3]

template<class T >
template<RunOn run_on>
void amrex::BaseFab< T >::abs
noexcept

Compute absolute value for all components of this FAB.

◆ abs() [2/3]

template<class T >
template<RunOn run_on>
void amrex::BaseFab< T >::abs ( const Box subbox,
int  comp = 0,
int  numcomp = 1 
)
noexcept

Calculate abs() on subbox for given component range.

◆ abs() [3/3]

template<class T >
template<RunOn run_on>
void amrex::BaseFab< T >::abs ( int  comp,
int  numcomp = 1 
)
noexcept

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

◆ addFromMem()

template<class T >
template<RunOn run_on, typename BUF >
std::size_t amrex::BaseFab< T >::addFromMem ( const Box dstbox,
int  dstcomp,
int  numcomp,
const void *  src 
)
noexcept

Add from raw memory to the dstbox of this Fab and return the number of bytes copied.

◆ addproduct()

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::addproduct ( const Box destbox,
int  destcomp,
int  numcomp,
const BaseFab< T > &  src1,
int  comp1,
const BaseFab< T > &  src2,
int  comp2 
)
noexcept

y[i] <- y[i] + x1[i] * x2[i])

◆ array() [1/6]

template<class T >
AMREX_FORCE_INLINE Array4<T const> amrex::BaseFab< T >::array ( ) const
inlinenoexcept

◆ array() [2/6]

template<class T >
AMREX_FORCE_INLINE Array4<T> amrex::BaseFab< T >::array ( )
inlinenoexcept

◆ array() [3/6]

template<class T >
AMREX_FORCE_INLINE Array4<T const> amrex::BaseFab< T >::array ( int  start_comp) const
inlinenoexcept

◆ array() [4/6]

template<class T >
AMREX_FORCE_INLINE Array4<T> amrex::BaseFab< T >::array ( int  start_comp)
inlinenoexcept

◆ array() [5/6]

template<class T >
AMREX_FORCE_INLINE Array4<T const> amrex::BaseFab< T >::array ( int  start_comp,
int  num_comps 
) const
inlinenoexcept

◆ array() [6/6]

template<class T >
AMREX_FORCE_INLINE Array4<T> amrex::BaseFab< T >::array ( int  start_comp,
int  num_comps 
)
inlinenoexcept

◆ atomicAdd() [1/4]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::atomicAdd ( const BaseFab< T > &  src,
const Box srcbox,
const Box destbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

Atomically add srcbox region of src FAB to destbox region of this FAB. The srcbox and destbox must be same size.

◆ atomicAdd() [2/4]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::atomicAdd ( const BaseFab< T > &  src,
const Box subbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

Same as above except addition is restricted to intersection of subbox and src FAB. NOTE: subbox must be contained in this FAB.

◆ atomicAdd() [3/4]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::atomicAdd ( const BaseFab< T > &  src,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

Atomically add src components (srccomp:srccomp+numcomp-1) to this FABs components (destcomp:destcomp+numcomp-1) where the two FABs intersect.

◆ atomicAdd() [4/4]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::atomicAdd ( const BaseFab< T > &  x)
noexcept

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

◆ bigEnd()

template<class T >
const IntVect& amrex::BaseFab< T >::bigEnd ( ) const
inlinenoexcept

Returns the upper corner of the domain. See class Box for analogue.

◆ box()

template<class T >
const Box& amrex::BaseFab< T >::box ( ) const
inlinenoexcept

Returns the domain (box) where the array is defined.

◆ clear()

template<class T >
void amrex::BaseFab< T >::clear
noexcept

The function returns the BaseFab to the invalid state. The memory is freed.

◆ const_array() [1/3]

template<class T >
AMREX_FORCE_INLINE Array4<T const> amrex::BaseFab< T >::const_array ( ) const
inlinenoexcept

◆ const_array() [2/3]

template<class T >
AMREX_FORCE_INLINE Array4<T const> amrex::BaseFab< T >::const_array ( int  start_comp) const
inlinenoexcept

◆ const_array() [3/3]

template<class T >
AMREX_FORCE_INLINE Array4<T const> amrex::BaseFab< T >::const_array ( int  start_comp,
int  num_comps 
) const
inlinenoexcept

◆ contains() [1/2]

template<class T >
bool amrex::BaseFab< T >::contains ( const BaseFab< T > &  fab) const
inlinenoexcept

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

◆ contains() [2/2]

template<class T >
bool amrex::BaseFab< T >::contains ( const Box bx) const
inlinenoexcept

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

◆ copy() [1/5]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::copy ( const BaseFab< T > &  src)
noexcept

copy is performed on the intersection of dest and src fabs. All components of dest fab are copied. src fab must have enough components (more is OK).

◆ copy() [2/5]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::copy ( const BaseFab< T > &  src,
Box  bx,
SrcComp  scomp,
DestComp  dcomp,
NumComps  ncomp 
)
noexcept

Do nothing if bx does not intersect with src fab.

◆ copy() [3/5]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::copy ( const BaseFab< T > &  src,
const Box destbox 
)
noexcept

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

◆ copy() [4/5]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::copy ( const BaseFab< T > &  src,
const Box srcbox,
int  srccomp,
const Box destbox,
int  destcomp,
int  numcomp 
)
noexcept

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. The results are UNDEFINED if the src and dest are the same and the srcbox and destbox overlap.

◆ copy() [5/5]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::copy ( const BaseFab< T > &  src,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

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. class.

◆ copyFromMem()

template<class T >
template<RunOn run_on, typename BUF >
std::size_t amrex::BaseFab< T >::copyFromMem ( const Box dstbox,
int  dstcomp,
int  numcomp,
const void *  src 
)
noexcept

Copy from raw memory to the dstbox of this Fab and return the number of bytes copied.

◆ copyToMem()

template<class T >
template<RunOn run_on>
std::size_t amrex::BaseFab< T >::copyToMem ( const Box srcbox,
int  srccomp,
int  numcomp,
void *  dst 
) const
noexcept

Copy from the srcbox of this Fab to raw memory and return the number of bytes copied.

◆ dataPtr() [1/4]

template<class T >
AMREX_FORCE_INLINE const T * amrex::BaseFab< T >::dataPtr ( const IntVect p,
int  n = 0 
) const
noexcept

◆ dataPtr() [2/4]

template<class T >
AMREX_FORCE_INLINE T * amrex::BaseFab< T >::dataPtr ( const IntVect p,
int  n = 0 
)
noexcept

◆ dataPtr() [3/4]

template<class T >
const T* amrex::BaseFab< T >::dataPtr ( int  n = 0) const
inlinenoexcept

Same as above except works on const FABs.

◆ dataPtr() [4/4]

template<class T >
T* amrex::BaseFab< T >::dataPtr ( int  n = 0)
inlinenoexcept

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.

◆ define()

template<class T >
void amrex::BaseFab< T >::define
protected

Allocates memory for the BaseFab<T>.

◆ divide() [1/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::divide ( const BaseFab< T > &  src)
noexcept

Fab division is performed on the intersection of dest and src fabs. All components of dest fab are copied. src fab must have enough components (more is OK).

◆ divide() [2/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::divide ( const BaseFab< T > &  src,
Box  bx,
SrcComp  scomp,
DestComp  dcomp,
NumComps  ncomp 
)
noexcept

Do nothing if bx does not intersect with src fab.

◆ divide() [3/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::divide ( const BaseFab< T > &  src,
const Box srcbox,
const Box destbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

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

◆ divide() [4/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::divide ( const BaseFab< T > &  src,
const Box subbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

Same as above except division is restricted to intersection of subbox and src FAB. NOTE: subbox must be contained in this FAB.

◆ divide() [5/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::divide ( const BaseFab< T > &  src,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

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

◆ divide() [6/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::divide ( T const &  r,
const Box b,
int  comp = 0,
int  numcomp = 1 
)
noexcept

As above except specify sub-box.

◆ divide() [7/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::divide ( T const &  r,
int  comp,
int  numcomp = 1 
)
noexcept

As above except specify which components.

◆ divide() [8/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::divide ( T const &  val)
noexcept

Scalar division on the whole domain and all components.

◆ divide() [9/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::divide ( T const &  val,
Box const &  bx,
DestComp  dcomp,
NumComps  ncomp 
)
noexcept

Do nothing if bx is empty.

◆ dot() [1/4]

template<class T >
template<RunOn run_on>
T amrex::BaseFab< T >::dot ( const BaseFab< T > &  src,
const Box bx,
SrcComp  scomp,
DestComp  dcomp,
NumComps  ncomp 
) const
noexcept

Dot product of two Fabs.

◆ dot() [2/4]

template<class T >
template<RunOn run_on>
T amrex::BaseFab< T >::dot ( const Box bx,
DestComp  dcomp,
NumComps  ncomp 
) const
noexcept

Dot product.

◆ dot() [3/4]

template<class T >
template<RunOn run_on>
T amrex::BaseFab< T >::dot ( const Box bx,
int  destcomp,
int  numcomp 
) const
noexcept

Int wrapper for dot.

◆ dot() [4/4]

template<class T >
template<RunOn run_on>
T amrex::BaseFab< T >::dot ( const Box xbx,
int  xcomp,
const BaseFab< T > &  y,
const Box ybx,
int  ycomp,
int  numcomp = 1 
) const
noexcept

Dot product of x (i.e.,this) and y.

◆ dotmask() [1/2]

template<class T >
template<RunOn run_on>
T amrex::BaseFab< T >::dotmask ( const BaseFab< int > &  mask,
const Box xbx,
int  xcomp,
const BaseFab< T > &  y,
const Box ybx,
int  ycomp,
int  numcomp 
) const
noexcept

◆ dotmask() [2/2]

template<class T >
template<RunOn run_on>
T amrex::BaseFab< T >::dotmask ( const BaseFab< T > &  src,
const Box bx,
const BaseFab< int > &  mask,
SrcComp  scomp,
DestComp  dcomp,
NumComps  ncomp 
) const
noexcept

Dot product of two Fabs with mask.

◆ elixir()

template<class T >
template<class U , std::enable_if_t< std::is_trivially_destructible_v< U >, int > >
Elixir amrex::BaseFab< T >::elixir
noexcept

◆ fill_snan()

template<class T >
template<RunOn run_on, class U , std::enable_if_t< std::is_same_v< U, float >||std::is_same_v< U, double >, int > FOO>
void amrex::BaseFab< T >::fill_snan
noexcept

◆ Finalize()

template<class T >
static void amrex::BaseFab< T >::Finalize ( )
static

◆ getVal() [1/2]

template<class T >
void amrex::BaseFab< T >::getVal ( T *  data,
const IntVect pos 
) const
noexcept

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

◆ getVal() [2/2]

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

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.

◆ hiVect()

template<class T >
const int* amrex::BaseFab< T >::hiVect ( ) const
inlinenoexcept

Returns the upper corner of the domain.

Instead of returning them in the form of INTVECTs, 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.

◆ indexFromValue()

template<class T >
template<RunOn run_on>
IntVect amrex::BaseFab< T >::indexFromValue ( const Box subbox,
int  comp,
T const &  value 
) const
noexcept

◆ Initialize()

template<class T >
static void amrex::BaseFab< T >::Initialize ( )
static

◆ invert() [1/4]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::invert ( T const &  r)
noexcept

Fab <- Fab/r on the whole domain and all components.

◆ invert() [2/4]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::invert ( T const &  r,
const Box b,
int  comp = 0,
int  numcomp = 1 
)
noexcept

Most general version, specify subbox and which components.

◆ invert() [3/4]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::invert ( T const &  r,
const Box bx,
DestComp  dcomp,
NumComps  ncomp 
)
noexcept

◆ invert() [4/4]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::invert ( T const &  r,
int  comp,
int  numcomp = 1 
)
noexcept

As above except on entire domain.

◆ isAllocated()

template<class T >
bool amrex::BaseFab< T >::isAllocated ( ) const
inlinenoexcept

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

◆ length()

template<class T >
IntVect amrex::BaseFab< T >::length ( ) const
inlinenoexcept

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

◆ linComb()

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::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 
)
noexcept

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.

◆ linInterp() [1/2]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::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 
)
noexcept

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.

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.

◆ linInterp() [2/2]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::linInterp ( const BaseFab< T > &  f1,
int  comp1,
const BaseFab< T > &  f2,
int  comp2,
Real  t1,
Real  t2,
Real  t,
const Box b,
int  comp,
int  numcomp = 1 
)
noexcept

Version of linInterp() in which b, b1, & b2 are the same.

◆ lockAdd()

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::lockAdd ( const BaseFab< T > &  src,
const Box srcbox,
const Box destbox,
int  srccomp,
int  destcomp,
int  numcomp 
)
noexcept

Atomically add srcbox region of src FAB to destbox region of this FAB. The srcbox and destbox must be same size. When OMP is on, this uses OMP locks in the implementation and it's usually faster than atomicAdd.

◆ loVect()

template<class T >
const int* amrex::BaseFab< T >::loVect ( ) const
inlinenoexcept

Returns the lower corner of the domain.

Instead of returning them in the form of INTVECTs, 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.

◆ maskEQ()

template<class T >
template<RunOn run_on>
int amrex::BaseFab< T >::maskEQ ( BaseFab< int > &  mask,
T const &  val,
int  comp = 0 
) const
noexcept

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

◆ maskGE()

template<class T >
template<RunOn run_on>
int amrex::BaseFab< T >::maskGE ( BaseFab< int > &  mask,
T const &  val,
int  comp = 0 
) const
noexcept

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

◆ maskGT()

template<class T >
template<RunOn run_on>
int amrex::BaseFab< T >::maskGT ( BaseFab< int > &  mask,
T const &  val,
int  comp = 0 
) const
noexcept

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

◆ maskLE()

template<class T >
template<RunOn run_on>
int amrex::BaseFab< T >::maskLE ( BaseFab< int > &  mask,
T const &  val,
int  comp = 0 
) const
noexcept

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

◆ maskLT()

template<class T >
template<RunOn run_on>
int amrex::BaseFab< T >::maskLT ( BaseFab< int > &  mask,
T const &  val,
int  comp = 0 
) const
noexcept

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.

◆ max() [1/2]

template<class T >
template<RunOn run_on>
T amrex::BaseFab< T >::max ( const Box subbox,
int  comp = 0 
) const
noexcept
Returns
Maximum value of given component in given subbox.

◆ max() [2/2]

template<class T >
template<RunOn run_on>
T amrex::BaseFab< T >::max ( int  comp = 0) const
noexcept
Returns
Maximum value of given component.

◆ maxabs() [1/2]

template<class T >
template<RunOn run_on>
T amrex::BaseFab< T >::maxabs ( const Box subbox,
int  comp = 0 
) const
noexcept
Returns
Maximum of the absolute value of given component in given subbox.

◆ maxabs() [2/2]

template<class T >
template<RunOn run_on>
T amrex::BaseFab< T >::maxabs ( int  comp = 0) const
noexcept
Returns
Maximum of the absolute value of given component.

◆ maxIndex() [1/3]

template<class T >
template<RunOn run_on>
IntVect amrex::BaseFab< T >::maxIndex ( const Box subbox,
int  comp = 0 
) const
noexcept
Returns
location of maximum value in given component in given subbox.

◆ maxIndex() [2/3]

template<class T >
template<RunOn run_on>
void amrex::BaseFab< T >::maxIndex ( const Box subbox,
Real &  max_value,
IntVect max_idx,
int  comp = 0 
) const
noexcept
Returns
return maximum value and location to allow efficient looping over multiple boxes.

◆ maxIndex() [3/3]

template<class T >
template<RunOn run_on>
IntVect amrex::BaseFab< T >::maxIndex ( int  comp = 0) const
noexcept
Returns
location of maximum value in given component.

◆ min() [1/2]

template<class T >
template<RunOn run_on>
T amrex::BaseFab< T >::min ( const Box subbox,
int  comp = 0 
) const
noexcept
Returns
Minimum value of given component in given subbox.

◆ min() [2/2]

template<class T >
template<RunOn run_on>
T amrex::BaseFab< T >::min ( int  comp = 0) const
noexcept
Returns
Minimum value of given component.

◆ minIndex() [1/3]

template<class T >
template<RunOn run_on>
IntVect amrex::BaseFab< T >::minIndex ( const Box subbox,
int  comp = 0 
) const
noexcept
Returns
location of minimum value in given component in given subbox.

◆ minIndex() [2/3]

template<class T >
template<RunOn run_on>
void amrex::BaseFab< T >::minIndex ( const Box subbox,
Real &  min_val,
IntVect min_idx,
int  comp = 0 
) const
noexcept
Returns
return minimum value and location to allow efficient looping over multiple boxes.

◆ minIndex() [3/3]

template<class T >
template<RunOn run_on>
IntVect amrex::BaseFab< T >::minIndex ( int  comp = 0) const
noexcept
Returns
location of minimum value in given component.

◆ minmax() [1/2]

template<class T >
template<RunOn run_on>
std::pair< T, T > amrex::BaseFab< T >::minmax ( const Box subbox,
int  comp = 0 
) const
noexcept
Returns
Minimum and Maximum of given component in given subbox.

◆ minmax() [2/2]

template<class T >
template<RunOn run_on>
std::pair< T, T > amrex::BaseFab< T >::minmax ( int  comp = 0) const
noexcept
Returns
Minimum and Maximum of given component

◆ minus() [1/7]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::minus ( const BaseFab< T > &  src)
noexcept

Fab subtraction is performed on the intersection of dest and src fabs. All components of dest fab are copied. src fab must have enough components (more is OK).

◆ minus() [2/7]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::minus ( const BaseFab< T > &  src,
Box  bx,
SrcComp  scomp,
DestComp  dcomp,
NumComps  ncomp 
)
noexcept

Do nothing if bx does not intersect with src fab.

◆ minus() [3/7]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::minus ( const BaseFab< T > &  src,
const Box srcbox,
const Box destbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

Subtract srcbox region of src FAB from destbox region of this FAB. srcbox and destbox must be same size.

◆ minus() [4/7]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::minus ( const BaseFab< T > &  src,
const Box subbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

Same as above except subtraction is restricted to intersection of subbox and src FAB. NOTE: subbox must be contained in this FAB.

◆ minus() [5/7]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::minus ( const BaseFab< T > &  src,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

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

◆ minus() [6/7]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::minus ( T const &  val)
noexcept

Scalar subtraction on the whole domain and all components.

◆ minus() [7/7]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::minus ( T const &  val,
Box const &  bx,
DestComp  dcomp,
NumComps  ncomp 
)
noexcept

Do nothing if bx is empty.

◆ mult() [1/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::mult ( const BaseFab< T > &  src)
noexcept

Fab multiplication is performed on the intersection of dest and src fabs. All components of dest fab are copied. src fab must have enough components (more is OK).

◆ mult() [2/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::mult ( const BaseFab< T > &  src,
Box  bx,
SrcComp  scomp,
DestComp  dcomp,
NumComps  ncomp 
)
noexcept

Do nothing if bx does not intersect with src fab.

◆ mult() [3/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::mult ( const BaseFab< T > &  src,
const Box srcbox,
const Box destbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

Multiply srcbox region of src FAB with destbox region of this FAB. The srcbox and destbox must be same size.

◆ mult() [4/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::mult ( const BaseFab< T > &  src,
const Box subbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

Same as above except multiplication is restricted to intersection of subbox and src FAB. NOTE: subbox must be contained in this FAB.

◆ mult() [5/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::mult ( const BaseFab< T > &  src,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

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

◆ mult() [6/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::mult ( T const &  r,
const Box b,
int  comp = 0,
int  numcomp = 1 
)
noexcept

As above, except specify sub-box.

◆ mult() [7/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::mult ( T const &  r,
int  comp,
int  numcomp = 1 
)
noexcept

Scalar multiplication, except control which components are multiplied.

◆ mult() [8/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::mult ( T const &  val)
noexcept

Scalar multiplication on the whole domain and all components.

◆ mult() [9/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::mult ( T const &  val,
Box const &  bx,
DestComp  dcomp,
NumComps  ncomp 
)
noexcept

Do nothing if bx is empty.

◆ nBytes() [1/2]

template<class T >
std::size_t amrex::BaseFab< T >::nBytes ( ) const
inlinenoexcept

Returns how many bytes used.

◆ nBytes() [2/2]

template<class T >
std::size_t amrex::BaseFab< T >::nBytes ( const Box bx,
int  ncomps 
) const
inlinenoexcept

Returns bytes used in the Box for those components.

◆ nBytesOwned()

template<class T >
std::size_t amrex::BaseFab< T >::nBytesOwned ( ) const
inlinenoexcept

◆ nComp()

template<class T >
int amrex::BaseFab< T >::nComp ( ) const
inlinenoexcept

Returns the number of components.

◆ nCompPtr()

template<class T >
const int* amrex::BaseFab< T >::nCompPtr ( ) const
inlinenoexcept

for calls to fortran.

◆ negate() [1/4]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::negate
noexcept

on the whole domain and all components

◆ negate() [2/4]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::negate ( const Box b,
int  comp = 0,
int  numcomp = 1 
)
noexcept

Negate BaseFab, most general.

◆ negate() [3/4]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::negate ( const Box bx,
DestComp  dcomp,
NumComps  ncomp 
)
noexcept

◆ negate() [4/4]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::negate ( int  comp,
int  numcomp = 1 
)
noexcept

As above, except on entire domain.

◆ norm() [1/2]

template<class T >
template<RunOn run_on>
Real amrex::BaseFab< T >::norm ( const Box subbox,
int  p,
int  scomp = 0,
int  numcomp = 1 
) const
noexcept

Same as above except only on given subbox.

◆ norm() [2/2]

template<class T >
template<RunOn run_on>
Real amrex::BaseFab< T >::norm ( int  p,
int  scomp = 0,
int  numcomp = 1 
) const
noexcept

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)

◆ norminfmask()

template<class T >
template<RunOn run_on>
Real amrex::BaseFab< T >::norminfmask ( const Box subbox,
const BaseFab< int > &  mask,
int  scomp = 0,
int  ncomp = 1 
) const
noexcept

◆ numPts()

template<class T >
Long amrex::BaseFab< T >::numPts ( ) const
inlinenoexcept

Returns the number of points.

◆ operator()() [1/4]

template<class T >
AMREX_FORCE_INLINE const T & amrex::BaseFab< T >::operator() ( const IntVect p) const
noexcept

Same as above, except returns component 0.

◆ operator()() [2/4]

template<class T >
AMREX_FORCE_INLINE T & amrex::BaseFab< T >::operator() ( const IntVect p)
noexcept

Same as above, except returns component 0.

◆ operator()() [3/4]

template<class T >
AMREX_FORCE_INLINE const T & amrex::BaseFab< T >::operator() ( const IntVect p,
int  N 
) const
noexcept

Same as above except works on const FABs.

◆ operator()() [4/4]

template<class T >
AMREX_FORCE_INLINE T & amrex::BaseFab< T >::operator() ( const IntVect p,
int  N 
)
noexcept

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.

◆ operator*=() [1/2]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::operator*= ( const BaseFab< T > &  src)
noexcept

◆ operator*=() [2/2]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::operator*= ( T const &  val)
noexcept

◆ operator+=() [1/2]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::operator+= ( const BaseFab< T > &  src)
noexcept

◆ operator+=() [2/2]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::operator+= ( T const &  val)
noexcept

◆ operator-=() [1/2]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::operator-= ( const BaseFab< T > &  src)
noexcept

◆ operator-=() [2/2]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::operator-= ( T const &  val)
noexcept

◆ operator/=() [1/2]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::operator/= ( const BaseFab< T > &  src)
noexcept

◆ operator/=() [2/2]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::operator/= ( T const &  val)
noexcept

◆ operator=() [1/4]

template<class T >
BaseFab< T > & amrex::BaseFab< T >::operator= ( BaseFab< T > &&  rhs)
noexcept

◆ operator=() [2/4]

template<class T >
BaseFab<T>& amrex::BaseFab< T >::operator= ( const BaseFab< T > &  rhs)
delete

◆ operator=() [3/4]

template<class T >
template<RunOn run_on>
BaseFab& amrex::BaseFab< T >::operator= ( T const &  )
noexcept

◆ operator=() [4/4]

template<class T >
template<RunOn run_on>
BaseFab<T>& amrex::BaseFab< T >::operator= ( T const &  t)
noexcept

◆ plus() [1/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::plus ( const BaseFab< T > &  src)
noexcept

Fab addition is performed on the intersection of dest and src fabs. All components of dest fab are copied. src fab must have enough components (more is OK).

◆ plus() [2/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::plus ( const BaseFab< T > &  src,
Box  bx,
SrcComp  scomp,
DestComp  dcomp,
NumComps  ncomp 
)
noexcept

Do nothing if bx does not intersect with src fab.

◆ plus() [3/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::plus ( const BaseFab< T > &  src,
const Box srcbox,
const Box destbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

Add srcbox region of src FAB to destbox region of this FAB. The srcbox and destbox must be same size.

◆ plus() [4/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::plus ( const BaseFab< T > &  src,
const Box subbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

Same as above except addition is restricted to intersection of subbox and src FAB. NOTE: subbox must be contained in this FAB.

◆ plus() [5/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::plus ( const BaseFab< T > &  src,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

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

◆ plus() [6/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::plus ( T const &  r,
const Box b,
int  comp = 0,
int  numcomp = 1 
)
noexcept

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

◆ plus() [7/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::plus ( T const &  r,
int  comp,
int  numcomp = 1 
)
noexcept

As above, except on entire domain.

◆ plus() [8/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::plus ( T const &  val)
noexcept

Scalar addition on the whole domain and all components.

◆ plus() [9/9]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::plus ( T const &  val,
Box const &  bx,
DestComp  dcomp,
NumComps  ncomp 
)
noexcept

Do nothing if bx is empty.

◆ prefetchToDevice()

template<class T >
void amrex::BaseFab< T >::prefetchToDevice
noexcept

◆ prefetchToHost()

template<class T >
void amrex::BaseFab< T >::prefetchToHost
noexcept

◆ protected_divide() [1/4]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::protected_divide ( const BaseFab< T > &  src)
noexcept

Divide wherever "src" is "true" or "non-zero".

◆ protected_divide() [2/4]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::protected_divide ( const BaseFab< T > &  src,
const Box srcbox,
const Box destbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

Divide wherever "src" is "true" or "non-zero". destbox region of this FAB is numerator. srcbox regions of src FAB is denominator. srcbox and destbox must be same size.

◆ protected_divide() [3/4]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::protected_divide ( const BaseFab< T > &  src,
const Box subbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

Divide wherever "src" is "true" or "non-zero". Same as above except division is restricted to intersection of subbox and src FAB. NOTE: subbox must be contained in this FAB.

◆ protected_divide() [4/4]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::protected_divide ( const BaseFab< T > &  src,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

Divide wherever "src" is "true" or "non-zero". This FAB is numerator, src FAB is denominator divide src components (srccomp:srccomp+numcomp-1) into this FABs components (destcomp:destcomp+numcomp-1) where the two FABs intersect.

◆ release()

template<class T >
std::unique_ptr< T, DataDeleter > amrex::BaseFab< T >::release
noexcept

Release ownership of memory.

◆ resize()

template<class T >
void amrex::BaseFab< T >::resize ( const Box b,
int  N = 1,
Arena ar = nullptr 
)

This function resizes a BaseFab so it covers the Box b with N components.

The default action is that under resizing, 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. Resizing is typically faster than re-allocating a BaseFab because memory allocation can often be avoided. If a nullptr is provided as Arena*, the Arena already in BaseFab will be used. Otherwise, the Arena argument will be used.

◆ saxpy() [1/2]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::saxpy ( a,
const BaseFab< T > &  x 
)
noexcept

FAB SAXPY (y[i] <- y[i] + a * x[i]), in place. All components.

◆ saxpy() [2/2]

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::saxpy ( a,
const BaseFab< T > &  x,
const Box srcbox,
const Box destbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

FAB SAXPY (y[i] <- y[i] + a * x[i]), in place.

◆ SetBoxType()

template<class T >
void amrex::BaseFab< T >::SetBoxType ( const IndexType typ)
inlinenoexcept

Change the Box type without change the length.

◆ setComplement() [1/2]

template<class T >
template<RunOn run_on>
void amrex::BaseFab< T >::setComplement ( T const &  x,
Box const &  bx,
DestComp  dcomp,
NumComps  ncomp 
)
noexcept

setVal on the complement of bx in the fab's domain

◆ setComplement() [2/2]

template<class T >
template<RunOn run_on>
void amrex::BaseFab< T >::setComplement ( T const &  x,
const Box b,
int  ns,
int  num 
)
noexcept

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.

◆ setPtr()

template<class T >
void amrex::BaseFab< T >::setPtr ( T *  p,
Long  sz 
)
inlinenoexcept

◆ setVal() [1/5]

template<class T >
template<RunOn run_on>
void amrex::BaseFab< T >::setVal ( T const &  val)
noexcept

Set value on the whole domain and all components.

◆ setVal() [2/5]

template<class T >
template<RunOn run_on>
void amrex::BaseFab< T >::setVal ( T const &  x,
Box const &  bx,
DestComp  dcomp,
NumComps  ncomp 
)
noexcept

Do nothing if bx is empty.

◆ setVal() [3/5]

template<class T >
template<RunOn run_on>
void amrex::BaseFab< T >::setVal ( T const &  x,
const Box bx,
int  dcomp,
int  ncomp 
)
noexcept

The setVal functions set sub-regions 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.

◆ setVal() [4/5]

template<class T >
template<RunOn run_on>
void amrex::BaseFab< T >::setVal ( T const &  x,
const Box bx,
int  N = 0 
)
noexcept

Same as above, except the number of modified components is one. N is the component to be modified.

◆ setVal() [5/5]

template<class T >
template<RunOn run_on>
void amrex::BaseFab< T >::setVal ( T const &  x,
int  N 
)
noexcept

Same as above, except the sub-box defaults to the entire domain.

◆ setValIf() [1/2]

template<class T >
template<RunOn run_on>
void amrex::BaseFab< T >::setValIf ( T const &  val,
Box const &  bx,
const BaseFab< int > &  mask,
DestComp  dcomp,
NumComps  ncomp 
)
noexcept

Do nothing if bx is empty.

◆ setValIf() [2/2]

template<class T >
template<RunOn run_on>
void amrex::BaseFab< T >::setValIf ( T const &  val,
const BaseFab< int > &  mask 
)
noexcept

◆ setValIfNot() [1/3]

template<class T >
template<RunOn run_on>
void amrex::BaseFab< T >::setValIfNot ( T const &  val,
Box const &  bx,
const BaseFab< int > &  mask,
DestComp  dcomp,
NumComps  ncomp 
)
noexcept

Do nothing if bx is empty.

◆ setValIfNot() [2/3]

template<class T >
template<RunOn run_on>
void amrex::BaseFab< T >::setValIfNot ( T const &  val,
const BaseFab< int > &  mask 
)
noexcept

◆ setValIfNot() [3/3]

template<class T >
template<RunOn run_on>
void amrex::BaseFab< T >::setValIfNot ( T const &  val,
const Box bx,
const BaseFab< int > &  mask,
int  nstart,
int  num 
)
noexcept

◆ shift() [1/2]

template<class T >
BaseFab< T > & amrex::BaseFab< T >::shift ( const IntVect v)
noexcept

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.

◆ shift() [2/2]

template<class T >
BaseFab< T > & amrex::BaseFab< T >::shift ( int  idir,
int  n_cell 
)
noexcept

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.

◆ shiftHalf() [1/2]

template<class T >
BaseFab< T > & amrex::BaseFab< T >::shiftHalf ( const IntVect v)
noexcept

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.

◆ shiftHalf() [2/2]

template<class T >
BaseFab< T > & amrex::BaseFab< T >::shiftHalf ( int  dir,
int  n_cell 
)
noexcept

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.

◆ size()

template<class T >
Long amrex::BaseFab< T >::size ( ) const
inlinenoexcept

Returns the total number of points of all components.

◆ smallEnd()

template<class T >
const IntVect& amrex::BaseFab< T >::smallEnd ( ) const
inlinenoexcept

Returns the lower corner of the domain See class Box for analogue.

◆ sum() [1/3]

template<class T >
template<RunOn run_on>
T amrex::BaseFab< T >::sum ( const Box bx,
DestComp  dcomp,
NumComps  ncomp 
) const
noexcept

Sum.

◆ sum() [2/3]

template<class T >
template<RunOn run_on>
T amrex::BaseFab< T >::sum ( const Box subbox,
int  comp,
int  numcomp = 1 
) const
noexcept

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

◆ sum() [3/3]

template<class T >
template<RunOn run_on>
T amrex::BaseFab< T >::sum ( int  comp,
int  numcomp = 1 
) const
noexcept

Returns sum of given component of FAB state vector.

◆ xpay()

template<class T >
template<RunOn run_on>
BaseFab< T > & amrex::BaseFab< T >::xpay ( a,
const BaseFab< T > &  x,
const Box srcbox,
const Box destbox,
int  srccomp,
int  destcomp,
int  numcomp = 1 
)
noexcept

FAB XPAY (y[i] <- x[i] + a * y[i])

Friends And Related Function Documentation

◆ BaseFab

template<class T >
template<class U >
friend class BaseFab
friend

Member Data Documentation

◆ alloc_stream

template<class T >
gpuStream_t amrex::BaseFab< T >::alloc_stream {}
protected

◆ domain

template<class T >
Box amrex::BaseFab< T >::domain
protected

My index space.

◆ dptr

template<class T >
T* amrex::BaseFab< T >::dptr = nullptr
protected

The data pointer.

◆ nvar

template<class T >
int amrex::BaseFab< T >::nvar = 0
protected

Number components.

◆ ptr_owner

template<class T >
bool amrex::BaseFab< T >::ptr_owner = false
protected

Owner of T*?

◆ shared_memory

template<class T >
bool amrex::BaseFab< T >::shared_memory = false
protected

Is the memory allocated in shared memory?

◆ truesize

template<class T >
Long amrex::BaseFab< T >::truesize = 0L
protected

nvar*numpts that was allocated on heap.


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