SSAGES  0.1
A MetaDynamics Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
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<uint> cvmask_;
51 
52  public:
54 
61  Method(uint 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  void SetCVMask(const std::vector<uint>& mask)
94  {
95  cvmask_ = mask;
96  }
97 
99 
112  static Method* BuildMethod(const Json::Value& json,
113  const MPI_Comm& world,
114  const MPI_Comm& comm,
115  const std::string& path);
116 
118  virtual ~Method()
119  {
120  }
121  };
122 }
Base abstract class for listening in to events fired by "Hook".
Definition: EventListener.h:34
Collective variable manager.
Definition: CVManager.h:40
virtual ~Method()
Destructor.
Definition: Method.h:118
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:43
mxx::comm comm_
Local MPI communicator.
Definition: Method.h:47
Interface for Method implementations.
Definition: Method.h:43
mxx::comm world_
Global MPI communicator.
Definition: Method.h:46
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.
Method(uint frequency, const MPI_Comm &world, const MPI_Comm &comm)
Constructor.
Definition: Method.h:61
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:38
std::vector< uint > cvmask_
Mask which identifies which CVs to act on.
Definition: Method.h:50
void SetCVMask(const std::vector< uint > &mask)
Sets the collective variable mask.
Definition: Method.h:93