ListBox< T > Class Template Reference

#include <ListBox.H>

List of all members.


Detailed Description

template<class T>
class ListBox< T >

A class for storing and sorting particle items. Particles are held in a List and belong to this ListBox if their position is within the domain represented by the object Box.. Class <T> must have a RealVect <T>position() const function which is used to assign the item to the ListBox. See class BinItem for a base class for particles.

Public Member Functions

 ListBox ()
 Null constructor.
 ListBox (const Box &a_box, const RealVect &a_meshSpacing, const RealVect &a_origin)
virtual ~ListBox ()
 Destructor.
virtual void define (const Box &a_box, const RealVect &a_meshSpacing, const RealVect &a_origin)
 Same as the constructor.
virtual void undefine ()
 Free the memory associated with this ListBox.
List< T > & listItems ()
 Returns the list of items contained in this ListBox.
const List< T > & listItems () const
 Returns the list of items contained in this ListBox, const version.
virtual void getItems (List< T > &a_list, const Box &a_valid) const
virtual void getItemsDestructive (List< T > &a_list, const Box &a_valid)
virtual void getInvalid (List< T > &a_list, const Box &a_valid) const
virtual void getInvalidDestructive (List< T > &a_list, const Box &a_valid)
virtual void addItem (const T &a_item)
 Add a_item to this ListBox if it is contained within m_box.
virtual void addItems (const List< T > &a_list)
virtual void addItemsDestructive (List< T > &a_list)
virtual void addItemsDestructive (List< T > &a_list, const Box &a_valid)
virtual void transfer (ListBox< T > &a_src, const Box &a_srcBox, const Box &a_destBox, const int a_srcComp=0, const int a_destComp=0, const int a_numComp=1)
virtual void copy (const Box &a_RegionFrom, const Interval &a_Cdest, const Box &a_RegionTo, const ListBox< T > &a_src, const Interval &a_Csrc)
virtual size_t numItems () const
 Return the number of items in this ListBox.
virtual size_t numItems (const Box &a_box, const bool a_in=true) const
virtual int size (const Box &a_box, const Interval &a_comps=Interval()) const
 The number of bytes used by linearIn()/linearOut().
virtual void linearOut (void *a_buf, const Box &a_box, const Interval &a_comps=Interval()) const
 Write a serialized (packed) representation into a_buf.
virtual void linearOutDestructive (void *buf, const Box &a_box, const Interval &a_comps=Interval())
virtual void linearIn (void *a_buf, const Box &a_box, const Interval &a_comps=Interval())
 Extract a serialized (packed) representation from a_buf.
virtual const RealVectmeshSpacing () const
 Retrieve the mesh size.
const Boxbox () const
 Retrieve the box.
virtual void clear ()
 Delete all items in this ListBox and reset it to the null Box.
IntVect size () const
 as in BaseFab; needed for loop-unroll macro

Static Public Member Functions

static int preAllocatable ()
 Lists are not pre-allocatable. This function is needed so that ListBox.

Protected Member Functions

virtual bool isEnclosed (const T &a_item, const Box &a_box) const
 Determines whether a_item is enclosed in a_box.

Static Protected Member Functions

static std::string name ()

Protected Attributes

Box m_box
 The Box that defines the valid region of this ListBox.
List< T > * m_dptr
 Pointer to the List that stores our items.
RealVect m_mesh_spacing
 The cell size in physical space.
RealVect m_origin
 The center of our coordinate system. Used for binning our items.

Static Protected Attributes

static Arenas_Arena = NULL

Private Member Functions

ListBox< T > & operator= (const ListBox< T > &)
 ListBox (const ListBox< T > &)

Constructor & Destructor Documentation

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

Null constructor.

template<class T>
ListBox< T >::ListBox ( const Box a_box,
const RealVect a_meshSpacing,
const RealVect a_origin 
) [inline]

Constructs an empty ListBox on a_box. a_meshSpacing is the cell size in each direction, and a_origin is the location in physical coordinates of the lower left corner of the problem domain.

References ListBox< T >::define().

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

Destructor.

References ListBox< T >::undefine().

template<class T>
ListBox< T >::ListBox ( const ListBox< T > &   )  [private]


Member Function Documentation

template<class T>
void ListBox< T >::define ( const Box a_box,
const RealVect a_meshSpacing,
const RealVect a_origin 
) [inline, virtual]

template<class T>
void ListBox< T >::undefine (  )  [inline, virtual]

Free the memory associated with this ListBox.

References CH_assert, Arena::free(), ListBox< T >::m_dptr, and ListBox< T >::s_Arena.

Referenced by ListBox< T >::clear(), and ListBox< T >::~ListBox().

template<class T>
List< T > & ListBox< T >::listItems (  )  [inline]

template<class T>
const List< T > & ListBox< T >::listItems (  )  const [inline]

Returns the list of items contained in this ListBox, const version.

References CH_assert, and ListBox< T >::m_dptr.

template<class T>
void ListBox< T >::getItems ( List< T > &  a_list,
const Box a_valid 
) const [inline, virtual]

Copy items from this ListBox into a_list only if they are contained in a_valid. This operation does not remove the items from this ListBox.

References List< T >::add(), CH_assert, ListBox< T >::isEnclosed(), List< T >::join(), ListBox< T >::listItems(), ListBox< T >::m_box, and ListBox< T >::m_dptr.

Referenced by ListBox< T >::copy(), and ListBox< T >::linearOut().

template<class T>
void ListBox< T >::getItemsDestructive ( List< T > &  a_list,
const Box a_valid 
) [inline, virtual]

Transfer items from this ListBox into a_list only if they are contained in a_valid. This operation removes the items from this ListBox.

References List< T >::catenate(), CH_assert, ListBox< T >::isEnclosed(), ListBox< T >::listItems(), ListBox< T >::m_box, ListBox< T >::m_dptr, and List< T >::transfer().

Referenced by ListBox< T >::copy(), ListBox< T >::linearOutDestructive(), and ListBox< T >::transfer().

template<class T>
void ListBox< T >::getInvalid ( List< T > &  a_list,
const Box a_valid 
) const [inline, virtual]

Copy items from this ListBox into a_list if they are NOT contained in a_valid. Does not remove the items from this ListBox.

References List< T >::add(), CH_assert, ListBox< T >::isEnclosed(), ListBox< T >::listItems(), and ListBox< T >::m_dptr.

Referenced by ParticleData< P >::fillGhosts().

template<class T>
void ListBox< T >::getInvalidDestructive ( List< T > &  a_list,
const Box a_valid 
) [inline, virtual]

Transfer items from this ListBox into a_list if they are NOT contained in a_valid. This removes the items from this ListBox.

References CH_assert, ListBox< T >::isEnclosed(), ListBox< T >::listItems(), ListBox< T >::m_dptr, and List< T >::transfer().

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

Add a_item to this ListBox if it is contained within m_box.

References ListBox< T >::isEnclosed(), ListBox< T >::listItems(), and ListBox< T >::m_box.

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

Add each item in a_list into this ListBox if they are contained within m_box. Does not remove the items from a_list.

References List< T >::add(), ListBox< T >::isEnclosed(), List< T >::isNotEmpty(), ListBox< T >::listItems(), and ListBox< T >::m_box.

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

Transfer each item in a_list into this ListBox if it is contained within m_box. This removes the items from a_list.

References ListBox< T >::m_box.

Referenced by ListBox< T >::copy().

template<class T>
void ListBox< T >::addItemsDestructive ( List< T > &  a_list,
const Box a_valid 
) [inline, virtual]

Transfer each item in a_list into this ListBox if it is contained within a_valid. This removes the items from a_list.

References ListBox< T >::isEnclosed(), List< T >::isNotEmpty(), ListBox< T >::listItems(), and List< T >::transfer().

template<class T>
void ListBox< T >::transfer ( ListBox< T > &  a_src,
const Box a_srcBox,
const Box a_destBox,
const int  a_srcComp = 0,
const int  a_destComp = 0,
const int  a_numComp = 1 
) [inline, virtual]

Performs transfer of the items from src to dest. Notice that as a result both *this and a_src are modified.

References CH_assert, Box::contains(), ListBox< T >::getItemsDestructive(), ListBox< T >::listItems(), ListBox< T >::m_box, ListBox< T >::m_dptr, and Box::sameSize().

template<class T>
void ListBox< T >::copy ( const Box a_RegionFrom,
const Interval a_Cdest,
const Box a_RegionTo,
const ListBox< T > &  a_src,
const Interval a_Csrc 
) [inline, virtual]

Remove all the items from this ListBox that are within a_RegionTo, and add all the particles from the ListBox a_src that are within a_RegionFrom.

References ListBox< T >::addItemsDestructive(), ListBox< T >::getItems(), ListBox< T >::getItemsDestructive(), and ListBox< T >::listItems().

template<class T>
size_t ListBox< T >::numItems (  )  const [inline, virtual]

Return the number of items in this ListBox.

References ListBox< T >::listItems().

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

template<class T>
size_t ListBox< T >::numItems ( const Box a_box,
const bool  a_in = true 
) const [inline, virtual]

template<class T>
int ListBox< T >::size ( const Box a_box,
const Interval a_comps = Interval() 
) 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.

References ListBox< T >::numItems().

template<class T>
void ListBox< T >::linearOut ( void *  a_buf,
const Box a_box,
const Interval a_comps = Interval() 
) 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.

References ListBox< T >::getItems(), and List< T >::length().

template<class T>
void ListBox< T >::linearOutDestructive ( void *  buf,
const Box a_box,
const Interval a_comps = Interval() 
) [inline, virtual]

template<class T>
void ListBox< T >::linearIn ( void *  a_buf,
const Box a_box,
const Interval a_comps = Interval() 
) [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.

References List< T >::append(), ListBox< T >::listItems(), and ListBox< T >::numItems().

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

Retrieve the mesh size.

References ListBox< T >::m_mesh_spacing.

template<class T>
const Box & ListBox< T >::box (  )  const [inline]

Retrieve the box.

References ListBox< T >::m_box.

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

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

References ListBox< T >::m_box, ListBox< T >::m_mesh_spacing, ListBox< T >::m_origin, ListBox< T >::undefine(), and RealVect::Zero.

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

Lists are not pre-allocatable. This function is needed so that ListBox.

can be stored inside LevelData<T> containers

template<class T>
IntVect ListBox< T >::size (  )  const [inline]

as in BaseFab; needed for loop-unroll macro

References ListBox< T >::m_box, and Box::size().

template<class T>
std::string ListBox< T >::name (  )  [inline, static, protected]

Referenced by ListBox< T >::define().

template<class T>
bool ListBox< T >::isEnclosed ( const T &  a_item,
const Box a_box 
) const [inline, protected, virtual]

template<class T>
ListBox<T>& ListBox< T >::operator= ( const ListBox< T > &   )  [private]

These functions are made private to prevent use of the default functions provided by the C++ compiler.


Member Data Documentation

template<class T>
Arena * ListBox< T >::s_Arena = NULL [inline, static, protected]

template<class T>
Box ListBox< T >::m_box [protected]

template<class T>
List<T>* ListBox< T >::m_dptr [protected]

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

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

The center of our coordinate system. Used for binning our items.

Referenced by ListBox< T >::clear(), ListBox< T >::define(), and ListBox< T >::isEnclosed().


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

Generated on Mon Nov 20 03:27:15 2017 for Chombo + EB + MF by  doxygen 1.5.5