CGHandler.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 #ifndef CGHandler_H
6 #define CGHandler_H
7 
8 #include "GeneralDefine.h"
9 #include "BaseHandler.h"
10 #include "CG/BaseCG.h"
11 
12 class DPMBase;
13 
44 class CGHandler : public BaseHandler<BaseCG>
45 {
46 public:
50  CGHandler() = default;;
51 
55  CGHandler(const CGHandler& BH);
56 
60  CGHandler& operator=(const CGHandler& rhs);
61 
65  ~CGHandler() final = default;
66 
67  void addObject(BaseCG* cg) final;
68 
69  std::string getName() const final;
70 
75  void readAndAddObject(std::istream& is) final;
76 
81  void write(std::ostream& os) const;
82 
86  void initialise();
87 
91  void evaluate();
92 
96  void finish();
97 
101  void restart(std::string name);
102 
103  void restartAndEvaluateRestartFiles(const std::string& name);
104 
105  void restartAndEvaluateDataFiles(const std::string& name, bool evaluateFStatFiles = true);
106 
111  bool evaluateDataFiles(bool evaluateFStatFiles = true);
112 
113  bool evaluateRestartFiles();
114 
115  void computeContactPoints();
116 
118 
120 
122  this->initialFileCounter = initialFileCounter;
123  }
124 
125  unsigned getInitialFileCounter() const {
126  return initialFileCounter;
127  }
128 
133 
138 
145 
152 
162 
163  unsigned initialFileCounter = 0;
164 
165 private:
166 
172 
173 };
174 
175 #endif
Base class of all CG objects, needed to store the various CG objects in the CGHandler.
Definition: BaseCG.h:36
Container to store the pointers to all objects that one creates in a simulation.
Definition: BaseHandler.h:30
Container that stores all CG objects.
Definition: CGHandler.h:45
unsigned initialFileCounter
Definition: CGHandler.h:163
void computeContactPoints()
Definition: CGHandler.cc:179
void evaluate()
Contains the code executed at each time step.
Definition: CGHandler.cc:77
CGHandler()=default
Default constructor, creates an empty CGHandler.
void finish()
Contains the code executed after the last time step.
Definition: CGHandler.cc:96
Mdouble getTimeMin()
Definition: CGHandler.cc:376
void restartAndEvaluateDataFiles(const std::string &name, bool evaluateFStatFiles=true)
Definition: CGHandler.cc:173
void handlePreviousInformation()
Sets data from the current time step as data from the previous time step.
Definition: CGHandler.cc:409
void restartAndEvaluateRestartFiles(const std::string &name)
Definition: CGHandler.cc:167
Mdouble getPreviousEvaluationTime()
Returns the time of the last read/evaluated time step.
Definition: CGHandler.h:132
Mdouble getTimeMax()
Definition: CGHandler.cc:386
void write(std::ostream &os) const
Writes objects into the CGHandler to an ostream (currently not implemented).
Definition: CGHandler.cc:65
bool evaluateDataFiles(bool evaluateFStatFiles=true)
does the same as StatisticsVector::statistics_from_fstat_and_data: loads a restart file (if existing)...
Definition: CGHandler.cc:307
void setPreviousEvaluationTimeToCurrentTime()
Sets the previous evaluation time to the current time.
Definition: CGHandler.cc:396
std::string getName() const final
Definition: CGHandler.cc:55
void setPreviousPositionToCurrentPosition()
Sets the previous position for every particle to its current position.
Definition: CGHandler.cc:401
bool evaluateRestartFiles()
Definition: CGHandler.cc:232
void addObject(BaseCG *cg) final
Definition: CGHandler.cc:44
void initialise()
Contains the code executed before the first time step.
Definition: CGHandler.cc:70
void readAndAddObject(std::istream &is) final
Reads objects into the CGHandler from an istream (currently not implemented).
Definition: CGHandler.cc:60
void setInitialFileCounter(unsigned initialFileCounter)
Definition: CGHandler.h:121
void setPreviousEvaluationTime(Mdouble time)
Sets the time of the last read/evaluated time step to a specified time.
Definition: CGHandler.h:137
CGHandler & operator=(const CGHandler &rhs)
Assignment operator that copies the pointer to the DPMBase and all objects.
Definition: CGHandler.cc:27
Mdouble previousEvaluationTime_
Saves the time of the last read/evaluated data/restartFile.
Definition: CGHandler.h:171
unsigned getInitialFileCounter() const
Definition: CGHandler.h:125
~CGHandler() final=default
Destructor, destructs the CGHandler and all BaseCGPoint's it contains.
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:56
Definition: restart2.cpp:8
default
Definition: calibrate.py:45
string name
Definition: plotDoE.py:33