SSAGES  0.9.3
Software Suite for Advanced General Ensemble Simulations
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
SSAGES::EventListener Class Referenceabstract

Base abstract class for listening in to events fired by "Hook". More...

#include <EventListener.h>

Inheritance diagram for SSAGES::EventListener:
Inheritance graph
[legend]

Public Member Functions

 EventListener (unsigned int frequency)
 Constructor. More...
 
unsigned int GetFrequency () const
 Get frequency of event listener. More...
 
virtual void PreSimulation (Snapshot *snapshot, const class CVManager &cvmanager)=0
 Method call prior to simulation initiation. More...
 
virtual void PostIntegration (Snapshot *snapshot, const class CVManager &cvmanager)=0
 Method call post integration. More...
 
virtual void PostSimulation (Snapshot *snapshot, const class CVManager &cvmanager)=0
 Method call post simulation. More...
 
virtual ~EventListener ()
 Destructor.
 

Static Public Member Functions

static unsigned int GetWalkerID (const MPI_Comm &world, const MPI_Comm &comm)
 Get walker ID number of specified communicator. More...
 
static unsigned int GetNumWalkers (const MPI_Comm &world, const MPI_Comm &comm)
 Get total number of walkers in the simulation. More...
 
static bool IsMasterRank (const MPI_Comm &comm)
 Check if current processor is master. More...
 

Private Attributes

unsigned int frequency_
 Frequency for listening.
 

Detailed Description

Base abstract class for listening in to events fired by "Hook".

Definition at line 35 of file EventListener.h.

Constructor & Destructor Documentation

◆ EventListener()

SSAGES::EventListener::EventListener ( unsigned int  frequency)
inline

Constructor.

Parameters
frequencyFrequency for listening.

Definition at line 45 of file EventListener.h.

45  :
46  frequency_(frequency)
47  {
48  }
unsigned int frequency_
Frequency for listening.
Definition: EventListener.h:38

Member Function Documentation

◆ GetFrequency()

unsigned int SSAGES::EventListener::GetFrequency ( ) const
inline

Get frequency of event listener.

Returns
Frequency of event listener.

Definition at line 54 of file EventListener.h.

54 { return frequency_; }

References frequency_.

◆ GetNumWalkers()

static unsigned int SSAGES::EventListener::GetNumWalkers ( const MPI_Comm &  world,
const MPI_Comm &  comm 
)
inlinestatic

Get total number of walkers in the simulation.

Parameters
worldMPI communicator for the whole simulation.
commMPI communicator for the local walker.
Returns
Total number of walkers in the simulation.

Definition at line 100 of file EventListener.h.

101  {
102  return mxx::comm(world).size()/mxx::comm(comm).size();
103  }

◆ GetWalkerID()

static unsigned int SSAGES::EventListener::GetWalkerID ( const MPI_Comm &  world,
const MPI_Comm &  comm 
)
inlinestatic

Get walker ID number of specified communicator.

Parameters
worldMPI communicator for the whole simulation.
commMPI communicator for the local walker.
Returns
Walker ID number.

Definition at line 89 of file EventListener.h.

90  {
91  return mxx::comm(world).rank()/mxx::comm(comm).size();
92  }

◆ IsMasterRank()

static bool SSAGES::EventListener::IsMasterRank ( const MPI_Comm &  comm)
inlinestatic

Check if current processor is master.

Parameters
commMPI communicator to check.
Returns
Whether the current MPI rank is the first in the communicator.

Definition at line 110 of file EventListener.h.

111  {
112  return mxx::comm(comm).rank() == 0;
113  }

Referenced by SSAGES::DirectForwardFlux::CheckForInterfaceCrossings(), SSAGES::DirectForwardFlux::InitializeQueue(), SSAGES::ANN::PostIntegration(), and SSAGES::ANN::TrainNetwork().

Here is the caller graph for this function:

◆ PostIntegration()

virtual void SSAGES::EventListener::PostIntegration ( Snapshot snapshot,
const class CVManager cvmanager 
)
pure virtual

Method call post integration.

Parameters
snapshotPointer to the simulation snapshot.
cvmanagerCollective variable manager.

This function will be called at the end of each integration step.

Implemented in SSAGES::StringMethod, SSAGES::Method, SSAGES::ForwardFlux, SSAGES::Umbrella, SSAGES::Swarm, SSAGES::Meta, SSAGES::FiniteTempString, SSAGES::ElasticBand, SSAGES::DirectForwardFlux, SSAGES::CFF, SSAGES::BFS, SSAGES::ANN, SSAGES::ABF, and SSAGES::Logger.

◆ PostSimulation()

virtual void SSAGES::EventListener::PostSimulation ( Snapshot snapshot,
const class CVManager cvmanager 
)
pure virtual

Method call post simulation.

Parameters
snapshotPointer to the simulation snapshot.
cvmanagerCollective variable manager.

This function will be called after the simulation has finished.

Implemented in SSAGES::Method, SSAGES::Umbrella, SSAGES::StringMethod, SSAGES::Meta, SSAGES::ForwardFlux, SSAGES::CFF, SSAGES::BFS, SSAGES::ANN, SSAGES::ABF, and SSAGES::Logger.

◆ PreSimulation()

virtual void SSAGES::EventListener::PreSimulation ( Snapshot snapshot,
const class CVManager cvmanager 
)
pure virtual

Method call prior to simulation initiation.

Parameters
snapshotPointer to the simulation snapshot.
cvmanagerCollective variable manager.

This function will be called before the simulation is started.

Implemented in SSAGES::Method, SSAGES::Umbrella, SSAGES::StringMethod, SSAGES::Meta, SSAGES::ForwardFlux, SSAGES::CFF, SSAGES::BFS, SSAGES::ANN, SSAGES::ABF, and SSAGES::Logger.


The documentation for this class was generated from the following file: