BinFab< T > Class Template Reference

#include <BinFab.H>

Inheritance diagram for BinFab< T >:

Inheritance graph
[legend]

List of all members.


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.

Public Member Functions

 BinFab ()
 Null constructor, copy constructor and operator= can be compiler defined.
 BinFab (const Box &a_domain, const RealVect &a_mesh_spacing, const RealVect &a_origin)
 Constructs an empty BinFab on a_domain.
 BinFab (const BinFab &a_binfab)
 Copy constructor.
virtual ~BinFab ()
 Destructor.
virtual void define (const Box &a_domain, const RealVect &a_mesh_spacing, const RealVect &a_origin)
 Same as the constructor.
virtual void reBin ()
 Sort all the items into the appropriate bins, losing items not in the FAB's domain.
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.
virtual void addItem (const T &a_item)
 Copy one item into the appropriate bin.
virtual void addItem (const T &a_item, const IntVect &a_bin)
 Copy one item into the specified bin.
virtual void addItems (const List< T > &a_list)
 Copy items into the appropriate bins.
virtual void addItemsDestructive (List< T > &a_list)
 Copy items into the appropriate bins and remove them from the List.
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.
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.
virtual void clear ()
 Delete all the items in this BinFab and reset it to the null Box.
virtual int numItems (const Box &a_box=Box()) const
 Count the number of items in this BinFab in the specified Box.
virtual RealVect meshSpacing () const
 Retrieve the mesh cell size, in physical coordinates.
virtual void meshSpacing (const RealVect &a_mesh_spacing)
 Set the mesh cell size, in physical coordinates.
RealVect origin () const
 Retrieve the physical coordinates of the lower corner of cell zero.
void origin (const RealVect &a_origin)
 Set the physical coordinates of the lower corner of cell zero.
virtual size_t size (const Box &a_box, const Interval &a_comps=Interval(0, 0)) const
 The number of bytes used by linearIn()/linearOut().
virtual void linearOut (void *a_buf, const Box &a_box, const Interval &a_comps) const
 Write a serialized (packed) representation into a_buf.
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.
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.
IntVect size () const
 Should be inherited from BaseFab but it isn't, sigh; code is the same.

Static Public Member Functions

static int preAllocatable ()

Protected Member Functions

virtual IntVect locateBin (const T &a_item) const
 compute the cell index containing the physical position of the item

Protected Attributes

RealVect m_origin
 location in physical space of the 0 index
RealVect m_mesh_spacing
 cell size in physical space


Constructor & Destructor Documentation

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

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 
) [inline]

Constructs an empty BinFab on a_domain.

References BaseFab< List< T > >::define().

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

Copy constructor.

template<class T>
BinFab< T >::~BinFab (  )  [inline, virtual]

Destructor.

References BaseFab< List< T > >::undefine().


Member Function Documentation

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

template<class T>
void BinFab< T >::reBin (  )  [inline, 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 Box::contains(), List< T >::isNotEmpty(), BinFab< T >::locateBin(), BaseFab< List< T > >::m_domain, BoxIterator::ok(), BaseFab< List< T > >::operator()(), and List< T >::remove().

template<class T>
void BinFab< T >::reBin ( List< T > &  a_lost,
const Box a_valid = Box(),
bool  a_in = true 
) [inline, 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(), BinFab< T >::locateBin(), BaseFab< List< T > >::m_domain, BaseFab< List< T > >::operator()(), List< T >::remove(), and List< T >::transfer().

template<class T>
void BinFab< T >::addItem ( const T &  a_item  )  [inline, virtual]

Copy one item into the appropriate bin.

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

References Box::contains(), BinFab< T >::locateBin(), BaseFab< List< T > >::m_domain, and BaseFab< List< T > >::operator()().

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

Copy one item into the specified bin.

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

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

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

template<class T>
void BinFab< T >::addItemsDestructive ( List< T > &  a_list  )  [inline, virtual]

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

Insert multiple items into BinFab and remove from source list.

References Box::contains(), List< T >::isNotEmpty(), BinFab< T >::locateBin(), BaseFab< List< T > >::m_domain, BaseFab< List< T > >::operator()(), and ListIterator< T >::rewind().

template<class T>
void BinFab< T >::addItemsDestructive ( List< T > &  a_list,
const Box a_valid,
bool  a_in = true 
) [inline, 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(), BinFab< T >::locateBin(), BaseFab< List< T > >::m_domain, BaseFab< List< T > >::operator()(), and ListIterator< T >::rewind().

template<class T>
void BinFab< T >::transfer ( BinFab< T > &  a_src,
const Box a_srcBox,
const Box a_destBox 
) [inline, 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(), CH_assert, Box::contains(), BaseFab< List< T > >::nComp(), and Box::sameSize().

template<class T>
void BinFab< T >::clear (  )  [inline, virtual]

template<class T>
int BinFab< T >::numItems ( const Box a_box = Box()  )  const [inline, 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 BaseFab< List< T > >::box(), Box::isEmpty(), and BaseFab< List< T > >::operator()().

Referenced by BinFab< T >::linearIn(), and BinFab< T >::size().

template<class T>
RealVect BinFab< T >::meshSpacing (  )  const [inline, virtual]

Retrieve the mesh cell size, in physical coordinates.

References BinFab< T >::m_mesh_spacing.

template<class T>
void BinFab< T >::meshSpacing ( const RealVect a_mesh_spacing  )  [inline, virtual]

Set the mesh cell size, in physical coordinates.

References BinFab< T >::m_mesh_spacing.

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

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

References BinFab< T >::m_origin.

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

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

References BinFab< T >::m_origin.

template<class T>
size_t BinFab< T >::size ( const Box a_box,
const Interval a_comps = Interval(0,0) 
) const [inline, 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 BinFab< T >::numItems(), and Box::numPts().

template<class T>
void BinFab< T >::linearOut ( void *  a_buf,
const Box a_box,
const Interval a_comps 
) const [inline, 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(), and BaseFab< List< T > >::operator()().

template<class T>
void BinFab< T >::linearOutDestructive ( void *  buf,
const Box a_box,
const Interval a_comps = Interval(0,0) 
) [inline, 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(), and BaseFab< List< T > >::operator()().

template<class T>
void BinFab< T >::linearIn ( void *  a_buf,
const Box a_box,
const Interval a_comps = Interval(0,0) 
) [inline, 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(), BinFab< T >::numItems(), and BaseFab< List< T > >::operator()().

template<class T>
static int BinFab< T >::preAllocatable (  )  [inline, static]

Reimplemented from BaseFab< List< T > >.

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

Reimplemented from BaseFab< List< T > >.

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

template<class T>
IntVect BinFab< T >::locateBin ( const T &  a_item  )  const [inline, protected, virtual]

compute the cell index containing the physical position of the item

References BinFab< T >::m_mesh_spacing, BinFab< T >::m_origin, and SpaceDim.

Referenced by BinFab< T >::addItem(), BinFab< T >::addItems(), BinFab< T >::addItemsDestructive(), and BinFab< T >::reBin().


Member Data Documentation

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

location in physical space of the 0 index

Referenced by BinFab< T >::clear(), BinFab< T >::define(), BinFab< T >::locateBin(), and BinFab< T >::origin().

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


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

Generated on Tue Sep 26 03:26:58 2017 for Chombo + EB + MF by  doxygen 1.5.5