Molecular Dynamics Simulation  1.0
XSDToInternalTypeAdapter.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <string>
5 #include <variant>
6 #include <vector>
7 
8 #include "io/xml_schemas/checkpoint/checkpoint_schema.h"
9 #include "io/xml_schemas/simulation_input/simulation_input_schema.h"
15 #include "utils/Enums.h"
16 
21  public:
29  static CuboidSpawner convertToCuboidSpawner(const CuboidSpawnerType& cuboid, ThirdDimension third_dimension);
30 
38  static SoftBodyCuboidSpawner convertToSoftBodyCuboidSpawner(const SoftBodySpawnerType& soft_body_cuboid,
39  ThirdDimension third_dimension);
40 
48  static SphereSpawner convertToSphereSpawner(const SphereSpawnerType& sphere, ThirdDimension third_dimension);
49 
57  static CuboidSpawner convertToSingleParticleSpawner(const SingleParticleSpawnerType& particle, ThirdDimension third_dimension);
58 
67  static std::vector<std::shared_ptr<SimulationInterceptor>> convertToSimulationInterceptors(
68  const SimulationInterceptorsType& interceptors, ThirdDimension third_dimension,
69  std::variant<SimulationParams::DirectSumType, SimulationParams::LinkedCellsType> container_type);
70 
77  static std::variant<SimulationParams::DirectSumType, SimulationParams::LinkedCellsType> convertToParticleContainer(
78  const ParticleContainerType& container_type);
79 
86  static std::array<LinkedCellsContainer::BoundaryCondition, 6> convertToBoundaryConditionsArray(const BoundaryConditionsType& boundary);
87 
94  static LinkedCellsContainer::BoundaryCondition convertToBoundaryCondition(const BoundaryType& boundary);
95 
102  static Particle convertToParticle(const ParticleType& particle);
103 
111  static std::tuple<std::vector<std::shared_ptr<SimpleForceSource>>, std::vector<std::shared_ptr<PairwiseForceSource>>,
112  std::vector<std::shared_ptr<TargettedForceSource>>>
113  convertToForces(const ForcesType& forces,
114  const std::variant<SimulationParams::DirectSumType, SimulationParams::LinkedCellsType>& container_data);
115 
122  static std::array<double, 3> convertToVector(const DoubleVec3Type& vector);
123 
130  static std::array<int, 3> convertToVector(const IntVec3Type& vector);
131 
138  static std::tuple<long, double, double> convertToTuple(const ConnectedParticleEntryType& entry);
139 };
ThirdDimension
Enum class to define the dimension count of the simulation (2D or 3D). Affects primarily the dimensio...
Definition: Enums.h:7
Class to spawn particles in a cuboid. Implements the interface ParticleSpawner.
Definition: CuboidSpawner.h:15
BoundaryCondition
Boundary type enum for labeling the sides of the domain.
Class to represent a particle.
Definition: Particle.h:26
Class to spawn particles of a soft body in a cuboid. Implements the interface ParticleSpawner.
Class to spawn particles in a Sphere. Implements the interface ParticleSpawner.
Definition: SphereSpawner.h:15
Class to convert XSD types to internal types.
static SoftBodyCuboidSpawner convertToSoftBodyCuboidSpawner(const SoftBodySpawnerType &soft_body_cuboid, ThirdDimension third_dimension)
Converts a soft body cuboid from the XSD format to the internal format.
static SphereSpawner convertToSphereSpawner(const SphereSpawnerType &sphere, ThirdDimension third_dimension)
Converts a sphere from the XSD format to the internal format.
static std::tuple< std::vector< std::shared_ptr< SimpleForceSource > >, std::vector< std::shared_ptr< PairwiseForceSource > >, std::vector< std::shared_ptr< TargettedForceSource > > > convertToForces(const ForcesType &forces, const std::variant< SimulationParams::DirectSumType, SimulationParams::LinkedCellsType > &container_data)
Converts a force type from the XSD format to the internal format.
static LinkedCellsContainer::BoundaryCondition convertToBoundaryCondition(const BoundaryType &boundary)
Converts a boundary type from the XSD format to the internal format.
static std::variant< SimulationParams::DirectSumType, SimulationParams::LinkedCellsType > convertToParticleContainer(const ParticleContainerType &container_type)
Converts a container type from the XSD format to the internal format.
static std::array< LinkedCellsContainer::BoundaryCondition, 6 > convertToBoundaryConditionsArray(const BoundaryConditionsType &boundary)
Converts a boundary conditions type from the XSD format to the internal format.
static Particle convertToParticle(const ParticleType &particle)
Converts a particle type from the XSD format to the internal format.
static CuboidSpawner convertToSingleParticleSpawner(const SingleParticleSpawnerType &particle, ThirdDimension third_dimension)
Converts a particle from the XSD format to the internal format.
static std::array< double, 3 > convertToVector(const DoubleVec3Type &vector)
Converts a double vector from the XSD format to the internal format.
static std::tuple< long, double, double > convertToTuple(const ConnectedParticleEntryType &entry)
Converts a connected particle entry from the XSD format to the internal format.
static std::vector< std::shared_ptr< SimulationInterceptor > > convertToSimulationInterceptors(const SimulationInterceptorsType &interceptors, ThirdDimension third_dimension, std::variant< SimulationParams::DirectSumType, SimulationParams::LinkedCellsType > container_type)
Converts the simulation interceptors from the XSD format to the internal format.
static CuboidSpawner convertToCuboidSpawner(const CuboidSpawnerType &cuboid, ThirdDimension third_dimension)
Converts a cuboid from the XSD format to the internal format.