Chombo + EB + MF  3.2
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
BinFab< T > Class Template Reference

Base class for particle data on a Box. More...

#include <BinFab.H>

Inheritance diagram for BinFab< T >:
Inheritance graph
[legend]

Public Member Functions

 BinFab ()
 Null constructor, copy constructor and operator= can be compiler defined. More...
 
 BinFab (const Box &a_domain, const RealVect &a_mesh_spacing, const RealVect &a_origin)
 Constructs an empty BinFab on a_domain. More...
 
 BinFab (const BinFab &a_binfab)
 Copy constructor. More...
 
virtual ~BinFab ()
 Destructor. More...
 
virtual void define (const Box &a_domain, const RealVect &a_mesh_spacing, const RealVect &a_origin)
 Same as the constructor. More...
 
virtual void reBin ()
 Sort all the items into the appropriate bins, losing items not in the FAB's domain. More...
 
virtual void reBin (List< T > &a_lost, const Box &a_valid=Box(), bool a_in=true)
 Sort all the items into the appropriate bins and return items in (or not in) the Box. More...
 
virtual void addItem (const T &a_item)
 Copy one item into the appropriate bin. More...
 
virtual void addItem (const T &a_item, const IntVect &a_bin)
 Copy one item into the specified bin. More...
 
virtual void addItems (const List< T > &a_list)
 Copy items into the appropriate bins. More...
 
virtual void addItemsDestructive (List< T > &a_list)
 Copy items into the appropriate bins and remove them from the List. More...
 
virtual void addItemsDestructive (List< T > &a_list, const Box &a_valid, bool a_in=true)
 Copy items into the appropriate bins. Remove items that are in (or not in) the Box from the List. More...
 
virtual void transfer (BinFab< T > &a_src, const Box &a_srcBox, const Box &a_destBox)
 Move particles from a BinFab to the overlapping cells in this one. More...
 
virtual void clear ()
 Delete all the items in this BinFab and reset it to the null Box. More...
 
virtual int numItems (const Box &a_box=Box()) const
 Count the number of items in this BinFab in the specified Box. More...
 
virtual RealVect meshSpacing () const
 Retrieve the mesh cell size, in physical coordinates. More...
 
virtual void meshSpacing (const RealVect &a_mesh_spacing)
 Set the mesh cell size, in physical coordinates. More...
 
RealVect origin () const
 Retrieve the physical coordinates of the lower corner of cell zero. More...
 
void origin (const RealVect &a_origin)
 Set the physical coordinates of the lower corner of cell zero. More...
 
virtual size_t size (const Box &a_box, const Interval &a_comps=Interval(0, 0)) const
 The number of bytes used by linearIn()/linearOut(). More...
 
virtual void linearOut (void *a_buf, const Box &a_box, const Interval &a_comps) const
 Write a serialized (packed) representation into a_buf. More...
 
virtual void linearOutDestructive (void *buf, const Box &a_box, const Interval &a_comps=Interval(0, 0))
 Write a serialized (packed) representation into a_buf and remove from *this. More...
 
virtual void linearIn (void *a_buf, const Box &a_box, const Interval &a_comps=Interval(0, 0))
 Extract a serialized (packed) representation from a_buf. More...
 
IntVect size () const
 Should be inherited from BaseFab but it isn't, sigh; code is the same. More...
 
- Public Member Functions inherited from BaseFab< List< T > >
virtual long offset (const IntVect &a_iv, const int &a_ivar) const
 { constructors, destructor and defines} More...
 
 BaseFab ()
 
 BaseFab (const Box &a_bx, int a_n, List< T > *a_alias=NULL)
 
 BaseFab (const Interval &a_comps, BaseFab< List< T > > &a_original)
 
 BaseFab (BaseFab< List< T > > &&a_in) noexcept
 move constructor More...
 
virtual ~BaseFab ()
 
void resize (const Box &a_b, int a_n=1, List< T > *a_alias=NULL)
 
virtual void define (const Box &a_box, int a_comps, List< T > *a_alias=NULL)
 
virtual void define (const Interval &a_comps, BaseFab< List< T > > &a_original)
 
void clear ()
 
int nComp () const
 { accessors} More...
 
const Boxbox () const
 
IntVect size () const
 
const IntVectsmallEnd () const
 
const IntVectbigEnd () const
 
Interval interval () const
 
BaseFab< List< T > > & operator= (BaseFab< List< T > > &&) noexcept
 move assignment More...
 
List< T > & operator() (const IntVect &a_p, int a_N)
 
List< T > & operator() (const IntVect &a_p)
 
const List< T > & operator() (const IntVect &p, int N) const
 
const List< T > & operator() (const IntVect &p) const
 
void getVal (List< T > *a_data, const IntVect &a_pos, int a_N, int a_numcomp) const
 
void getVal (List< T > *a_data, const IntVect &a_pos) const
 
const int * loVect () const
 { Fortran interface functions} More...
 
const int * hiVect () const
 
const int * nCompPtr () const
 
List< T > * dataPtr (int a_n=0)
 
const List< T > * dataPtr (int a_n=0) const
 
bool contains (const BaseFab< List< T > > &a_fab) const
 { comparison functions} More...
 
bool contains (const Box &a_bx) const
 
void setVal (List< T >a_x, const Box &a_bx, int a_nstart, int a_numcomp)
 { data modification functions} More...
 
void setVal (List< T >a_x, const Box &a_bx, int a_n)
 
void setVal (List< T >a_x, int a_n)
 
void setVal (List< T >a_x)
 
BaseFab< List< T > > & copy (const BaseFab< List< T > > &a_src, const Box &a_srcbox, int a_srccomp, const Box &a_destbox, int a_destcomp, int a_numcomp)
 
BaseFab< List< T > > & copy (const BaseFab< List< T > > &a_src, int a_srccomp, int a_destcomp, int a_numcomp=1)
 
BaseFab< List< T > > & copy (const BaseFab< List< T > > &a_src, const Box &a_destbox)
 
BaseFab< List< T > > & copy (const BaseFab< List< T > > &a_src)
 
void copy (const Box &a_RegionFrom, const Interval &a_Cdest, const Box &a_RegionTo, const BaseFab< List< T > > &a_src, const Interval &a_Csrc)
 
BaseFab< List< T > > & shift (const IntVect &a_v)
 { domain modification functions} More...
 
BaseFab< List< T > > & shift (int a_idir, int a_ncells)
 
BaseFab< List< T > > & shiftHalf (int a_dir, int a_numHalfs)
 
BaseFab< List< T > > & shiftHalf (const IntVect &a_v)
 
void linearOut (void *a_buf) const
 These functions are required for broadcast & gather. More...
 
virtual void * linearOut2 (void *a_buf, const Box &a_R, const Interval &a_comps) const
 Same as linearOut, but returns the current location in the buffer. More...
 
void linearIn (const void *const a_buf)
 
virtual void * linearIn2 (void *a_buf, const Box &a_R, const Interval &a_comps)
 same as linearIn, but returns the current location in the buffer More...
 
int linearSize (void) const
 
void degenerate (BaseFab< List< T > > &a_slice, const SliceSpec &a_sliceSpec) const
 
bool isAliased () const
 

Static Public Member Functions

static int preAllocatable ()
 
- Static Public Member Functions inherited from BaseFab< List< T > >
static int preAllocatable ()
 
static int test ()
 regression test More...
 
static int testBoxAndComp ()
 regression test More...
 

Protected Member Functions

virtual IntVect locateBin (const T &a_item) const
 compute the cell index containing the physical position of the item More...
 
- Protected Member Functions inherited from BaseFab< List< T > >
void define ()
 
void undefine ()
 
virtual void performCopy (const BaseFab< List< T > > &a_src, const Box &a_srcbox, int a_srccomp, const Box &a_destbox, int a_destcomp, int a_numcomp)
 
void performSetVal (List< T >a_x, const Box &a_bx, int a_nstart, int a_numcomp)
 

Protected Attributes

RealVect m_origin
 location in physical space of the 0 index More...
 
RealVect m_mesh_spacing
 cell size in physical space More...
 
- Protected Attributes inherited from BaseFab< List< T > >
Box m_domain
 
int m_nvar
 
long m_numpts
 
long m_truesize
 
List< T > *__restrict m_dptr
 
bool m_aliased
 

Additional Inherited Members

- Static Protected Member Functions inherited from BaseFab< List< T > >
static std::string name ()
 
- Static Protected Attributes inherited from BaseFab< List< T > >
static Arenas_Arena
 

Detailed Description

template<class T>
class BinFab< T >

Base class for particle data on a Box.

This is a class for holding and sorting particle items. Class <T> must have a RealVect <T>::position() const function which is used to place the item in an appropriate bin. See class BinItem for a base class for particles. All BinFabs are assumed to have 1 component.

Constructor & Destructor Documentation

template<class T >
BinFab< T >::BinFab ( )

Null constructor, copy constructor and operator= can be compiler defined.

template<class T >
BinFab< T >::BinFab ( const Box a_domain,
const RealVect a_mesh_spacing,
const RealVect a_origin 
)

Constructs an empty BinFab on a_domain.

template<class T>
BinFab< T >::BinFab ( const BinFab< T > &  a_binfab)

Copy constructor.

template<class T >
BinFab< T >::~BinFab ( )
virtual

Destructor.

Member Function Documentation

template<class T >
void BinFab< T >::define ( const Box a_domain,
const RealVect a_mesh_spacing,
const RealVect a_origin 
)
virtual

Same as the constructor.

References Box::numPts().

template<class T >
void BinFab< T >::reBin ( )
virtual

Sort all the items into the appropriate bins, losing items not in the FAB's domain.

This is used after "pushing" particles (i.e. updating physical positions).

References List< T >::isNotEmpty(), locateBin(), BoxIterator::ok(), and List< T >::remove().

template<class T >
void BinFab< T >::reBin ( List< T > &  a_lost,
const Box a_valid = Box(),
bool  a_in = true 
)
virtual

Sort all the items into the appropriate bins and return items in (or not in) the Box.

This is used after "pushing" particles, to find which have left the domain of the BinFab.

References Box::contains(), Box::isEmpty(), List< T >::isNotEmpty(), locateBin(), BoxIterator::ok(), List< T >::remove(), and List< T >::transfer().

template<class T >
void BinFab< T >::addItem ( const T &  a_item)
virtual

Copy one item into the appropriate bin.

Insert a single item into this BinFab in the appropriate cell.

References locateBin().

template<class T >
void BinFab< T >::addItem ( const T &  a_item,
const IntVect a_bin 
)
virtual

Copy one item into the specified bin.

Insert a single item into this BinFab in the specified cell.

template<class T >
void BinFab< T >::addItems ( const List< T > &  a_list)
virtual

Copy items into the appropriate bins.

Insert multiple items into this BinFab.

References List< T >::isNotEmpty(), locateBin(), and ListIterator< T >::rewind().

template<class T >
void BinFab< T >::addItemsDestructive ( List< T > &  a_list)
virtual

Copy items into the appropriate bins and remove them from the List.

Insert multiple items into BinFab and remove from source list.

References List< T >::isNotEmpty(), locateBin(), and ListIterator< T >::rewind().

template<class T >
void BinFab< T >::addItemsDestructive ( List< T > &  a_list,
const Box a_valid,
bool  a_in = true 
)
virtual

Copy items into the appropriate bins. Remove items that are in (or not in) the Box from the List.

Move or copy items from arg list to *this, depending on in or not-in the given Box.

References Box::cellCentered(), CH_assert, Box::contains(), List< T >::isNotEmpty(), locateBin(), and ListIterator< T >::rewind().

template<class T >
void BinFab< T >::transfer ( BinFab< T > &  a_src,
const Box a_srcBox,
const Box a_destBox 
)
virtual

Move particles from a BinFab to the overlapping cells in this one.

Performs a point-wise transfer of the whole List<T> in src cells to the corresponding cells in *this. Notice that as a result both this and a_src are modified.

References BaseFab< List< T > >::box(), List< T >::catenate(), CH_assert, Box::contains(), BaseFab< List< T > >::nComp(), and Box::sameSize().

template<class T >
void BinFab< T >::clear ( )
virtual

Delete all the items in this BinFab and reset it to the null Box.

References RealVect::Zero.

template<class T >
int BinFab< T >::numItems ( const Box a_box = Box()) const
virtual

Count the number of items in this BinFab in the specified Box.

The default is to do the whole FAB. This is slow, so use it sparingly.

References Box::isEmpty(), and BoxIterator::ok().

template<class T >
RealVect BinFab< T >::meshSpacing ( ) const
virtual

Retrieve the mesh cell size, in physical coordinates.

template<class T >
void BinFab< T >::meshSpacing ( const RealVect a_mesh_spacing)
virtual

Set the mesh cell size, in physical coordinates.

template<class T >
RealVect BinFab< T >::origin ( ) const

Retrieve the physical coordinates of the lower corner of cell zero.

template<class T >
void BinFab< T >::origin ( const RealVect a_origin)

Set the physical coordinates of the lower corner of cell zero.

template<class T >
size_t BinFab< T >::size ( const Box a_box,
const Interval a_comps = Interval(0,0) 
) const
virtual

The number of bytes used by linearIn()/linearOut().

Returns the size, in number of bytes, of a flat linear representation of the items in the specified Box.

Reimplemented from BaseFab< List< T > >.

References Box::numPts().

template<class T >
void BinFab< T >::linearOut ( void *  a_buf,
const Box a_box,
const Interval a_comps 
) const
virtual

Write a serialized (packed) representation into a_buf.

Write a linear representation of the items in the specified Box. Assumes that sufficient memory for the buffer has already been allocated by the caller.

Reimplemented from BaseFab< List< T > >.

References List< T >::length(), ListIterator< T >::ok(), and BoxIterator::ok().

template<class T >
void BinFab< T >::linearOutDestructive ( void *  buf,
const Box a_box,
const Interval a_comps = Interval(0,0) 
)
virtual

Write a serialized (packed) representation into a_buf and remove from *this.

Write a linear representation of the items in the specified Box and removes them from this BinFab. Assumes that sufficient memory for the buffer has already been allocated by the caller.

References List< T >::clear(), List< T >::length(), ListIterator< T >::ok(), and BoxIterator::ok().

template<class T >
void BinFab< T >::linearIn ( void *  a_buf,
const Box a_box,
const Interval a_comps = Interval(0,0) 
)
virtual

Extract a serialized (packed) representation from a_buf.

Given a linear representation of the class data previously made using linearIn() in a_buf, set the data for this class on the specified Box.

Reimplemented from BaseFab< List< T > >.

References List< T >::append(), List< T >::clear(), and BoxIterator::ok().

template<class T>
static int BinFab< T >::preAllocatable ( )
inlinestatic
template<class T>
IntVect BinFab< T >::size ( ) const
inline

Should be inherited from BaseFab but it isn't, sigh; code is the same.

needed for loop-unroll macro

References BaseFab< List< T > >::m_domain, and Box::size().

template<class T >
IntVect BinFab< T >::locateBin ( const T &  a_item) const
inlineprotectedvirtual

compute the cell index containing the physical position of the item

References SpaceDim.

Member Data Documentation

template<class T>
RealVect BinFab< T >::m_origin
protected

location in physical space of the 0 index

template<class T>
RealVect BinFab< T >::m_mesh_spacing
protected

cell size in physical space


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