MaMiCo 1.2
Loading...
Searching...
No Matches
coupling::InstanceHandling< LinkedCell, dim > Class Template Reference

Simulation slots are managed (i.e., added/removed) via this class. Works and interacts with the class coupling::MultiMDMediator closely. More...

#include <InstanceHandling.h>

Public Member Functions

 InstanceHandling (simplemd::configurations::MolecularDynamicsConfiguration &mdConfig, coupling::configurations::MaMiCoConfiguration< dim > &mamicoConfig, tarch::utils::MultiMDService< dim > &multiMDService)
 
 ~InstanceHandling ()
 
void equilibrate (const unsigned int &t, const unsigned int &T)
 
auto & getSimpleMD () const
 
void setMDSolverInterface ()
 
auto & getMDSolverInterface () const
 
void switchOnCoupling ()
 
void switchOnCoupling (const unsigned int &i)
 
void switchOffCoupling ()
 
void switchOffCoupling (const unsigned int &i)
 
void simulateTimesteps (const unsigned int &t, unsigned int &T)
 
void writeCheckpoint (const std::string &filestem, const unsigned int &T) const
 
void simulateTimesteps (const unsigned int &t, unsigned int &T, coupling::services::MultiMDCellService< LinkedCell, dim > &multiMDCellService)
 
void simulateTimesteps (const unsigned int &t, unsigned int &T, const unsigned int &i)
 
void addSimulationBlock ()
 
void rmSimulationBlock ()
 
coupling::interface::MDSolverInterface< LinkedCell, dim > * addMDSimulation (unsigned int slot, unsigned int localIndex)
 
void rmMDSimulation (const unsigned int &index)
 
void setCouplingCellServices (coupling::services::MultiMDCellService< LinkedCell, dim > &multiMDCellService)
 

Private Attributes

std::vector< coupling::interface::MDSimulation * > _mdSimulations
 
std::vector< coupling::interface::MDSolverInterface< LinkedCell, dim > * > _mdSolverInterface
 
simplemd::configurations::MolecularDynamicsConfiguration & _mdConfig
 
coupling::configurations::MaMiCoConfiguration< dim > & _mamicoConfig
 
const tarch::utils::MultiMDService< dim > & _multiMDService
 

Detailed Description

template<class LinkedCell, unsigned int dim>
class coupling::InstanceHandling< LinkedCell, dim >

Simulation slots are managed (i.e., added/removed) via this class. Works and interacts with the class coupling::MultiMDMediator closely.

holds one vector of MDSimulation and one vector for MDSolverInterface. Initialization, execution of MD time steps and shutdown are abstracted into this class. In order to launch a new MF simulatio, a slot has to be chosen first (either manualy or using coupling::MultiMDMediator). Then MultiMDCellService initializes a new CouplingCellService via MultiMDMediator. In the activated slot, a new MD simulation is launched. The new MD instance has to be equilibrated first and then it can be coupled to the simulation. In order to remove a MD simulation, the MD simulation and its corresponding MDSolverInterface are shut down. Then, the respective instance of the CouplingCellService is removed. Finally, the selected slot will be set to inactive. This slot is now available again for the launch of a new MD instance in the future.

Template Parameters
LinkedCelltype of the cell
dimNumber of dimensions; it can be 1, 2 or 3
See also
see also coupling::MultiMDMediator
Author
Niklas Wittmer

Constructor & Destructor Documentation

◆ InstanceHandling()

template<class LinkedCell, unsigned int dim>
coupling::InstanceHandling< LinkedCell, dim >::InstanceHandling ( simplemd::configurations::MolecularDynamicsConfiguration & mdConfig,
coupling::configurations::MaMiCoConfiguration< dim > & mamicoConfig,
tarch::utils::MultiMDService< dim > & multiMDService )
inline

Constructor:

Parameters
mdConfig
mamicoConfig
multiMDService

◆ ~InstanceHandling()

template<class LinkedCell, unsigned int dim>
coupling::InstanceHandling< LinkedCell, dim >::~InstanceHandling ( )
inline

Destructor:

Member Function Documentation

◆ addMDSimulation()

template<class LinkedCell, unsigned int dim>
coupling::interface::MDSolverInterface< LinkedCell, dim > * coupling::InstanceHandling< LinkedCell, dim >::addMDSimulation ( unsigned int slot,
unsigned int localIndex )
inline

adds one MS instance with the identifier localIndex to the slot "slot" and return the corresponding MD solver interface. It initializes first an instance of the slot "slot". Then set the _mdSimulations[localIndex] to this new instance.

Parameters
slot
localIndex
Returns
_mdSolverInterface[localIndex]

◆ addSimulationBlock()

template<class LinkedCell, unsigned int dim>
void coupling::InstanceHandling< LinkedCell, dim >::addSimulationBlock ( )
inline

add a nullptr to the MD simulation vector and the vector of the MD solver interface.

◆ equilibrate()

template<class LinkedCell, unsigned int dim>
void coupling::InstanceHandling< LinkedCell, dim >::equilibrate ( const unsigned int & t,
const unsigned int & T )
inline

switches off the coupling between the new MD simulations and Macroscopic solver and lets the MD simulations run t time steps starting from the time step T to equilibrate. It should be called before switchOnCoupling()

Parameters
T
t

◆ getMDSolverInterface()

template<class LinkedCell, unsigned int dim>
auto & coupling::InstanceHandling< LinkedCell, dim >::getMDSolverInterface ( ) const
inline

Returns the MD solver onterface

Returns
_mdSolverInterface

◆ getSimpleMD()

template<class LinkedCell, unsigned int dim>
auto & coupling::InstanceHandling< LinkedCell, dim >::getSimpleMD ( ) const
inline

returns the vector of MD simulations

Returns
_mdSimulations

◆ rmMDSimulation()

template<class LinkedCell, unsigned int dim>
void coupling::InstanceHandling< LinkedCell, dim >::rmMDSimulation ( const unsigned int & index)
inline

removes one MS instance with the identifier index and delete the corresponding MD solver interface.

Parameters
index

◆ rmSimulationBlock()

template<class LinkedCell, unsigned int dim>
void coupling::InstanceHandling< LinkedCell, dim >::rmSimulationBlock ( )
inline

rempve the last element of the MD simulation vector and the last element of the vector of the MD solver interface.

◆ setCouplingCellServices()

template<class LinkedCell, unsigned int dim>
void coupling::InstanceHandling< LinkedCell, dim >::setCouplingCellServices ( coupling::services::MultiMDCellService< LinkedCell, dim > & multiMDCellService)
inline

sets single cell services in each MD simulation after initialising coupling cell service for multi-MD case

Parameters
multiMDCellService

◆ setMDSolverInterface()

template<class LinkedCell, unsigned int dim>
void coupling::InstanceHandling< LinkedCell, dim >::setMDSolverInterface ( )
inline

Allocates Coupling interfaces This method has to be called after switchOnCoupling()

◆ simulateTimesteps() [1/3]

template<class LinkedCell, unsigned int dim>
void coupling::InstanceHandling< LinkedCell, dim >::simulateTimesteps ( const unsigned int & t,
unsigned int & T )
inline

Simulates t timesteps starting from current timestep T on all instances.

Parameters
T
t

◆ simulateTimesteps() [2/3]

template<class LinkedCell, unsigned int dim>
void coupling::InstanceHandling< LinkedCell, dim >::simulateTimesteps ( const unsigned int & t,
unsigned int & T,
const unsigned int & i )
inline

Simulates t timesteps starting from current timestep T on all instances but only performs simulation on one particular instance

Parameters
t
T
i

◆ simulateTimesteps() [3/3]

template<class LinkedCell, unsigned int dim>
void coupling::InstanceHandling< LinkedCell, dim >::simulateTimesteps ( const unsigned int & t,
unsigned int & T,
coupling::services::MultiMDCellService< LinkedCell, dim > & multiMDCellService )
inline

Simulates t timesteps starting from current timestep T on all instances and additionally uses MamicoInterfaceProvider for interfacing MD to FD.

Parameters
t
T
multiMDCellService

◆ switchOffCoupling() [1/2]

template<class LinkedCell, unsigned int dim>
void coupling::InstanceHandling< LinkedCell, dim >::switchOffCoupling ( )
inline

switches off the coupling between All new MD simulations and Macroscopic solver.

◆ switchOffCoupling() [2/2]

template<class LinkedCell, unsigned int dim>
void coupling::InstanceHandling< LinkedCell, dim >::switchOffCoupling ( const unsigned int & i)
inline

switches off the coupling between a new MD simulation with the index i and Macroscopic solver.

Parameters
iindex number of the MD simulation

◆ switchOnCoupling() [1/2]

template<class LinkedCell, unsigned int dim>
void coupling::InstanceHandling< LinkedCell, dim >::switchOnCoupling ( )
inline

switches on the coupling between ALL new MD simulations and Macroscopic solver after the new MD instances are equilibrated. It should be called right after equilibrate() and before setMDSolverInterface()

◆ switchOnCoupling() [2/2]

template<class LinkedCell, unsigned int dim>
void coupling::InstanceHandling< LinkedCell, dim >::switchOnCoupling ( const unsigned int & i)
inline

switches on the coupling between a specific new MD simulation with the index number i and Macroscopic solver. It should be called right after equilibrate() and before setMDSolverInterface()

Parameters
i

◆ writeCheckpoint()

template<class LinkedCell, unsigned int dim>
void coupling::InstanceHandling< LinkedCell, dim >::writeCheckpoint ( const std::string & filestem,
const unsigned int & T ) const
inline

Saves the simulation result of the first MD instance as check point in the file filestem

Parameters
filestem
T

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