SSAGES  0.8.3
Software Suite for Advanced General Ensemble Simulations
Constraint.h
1 
21 #pragma once
22 
23 #include "../EventListener.h"
24 #include "../Snapshot.h"
25 #include <boost/mpi.hpp>
26 
27 // Forward declare.
28 namespace Json {
29  class Value;
30 }
31 
32 namespace SSAGES
33 {
34  // Forward declare.
35  class Constraint;
36 
38  using ConstraintList = std::vector<Constraint*>;
39 
41  class Constraint : public EventListener, public Serializable
42  {
43  protected:
45  boost::mpi::communicator comm_;
46 
47  public:
49 
55  Constraint(unsigned int frequency,
56  boost::mpi::communicator& comm) :
57  EventListener(frequency), comm_(comm){}
58 
60  virtual ~Constraint(){}
61 
63 
67  virtual void PreSimulation(Snapshot* snapshot, const CVList& cvs) override = 0;
68 
70 
74  virtual void PostIntegration(Snapshot* snapshot, const CVList& cvs) override = 0;
75 
77 
81  virtual void PostSimulation(Snapshot* snapshot, const CVList& cvs) override = 0;
82 
84 
97  static Constraint* BuildConstraint(const Json::Value& json,
98  boost::mpi::communicator& comm);
99 
101 
108  static Constraint* BuildConstraint(const Json::Value& json,
109  boost::mpi::communicator& comm,
110  const std::string& path);
111 
113 
123  static void BuildConstraint(const Json::Value& json,
124  ConstraintList& clist,
125  boost::mpi::communicator& comm,
126  const std::string& path);
127  };
128 }
Base abstract class for listening in to events fired by "Hook".
Definition: EventListener.h:34
boost::mpi::communicator comm_
MPI global communicator.
Definition: Constraint.h:45
std::vector< CollectiveVariable * > CVList
List of Collective Variables.
Definition: types.h:51
Class containing a snapshot of the current simulation in time.
Definition: Snapshot.h:43
std::vector< Constraint * > ConstraintList
List of Constraints.
Definition: Constraint.h:38
virtual ~Constraint()
Destructor.
Definition: Constraint.h:60
Constraint(unsigned int frequency, boost::mpi::communicator &comm)
Constructor.
Definition: Constraint.h:55
Interface for Constraint implementations.
Definition: Constraint.h:41