Simpatico  v1.10
List of all members | Public Member Functions
DdMd::AtomMap Class Reference

Detailed Description

Associative container for finding atoms identified by integer id.

Definition at line 36 of file AtomMap.h.

#include <AtomMap.h>

Public Member Functions

 AtomMap ()
 Constructor. More...
 
 ~AtomMap ()
 Destructor. More...
 
void allocate (int totalAtomCapacity)
 Set parameters, allocate memory and initialize. More...
 
void addLocal (Atom *ptr)
 Add local atom. More...
 
void removeLocal (Atom *ptr)
 Remove a specific Atom. More...
 
void addGhost (Atom *ptr)
 Add ghost atom. More...
 
void removeGhost (Atom *ptr)
 Remove a ghost Atom. More...
 
void clearGhosts (const ArraySet< Atom > &ghostSet)
 Clear all ghosts from this map. More...
 
Accessors
Atomfind (int atomId) const
 Return pointer to Atom with specified id. More...
 
int nLocal () const
 Return the number of local atoms. More...
 
int nGhostDistinct () const
 Return the number of ghosts with distinct ids. More...
 
int nGhost () const
 Return the number of ghosts, including images. More...
 
template<int N>
int findGroupLocalAtoms (Group< N > &group) const
 Set handles to local atoms in a Group<N> object. More...
 
template<int N>
int findGroupGhostAtoms (Group< N > &group) const
 Set handles to ghost atoms in a Group<N> object. More...
 
bool isValid () const
 Check validity of this AtomMap. More...
 

Constructor & Destructor Documentation

DdMd::AtomMap::AtomMap ( )

Constructor.

Definition at line 23 of file AtomMap.cpp.

DdMd::AtomMap::~AtomMap ( )

Destructor.

Definition at line 34 of file AtomMap.cpp.

Member Function Documentation

void DdMd::AtomMap::allocate ( int  totalAtomCapacity)

Set parameters, allocate memory and initialize.

Call this or (read|load)Parameters to initialize, but not both.

Parameters
totalAtomCapacitymax number of atoms on all processors.

Definition at line 40 of file AtomMap.cpp.

References UTIL_THROW.

Referenced by DdMd::AtomStorage::save().

void DdMd::AtomMap::addLocal ( Atom ptr)

Add local atom.

Parameters
ptrPointer to new Atom.

Definition at line 57 of file AtomMap.cpp.

References Util::Log::file(), DdMd::Atom::id(), DdMd::Atom::position(), and UTIL_THROW.

Referenced by DdMd::AtomStorage::addNewAtom().

void DdMd::AtomMap::removeLocal ( Atom ptr)

Remove a specific Atom.

Exceptions
Exceptionif atom is not present.
Parameters
ptrPointer to Atom to be removed.

Definition at line 83 of file AtomMap.cpp.

References Util::Log::file(), DdMd::Atom::id(), and UTIL_THROW.

Referenced by DdMd::AtomStorage::clearAtoms(), and DdMd::AtomStorage::removeAtom().

void DdMd::AtomMap::addGhost ( Atom ptr)

Add ghost atom.

Parameters
ptrPointer to new Atom.

Definition at line 120 of file AtomMap.cpp.

References DdMd::Atom::id(), and UTIL_THROW.

Referenced by DdMd::AtomStorage::addNewGhost().

void DdMd::AtomMap::removeGhost ( Atom ptr)

Remove a ghost Atom.

This function throws an exception if no atom with this id is present, but not if it does not match this pointer.

Parameters
ptrPointer to Atom to be removed.

Definition at line 139 of file AtomMap.cpp.

References DdMd::Atom::id(), and UTIL_THROW.

Referenced by DdMd::AtomStorage::removeGhost().

void DdMd::AtomMap::clearGhosts ( const ArraySet< Atom > &  ghostSet)

Clear all ghosts from this map.

Parameters
ghostSetSet containing all ghosts on this processor.

Definition at line 185 of file AtomMap.cpp.

References Util::PArray< Data >::begin(), Util::ConstPArrayIterator< Data >::get(), nGhost(), Util::ConstPArrayIterator< Data >::notEnd(), Util::PArray< Data >::size(), and UTIL_THROW.

Referenced by DdMd::AtomStorage::clearGhosts().

Atom * DdMd::AtomMap::find ( int  atomId) const
inline

Return pointer to Atom with specified id.

This function returns a pointer to an Atom with the specified id if it is present, or returns a null pointer otherwise.

Parameters
atomIdinteger index of atom

Definition at line 230 of file AtomMap.h.

Referenced by DdMd::GroupStorage< N >::isValid(), DdMd::AtomStorage::isValid(), DdMd::GroupStorage< N >::markGhosts(), and DdMd::ConfigIo::setAtomMasks().

int DdMd::AtomMap::nLocal ( ) const
inline

Return the number of local atoms.

Definition at line 236 of file AtomMap.h.

Referenced by DdMd::AtomStorage::clearAtoms().

int DdMd::AtomMap::nGhostDistinct ( ) const
inline

Return the number of ghosts with distinct ids.

Definition at line 242 of file AtomMap.h.

Referenced by DdMd::AtomStorage::clearGhosts().

int DdMd::AtomMap::nGhost ( ) const
inline

Return the number of ghosts, including images.

Definition at line 248 of file AtomMap.h.

Referenced by clearGhosts(), DdMd::AtomStorage::clearGhosts(), and DdMd::AtomStorage::isValid().

template<int N>
int DdMd::AtomMap::findGroupLocalAtoms ( Group< N > &  group) const

Set handles to local atoms in a Group<N> object.

On entry, group is a Group<N> object for which the atom ids for all N atoms in the Group have been set to valid values, in the range 0 <= atomId < totalAtomCapacity, but in which some or all pointers have not been set. The AtomMap may not contain any ghosts.

On exit, pointers are set correctly for all local atoms that exist in this AtomMap, or set to null for absent atoms. All old pointer values are overwritten.

Parameters
groupGroup<N> object with known atom ids.
Returns
number of atoms found on this processor.

Definition at line 257 of file AtomMap.h.

References DdMd::Group< N >::atomId(), DdMd::Group< N >::clearAtomPtr(), DdMd::Atom::id(), DdMd::Atom::isGhost(), and DdMd::Group< N >::setAtomPtr().

Referenced by DdMd::GroupDistributor< N >::add(), DdMd::GroupDistributor< N >::receive(), and DdMd::GroupStorage< N >::unpack().

template<int N>
int DdMd::AtomMap::findGroupGhostAtoms ( Group< N > &  group) const

Set handles to ghost atoms in a Group<N> object.

On entry, group is a Group<N> object for which the atom ids for all N atoms in the Group have been set to valid values, in the range 0 <= atomId < totalAtomCapacity, and in which all pointers to local atoms have been set, but in which no pointers to ghosts have been set. This function may only be called after all pointers have been set for all local atoms and after this AtomMap contains all ghost atoms.

On exit, pointers are set for all ghost atoms present in this AtomMap.

Parameters
groupGroup<N> object with known atom ids.
Returns
number of atoms found on this processor.

Definition at line 279 of file AtomMap.h.

References DdMd::Group< N >::atomId(), DdMd::Group< N >::atomPtr(), DdMd::Group< N >::clearAtomPtr(), DdMd::Atom::id(), DdMd::Atom::isGhost(), and DdMd::Group< N >::setAtomPtr().

Referenced by DdMd::GroupStorage< N >::findGhosts().

bool DdMd::AtomMap::isValid ( ) const

Check validity of this AtomMap.

Returns true if all is ok, or throws an Exception.

Definition at line 215 of file AtomMap.cpp.

References Util::Log::file(), DdMd::Atom::id(), and UTIL_THROW.

Referenced by DdMd::AtomStorage::isValid().


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