Simpatico  v1.10
ddMd/chemistry/Mask.cpp
1 /*
2 * Simpatico - Simulation Package for Polymeric and Molecular Liquids
3 *
4 * Copyright 2010 - 2017, The Regents of the University of Minnesota
5 * Distributed under the terms of the GNU General Public License.
6 */
7 
8 #include "Mask.h"
9 #include "Atom.h"
10 #include <util/global.h>
11 
12 namespace DdMd
13 {
14 
15  using namespace Util;
16 
17  /*
18  * Constructor.
19  */
21  : size_(0)
22  {
23  for (int i=0; i < Capacity; ++i) {
24  atomIds_[i] = -1;
25  }
26  }
27 
28  /*
29  * Clear the mask, i.e., remove all Atoms.
30  */
31  void Mask::clear()
32  {
33  for (int i=0; i < Capacity; ++i) {
34  atomIds_[i] = -1;
35  }
36  size_ = 0;
37  }
38 
39  /*
40  * Add an an atom to the mask.
41  */
42  void Mask::append(int id)
43  {
44  if (size_ >= Capacity) {
45  UTIL_THROW("Too many masked partners for one Atom");
46  }
47  if (isMasked(id)) {
48  UTIL_THROW("Attempt to add an atom to a Mask twice");
49  }
50  atomIds_[size_] = id;
51  ++size_;
52  }
53 
54 }
void clear()
Clear the masked set (remove all atoms).
void append(int id)
Add an Atom to the masked set.
File containing preprocessor macros for error handling.
Parallel domain decomposition (DD) MD simulation.
Mask()
Constructor.
bool isMasked(int id) const
True if the atom is in the masked set for the parent Atom.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Definition: global.h:51
Utility classes for scientific computation.
Definition: accumulators.mod:1