SSAGES  0.8.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  void SetCVMask(const std::vector<unsigned int>& 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
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
std::vector< unsigned int > cvmask_
Mask which identifies which CVs to act on.
Definition: Method.h:50
Method(unsigned int frequency, const MPI_Comm &world, const MPI_Comm &comm)
Constructor.
Definition: Method.h:61
void SetCVMask(const std::vector< unsigned int > &mask)
Sets the collective variable mask.
Definition: Method.h:93