Simpatico  v1.10
AtomDistributor.h
1 #ifndef DDMD_ATOM_DISTRIBUTOR_H
2 #define DDMD_ATOM_DISTRIBUTOR_H
3 
4 /*
5 * Simpatico - Simulation Package for Polymeric and Molecular Liquids
6 *
7 * Copyright 2010 - 2017, The Regents of the University of Minnesota
8 * Distributed under the terms of the GNU General Public License.
9 */
10 
11 #include <ddMd/chemistry/AtomArray.h> // member
12 #include <ddMd/chemistry/Atom.h> // member
13 #include <simp/boundary/Boundary.h> // typedef
14 #include <util/param/ParamComposite.h> // base class
15 #include <util/containers/ArrayStack.h> // member
16 #include <util/containers/DMatrix.h> // member
17 #include <util/containers/DArray.h> // member
18 
19 namespace DdMd
20 {
21 
22  class Domain;
23  class Buffer;
24  class AtomStorage;
25 
26  using namespace Util;
27  using namespace Simp;
28 
83  {
84 
85  public:
86 
91 
95  ~AtomDistributor();
96 
107  void associate(Domain& domain, Boundary& boundary,
108  AtomStorage& storage, Buffer& buffer);
109 
123  void setCapacity(int cacheCapacity);
124 
130  virtual void readParameters(std::istream& in);
131 
132  #ifdef UTIL_MPI
133 
141  void setup();
142  #endif
143 
154  Atom* newAtomPtr();
155 
182  int addAtom();
183 
184  #ifdef UTIL_MPI
185 
191  void send();
192 
201  void receive();
202  #endif
203 
214  int validate();
215 
216  private:
217 
222  AtomArray cache_;
223 
228  ArrayStack<Atom> reservoir_;
229 
230  #ifdef UTIL_MPI
231 
236  DMatrix<Atom*> sendArrays_;
237 
242  DArray<int> sendSizes_;
243  #endif
244 
248  Boundary* boundaryPtr_;
249 
253  Domain* domainPtr_;
254 
258  AtomStorage* storagePtr_;
259 
260  #ifdef UTIL_MPI
261 
264  Buffer* bufferPtr_;
265  #endif
266 
270  Atom* newPtr_;
271 
275  int cacheCapacity_;
276 
280  int sendCapacity_;
281 
286  int rankMaxSendSize_;
287 
292  int nCachedTotal_;
293 
298  int nSentTotal_;
299 
305  bool isAllocated_;
306 
315  void allocate();
316 
317  };
318 
319 }
320 #endif
An orthorhombic periodic unit cell.
A point particle in an MD simulation.
Parallel domain decomposition (DD) MD simulation.
Classes used by all simpatico molecular simulations.
void send(MPI::Comm &comm, T &data, int dest, int tag)
Send a single T value.
Definition: MpiSendRecv.h:97
An array of Atom objects.
Definition: AtomArray.h:40
Dynamically allocated Matrix.
Definition: DMatrix.h:24
Utility classes for scientific computation.
Definition: accumulators.mod:1
A stack of fixed capacity.
Definition: ArrayStack.h:25
A container for all the atoms and ghost atoms on this processor.
Buffer for interprocessor communication.
Definition: Buffer.h:217
Decomposition of the system into domains associated with processors.
Definition: Domain.h:31
An object that can read multiple parameters from file.
Class for distributing Atoms among processors.