Simpatico  v1.10
Plan.h
1 #ifndef DDMD_PLAN_H
2 #define DDMD_PLAN_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 <iostream>
12 
13 namespace DdMd
14 {
15 
45  class Plan
46  {
47 
48  public:
49 
55  Plan() :
56  flags_(0)
57  {}
58 
65  void setExchange(int i, int j)
66  { flags_ |= EMask[i][j]; }
67 
74  void clearExchange(int i, int j)
75  { flags_ &= (~EMask[i][j]); }
76 
83  void setGhost(int i, int j)
84  { flags_ |= GMask[i][j]; }
85 
92  void clearGhost(int i, int j)
93  { flags_ &= (~GMask[i][j]); }
94 
98  void setFlags(unsigned int flags)
99  { flags_ = flags; }
100 
104  void clearFlags()
105  { flags_ = 0; }
106 
113  bool exchange(int i, int j) const
114  { return bool(flags_ & EMask[i][j]); }
115 
122  bool ghost(int i, int j) const
123  { return bool(flags_ & GMask[i][j]); }
124 
128  unsigned int flags() const
129  { return flags_; }
130 
131  private:
132 
133  unsigned int flags_;
134 
136  static unsigned int EMask[3][2];
137 
139  static unsigned int GMask[3][2];
140 
141  //friends:
142 
143  friend std::istream& operator >> (std::istream& in, Plan &plan);
144  friend std::ostream& operator << (std::ostream& out, const Plan &plan);
145 
146  };
147 
155  std::istream& operator>>(std::istream& in, Plan &plan);
156 
166  std::ostream& operator<<(std::ostream& out, const Plan &plan);
167 
168 }
169 #endif
void setGhost(int i, int j)
Set ghost flag for direction i, j (set true).
Definition: Plan.h:83
unsigned int flags() const
Return raw flags unsigned int.
Definition: Plan.h:128
bool exchange(int i, int j) const
Get bool exchange flag for direction i, j.
Definition: Plan.h:113
bool ghost(int i, int j) const
Get ghost flag for direction i, j.
Definition: Plan.h:122
void setFlags(unsigned int flags)
Set all flags (contains all bits).
Definition: Plan.h:98
void clearFlags()
Clear all flags (set all to false, set flags_ = 0).
Definition: Plan.h:104
Parallel domain decomposition (DD) MD simulation.
void setExchange(int i, int j)
Set exchange flag for direction i, j (set true).
Definition: Plan.h:65
friend std::istream & operator>>(std::istream &in, Plan &plan)
istream extractor (>>) for a Plan.
Definition: Plan.cpp:22
void clearExchange(int i, int j)
Clear exchange flag for direction i, j (set false).
Definition: Plan.h:74
void clearGhost(int i, int j)
Clear ghost flag for direction i, j (set false).
Definition: Plan.h:92
Communication plan.
Definition: Plan.h:45
Plan()
Constructor.
Definition: Plan.h:55
friend std::ostream & operator<<(std::ostream &out, const Plan &plan)
ostream inserter (<<) for a Plan.
Definition: Plan.cpp:58