17 std::filesystem::path
constructOutputPath(
const std::filesystem::path& base_path,
const std::string& name) {
18 auto base = base_path;
24 return std::filesystem::absolute(base) / name;
28 const std::variant<DirectSumType, LinkedCellsType>& container_type,
29 const std::vector<std::shared_ptr<SimulationInterceptor>>& interceptors,
30 const std::vector<std::shared_ptr<SimpleForceSource>>& simple_forces,
31 const std::vector<std::shared_ptr<PairwiseForceSource>>& pairwise_forces,
32 const std::vector<std::shared_ptr<TargettedForceSource>>& targetted_forces,
bool fresh,
33 const std::filesystem::path& base_path,
size_t start_iteration)
34 : input_file_path(std::filesystem::absolute(input_file_path)),
37 interceptors(interceptors),
38 container_type(container_type),
39 simple_forces(simple_forces),
40 pairwise_forces(pairwise_forces),
41 targetted_forces(targetted_forces),
43 start_iteration(start_iteration) {
46 throw std::runtime_error(
"End time must be positive");
50 throw std::runtime_error(
"Delta t must be positive");
61 std::string indent = std::string(depth * 2,
' ');
63 std::string force_names =
66 [](
const std::string& acc,
const std::shared_ptr<SimpleForceSource>& force) { return acc + std::string(*force) +
", "; }) +
69 [](
const std::string& acc,
const std::shared_ptr<PairwiseForceSource>& force) { return acc + std::string(*force) +
", "; });
71 Logger::logger->info(
"{}╔════════════════════════════════════════", indent);
88 if (std::holds_alternative<SimulationParams::LinkedCellsType>(
container_type)) {
89 auto lc_container = std::get<SimulationParams::LinkedCellsType>(
container_type);
95 Logger::logger->info(
"{}║ Domain size: {} x {} x {}", indent, domain_size[0], domain_size[1], domain_size[2]);
96 Logger::logger->info(
"{}║ Cutoff radius: {}", indent, lc_container.cutoff_radius);
97 Logger::logger->info(
"{}║ ┌Left: {}", indent, LC::boundaryConditionToString(lc_container.boundary_conditions[0]));
98 Logger::logger->info(
"{}║ ├Right: {}", indent, LC::boundaryConditionToString(lc_container.boundary_conditions[1]));
99 Logger::logger->info(
"{}║ ├Bottom: {}", indent, LC::boundaryConditionToString(lc_container.boundary_conditions[2]));
100 Logger::logger->info(
"{}║ ├Top: {}", indent, LC::boundaryConditionToString(lc_container.boundary_conditions[3]));
101 Logger::logger->info(
"{}║ ├Back: {}", indent, LC::boundaryConditionToString(lc_container.boundary_conditions[4]));
102 Logger::logger->info(
"{}║ └Front: {}", indent, LC::boundaryConditionToString(lc_container.boundary_conditions[5]));
103 }
else if (std::holds_alternative<SimulationParams::DirectSumType>(
container_type)) {
107 throw std::runtime_error(
"Invalid container type");
115 interceptor->logSummary(depth);
123 Logger::logger->info(
"{}╚════════════════════════════════════════", indent);
const std::string ansi_yellow_bold
const std::string ansi_end
std::filesystem::path constructOutputPath(const std::filesystem::path &base_path, const std::string &name)
static size_t calculateHash(const std::filesystem::path &filepath)
Calculates the hash for the given input file.
Extension of the ParticleContainer class using a linked cells data structure for improved performance...
std::array< double, 3 > domain_size
Domain size in each dimension.
static std::shared_ptr< spdlog::logger > logger
Publically accessible shared pointer to the logger.
std::vector< std::shared_ptr< PairwiseForceSource > > pairwise_forces
Pairwise Forces to be applied to the particles.
size_t num_particles
Number of particles in the simulation.
double delta_t
Time step of a single simulation iteration.
std::vector< std::shared_ptr< SimulationInterceptor > > interceptors
List of interceptors to be used in the simulation.
bool fresh
Flag to indicate whether the simulation should be run from scratch, or whether cached data should be ...
std::filesystem::path output_dir_path
Path to the directory in which to save the simulation output.
SimulationParams(const std::filesystem::path &input_file_path, double delta_t, double end_time, const std::variant< DirectSumType, LinkedCellsType > &container_type, const std::vector< std::shared_ptr< SimulationInterceptor >> &interceptors, const std::vector< std::shared_ptr< SimpleForceSource >> &simple_forces, const std::vector< std::shared_ptr< PairwiseForceSource >> &pairwise_forces, const std::vector< std::shared_ptr< TargettedForceSource >> &targetted_forces, bool fresh=false, const std::filesystem::path &base_path="./output", size_t start_iteration=0)
Construct a new SimulationParams object.
std::filesystem::path input_file_path
Path to the input file of the simulation.
std::size_t input_file_hash
Hash of the input file of the simulation.
size_t start_iteration
Start iteration of the simulation.
std::vector< std::shared_ptr< SimpleForceSource > > simple_forces
Simple Forces to be applied to the particles.
void logSummary(int depth=0) const
Prints a summary of the simulation parameters to the console.
std::variant< DirectSumType, LinkedCellsType > container_type
Type of the particle container.
double end_time
End time of the simulation.