MolSim
Loading...
Searching...
No Matches
Arguments.h
Go to the documentation of this file.
1
9#pragma once
10#include "CellUtils.h"
11#include <array>
12#include <bitset>
13#include <cmath>
14#include <iostream>
15#include <limits>
16#include <sstream>
17#include <string>
18
20enum class WriterType { VTK, XYZ, NIL };
21
23enum class SimulationType { GRAVITY, LJ };
24
27
31struct Arguments {
33 double startTime{};
35 double endTime{};
37 double delta_t{};
39 int itFreq{10};
41 std::array<double, 3> domainSize{INFINITY, INFINITY, INFINITY};
43 double cutoffRadius{3.0};
45 double gravity{0.0};
47 std::string basename{};
55 bool linkedCells{true};
61 size_t dimensions{2};
63 bool membrane{false};
66 std::bitset<4> argsSet{0b0000};
69 std::string toString() const;
70
80 inline bool operator==(const Arguments &other) const {
81 return startTime == other.startTime && endTime == other.endTime && delta_t == other.delta_t &&
82 itFreq == other.itFreq && domainSize == other.domainSize && cutoffRadius == other.cutoffRadius &&
83 gravity == other.gravity && basename == other.basename && type == other.type && sim == other.sim &&
85 conditions == other.conditions && dimensions == other.dimensions;
86 }
87};
88
96static inline std::ostream &operator<<(std::ostream &stream, const Arguments &args) {
97 return (stream << "{ t_0: " << args.startTime << ", t_end: " << args.endTime << ", dt: " << args.delta_t
98 << ", itFreq: " << args.itFreq << " }");
99}
100
101/* toString implementation */
102inline std::string Arguments::toString() const {
103 std::stringstream ss;
104 ss << (*this);
105 return ss.str();
106}
static std::ostream & operator<<(std::ostream &stream, const Arguments &args)
Overload of the << operator for passing an Arguments struct to an output stream.
Definition Arguments.h:96
ParallelizationType
Enum containing each possible parallelization strategy.
Definition Arguments.h:26
SimulationType
Enum containg each possible Simulation to be performed.
Definition Arguments.h:23
WriterType
Enum containing each (valid) type of output writer.
Definition Arguments.h:20
Utility functions for Cell and CellContainer objects.
Enumeration class corresponding to the type schema type.
Definition vtk-unstructured.h:2125
Struct containing each option configurable via command line arguments.
Definition Arguments.h:31
double endTime
End time of a simulation (default: simulation-specific).
Definition Arguments.h:35
double gravity
The gravity that the particles are exposed to (default: 0).
Definition Arguments.h:45
ParallelizationType parallelization
Parallelization type (default: coarse-grained).
Definition Arguments.h:53
std::bitset< 4 > argsSet
Bitset containing flags, whether startTime (0), endTime (1), delta_t (2) and basename (3) have been m...
Definition Arguments.h:66
WriterType type
Output type (default: VTK).
Definition Arguments.h:49
std::array< BoundaryCondition, 6 > conditions
The type of condition to be applied at each boundary (default: outflow)
Definition Arguments.h:57
int itFreq
Logging frequency (default: every 10 iterations)
Definition Arguments.h:39
size_t dimensions
The dimensions of the simulation, either 2 or 3 (default: 2).
Definition Arguments.h:61
std::string basename
The basename of the output file (default: type-specific).
Definition Arguments.h:47
double cutoffRadius
Cutoff radius for linked cells (default: 3.0)
Definition Arguments.h:43
bool operator==(const Arguments &other) const
Overload of the equality operator. Checks if two Arguments structs contain the same values.
Definition Arguments.h:80
bool membrane
Determines, whether the simulation is a membrane simulation or not.
Definition Arguments.h:63
std::array< double, 3 > domainSize
Domain size for linked cells (default: unspecified, will fail if not specified!)
Definition Arguments.h:41
bool linkedCells
Decide, whether or not to use the linked cell method (default: true)
Definition Arguments.h:55
std::string toString() const
Returns a string representation of the struct.
Definition Arguments.h:102
double delta_t
Duration of a timestep (default: simulation-specific).
Definition Arguments.h:37
SimulationType sim
Simulation type (default: LJ).
Definition Arguments.h:51
double startTime
Start time of a simulation (default: simulation-specific).
Definition Arguments.h:33