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

#include <ListBox.H>

Public Member Functions

 ListBox ()
 Null constructor. More...
 
 ListBox (const Box &a_box, const RealVect &a_meshSpacing, const RealVect &a_origin)
 
virtual ~ListBox ()
 Destructor. More...
 
virtual void define (const Box &a_box, const RealVect &a_meshSpacing, const RealVect &a_origin)
 Same as the constructor. More...
 
virtual void undefine ()
 Free the memory associated with this ListBox. More...
 
List< T > & listItems ()
 Returns the list of items contained in this ListBox. More...
 
const List< T > & listItems () const
 Returns the list of items contained in this ListBox, const version. More...
 
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. More...
 
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. More...
 
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(). More...
 
virtual void linearOut (void *a_buf, const Box &a_box, const Interval &a_comps=Interval()) const
 Write a serialized (packed) representation into a_buf. More...
 
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. More...
 
virtual const RealVectmeshSpacing () const
 Retrieve the mesh size. More...
 
const Boxbox () const
 Retrieve the box. More...
 
virtual void clear ()
 Delete all items in this ListBox and reset it to the null Box. More...
 
IntVect size () const
 as in BaseFab; needed for loop-unroll macro More...
 

Static Public Member Functions

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

Protected Member Functions

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

Static Protected Member Functions

static std::string name ()
 

Protected Attributes

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

Static Protected Attributes

static Arenas_Arena = NULL
 

Private Member Functions

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

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.

Constructor & Destructor Documentation

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

Null constructor.

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

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 ( )
virtual

Destructor.

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 
)
virtual

Same as the constructor.

References CH_assert, MayDay::Error(), and name().

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

template<class T >
void ListBox< T >::undefine ( )
virtual

Free the memory associated with this ListBox.

References CH_assert.

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

Returns the list of items contained in this ListBox.

References CH_assert.

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.

template<class T >
void ListBox< T >::getItems ( List< T > &  a_list,
const Box a_valid 
) const
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, and List< T >::join().

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

template<class T >
void ListBox< T >::getItemsDestructive ( List< T > &  a_list,
const Box a_valid 
)
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, and List< T >::transfer().

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

template<class T >
void ListBox< T >::getInvalid ( List< T > &  a_list,
const Box a_valid 
) const
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(), and CH_assert.

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

template<class T >
void ListBox< T >::getInvalidDestructive ( List< T > &  a_list,
const Box a_valid 
)
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, and List< T >::transfer().

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

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

template<class T >
void ListBox< T >::addItems ( const List< T > &  a_list)
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(), List< T >::isNotEmpty(), and ListIterator< T >::ok().

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

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

template<class T >
void ListBox< T >::addItemsDestructive ( List< T > &  a_list,
const Box a_valid 
)
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 List< T >::isNotEmpty(), 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 
)
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, ListBox< T >::getItemsDestructive(), 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 
)
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 >::getItems().

template<class T >
size_t ListBox< T >::numItems ( ) const
virtual

Return the number of items in this ListBox.

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

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

References List< T >::length().

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

References List< T >::length().

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

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

Retrieve the mesh size.

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

Retrieve the box.

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

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

References RealVect::Zero.

template<class T>
static int ListBox< T >::preAllocatable ( )
inlinestatic

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 ( )
inlinestaticprotected
template<class T >
bool ListBox< T >::isEnclosed ( const T &  a_item,
const Box a_box 
) const
inlineprotectedvirtual

Determines whether a_item is enclosed in a_box.

References Box::bigEnd(), D_TERM6, and Box::smallEnd().

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
staticprotected
template<class T>
Box ListBox< T >::m_box
protected

The Box that defines the valid region of this ListBox.

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

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

Pointer to the List that stores our items.

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

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

The cell size in physical space.

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

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


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