SSAGES  0.9.3
Software Suite for Advanced General Ensemble Simulations
ResourceHandler.h
1 
20 #pragma once
21 
22 #include <mxx/comm.hpp>
23 #include <vector>
24 
25 // Forward declare.
26 namespace Json {
27  class Value;
28 }
29 
30 namespace SSAGES
31 {
32 
34 
45  {
46  private:
48  mxx::comm world_;
49 
51  mxx::comm comm_;
52 
54  size_t walkerid_;
55 
57  size_t nwalkers_;
58 
61 
63  std::vector<class Method*> methods_;
64 
66  class Logger* logger_;
67 
70 
72  class Hook* hook_;
73 
75  std::vector<std::string> inputs_;
76 
77  public:
79 
88  ResourceHandler(mxx::comm&& world, mxx::comm&& comm, size_t walkerid,
89  const std::vector<class Method*>& methods, class CVManager* cvmanager);
90 
92 
95  std::string GetInput() const
96  {
97  return inputs_[walkerid_];
98  }
99 
101 
104  MPI_Comm GetLocalComm() const
105  {
106  return comm_;
107  }
108 
110 
113  MPI_Comm GetWorldComm() const
114  {
115  return world_;
116  }
117 
119 
122  const mxx::comm& GetLocalMxxComm() const
123  {
124  return comm_;
125  }
126 
128 
131  const mxx::comm& GetWorldMxxComm() const
132  {
133  return world_;
134  }
135 
137 
140  size_t GetWalkerID() const
141  {
142  return walkerid_;
143  }
144 
146 
149  size_t GetNumWalkers() const
150  {
151  return nwalkers_;
152  }
153 
155 
158  void ConfigureHook(class Hook* hook);
159 
161 
168  static ResourceHandler* Build(const Json::Value& json, const MPI_Comm& world);
169 
172  };
173 }
Collective variable manager.
Definition: CVManager.h:43
Base class for hooks into the simultion engines.
Definition: Hook.h:36
Base class for logging SSAGES data.
Definition: Logger.h:42
Class that handles SSAGES resources for a simulation.
ResourceHandler(mxx::comm &&world, mxx::comm &&comm, size_t walkerid, const std::vector< class Method * > &methods, class CVManager *cvmanager)
Constructor.
size_t GetWalkerID() const
Returns processor-specific walker ID.
class Snapshot * snapshot_
Snapshot of system state (pointer).
size_t walkerid_
Walker ID for specific driver.
class CVManager * cvmanager_
Collective variable manager.
size_t nwalkers_
Number of walkers.
class Hook * hook_
Hook pointer.
std::vector< class Method * > methods_
Vector of advanced sampling methods.
mxx::comm comm_
MPI communicator containing processors for specific walker.
class Logger * logger_
CV logger.
void ConfigureHook(class Hook *hook)
Configure the Hook from given resources.
size_t GetNumWalkers() const
Returns the total number of walkers across all processors.
mxx::comm world_
MPI communicator containing all processors.
std::vector< std::string > inputs_
Input file vector.
MPI_Comm GetWorldComm() const
Returns world (all processors) MPI communicator.
static ResourceHandler * Build(const Json::Value &json, const MPI_Comm &world)
Build a new ResourceHandler from JSON.
std::string GetInput() const
Returns inputs of the walker for the current processor.
MPI_Comm GetLocalComm() const
Returns local (walker-specific) MPI communicator.
const mxx::comm & GetWorldMxxComm() const
Returns world (all processors) mxx communicator.
const mxx::comm & GetLocalMxxComm() const
Returns local (walker-specific) mxx communicator.
Class containing a snapshot of the current simulation in time.
Definition: Snapshot.h:48