SSAGES  0.9.3
Software Suite for Advanced General Ensemble Simulations
Hook.h
1 
21 #pragma once
22 
23 #include "EventListener.h"
24 #include <algorithm>
25 
26 namespace SSAGES
27 {
29 
35  class Hook
36  {
37  private:
39  std::vector<EventListener*> listeners_;
40 
43 
44  protected:
47 
49 
53  virtual void SyncToEngine() = 0;
54 
56 
60  virtual void SyncToSnapshot() = 0;
61 
62  public:
64 
68  Hook() :
69  listeners_(0), snapshot_(nullptr)
70  {}
71 
73 
76  void SetSnapshot(class Snapshot* snapshot);
77 
79 
82  void SetCVManager(class CVManager* cvmanager);
83 
85 
90  void AddListener(EventListener* listener);
91 
94 
96 
100  void PreSimulationHook();
101 
103 
108  void PostIntegrationHook();
109 
111 
117  {
118  }
119 
121 
125  void PostSimulationHook();
126 
128  virtual ~Hook(){}
129  };
130 }
Collective variable manager.
Definition: CVManager.h:43
Base abstract class for listening in to events fired by "Hook".
Definition: EventListener.h:36
Base class for hooks into the simultion engines.
Definition: Hook.h:36
virtual void SyncToEngine()=0
Synchronization to the simulation engine.
void SetCVManager(class CVManager *cvmanager)
Sets the current CV manager.
Definition: Hook.cpp:90
virtual ~Hook()
Destructor.
Definition: Hook.h:128
std::vector< EventListener * > listeners_
Vector of event listeners.
Definition: Hook.h:39
class Snapshot * snapshot_
Local snapshot.
Definition: Hook.h:46
void NotifyObservers()
Notify observers of changes in the simulation.
void PostSimulationHook()
Post-simulation hook.
Definition: Hook.cpp:67
class CVManager * cvmanager_
Collective variable manager.
Definition: Hook.h:42
Hook()
Constructor.
Definition: Hook.h:68
void AddListener(EventListener *listener)
Add a listener to the hook.
Definition: Hook.cpp:101
void SetSnapshot(class Snapshot *snapshot)
Sets the active snapshot.
Definition: Hook.cpp:84
void PostIntegrationHook()
Post-integration hook.
Definition: Hook.cpp:50
void PostStepHook()
Post-step hook.
Definition: Hook.h:116
void PreSimulationHook()
Pre-simulation hook.
Definition: Hook.cpp:30
virtual void SyncToSnapshot()=0
Synchronization to the snapshot.
Class containing a snapshot of the current simulation in time.
Definition: Snapshot.h:48