Position diff hook¶
-
class mdk::PositionDiff : public mdk::Hook, private mdk::SimulVar
A hook which saves position diffs. I assume this takes the path to the positions as outputted by the Fortran implementation and compares the positions in the consecutive steps with the current positions, whereafter it outputs the diffs to the
outputPath
.Public Functions
-
inline PositionDiff(std::string inputPath, std::string const &outputPath)
Create a
PositionDiff
object with given input and output paths.- Parameters
inputPath – Path to the file with Fortran positions.
outputPath – Path to the diff file to create.
-
virtual void bind(Simulation &simulation) override
Bind the hook to the simulation; also fetch the state and load the reference positions.
- Parameters
simulation –
-
virtual void execute(int step_nr) override
Execute the hook, i.e. output the diffs for the current step to the diff file.
- Parameters
step_nr – Number of the step of the simulation at which the hook was invoked.
Private Members
-
std::string inputPath
A path to the Fortran reference positions file.
-
std::ofstream output
Position diffs output stream.
-
std::map<int, Vectors> refPositions
Reference positions loaded from the file at
inputPath
, in the form of a map from the step number to a list of positions.
-
State const *state = nullptr
Saved const pointer to the state of the simulation.
-
inline PositionDiff(std::string inputPath, std::string const &outputPath)