Simpatico  v1.10
Exchanger.h
1 #ifndef DDMD_EXCHANGER_H
2 #define DDMD_EXCHANGER_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/misc/DdTimer.h>
12 #include <util/space/IntVector.h>
13 #include <simp/boundary/Boundary.h>
14 #include <util/containers/FMatrix.h>
15 #include <util/containers/GPArray.h>
16 
17 
18 namespace DdMd
19 {
20 
21  class Domain;
22  class Atom;
23  class AtomStorage;
24  class Buffer;
25  class GroupExchanger;
26 
27  using namespace Util;
28  using namespace Simp;
29 
35  class Exchanger
36  {
37 
38  public:
39 
43  Exchanger();
44 
48  ~Exchanger();
49 
58  void associate(const Domain& domain, const Boundary& boundary,
59  AtomStorage& atomStorage, Buffer& buffer);
60 
66  void addGroupExchanger(GroupExchanger& groupExchanger);
67 
73  void allocate();
74 
80  void setPairCutoff(double pairCutoff);
81 
91  void exchange();
92 
101  void update();
102 
113  void reverseUpdate();
114 
118  void outputStatistics(std::ostream& out, double time, int nStep);
119 
123  DdTimer& timer();
124 
128  enum timeId {START, ATOM_PLAN, INIT_GROUP_PLAN, CLEAR_GHOSTS,
129  PACK_ATOMS, PACK_GROUPS, REMOVE_ATOMS,
130  SEND_RECV_ATOMS, UNPACK_ATOMS, UNPACK_GROUPS,
131  MARK_GROUP_GHOSTS, INIT_SEND_ARRAYS, PACK_GHOSTS,
132  SEND_RECV_GHOSTS, UNPACK_GHOSTS, FIND_GROUP_GHOSTS,
133  PACK_UPDATE, SEND_RECV_UPDATE, UNPACK_UPDATE,
134  LOCAL_UPDATE, PACK_FORCE, SEND_RECV_FORCE,
135  UNPACK_FORCE, LOCAL_FORCE, NTime};
136 
137  private:
138 
149  FMatrix< GPArray<Atom>, Dimension, 2> sendArray_;
150 
161  FMatrix< GPArray<Atom>, Dimension, 2> recvArray_;
162 
163  #ifdef UTIL_MPI
164 
169  GPArray<Atom> sentAtoms_;
170  #endif // UTIL_MPI
171 
174 
177 
180 
182  IntVector gridFlags_;
183 
185  const Boundary* boundaryPtr_;
186 
188  const Domain* domainPtr_;
189 
191  AtomStorage* atomStoragePtr_;
192 
194  GPArray<GroupExchanger> groupExchangers_;
195 
197  Buffer* bufferPtr_;
198 
200  double pairCutoff_;
201 
203  DdTimer timer_;
204 
212  void exchangeAtoms();
213 
222  void exchangeGhosts();
223 
227  void stamp(unsigned int timeId);
228 
229  };
230 
231  // Inline methods.
232 
233  // Return internal timer by reference (public).
235  { return timer_; }
236 
237  // Stamp internal timer (private)
238  inline void Exchanger::stamp(unsigned int timeId)
239  { timer_.stamp(timeId); }
240 
241 }
242 #endif
const int Dimension
Dimensionality of space.
Definition: Dimension.h:19
An orthorhombic periodic unit cell.
timeId
Enumeration of time stamp identifiers.
Definition: Exchanger.h:128
Parallel domain decomposition (DD) MD simulation.
Classes used by all simpatico molecular simulations.
void stamp(int id)
Mark end of interval id.
Definition: DdTimer.cpp:37
Utility classes for scientific computation.
Definition: accumulators.mod:1
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
DdTimer & timer()
Return internal timer by reference.
Definition: Exchanger.h:234
Class for exchanging Atoms, Ghosts and Groups between processors.
Definition: Exchanger.h:35
Interface for a GroupStorage<N> for use in Exchanger.
An IntVector is an integer Cartesian vector.
Definition: IntVector.h:73
Class for measuring time intervals.
Definition: DdTimer.h:24
An automatically growable PArray.
Definition: GPArray.h:28
Fixed Size Matrix.
Definition: FMatrix.h:28