SSAGES  0.9.3
Software Suite for Advanced General Ensemble Simulations
Method.h
1 
21 #pragma once
22 
23 #include "../EventListener.h"
24 #include <mxx/comm.hpp>
25 
26 // Forward declare.
27 namespace Json {
28  class Value;
29 }
30 
31 namespace SSAGES
32 {
34 
43  class Method : public EventListener
44  {
45  protected:
46  mxx::comm world_;
47  mxx::comm comm_;
48 
50  std::vector<unsigned int> cvmask_;
51 
52  public:
54 
61  Method(unsigned int frequency, const MPI_Comm& world, const MPI_Comm& comm) :
62  EventListener(frequency), world_(world), comm_(comm), cvmask_()
63  {}
64 
66 
72  virtual void PreSimulation(Snapshot* snapshot, const class CVManager& cvmanager) override = 0;
73 
75 
81  virtual void PostIntegration(Snapshot* snapshot, const class CVManager& cvmanager) override = 0;
82 
84 
90  virtual void PostSimulation(Snapshot* snapshot, const class CVManager& cvmanager) override = 0;
91 
93 
99  void SetCVMask(const std::vector<unsigned int>& mask)
100  {
101  cvmask_ = mask;
102  }
103 
105 
118  static Method* BuildMethod(const Json::Value& json,
119  const MPI_Comm& world,
120  const MPI_Comm& comm,
121  const std::string& path);
122 
124  virtual ~Method()
125  {
126  }
127  };
128 }
Collective variable manager.
Definition: CVManager.h:43
Base abstract class for listening in to events fired by "Hook".
Definition: EventListener.h:36
Interface for Method implementations.
Definition: Method.h:44
mxx::comm comm_
Local MPI communicator.
Definition: Method.h:47
static Method * BuildMethod(const Json::Value &json, const MPI_Comm &world, const MPI_Comm &comm, const std::string &path)
Build a derived method from JSON node.
Definition: Method.cpp:40
std::vector< unsigned int > cvmask_
Mask which identifies which CVs to act on.
Definition: Method.h:50
void SetCVMask(const std::vector< unsigned int > &mask)
Sets the collective variable mask.
Definition: Method.h:99
virtual void PostSimulation(Snapshot *snapshot, const class CVManager &cvmanager) override=0
Method call post simulation.
virtual void PreSimulation(Snapshot *snapshot, const class CVManager &cvmanager) override=0
Method call prior to simulation initiation.
mxx::comm world_
Global MPI communicator.
Definition: Method.h:46
virtual ~Method()
Destructor.
Definition: Method.h:124
Method(unsigned int frequency, const MPI_Comm &world, const MPI_Comm &comm)
Constructor.
Definition: Method.h:61
virtual void PostIntegration(Snapshot *snapshot, const class CVManager &cvmanager) override=0
Method call post integration.
Class containing a snapshot of the current simulation in time.
Definition: Snapshot.h:48