SSAGES  0.8.5
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 }
Base abstract class for listening in to events fired by "Hook".
Definition: EventListener.h:35
Collective variable manager.
Definition: CVManager.h:42
virtual ~Method()
Destructor.
Definition: Method.h:124
Class containing a snapshot of the current simulation in time.
Definition: Snapshot.h:47
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:99