Molecular Dynamics Simulation  1.0
SimulationParams.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <filesystem>
4 #include <memory>
5 #include <optional>
6 #include <string>
7 #include <tuple>
8 #include <variant>
9 #include <vector>
10 
16 
23  public:
27  struct DirectSumType {
28  explicit operator std::string() const { return "DirectSum"; }
29  };
30 
34  struct LinkedCellsType {
35  std::array<double, 3> domain_size;
36  double cutoff_radius;
37  std::array<LinkedCellsContainer::BoundaryCondition, 6> boundary_conditions;
38 
39  LinkedCellsType() = delete;
40  LinkedCellsType(const std::array<double, 3>& domain_size, double cutoff_radius,
41  const std::array<LinkedCellsContainer::BoundaryCondition, 6>& boundary_conditions)
43 
44  explicit operator std::string() const {
45  return "LinkedCells ([" + std::to_string(domain_size[0]) + "x" + std::to_string(domain_size[1]) + "x" +
53  }
54  };
55 
59  std::filesystem::path input_file_path;
60 
64  std::size_t input_file_hash;
65 
69  std::filesystem::path output_dir_path;
70 
74  double delta_t;
75 
79  double end_time;
80 
84  std::vector<std::shared_ptr<SimulationInterceptor>> interceptors;
85 
89  std::variant<DirectSumType, LinkedCellsType> container_type;
90 
94  std::vector<std::shared_ptr<SimpleForceSource>> simple_forces;
95 
99  std::vector<std::shared_ptr<PairwiseForceSource>> pairwise_forces;
100 
104  std::vector<std::shared_ptr<TargettedForceSource>> targetted_forces;
105 
110 
114  bool fresh;
115 
120 
137  SimulationParams(const std::filesystem::path& input_file_path, double delta_t, double end_time,
138  const std::variant<DirectSumType, LinkedCellsType>& container_type,
139  const std::vector<std::shared_ptr<SimulationInterceptor>>& interceptors,
140  const std::vector<std::shared_ptr<SimpleForceSource>>& simple_forces,
141  const std::vector<std::shared_ptr<PairwiseForceSource>>& pairwise_forces,
142  const std::vector<std::shared_ptr<TargettedForceSource>>& targetted_forces, bool fresh = false,
143  const std::filesystem::path& base_path = "./output", size_t start_iteration = 0);
144 
149  void logSummary(int depth = 0) const;
150 };
static std::string boundaryConditionToString(const BoundaryCondition &bc)
Returns a string description of a boundary condition.
Contains all parameters needed to run a simulation.
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::vector< std::shared_ptr< TargettedForceSource > > targetted_forces
Targetted Forces to be applied to the particles.
std::variant< DirectSumType, LinkedCellsType > container_type
Type of the particle container.
double end_time
End time of the simulation.
std::string to_string(const Container &container, const std::string &delimiter=", ", const std::array< std::string, 2 > &surround={"[", "]"})
Definition: ArrayUtils.h:97
Struct to specify the type of the particle container as DirectSumType.
Struct to specify the type of the particle container as LinkedCellsType (needs domain_size and cutoff...
std::array< double, 3 > domain_size
std::array< LinkedCellsContainer::BoundaryCondition, 6 > boundary_conditions
LinkedCellsType(const std::array< double, 3 > &domain_size, double cutoff_radius, const std::array< LinkedCellsContainer::BoundaryCondition, 6 > &boundary_conditions)