1 #ifndef DDMD_ATOM_MAP_H 2 #define DDMD_ATOM_MAP_H 11 #include <ddMd/chemistry/Atom.h> 12 #include <util/containers/DArray.h> 13 #include <ddMd/chemistry/Group.h> 17 #include <unordered_map> 23 template <
typename T>
class ArraySet;
58 void allocate(
int totalAtomCapacity);
65 void addLocal(
Atom* ptr);
74 void removeLocal(
Atom* ptr);
81 void addGhost(
Atom* ptr);
91 void removeGhost(
Atom* ptr);
112 Atom* find(
int atomId)
const;
122 int nGhostDistinct()
const;
146 int findGroupLocalAtoms(
Group<N>& group)
const;
166 int findGroupGhostAtoms(
Group<N>& group)
const;
173 bool isValid()
const;
180 typedef std::unordered_multimap<int, Atom*> GhostMap;
182 typedef std::multimap<int, Atom*> GhostMap;
199 int totalAtomCapacity_;
230 inline Atom* AtomMap::find(
int atomId)
const 231 {
return atomPtrs_[atomId]; }
236 inline int AtomMap::nLocal()
const 242 inline int AtomMap::nGhostDistinct()
const 243 {
return nGhostDistinct_; }
248 inline int AtomMap::nGhost()
const 249 {
return nGhostDistinct_ + ghostMap_.size(); }
257 int AtomMap::findGroupLocalAtoms(
Group<N>& group)
const 261 for (
int i = 0; i < N; ++i) {
262 ptr = atomPtrs_[group.
atomId(i)];
265 assert(ptr->
id() == group.
atomId(i));
279 int AtomMap::findGroupGhostAtoms(
Group<N>& group)
const 283 for (
int i = 0; i < N; ++i) {
288 int atomId = group.
atomId(i);
289 ptr = atomPtrs_[atomId];
292 assert(ptr->
id() == atomId);
void setAtomPtr(int i, Atom *atomPtr)
Set the pointer to a specific atom.
Associative container for finding atoms identified by integer id.
File containing preprocessor macros for error handling.
Atom * atomPtr(int i) const
Get a pointer to a specific Atom.
A point particle in an MD simulation.
Parallel domain decomposition (DD) MD simulation.
int id() const
Get unique global index for this atom.
bool isGhost() const
Is this atom a ghost?
A container for pointers to a subset of elements of an associated array.
Utility classes for scientific computation.
Dynamically allocatable contiguous array template.
A group of covalently interacting atoms.
void clearAtomPtr(int i)
Clear the pointer to a specific atom.
int atomId(int i) const
Get the id for a specific atom in the Group.