Problem.h
Go to the documentation of this file.
1 // This file is part of the MercuryDPM project (https://www.mercurydpm.org).
2 // Copyright (c), The MercuryDPM Developers Team. All rights reserved.
3 // License: BSD 3-Clause License; see the LICENSE file in the root directory.
4 
5 /*
6  * File: Problem.h
7  * Author: dducks
8  *
9  * Created on April 12, 2014, 2:20 PM
10  */
11 
12 #ifndef SERIALIZATION_PROBLEM_H
13 #define SERIALIZATION_PROBLEM_H
14 
15 #include <cereal/cereal.hpp>
16 #include <Mercury3D.h>
17 
18 class SerializedProblem : public Mercury3D {
19 public:
20  //SerializedProblem();
21 };
22 
23 template<class Archive>
24 void load(Archive& ar, SerializedProblem & base) {
25  using namespace cereal;
26 
28  Mdouble tMax;
29  Mdouble tStep;
30  Vec3D gravity;
31  Vec3D minimum;
32  Vec3D maximum;
33 
34  ar( CEREAL_NVP( name )
35  ,CEREAL_NVP( tMax )
36  ,CEREAL_NVP( tStep )
37  ,CEREAL_NVP( gravity )
38  ,CEREAL_NVP( minimum )
39  ,CEREAL_NVP( maximum )
40  ,cereal::make_nvp("particles", base.particleHandler)
41  ,cereal::make_nvp("walls", base.wallHandler)
42  );
43 
44  base.setName( name );
45  base.setTimeMax( tMax );
46  base.setTimeStep( tStep );
47  base.setGravity( gravity );
48  base.setXMin(minimum.X);
49  base.setYMin(minimum.Y);
50  base.setZMin(minimum.Z);
51 
52  base.setXMax(maximum.X);
53  base.setYMax(maximum.Y);
54  base.setZMax(maximum.Z);
55 }
56 
57 template<class Archive>
58 void save(Archive& ar, const SerializedProblem & base) {
59  Vec3D minimum;
60  Vec3D maximum;
61 
62  minimum.X = base.getXMin();
63  minimum.Y = base.getYMin();
64  minimum.Z = base.getZMin();
65  maximum.X = base.getXMax();
66  maximum.Y = base.getYMax();
67  maximum.Z = base.getZMax();
68 
69  ar ( cereal::make_nvp("name", base.getName())
70  ,CEREAL_NVP(minimum)
71  ,CEREAL_NVP(maximum)
72  ,cereal::make_nvp("tMax", base.getTimeMax())
73  ,cereal::make_nvp("tStep", base.getTimeStep())
74  ,cereal::make_nvp("gravity", base.getGravity())
75  ,cereal::make_nvp("particles", base.particleHandler)
76  ,cereal::make_nvp("walls", base.wallHandler)
77  );
78 }
79 
80 
81 #endif /* PROBLEM_H */
82 
void load(Archive &ar, SerializedProblem &base)
Definition: Problem.h:24
void save(Archive &ar, const SerializedProblem &base)
Definition: Problem.h:58
Mdouble getXMin() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMin() returns XMin.
Definition: DPMBase.h:603
Mdouble getXMax() const
If the length of the problem domain in x-direction is XMax - XMin, then getXMax() returns XMax.
Definition: DPMBase.h:610
void setYMin(Mdouble newYMin)
Sets the value of YMin, the lower bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1025
Mdouble getYMin() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMin() returns YMin.
Definition: DPMBase.h:616
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:400
Mdouble getTimeStep() const
Returns the simulation time step.
Definition: DPMBase.cc:1241
const std::string & getName() const
Returns the name of the file. Does not allow to change it though.
Definition: DPMBase.cc:377
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1453
void setYMax(Mdouble newYMax)
Sets the value of YMax, the upper bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1182
void setZMin(Mdouble newZMin)
Sets the value of ZMin, the lower bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1049
void setXMax(Mdouble newXMax)
Sets the value of XMax, the upper bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1156
Vec3D getGravity() const
Returns the gravitational acceleration.
Definition: DPMBase.cc:1382
ParticleHandler particleHandler
An object of the class ParticleHandler, contains the pointers to all the particles created.
Definition: DPMBase.h:1443
void setZMax(Mdouble newZMax)
Sets the value of ZMax, the upper bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1208
Mdouble getYMax() const
If the length of the problem domain in y-direction is YMax - YMin, then getYMax() returns XMax.
Definition: DPMBase.h:622
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1225
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:864
void setXMin(Mdouble newXMin)
Sets the value of XMin, the lower bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1001
Mdouble getTimeMax() const
Returns the maximum simulation duration.
Definition: DPMBase.cc:879
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1374
Mdouble getZMax() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMax() returns ZMax.
Definition: DPMBase.h:634
Mdouble getZMin() const
If the length of the problem domain in z-direction is ZMax - ZMin, then getZMin() returns ZMin.
Definition: DPMBase.h:628
This adds on the hierarchical grid code for 3D problems.
Definition: Mercury3D.h:16
Definition: Problem.h:18
Definition: Kernel/Math/Vector.h:30
Mdouble Y
Definition: Kernel/Math/Vector.h:45
Mdouble Z
Definition: Kernel/Math/Vector.h:45
Mdouble X
the vector components
Definition: Kernel/Math/Vector.h:45
void gravity(const double &t, const Vector< double > &xi, Vector< double > &b)
Definition: ConstraintElementsUnitTest.cpp:20
Definition: MortaringCantileverCompareToNonMortaring.cpp:176
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
string name
Definition: plotDoE.py:33