ESyS-Particle  4.0.1
Classes | Public Types | Public Member Functions | Friends | List of all members
ParallelParticleArray< T > Class Template Reference

parrallel particle storage array with neighborsearch and variable exchange More...

#include <pp_array.h>

Inheritance diagram for ParallelParticleArray< T >:
Inheritance graph
[legend]
Collaboration diagram for ParallelParticleArray< T >:
Collaboration graph
[legend]

Classes

class  ParticleIterator

Public Types

typedef T_Handle< typename
NeighborTable< T >::pairlist > 
PairListHandle
typedef NeighborTable< T >
::pairlist::iterator 
PairListIterator
typedef T_Handle< typename
NeighborTable< T >
::particlelist > 
ParticleListHandle
typedef NeighborTable< T >
::particlelist::iterator 
ParticleListIterator

Public Member Functions

 ParallelParticleArray (TML_Comm *comm, const vector< unsigned int > &dims, const Vec3 &min, const Vec3 &max, double rmax, double alpha)
 ParallelParticleArray (TML_Comm *comm, const vector< unsigned int > &dims, const vector< bool > &circ, const Vec3 &min, const Vec3 &max, double rmax, double alpha)
 ~ParallelParticleArray ()
Vec3 getMinPos () const
Vec3 getMaxPos () const
vector< int > getCommCoords () const
vector< int > getCommDims () const
int size ()
int getInnerSize ()
void insert (const T &)
 particle insertion
void insert (const vector< T > &)
 multi particle insert
virtual bool isInInner (const Vec3 &)
T * getParticlePtrByIndex (int)
T * getParticlePtrByPosition (const Vec3 &)
void rebuild ()
template<typename P >
void exchange (P(T::*rdf)(), void(T::*wrtf)(const P &))
void forParticle (int, void(T::*rdf)())
template<typename P >
void forParticle (int, void(T::*rdf)(P), const P &)
void forParticleTag (int, void(T::*rdf)())
template<typename P >
void forParticleTag (int, void(T::*rdf)(P), const P &)
void forParticleTagMask (int, int, void(T::*rdf)())
template<typename P >
void forParticleTagMask (int, int, void(T::*rdf)(P), const P &)
void forAllParticles (void(T::*rdf)())
void forAllParticles (void(T::*rdf)() const)
template<typename P >
void forAllParticles (void(T::*rdf)(P), const P &)
template<typename P >
void forAllInnerParticles (void(T::*rdf)(P &), P &)
ParticleIterator getInnerParticleIterator ()
template<typename P >
void forAllParticlesGet (P &, typename P::value_type(T::*rdf)() const)
template<typename P >
void forAllInnerParticlesGet (P &, typename P::value_type(T::*rdf)() const)
template<typename P >
vector< pair< int, P > > forAllParticlesGetIndexed (P(T::*rdf)() const)
template<typename P >
vector< pair< int, P > > forAllInnerParticlesGetIndexed (P(T::*rdf)() const)
template<typename P >
void forAllTaggedParticlesGet (P &, typename P::value_type(T::*rdf)() const, int, int)
template<typename P >
void forAllTaggedInnerParticlesGet (P &, typename P::value_type(T::*rdf)() const, int, int)
template<typename P >
vector< pair< int, P > > forAllTaggedParticlesGetIndexed (P(T::*rdf)() const, int, int)
template<typename P >
vector< pair< int, P > > forAllInnerTaggedParticlesGetIndexed (P(T::*rdf)() const, int, int)
template<typename P >
void forPointsGetNearest (P &, typename P::value_type(T::*rdf)() const, const Vec3 &, double, double, double, int, int, int)
virtual set< int > getBoundarySlabIds (int, int) const
virtual set< int > get2ndSlabIds (int, int) const
PairListHandle getFullPairList ()
 Get list of all pairs. Forwards to NTable::getFullList().
PairListHandle getNewPairList ()
 Get list of new pairs. Forwards to NTable::getNewList().
ParticleListHandle getParticlesAtPlane (Vec3 o, Vec3 n)
 Get list of particles along a plane. Forwards to NTable::getParticlesAtPlane.
ParticleListHandle getParticlesNearTriangle (const Triangle &t)
 Get list of particles near a triangle. Forwards to NTable::getParticlesNearTriangle.
ParticleListHandle getParticlesNearEdge (const AEdge *e)
 Get list of particles near an edge. Forwards to NTable::getParticlesNearEdge.
ParticleListHandle getParticlesNearPoint (const Vec3 &v)
 Get list of particles near a point. Forwards to NTable::getParticlesNearEdge.
ParticleListHandle getAllParticles ()
 Get list of all particles. Forwards to NTable.
void getAllInnerParticles (vector< T > &)
 get all particles in inner block and put them into a vector
void saveCheckPointData (std::ostream &)
void loadCheckPointData (std::istream &)
- Public Member Functions inherited from AParallelParticleArray
 AParallelParticleArray (TML_Comm *comm, const std::vector< unsigned int > &dims)
 AParallelParticleArray (TML_Comm *comm, const std::vector< unsigned int > &dims, const std::vector< bool > &circ)
TML_CartComm getComm () const
int getTimeStamp ()
 return time stamp of last rebuild

Friends

template<typename TT >
ostream & operator<< (ostream &, const ParallelParticleArray< TT > &)

Additional Inherited Members

- Protected Attributes inherited from AParallelParticleArray
TML_CartComm m_comm
int m_timestamp

Detailed Description

template<typename T>
class ParallelParticleArray< T >

parrallel particle storage array with neighborsearch and variable exchange

Constructor & Destructor Documentation

template<typename T >
ParallelParticleArray< T >::ParallelParticleArray ( TML_Comm comm,
const vector< unsigned int > &  dims,
const vector< bool > &  circ,
const Vec3 min,
const Vec3 max,
double  range,
double  alpha 
)

Construct a parallel particle array from a given communicator and geometr, i.e. minimum and maximum corners and search range. The process topology is generated from the communicator (via MPI_Dims_create). The boundary conditions i.e. circular or open are given as parameter.

Parameters
commthe communicator
dimsthe dimensions the process space. {dims[0]=0; dims[1]=0; dims[2]=0;}–is 3D allocation of processors. {dims[0]=0; dims[1]=0; dims[2]=1;}–is 2D allocation of processors. {dims[0]=0; dims[1]=1; dims[2]=1;}–is 1D allocation of processors.
circcircular/open boundary conditions {circ[0] : x-direction, circ[1] : y-direction and circ[2] : z-direction, {true : circular, false : open}
minthe (global) minimum corner of the model space
maxthe (global) maximum corner of the model space
rangethe search range
alphathe pair search cutoff
Todo:
check for (dims.size() > 3)

References TML_CartComm::get_coords(), and TML_CartComm::get_dim().

Here is the call graph for this function:

template<typename T >
ParallelParticleArray< T >::~ParallelParticleArray ( )

destructor

Member Function Documentation

template<typename T >
template<typename P >
void ParallelParticleArray< T >::exchange ( P(T::*)()  rdf,
void(T::*)(const P &)  wrtf 
)

For all particles shared with neighboring nodes, exchange some value accessible by read and write functions.

Parameters
rdfthe particle member function to read the value
wrtfthe particle member function to write the value
template<typename T >
template<typename P >
void ParallelParticleArray< T >::forAllInnerParticles ( void(T::*)(P &)  fnc,
P &  arg 
)

call a particle member function taking one argument for all inner particles

Parameters
fncthe particle member function
argthe argument to the particle member function
template<typename T >
template<typename P >
void ParallelParticleArray< T >::forAllInnerParticlesGet ( P &  cont,
typename P::value_type(T::*)() const  rdf 
)

Get a value for all inner particle using a particle member function and return the values in a container.

Parameters
contthe container
rdfthe particle member function
template<typename T >
template<typename P >
vector< pair< int, P > > ParallelParticleArray< T >::forAllInnerParticlesGetIndexed ( P(T::*)() const  rdf)

Get a value all inner particles using a particle member function and return a vector of pairs of the particle id and the value.

Parameters
rdfthe particle member function
template<typename T >
template<typename P >
vector< pair< int, P > > ParallelParticleArray< T >::forAllInnerTaggedParticlesGetIndexed ( P(T::*)() const  rdf,
int  tag,
int  mask 
)

Get a value all inner particles which have a tag fitting a given tag and mask using a particle member function and return a vector of pairs of the particle id and the value.

Parameters
rdfthe particle member function
tagthe particle tag
maskthe mask
template<typename T >
void ParallelParticleArray< T >::forAllParticles ( void(T::*)()  fnc)

call a particle member function taking no argument for all particles

call a const particle member function taking no argument for all particles

template<typename T >
template<typename P >
void ParallelParticleArray< T >::forAllParticles ( void(T::*)(P)  fnc,
const P &  arg 
)

call a particle member function taking one argument for all particles

Parameters
fncthe particle member function
argthe argument to the particle member function
template<typename T >
template<typename P >
void ParallelParticleArray< T >::forAllParticlesGet ( P &  cont,
typename P::value_type(T::*)() const  rdf 
)

Call a constant particle member function taking no argument and returning a value for all particles and collect the return values in a container. The container has to be an STL sequence container (vector,list...) or something with the same interface. The template parameter P is a type of container of the return type of the particle member function, not the return type itself. The container had to be reference argument because template instantiation based only on return type is impossible.

Parameters
contthe container
rdfthe particle member function
template<typename T >
template<typename P >
vector< pair< int, P > > ParallelParticleArray< T >::forAllParticlesGetIndexed ( P(T::*)() const  rdf)

Get a value for each particle using a particle member function and return a vector of pairs of the particle id and the value.

Parameters
rdfthe particle member function
template<typename T >
template<typename P >
void ParallelParticleArray< T >::forAllTaggedInnerParticlesGet ( P &  cont,
typename P::value_type(T::*)() const  rdf,
int  tag,
int  mask 
)

Get a value for all inner particle which have a tag fitting a given tag and mask using a particle member function and return the values in a container.

Parameters
contthe container
rdfthe particle member function
tagthe particle tag
maskthe mask
template<typename T >
template<typename P >
void ParallelParticleArray< T >::forAllTaggedParticlesGet ( P &  cont,
typename P::value_type(T::*)() const  rdf,
int  tag,
int  mask 
)

Call a constant particle member function taking no argument and returning a value for all particles which have a tag fitting a given tag and mask and collect the return values in a container. The container has to be an STL sequence container (vector,list...) or something with the same interface. The template parameter P is a type of container of the return type of the particle member function, not the return type itself. The container had to be reference argument because template instantiation based only on return type is impossible.

Parameters
contthe container
rdfthe particle member function
tagthe particle tag
maskthe mask
template<typename T >
template<typename P >
vector< pair< int, P > > ParallelParticleArray< T >::forAllTaggedParticlesGetIndexed ( P(T::*)() const  rdf,
int  tag,
int  mask 
)

Get a value for each particle which has a tag fitting a given tag and mask using a particle member function and return a vector of pairs of the particle id and the value.

Parameters
rdfthe particle member function
tagthe particle tag
maskthe mask
template<typename T >
void ParallelParticleArray< T >::forParticle ( int  id,
void(T::*)()  mf 
)

Call a member function taking no argument for one particle. Do nothing if the particle with the id is not in the ntable.

Parameters
idthe id of the particle
mfthe member function
Warning
current implementation is O(n)
template<typename T >
template<typename P >
void ParallelParticleArray< T >::forParticle ( int  id,
void(T::*)(P)  mf,
const P &  arg 
)

Call a member function taking one argument for one particle. Do nothing if the particle with the id is not in the ntable.

Parameters
idthe id of the particle
mfthe member function
argthe argument to the function call
Warning
current implementation is O(n)
template<typename T >
void ParallelParticleArray< T >::forParticleTag ( int  tag,
void(T::*)()  mf 
)

Call a member function taking no argument for all particles with a given tag.

Parameters
tagthe tag
mfthe member function
template<typename T >
template<typename P >
void ParallelParticleArray< T >::forParticleTag ( int  tag,
void(T::*)(P)  mf,
const P &  arg 
)

Call a member function taking one argument for all particleswith a given tag.

Parameters
tagthe tag
mfthe member function
argthe argument to the function call
template<typename T >
void ParallelParticleArray< T >::forParticleTagMask ( int  tag,
int  mask,
void(T::*)()  mf 
)

Call a member function taking no argument for all particles with a given tag and mask. The functions is called if the masked bits in the particle tag and the given tag are identical, i.e. if ptag & mask == tag & mask

Parameters
tagthe tag
maskthe mask
mfthe member function
template<typename T >
template<typename P >
void ParallelParticleArray< T >::forParticleTagMask ( int  tag,
int  mask,
void(T::*)(P)  mf,
const P &  arg 
)

Call a member function taking one argument for all particles with a given tag and mask. The functions is called if the masked bits in the particle tag and the given tag are identical, i.e. if ptag & mask == tag & mask

Parameters
tagthe tag
maskthe mask
mfthe member function
argthe argument to the function call
template<typename T >
template<typename P >
void ParallelParticleArray< T >::forPointsGetNearest ( P &  cont,
typename P::value_type(T::*)() const  rdf,
const Vec3 orig,
double  dx,
double  dy,
double  dz,
int  nx,
int  ny,
int  nz 
)

get a value for the nearest particle to each point of a grid using a particle member function and return a container with the values

Parameters
contthe container
rdfthe particle member function returning the value
origthe base point of the grid
dxthe grid spacing in x-direction
dythe grid spacing in y-direction
dzthe grid spacing in z-direction
nxthe grid size in x-direction
nythe grid size in y-direction
nzthe grid size in z-direction

References BasicCon::Debug().

Here is the call graph for this function:

template<typename T >
set< int > ParallelParticleArray< T >::get2ndSlabIds ( int  dir,
int  up 
) const
virtual

Get the Ids of all particles in the slab next to the boundary.

Parameters
dirthe direction ,i.e. 0->x, 1->y and 2->z
upup (1) or down (-1)

Implements AParallelParticleArray.

template<typename T >
void ParallelParticleArray< T >::getAllInnerParticles ( vector< T > &  pv)

get all particles in inner block and put them into a vector

get all particles in inner block and put them into a vector

Parameters
pva reference to the vector
template<typename T >
set< int > ParallelParticleArray< T >::getBoundarySlabIds ( int  dir,
int  up 
) const
virtual

Get the Ids of all particles in the boundary slab.

Parameters
dirthe direction ,i.e. 0->x, 1->y and 2->z
upup (1) or down (-1)

Implements AParallelParticleArray.

template<typename T >
T * ParallelParticleArray< T >::getParticlePtrByIndex ( int  id)

Get the pointer to a particle with a given id. Return NULL if there is no particle with this index.

Parameters
idthe particle id.

Referenced by ParallelInteractionStorage_EB< P, I >::loadCheckPointData(), TriMesh_PIS_EB< ParticleType, IType >::rebuild(), ParallelInteractionStorage_E< P, I >::rebuild(), Mesh2D_PIS_EB< ParticleType, IType >::rebuild(), and Mesh2D_PIS_EB< ParticleType, IType >::tryInsert().

Here is the caller graph for this function:

template<typename T >
T * ParallelParticleArray< T >::getParticlePtrByPosition ( const Vec3 pos)

Get the pointer to a particle closest to a given position. Return NULL if the position is outside the area.

Parameters
posthe position.
template<typename T >
void ParallelParticleArray< T >::insert ( const T &  p)

particle insertion

insert a single particle into the storage

Parameters
pthe particle
template<typename T >
void ParallelParticleArray< T >::insert ( const vector< T > &  vp)

multi particle insert

insert a STL vector of particles into the storage

Parameters
vpthe vector of particles
template<typename T >
bool ParallelParticleArray< T >::isInInner ( const Vec3 pos)
virtual

check if a position is in the inner part

Parameters
posthe position

Implements AParallelParticleArray.

Referenced by ParallelParticleArray< T >::loadCheckPointData(), CViscWallIG< T >::Update(), and CBWallInteractionGroup< T >::Update().

Here is the caller graph for this function:

template<typename T >
void ParallelParticleArray< T >::loadCheckPointData ( std::istream &  ist)

load checkpoint data from an istream

Parameters
istthe input stream

References BasicCon::Debug(), and ParallelParticleArray< T >::isInInner().

Here is the call graph for this function:

template<typename T >
void ParallelParticleArray< T >::rebuild ( )

Rebuild the neighbor table, i.e. relocate particles to the appropriate gridpoints and exchange boundary particles with neighboring nodes. No (geometric) resizing done.

template<typename T >
void ParallelParticleArray< T >::saveCheckPointData ( std::ostream &  ost)

save checkpoint data into an ostream

Parameters
ostthe output stream

References BasicCon::Debug().

Here is the call graph for this function:


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