Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::EBCellFlagFab Class Referencefinal

FAB storing EBCellFlag data per cell. More...

#include <AMReX_EBCellFlag.H>

Inheritance diagram for amrex::EBCellFlagFab:
amrex::BaseFab< EBCellFlag > amrex::DataAllocator

Classes

struct  NumCells

Public Member Functions

 EBCellFlagFab (Arena *ar) noexcept
 Construct an empty FAB that allocates from arena ar when defined later.
 EBCellFlagFab (const Box &b, int ncomp, Arena *ar)
 Construct and allocate immediately for box b.
 EBCellFlagFab (const Box &b, int ncomp=1, bool alloc=true, bool shared=false, Arena *ar=nullptr)
 General constructor controlling allocation and sharing.
 EBCellFlagFab (const EBCellFlagFab &rhs, MakeType make_type, int scomp, int ncomp)
 Restricted constructor used when creating alias FABs.
 EBCellFlagFab ()=default
 EBCellFlagFab (EBCellFlagFab &&rhs)=default
 ~EBCellFlagFab () override=default
 EBCellFlagFab (const EBCellFlagFab &)=delete
EBCellFlagFab & operator= (const EBCellFlagFab &)=delete
EBCellFlagFab & operator= (EBCellFlagFab &&)=delete
FabType getType () const noexcept
 Returns FabType (regular, covered, etc.) for the entire FAB.
FabType getType (const Box &bx) const noexcept
 Returns FabType for a specific sub-box bx.
void resetType (int ng)
 Recompute FabType using the given number of grow cells.
int getNumRegularCells (const Box &bx) const noexcept
 Count regular cells within bx.
int getNumCutCells (const Box &bx) const noexcept
 Count cut cells within bx.
int getNumCoveredCells (const Box &bx) const noexcept
 Count covered cells within bx.
void setType (FabType t) noexcept
 Manually override the cached FabType.
Public Member Functions inherited from amrex::BaseFab< EBCellFlag >
BaseFab< EBCellFlag > & operator= (EBCellFlag const &t) noexcept
virtual ~BaseFab () noexcept
 The destructor deletes the array memory.
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.
Elixir elixir () noexcept
 Transfer owned storage to an Elixir when running in a GPU launch region.
void clear ()
 The function returns the BaseFab to the invalid state. The memory is freed.
std::unique_ptr< EBCellFlag, DataDeleter > release () noexcept
 Release ownership of memory.
std::size_t nBytes () const noexcept
 Returns how many bytes used.
std::size_t nBytesOwned () const noexcept
int nComp () const noexcept
 Returns the number of components.
const int * nCompPtr () const noexcept
 for calls to fortran.
Long numPts () const noexcept
 Returns the number of points.
Long size () const noexcept
 Returns the total number of points of all components.
const Box & box () const noexcept
 Returns the domain (box) where the array is defined.
IntVect length () const noexcept
 Returns a pointer to an array of SPACEDIM integers giving the length of the domain in each direction.
const IntVect & smallEnd () const noexcept
 Returns the lower corner of the domain See class Box for analogue.
const IntVect & bigEnd () const noexcept
 Returns the upper corner of the domain. See class Box for analogue.
const int * loVect () const noexcept
 Returns the lower corner of the domain.
const int * hiVect () const noexcept
 Returns the upper corner of the domain.
bool contains (const BaseFab< EBCellFlag > &fab) const noexcept
 Returns true if the domain of fab is totally contained within the domain of this BaseFab.
EBCellFlag * 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.
void setPtr (EBCellFlag *p, Long sz) noexcept
 Attach externally allocated storage without taking ownership.
void prefetchToHost () const noexcept
 Advise the runtime to migrate storage to the host.
void prefetchToDevice () const noexcept
 Advise the runtime to migrate storage to the active device.
Array4< EBCellFlag const > array () const noexcept
 Create an Array4 view over all components.
Array4< EBCellFlag const > const_array () const noexcept
 Return a const-qualified Array4 view over all components.
bool isAllocated () const noexcept
 Returns true if the data for the FAB has been allocated.
EBCellFlag & 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.
void getVal (EBCellFlag *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.
void fill_snan () noexcept
void setVal (EBCellFlag 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.
void setValIfNot (EBCellFlag const &val, const Box &bx, const BaseFab< int > &mask, int nstart, int num) noexcept
void setComplement (EBCellFlag 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.
BaseFab< EBCellFlag > & copy (const BaseFab< EBCellFlag > &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.
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.
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.
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.
BaseFab< EBCellFlag > & 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.
BaseFab< EBCellFlag > & 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.
Real norminfmask (const Box &subbox, const BaseFab< int > &mask, int scomp=0, int ncomp=1) const noexcept
Real norm (int p, int scomp=0, int numcomp=1) const
 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).
void abs () noexcept
 Compute absolute value for all components of this FAB.
EBCellFlag min (int comp=0) const noexcept
EBCellFlag max (int comp=0) const noexcept
std::pair< EBCellFlag, EBCellFlag > minmax (int comp=0) const noexcept
EBCellFlag maxabs (int comp=0) const noexcept
IntVect indexFromValue (const Box &subbox, int comp, EBCellFlag const &value) const noexcept
IntVect minIndex (int comp=0) const noexcept
IntVect maxIndex (int comp=0) const noexcept
int maskLT (BaseFab< int > &mask, EBCellFlag 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.
int maskLE (BaseFab< int > &mask, EBCellFlag const &val, int comp=0) const noexcept
 Mark cells with value <= val.
int maskEQ (BaseFab< int > &mask, EBCellFlag const &val, int comp=0) const noexcept
 Mark cells with value equal to val.
int maskGT (BaseFab< int > &mask, EBCellFlag const &val, int comp=0) const noexcept
 Mark cells with value greater than val.
int maskGE (BaseFab< int > &mask, EBCellFlag const &val, int comp=0) const noexcept
 Mark cells with value greater than or equal to val.
EBCellFlag sum (int comp, int numcomp=1) const noexcept
 Returns sum of given component of FAB state vector.
BaseFab< EBCellFlag > & invert (EBCellFlag const &r, const Box &b, int comp=0, int numcomp=1) noexcept
 Most general version, specify subbox and which components.
BaseFab< EBCellFlag > & negate (const Box &b, int comp=0, int numcomp=1) noexcept
 Negate BaseFab, most general.
BaseFab< EBCellFlag > & plus (EBCellFlag const &r, const Box &b, int comp=0, int numcomp=1) noexcept
 Scalar addition (a[i] <- a[i] + r), most general.
BaseFab< EBCellFlag > & atomicAdd (const BaseFab< EBCellFlag > &x) noexcept
 Atomic FAB addition (a[i] <- a[i] + b[i]).
BaseFab< EBCellFlag > & lockAdd (const BaseFab< EBCellFlag > &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.
BaseFab< EBCellFlag > & saxpy (EBCellFlag a, const BaseFab< EBCellFlag > &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.
BaseFab< EBCellFlag > & xpay (EBCellFlag a, const BaseFab< EBCellFlag > &x, const Box &srcbox, const Box &destbox, int srccomp, int destcomp, int numcomp=1) noexcept
 FAB XPAY (y[i] <- x[i] + a * y[i]).
BaseFab< EBCellFlag > & addproduct (const Box &destbox, int destcomp, int numcomp, const BaseFab< EBCellFlag > &src1, int comp1, const BaseFab< EBCellFlag > &src2, int comp2) noexcept
 y[i] <- y[i] + x1[i] * x2[i])
BaseFab< EBCellFlag > & minus (const BaseFab< EBCellFlag > &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.
BaseFab< EBCellFlag > & mult (EBCellFlag const &r, int comp, int numcomp=1) noexcept
 Scalar multiplication applied to selected components over the entire domain.
BaseFab< EBCellFlag > & divide (EBCellFlag const &r, int comp, int numcomp=1) noexcept
 Divide selected components by a scalar across the entire domain.
BaseFab< EBCellFlag > & protected_divide (const BaseFab< EBCellFlag > &src) noexcept
 Divide wherever "src" is "true" or "non-zero".
BaseFab< EBCellFlag > & linInterp (const BaseFab< EBCellFlag > &f1, const Box &b1, int comp1, const BaseFab< EBCellFlag > &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.
BaseFab< EBCellFlag > & linComb (const BaseFab< EBCellFlag > &f1, const Box &b1, int comp1, const BaseFab< EBCellFlag > &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.
EBCellFlag dot (const Box &xbx, int xcomp, const BaseFab< EBCellFlag > &y, const Box &ybx, int ycomp, int numcomp=1) const noexcept
 Dot product of x (i.e.,this) and y.
EBCellFlag dotmask (const BaseFab< int > &mask, const Box &xbx, int xcomp, const BaseFab< EBCellFlag > &y, const Box &ybx, int ycomp, int numcomp) const noexcept
void SetBoxType (const IndexType &typ) noexcept
 Change the Box type without change the length.
void setValIf (EBCellFlag const &val, const BaseFab< int > &mask) noexcept
BaseFab< EBCellFlag > & operator+= (EBCellFlag const &val) noexcept
BaseFab< EBCellFlag > & operator-= (EBCellFlag const &val) noexcept
BaseFab< EBCellFlag > & operator*= (EBCellFlag const &val) noexcept
BaseFab< EBCellFlag > & operator/= (EBCellFlag const &val) noexcept
Public Member Functions inherited from amrex::DataAllocator
 DataAllocator () noexcept=default
 Default-construct; alloc/free will use The_Arena().
 DataAllocator (Arena *ar) noexcept
 Construct with an explicit arena ar.
void * alloc (std::size_t sz) const
 Allocate sz bytes from the arena. Throws OutOfMemoryError on failure.
void free (void *pt) const noexcept
 Return the allocation at pt to the arena.
Arena * arena () const noexcept
 Return the stored arena, or The_Arena() if none was set.

Additional Inherited Members

Public Types inherited from amrex::BaseFab< EBCellFlag >
using value_type
Static Public Member Functions inherited from amrex::BaseFab< EBCellFlag >
static void Initialize ()
 Initialize static tracking/profiling metadata used by all BaseFabs.
static void Finalize ()
 Release static tracking/profiling metadata allocated by Initialize().
Public Attributes inherited from amrex::DataAllocator
Arena * m_arena = nullptr
 Stored arena pointer (may be null).
Protected Member Functions inherited from amrex::BaseFab< EBCellFlag >
void define ()
 Allocates memory for the BaseFab<T>.
Protected Attributes inherited from amrex::BaseFab< EBCellFlag >
EBCellFlag * dptr
 The data pointer.
Box domain
 My index space.
int nvar
 Number components.
Long truesize
 nvar*numpts that was allocated on heap.
bool ptr_owner
 Owner of T*?
bool shared_memory
 Is the memory allocated in shared memory?
gpuStream_t alloc_stream

Detailed Description

FAB storing EBCellFlag data per cell.

Constructor & Destructor Documentation

◆ EBCellFlagFab() [1/7]

amrex::EBCellFlagFab::EBCellFlagFab ( Arena * ar)
explicitnoexcept

Construct an empty FAB that allocates from arena ar when defined later.

◆ EBCellFlagFab() [2/7]

amrex::EBCellFlagFab::EBCellFlagFab ( const Box & b,
int ncomp,
Arena * ar )
explicit

Construct and allocate immediately for box b.

◆ EBCellFlagFab() [3/7]

amrex::EBCellFlagFab::EBCellFlagFab ( const Box & b,
int ncomp = 1,
bool alloc = true,
bool shared = false,
Arena * ar = nullptr )
explicit

General constructor controlling allocation and sharing.

◆ EBCellFlagFab() [4/7]

amrex::EBCellFlagFab::EBCellFlagFab ( const EBCellFlagFab & rhs,
MakeType make_type,
int scomp,
int ncomp )

Restricted constructor used when creating alias FABs.

◆ EBCellFlagFab() [5/7]

amrex::EBCellFlagFab::EBCellFlagFab ( )
default

◆ EBCellFlagFab() [6/7]

amrex::EBCellFlagFab::EBCellFlagFab ( EBCellFlagFab && rhs)
default

◆ ~EBCellFlagFab()

amrex::EBCellFlagFab::~EBCellFlagFab ( )
overridedefault

◆ EBCellFlagFab() [7/7]

amrex::EBCellFlagFab::EBCellFlagFab ( const EBCellFlagFab & )
delete

Member Function Documentation

◆ getNumCoveredCells()

int amrex::EBCellFlagFab::getNumCoveredCells ( const Box & bx) const
noexcept

Count covered cells within bx.

◆ getNumCutCells()

int amrex::EBCellFlagFab::getNumCutCells ( const Box & bx) const
noexcept

Count cut cells within bx.

◆ getNumRegularCells()

int amrex::EBCellFlagFab::getNumRegularCells ( const Box & bx) const
noexcept

Count regular cells within bx.

◆ getType() [1/2]

FabType amrex::EBCellFlagFab::getType ( ) const
inlinenoexcept

Returns FabType (regular, covered, etc.) for the entire FAB.

◆ getType() [2/2]

FabType amrex::EBCellFlagFab::getType ( const Box & bx) const
noexcept

Returns FabType for a specific sub-box bx.

◆ operator=() [1/2]

EBCellFlagFab & amrex::EBCellFlagFab::operator= ( const EBCellFlagFab & )
delete

◆ operator=() [2/2]

EBCellFlagFab & amrex::EBCellFlagFab::operator= ( EBCellFlagFab && )
delete

◆ resetType()

void amrex::EBCellFlagFab::resetType ( int ng)

Recompute FabType using the given number of grow cells.

◆ setType()

void amrex::EBCellFlagFab::setType ( FabType t)
inlinenoexcept

Manually override the cached FabType.


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