Gromacs
2025-dev-20241003-bd59e46
|
#include <gromacs/modularsimulator/simulatoralgorithm.h>
Builder for ModularSimulatorAlgorithm objects.
This builds a ModularSimulatorAlgorithm.
Users can add elements and define their call order by calling the templated add<Element> function. Note that only elements that have a static getElementPointerImpl factory method can be built in that way.
Note that each ModularSimulatorAlgorithmBuilder can only be used to build one ModularSimulatorAlgorithm object, i.e. build() can only be called once. During the call to build, all elements and other infrastructure objects will be moved to the built ModularSimulatorAlgorithm object, such that further use of the builder would not make sense. Any access to the build or add<> methods after the first call to build() will result in an exception being thrown.
Public Member Functions | |
ModularSimulatorAlgorithmBuilder (compat::not_null< LegacySimulatorData * > legacySimulatorData, std::unique_ptr< ReadCheckpointDataHolder > checkpointDataHolder) | |
Constructor. | |
ModularSimulatorAlgorithm | build () |
Build algorithm. | |
template<typename Element , typename... Args> | |
void | add (Args &&...args) |
Add element to the modular simulator algorithm builder. More... | |
Friends | |
class | ModularSimulatorAlgorithmBuilderHelper |
Allow access from helper. | |
void gmx::ModularSimulatorAlgorithmBuilder::add | ( | Args &&... | args | ) |
Add element to the modular simulator algorithm builder.
This function has a general implementation, which will call the getElementPointer(...) factory function.
Element | The element type |
Args | A variable number of argument types |
args | A variable number of arguments |