-
Notifications
You must be signed in to change notification settings - Fork 12
Parameter Updatable
A parameter communication interface, anything that inherits from ParameterUpdatable can be called through a series of update* methods to communicate a parameter change. Parameters related with the particle's data are communicated using ParticleData[1] (like number of particles).
Parameters like a simulation box or the current simulation time are updated through ParameterUpdatable. See utils/ParameterUpdatable.h for a list of parameters handled by this interface.
Interactors are ParameterUpdatable objects by default.
If a module needs to be aware of a parameter change, it should define the particular update method. Which will do nothing by default.
If a module needs to delegate the ParameterUpdatable behavior to a member (i.e ExternalForces to the provided potential) it must then inherit from ParameterUpdatableDelegate and call setDelegate(&member). From that moment, calls to update*() will be called on member.
This will work (although will do nothing) even when member is not ParameterUpdatable (through SFINAE).
Example of a class that is ParameterUpdatable:
class User: public ParameterUpdatable{
Box myBox;
real time;
public:
User(){}
virtual void updateBox(Box newBox) override{
myBox = newBox;
}
virtual void updateSimulationTime(real newtime) override{
time = newtime;
}
//All the other update* functions do not need to be overrided, calls to them on User will just be ignored.
};
To update some parameter of some ParameterUpdatable entity:
//Imagine an Integrator wants to inform all its interactors of the current simulation time after a step
time += dt;
for(auto inte: interactors) inte->updateSimulationTime(time);
//Now all its interactors have been informed of the new simulation time. Some will do something with this information, some will just ignore the function call, which is the default behavior.
Integrators will call update* on its Interactors with every parameter that changes during the course of the simulation. That means that, among other things, the first thing happening at each step will typically be a call to updateSimulationTime() for each interactor.
Sometimes a certain User class may not be ParameterUpdatable itself, but would rather pass the ParameterUpdatable behavior to a member. In this case User will be a ParameterUpdatableDelegate. From the outside the User class will appear to be ParameterUpdatable, but the functionality will be redirected to a certain member.
Here you have an example of a class that is ParameterUpdatableDelegate:
template<class Child>
class User: public ParameterUpdatableDelegate<Child>{
public:
User(shared_ptr<Child> child){
//This must be called to register a Child instance to call update* on
this->setDelegate(child);
}
//User may need to handle some update*,
//if an update* function is overrided in User it will have the priority over Child.
virtual void updateSimulationTime(real newtime) override{
time = newtime;
//Call the Child update function.
ParameterUpdatableDelegate<Child>::updateSimulationTime(newtime);
}
//All the other update* functions will be calls to the update* functions in Child. If an update* function is not present here nor in Child, the call will be ignored.
};
-
-
1. PairForces
2. NbodyForces
3. ExternalForces
4. BondedForces
5. AngularBondedForces
6. TorsionalBondedForces
7. Poisson (Electrostatics) -
-
MD (Molecular Dynamics)
1. VerletNVT
2. VerletNVE - BD Brownian Dynamics
-
BDHI Brownian Dynamics with Hydrodynamic Interactions
1. EulerMaruyama
1.1 BDHI_Cholesky Brownian displacements through Cholesky factorization.
1.2 BDHI_Lanczos Brownian displacements through Lanczos algorithm.
1.3 BDHI_PSE Positively Split Edwald.
1.4 BDHI_FCM Force Coupling Method. - DPD Dissipative Particle Dynamics
- SPH Smoothed Particle Hydrodynamics
-
Hydrodynamics
1. ICM Inertial Coupling Method.
2. FIB Fluctuating Immerse Boundary.
3. Quasi2D Quasi2D hydrodynamics
-
MD (Molecular Dynamics)
-
- 1. Neighbour Lists
-
1. Programming Tools
2. Utils
-
1. Transverser
2. Functor
3. Potential
-
1. Particle Data
2. Particle Group
3. System
4. Parameter updatable
-
1. Tabulated Function
2. Postprocessing tools
3. InputFile
4. Tests
5. Allocator
6. Temporary memory
7. Immersed Boundary (IBM)
-
1. NBody
2. Neighbour Lists
3. Python wrappers
- 1. Superpunto