Simpatico  v1.10
mcMd/chemistry/MaskPolicy.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 "MaskPolicy.h" // class header
9 
10 #ifdef UTIL_MPI
11 namespace Util
12 {
13 
17  MPI::Datatype MpiTraits<McMd::MaskPolicy>::type = MPI::INT;
19 
20 }
21 #endif
22 
23 namespace McMd
24 {
25 
26  using namespace Util;
27 
28  /*
29  * Extract a MaskPolicy from an istream as a string.
30  */
31  std::istream& operator>>(std::istream& in, MaskPolicy& policy)
32  {
33  std::string buffer;
34  in >> buffer;
35  if (buffer == "MaskNone" || buffer == "maskNone") {
36  policy = MaskNone;
37  } else
38  if (buffer == "MaskBonded" || buffer == "maskBonded") {
39  policy = MaskBonded;
40  } else {
41  UTIL_THROW("Invalid MaskPolicy string in operator >>");
42  }
43  return in;
44  }
45 
46  /*
47  * Insert a MaskPolicy to an ostream as a string.
48  */
49  std::ostream& operator<<(std::ostream& out, MaskPolicy policy)
50  {
51  if (policy == MaskNone) {
52  out << "MaskNone";
53  } else
54  if (policy == MaskBonded) {
55  out << "MaskBonded";
56  } else {
57  std::cout << "Invalid MaskPolicy value on input" << std::endl;
58  //UTIL_THROW("Unrecognized value for MaskPolicy in operator <<.");
59  }
60  return out;
61  }
62 
63 }
MaskPolicy
Enumeration of policies for suppressing ("masking") some pair interactions.
static MPI::Datatype type
MPI Datatype.
std::ostream & operator<<(std::ostream &out, const Pair< Data > &pair)
Output a Pair to an ostream, without line breaks.
Definition: Pair.h:57
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Definition: global.h:51
std::istream & operator>>(std::istream &in, Pair< Data > &pair)
Input a Pair from an istream.
Definition: Pair.h:44
Utility classes for scientific computation.
Definition: accumulators.mod:1
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
static bool hasType
Is the MPI type initialized?