#include <DiffusionFunctionInterceptor.h>
◆ DiffusionFunctionInterceptor()
DiffusionFunctionInterceptor::DiffusionFunctionInterceptor |
( |
double |
sample_every_x_percent | ) |
|
|
inlineexplicit |
◆ calculateCurrentDiffusion()
double DiffusionFunctionInterceptor::calculateCurrentDiffusion |
( |
const Simulation & |
simulation | ) |
const |
|
private |
Definition at line 63 of file DiffusionFunctionInterceptor.cpp.
64 double total_displacement = 0;
70 std::array<double, 3> displacement = particle.getX() - old_particle_position;
73 if (std::holds_alternative<SimulationParams::LinkedCellsType>(simulation.
params.
container_type)) {
75 auto& box_size = container.domain_size;
77 for (
size_t i = 0; i < displacement.size(); i++) {
78 if (std::abs(displacement[i]) > box_size[i] / 2) {
79 displacement[i] = box_size[i] - std::abs(displacement[i]);
86 total_displacement += distance;
std::vector< std::array< double, 3 > > old_particle_positions
std::variant< DirectSumType, LinkedCellsType > container_type
Type of the particle container.
std::unique_ptr< ParticleContainer > particle_container
Reference to the ParticleContainer on whose content the simulation is performed.
const SimulationParams & params
Reference to the simulation parameters object.
auto L2Norm(const Container &c)
◆ logSummary()
void DiffusionFunctionInterceptor::logSummary |
( |
int |
depth | ) |
const |
|
overridevirtual |
Logs the summary of the radial distribution function.
Implements SimulationInterceptor.
Definition at line 47 of file DiffusionFunctionInterceptor.cpp.
48 std::string indent = std::string(depth * 2,
' ');
const std::string ansi_end
const std::string ansi_orange_bold
static std::shared_ptr< spdlog::logger > logger
Publically accessible shared pointer to the logger.
◆ onSimulationEnd()
void DiffusionFunctionInterceptor::onSimulationEnd |
( |
size_t |
iteration, |
|
|
Simulation & |
simulation |
|
) |
| |
|
overridevirtual |
This function is empty as the thermostat doesnt need to do anything at the end of the simulation.
- Parameters
-
iteration | The current iteration |
simulation | The simulation object |
Implements SimulationInterceptor.
Definition at line 40 of file DiffusionFunctionInterceptor.cpp.
std::unique_ptr< CSVWriter > csv_writer
double calculateCurrentDiffusion(const Simulation &simulation) const
size_t last_sampled_iteration
◆ onSimulationStart()
void DiffusionFunctionInterceptor::onSimulationStart |
( |
Simulation & |
simulation | ) |
|
|
overridevirtual |
This function is sets the particle_updates to 0 and initializes the start time of the simulation.
- Parameters
-
simulation | The simulation object |
Implements SimulationInterceptor.
Definition at line 10 of file DiffusionFunctionInterceptor.cpp.
15 csv_writer->initialize({
"iteration",
"var(t)"});
void saveCurrentParticlePositions(const Simulation &simulation)
size_t every_nth_iteration
double delta_t
Time step of a single simulation iteration.
std::filesystem::path output_dir_path
Path to the directory in which to save the simulation output.
size_t start_iteration
Start iteration of the simulation.
double end_time
End time of the simulation.
◆ operator std::string()
DiffusionFunctionInterceptor::operator std::string |
( |
| ) |
const |
|
explicitoverridevirtual |
◆ operator()()
void DiffusionFunctionInterceptor::operator() |
( |
size_t |
iteration, |
|
|
Simulation & |
simulation |
|
) |
| |
|
overridevirtual |
This function is called on every nth iteration. It counts the number of particle updates which have been performed.
- Parameters
-
iteration | The current iteration |
simulation | The simulation object |
Implements SimulationInterceptor.
Definition at line 27 of file DiffusionFunctionInterceptor.cpp.
29 throw std::runtime_error(
30 "Particle container size changed during simulation. This is not supported by the diffusion function interceptor.");
◆ saveCurrentParticlePositions()
void DiffusionFunctionInterceptor::saveCurrentParticlePositions |
( |
const Simulation & |
simulation | ) |
|
|
private |
◆ csv_writer
std::unique_ptr<CSVWriter> DiffusionFunctionInterceptor::csv_writer |
|
private |
◆ last_sampled_iteration
size_t DiffusionFunctionInterceptor::last_sampled_iteration = 0 |
|
private |
◆ old_particle_positions
std::vector<std::array<double, 3> > DiffusionFunctionInterceptor::old_particle_positions |
|
private |
◆ sample_every_x_percent
double DiffusionFunctionInterceptor::sample_every_x_percent |
|
private |
The documentation for this class was generated from the following files: