Classes | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends

LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY > Class Template Reference

This class is useful for writing irregularly shaped codes with LibGeoDecomp (e.g. More...

#include <containercell.h>

Collaboration diagram for LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >:
Collaboration graph
[legend]

List of all members.

Classes

class  API
class  NeighborhoodAdapter

Public Types

typedef CARGO Cargo
typedef CARGO value_type
typedef KEY Key
typedef
APITraits::SelectTopology
< CARGO >::Value 
Topology
typedef CargoIterator
typedef Cargoiterator
typedef const CargoConstIterator
typedef const Cargoconst_iterator

Public Member Functions

 ContainerCell ()
void insert (const Key &id, const Cargo &cell)
bool remove (const Key &id)
Cargooperator[] (const Key &id)
const Cargooperator[] (const Key &id) const
void clear ()
Cargobegin ()
const Cargobegin () const
Cargoend ()
const Cargoend () const
std::size_t size () const
template<class HOOD >
void update (const HOOD &neighbors, const int nanoStep)
 The normal update() will copy its state from last time step so all cargo items are well initialized.
template<class HOOD_SELF , class HOOD_ALL >
void updateCargo (HOOD_SELF &ownNeighbors, HOOD_ALL &allNeighbors, const int nanoStep)
 Assuming that some external entity has already taken care of initializing this container's cargo, we also provide updateCargo(), which doesn't copy over the old state:
const KeygetIDs () const

Static Public Attributes

static const int DIM = Topology::DIM
static const std::size_t MAX_SIZE = SIZE

Private Member Functions

void checkSize () const

Private Attributes

Key ids [SIZE]
Cargo cells [SIZE]
std::size_t numElements

Friends

class ContainerCellTest

Detailed Description

template<class CARGO, std::size_t SIZE, typename KEY = int>
class LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >

This class is useful for writing irregularly shaped codes with LibGeoDecomp (e.g.

meshfree or unstructured grids). It acts as an adapter between the underlying, regular grid and the amorphous structure of the model. Each entity of the model (of type CARGO) needs to be assigned a unique KEY, which will be used for lookups.

If your model doesn't access neighboring cells via IDs but rather all neighbors within a certain radius, then BoxCell is a better choice.


Member Typedef Documentation

template<class CARGO , std::size_t SIZE, typename KEY = int>
typedef CARGO LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::Cargo
template<class CARGO , std::size_t SIZE, typename KEY = int>
typedef const Cargo* LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::const_iterator
template<class CARGO , std::size_t SIZE, typename KEY = int>
typedef const Cargo* LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::ConstIterator
template<class CARGO , std::size_t SIZE, typename KEY = int>
typedef Cargo* LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::Iterator
template<class CARGO , std::size_t SIZE, typename KEY = int>
typedef Cargo* LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::iterator
template<class CARGO , std::size_t SIZE, typename KEY = int>
typedef KEY LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::Key
template<class CARGO , std::size_t SIZE, typename KEY = int>
typedef APITraits::SelectTopology<CARGO>::Value LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::Topology
template<class CARGO , std::size_t SIZE, typename KEY = int>
typedef CARGO LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::value_type

Constructor & Destructor Documentation

template<class CARGO , std::size_t SIZE, typename KEY = int>
LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::ContainerCell (  )  [inline]

Member Function Documentation

template<class CARGO , std::size_t SIZE, typename KEY = int>
Cargo* LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::begin (  )  [inline]
template<class CARGO , std::size_t SIZE, typename KEY = int>
const Cargo* LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::begin (  )  const [inline]
template<class CARGO , std::size_t SIZE, typename KEY = int>
void LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::checkSize (  )  const [inline, private]
template<class CARGO , std::size_t SIZE, typename KEY = int>
void LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::clear (  )  [inline]
template<class CARGO , std::size_t SIZE, typename KEY = int>
Cargo* LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::end (  )  [inline]
template<class CARGO , std::size_t SIZE, typename KEY = int>
const Cargo* LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::end (  )  const [inline]
template<class CARGO , std::size_t SIZE, typename KEY = int>
const Key* LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::getIDs (  )  const [inline]
template<class CARGO , std::size_t SIZE, typename KEY = int>
void LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::insert ( const Key id,
const Cargo cell 
) [inline]
template<class CARGO , std::size_t SIZE, typename KEY = int>
const Cargo* LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::operator[] ( const Key id  )  const [inline]
template<class CARGO , std::size_t SIZE, typename KEY = int>
Cargo* LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::operator[] ( const Key id  )  [inline]
template<class CARGO , std::size_t SIZE, typename KEY = int>
bool LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::remove ( const Key id  )  [inline]
template<class CARGO , std::size_t SIZE, typename KEY = int>
std::size_t LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::size (  )  const [inline]
template<class CARGO , std::size_t SIZE, typename KEY = int>
template<class HOOD >
void LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::update ( const HOOD &  neighbors,
const int  nanoStep 
) [inline]

The normal update() will copy its state from last time step so all cargo items are well initialized.

Otherwise the current container wouldn't even know the IDs of the items which need updating.

References LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::updateCargo().

template<class CARGO , std::size_t SIZE, typename KEY = int>
template<class HOOD_SELF , class HOOD_ALL >
void LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::updateCargo ( HOOD_SELF &  ownNeighbors,
HOOD_ALL &  allNeighbors,
const int  nanoStep 
) [inline]

Assuming that some external entity has already taken care of initializing this container's cargo, we also provide updateCargo(), which doesn't copy over the old state:

References LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::cells, and LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::numElements.

Referenced by LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::update().


Friends And Related Function Documentation

template<class CARGO , std::size_t SIZE, typename KEY = int>
friend class ContainerCellTest [friend]

Member Data Documentation

template<class CARGO , std::size_t SIZE, typename KEY = int>
Cargo LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::cells[SIZE] [private]
template<class CARGO , std::size_t SIZE, typename KEY = int>
const int LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::DIM = Topology::DIM [static]
template<class CARGO , std::size_t SIZE, typename KEY = int>
Key LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::ids[SIZE] [private]
template<class CARGO , std::size_t SIZE, typename KEY = int>
const std::size_t LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::MAX_SIZE = SIZE [static]
template<class CARGO , std::size_t SIZE, typename KEY = int>
std::size_t LibGeoDecomp::ContainerCell< CARGO, SIZE, KEY >::numElements [private]

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