TimeSmoothedCG.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 TimeSmoothedCG_H
6 #define TimeSmoothedCG_H
7 
8 #include <GeneralDefine.h>
9 #include "CG/CG.h"
10 #include <iostream>
11 #include <vector>
12 #include "TimeSmoothedFields.h"
13 
14 class BaseParticle;
15 
16 class BaseInteraction;
17 
18 class DPMBase;
19 
20 class Function;
21 
38 template<class Coordinates, template<class> class BaseFunction=CGFunctions::Lucy, class Fields=CGFields::StandardFields>
39 class TimeSmoothedCG final : public CG<Coordinates, BaseFunction, Fields>
40 {
41 public:
42  typedef BaseFunction<Coordinates> Function;
43 
49 
54  TimeSmoothedCG(const TimeSmoothedCG& p) = default;
55 
59  virtual ~TimeSmoothedCG() = default;
60 
65 
69  void write(std::ostream& os) const override;
70 
71  void writeAll(std::ostream& os, TimeSmoothedFields<Fields>& average) const;
72 
76  std::string getName() const override;
77 
82  void initialise() override;
83 
88  void evaluate() override;
89 
94  void finish() override;
95 
96  void setWidthTime(Mdouble widthTime) final;
97 
98  Mdouble getWidthTime() const final;
99 
100  void setTimeStep(Mdouble timeStep) final;
101 
102  Mdouble getTimeStep() const final;
103 
104 protected:
105 
112 
119 
127 
134 
139  std::vector<TimeSmoothedFields<Fields> > averages_;
140 };
141 
142 #include "TimeSmoothedCG.hcc"
143 
144 #endif
float * p
Definition: Tutorial_Map_using.cpp:9
Stores information about interactions between two interactable objects; often particles but could be ...
Definition: BaseInteraction.h:39
Definition: BaseParticle.h:33
Contains the computed field values, like density, momentum and stress.
Definition: StandardFields.h:33
A specialisation of Polynomials for PolynomialType::Lucy. See Polynomial for details.
Definition: Lucy.h:19
Evaluates time-resolved continuum fields and writes the data into a stat file.
Definition: CG.h:55
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:56
Template argument; use a member class of CGFunctions to instantiate.
Evaluates time-smoothed continuum fields and writes the data into a stat file.
Definition: TimeSmoothedCG.h:40
Mdouble getWidthTime() const final
TimeSmoothedCG< Coordinates, BaseFunction, Fields > * copy() const override
Copy operator. Required for BaseHandler::copyAndAddObject.
TimeSmoothedCG()
Default constructor; does nothing, i.e. no points are created initially.
Mdouble cutoffTime_
Definition: TimeSmoothedCG.h:118
BaseFunction< Coordinates > Function
Definition: TimeSmoothedCG.h:42
Mdouble nextTime_
Definition: TimeSmoothedCG.h:126
virtual ~TimeSmoothedCG()=default
Destructor, it simply destructs the TimeSmoothedCGFunction and all the objects it contains.
void finish() override
Called at the end of the DPM simulation to finish the cg evaluation and to close the statFile.
void setTimeStep(Mdouble timeStep) final
Mdouble widthTime_
Definition: TimeSmoothedCG.h:111
void evaluate() override
Called after a given number of time steps (statFile::saveCount_) to evaluate the CG fields.
void setWidthTime(Mdouble widthTime) final
std::vector< TimeSmoothedFields< Fields > > averages_
Definition: TimeSmoothedCG.h:139
Mdouble timeStep_
Definition: TimeSmoothedCG.h:133
void writeAll(std::ostream &os, TimeSmoothedFields< Fields > &average) const
void write(std::ostream &os) const override
Writes class content into an output stream, usually a stat file.
std::string getName() const override
A purely virtual function.
Mdouble getTimeStep() const final
void initialise() override
Called at the beginning of the DPM simulation to initialise the cg evaluation and to open the statFil...
TimeSmoothedCG(const TimeSmoothedCG &p)=default
Copy constructor. It copies the TimeSmoothedCGFunction and all objects it contains.
A helper class for TimeSmoothedCG containing the time-smoothed variables.
Definition: TimeSmoothedFields.h:32
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286