Simpatico  v1.10
ddMd/chemistry/Mask.h
1 #ifndef DDMD_MASK_H
2 #define DDMD_MASK_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 <util/global.h>
12 
13 namespace DdMd
14 {
15 
16  class Atom;
17 
31  class Mask
32  {
33 
34  public:
35 
36  /*
37  * Maximum number of masked atoms per parent atom.
38  */
39  static const int Capacity = 4;
40 
44  Mask();
45 
49  void clear();
50 
56  void append(int id);
57 
64  bool isMasked(int id) const;
65 
71  int operator [] (int i) const;
72 
76  int size() const;
77 
78  private:
79 
81  int atomIds_[Capacity];
82 
84  int size_;
85 
86  };
87 
88  // Inline methods
89 
90  /*
91  * Check if an Atom is masked.
92  */
93  inline bool Mask::isMasked(int id) const
94  {
95  for (int i=0; i < size_ ; ++i) {
96  if (atomIds_[i] == id) return true;
97  }
98  return false;
99  }
100 
101  /*
102  * Return the number of masked atoms for this parent Atom.
103  */
104  inline int Mask::size() const
105  { return size_; }
106 
107  /*
108  * Return value of atom index.
109  */
110  inline int Mask::operator[] (int i) const
111  {
112  assert(i >= 0);
113  assert(i < size_);
114  return atomIds_[i];
115  }
116 
117 }
118 #endif
Set of Atoms for which pair interactions with a parent Atom are "masked".
int operator[](int i) const
Return value of atom index number i.
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.
int size() const
Return the number of masked atoms.
bool isMasked(int id) const
True if the atom is in the masked set for the parent Atom.