#include <FrameWriterInterceptor.h>
Definition at line 8 of file FrameWriterInterceptor.h.
◆ FrameWriterInterceptor()
FrameWriterInterceptor::FrameWriterInterceptor |
( |
OutputFormat |
output_format, |
|
|
int |
fps, |
|
|
int |
video_length |
|
) |
| |
Construct a new Save File Interceptor object.
Definition at line 9 of file FrameWriterInterceptor.cpp.
13 throw std::runtime_error(
"FPS must be positive");
17 throw std::runtime_error(
"Video length must be positive");
OutputFormat output_format
static std::shared_ptr< spdlog::logger > logger
Publically accessible shared pointer to the logger.
◆ logSummary()
void FrameWriterInterceptor::logSummary |
( |
int |
depth | ) |
const |
|
overridevirtual |
Logs the summary of the thermostat.
Implements SimulationInterceptor.
Definition at line 44 of file FrameWriterInterceptor.cpp.
45 std::string indent = std::string(depth * 2,
' ');
49 std::string output_format_s =
50 std::find_if(supported_output_formats.begin(), supported_output_formats.end(), [
this](
const auto& format) {
51 return format.second == output_format;
55 Logger::logger->info(
"{}║ ┌Output format: {}", indent, output_format_s);
const std::string ansi_end
const std::string ansi_orange_bold
◆ onSimulationEnd()
void FrameWriterInterceptor::onSimulationEnd |
( |
size_t |
iteration, |
|
|
Simulation & |
simulation |
|
) |
| |
|
overridevirtual |
This function saves the final state of the simulation.
- Parameters
-
iteration | The current iteration |
simulation | The simulation object |
Implements SimulationInterceptor.
Definition at line 39 of file FrameWriterInterceptor.cpp.
std::unique_ptr< FileOutputHandler > file_output_handler
std::unique_ptr< ParticleContainer > particle_container
Reference to the ParticleContainer on whose content the simulation is performed.
◆ onSimulationStart()
void FrameWriterInterceptor::onSimulationStart |
( |
Simulation & |
simulation | ) |
|
|
overridevirtual |
This function saves the initial state of the simulation.
- Parameters
-
simulation | The simulation object |
Implements SimulationInterceptor.
Definition at line 21 of file FrameWriterInterceptor.cpp.
size_t every_nth_iteration
double delta_t
Time step of a single simulation iteration.
size_t start_iteration
Start iteration of the simulation.
double end_time
End time of the simulation.
const SimulationParams & params
Reference to the simulation parameters object.
◆ operator std::string()
FrameWriterInterceptor::operator std::string |
( |
| ) |
const |
|
explicitoverridevirtual |
The string representation of this interceptor.
- Returns
- std::string
This is used to write the final summary of the Interceptors to the console.
Implements SimulationInterceptor.
Definition at line 60 of file FrameWriterInterceptor.cpp.
std::string to_string(const Container &container, const std::string &delimiter=", ", const std::array< std::string, 2 > &surround={"[", "]"})
◆ operator()()
void FrameWriterInterceptor::operator() |
( |
size_t |
iteration, |
|
|
Simulation & |
simulation |
|
) |
| |
|
overridevirtual |
This function is called on every nth iteration. It writes the current state of the simulation to a file.
- Parameters
-
iteration | The current iteration |
simulation | The simulation object |
Implements SimulationInterceptor.
Definition at line 34 of file FrameWriterInterceptor.cpp.
◆ file_counter
size_t FrameWriterInterceptor::file_counter = 0 |
|
private |
◆ file_output_handler
◆ fps
size_t FrameWriterInterceptor::fps |
|
private |
◆ output_format
◆ video_length
size_t FrameWriterInterceptor::video_length |
|
private |
The documentation for this class was generated from the following files: