CGHandler.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2023, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 #ifndef CGHandler_H
26 #define CGHandler_H
27 
28 #include "GeneralDefine.h"
29 #include "BaseHandler.h"
30 #include "CG/BaseCG.h"
31 
32 class DPMBase;
33 
64 class CGHandler : public BaseHandler<BaseCG>
65 {
66 public:
70  CGHandler() = default;;
71 
75  CGHandler(const CGHandler& BH);
76 
80  CGHandler& operator=(const CGHandler& rhs);
81 
85  ~CGHandler() final = default;
86 
87  void addObject(BaseCG* cg) final;
88 
89  std::string getName() const final;
90 
95  void readAndAddObject(std::istream& is) final;
96 
101  void write(std::ostream& os) const;
102 
106  void initialise();
107 
111  void evaluate();
112 
116  void finish();
117 
121  void restart(std::string name);
122 
123  void restartAndEvaluateRestartFiles(const std::string& name);
124 
125  void restartAndEvaluateDataFiles(const std::string& name, bool evaluateFStatFiles = true);
126 
131  bool evaluateDataFiles(bool evaluateFStatFiles = true);
132 
133  bool evaluateRestartFiles();
134 
135  void computeContactPoints();
136 
138 
140 
142  this->initialFileCounter = initialFileCounter;
143  }
144 
145  unsigned getInitialFileCounter() const {
146  return initialFileCounter;
147  }
148 
149  unsigned initialFileCounter = 0;
150 };
151 
152 #endif
Base class of all CG objects, needed to store the various CG objects in the CGHandler.
Definition: BaseCG.h:57
Container to store the pointers to all objects that one creates in a simulation.
Definition: BaseHandler.h:51
Container that stores all CG objects.
Definition: CGHandler.h:65
unsigned initialFileCounter
Definition: CGHandler.h:149
void computeContactPoints()
Definition: CGHandler.cc:194
void evaluate()
Contains the code executed at each time step.
Definition: CGHandler.cc:97
CGHandler()=default
Default constructor, creates an empty CGHandler.
void finish()
Contains the code executed after the last time step.
Definition: CGHandler.cc:113
Mdouble getTimeMin()
Definition: CGHandler.cc:381
void restartAndEvaluateDataFiles(const std::string &name, bool evaluateFStatFiles=true)
Definition: CGHandler.cc:188
void restartAndEvaluateRestartFiles(const std::string &name)
Definition: CGHandler.cc:182
Mdouble getTimeMax()
Definition: CGHandler.cc:391
void write(std::ostream &os) const
Writes objects into the CGHandler to an ostream (currently not implemented).
Definition: CGHandler.cc:85
bool evaluateDataFiles(bool evaluateFStatFiles=true)
does the same as StatisticsVector::statistics_from_fstat_and_data: loads a restart file (if existing)...
Definition: CGHandler.cc:315
std::string getName() const final
Definition: CGHandler.cc:75
bool evaluateRestartFiles()
Definition: CGHandler.cc:247
void addObject(BaseCG *cg) final
Definition: CGHandler.cc:64
void initialise()
Contains the code executed before the first time step.
Definition: CGHandler.cc:90
void readAndAddObject(std::istream &is) final
Reads objects into the CGHandler from an istream (currently not implemented).
Definition: CGHandler.cc:80
void setInitialFileCounter(unsigned initialFileCounter)
Definition: CGHandler.h:141
CGHandler & operator=(const CGHandler &rhs)
Assignment operator that copies the pointer to the DPMBase and all objects.
Definition: CGHandler.cc:47
unsigned getInitialFileCounter() const
Definition: CGHandler.h:145
~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:77
Definition: restart2.cpp:29
std::string name
Definition: MercuryProb.h:48