|
Base class of all CG objects, needed to store the various CG objects in the CGHandler. More...
#include <BaseCG.h>
Public Member Functions | |
BaseCG () | |
Simple constructor, sets default values. More... | |
BaseCG (const BaseCG &p)=default | |
Default copy constructor, copies all values. More... | |
~BaseCG () override=default | |
Default destructor, does nothing. More... | |
void | read (std::istream &is) override |
Currently, no read functions are implemented for the CGHandler, but the function is required for any derivative of BaseObject. More... | |
void | write (std::ostream &os) const override |
Writes class content into an output stream, usually a stat file. More... | |
void | clear () |
This class seems to have no use (?), but is required for any derivative of BaseObject. More... | |
virtual BaseCG * | copy () const =0 |
Copy operator. Required for BaseHandler::copyAndAddObject. More... | |
virtual void | initialise ()=0 |
Called at the beginning of the DPM simulation to initialise the cg evaluation and to open the statFile. More... | |
virtual void | evaluate ()=0 |
Called after a given number of time steps (statFile::saveCount_) to evaluate the CG fields. More... | |
virtual void | finish ()=0 |
Called at the end of the DPM simulation to finish the cg evaluation and to close the statFile. More... | |
void | setHandler (CGHandler *handler) |
Sets handler_, the pointer to the CGHandler. More... | |
CGHandler * | getHandler () const |
Returns handler_, a pointer to the CGHandler. More... | |
virtual void | setWidth (Mdouble width)=0 |
Sets width_, the coarse-graining width. More... | |
virtual Mdouble | getWidth () const =0 |
Returns width_, the coarse-graining width. More... | |
void | setNZ (std::size_t nZ) |
Sets nZ_, the number of spatial mesh points in the z-direction. More... | |
std::size_t | getNZ () const |
Returns nZ_, the number of spatial mesh points in the z-direction. More... | |
void | setNY (std::size_t nY) |
Sets nY_, the number of spatial mesh points in the y-direction. More... | |
std::size_t | getNY () const |
Returns nY_, the number of spatial mesh points in the y-direction. More... | |
void | setNX (std::size_t nX) |
Sets nX_, the number of spatial mesh points in the x-direction. More... | |
std::size_t | getNX () const |
Returns nX_, the number of spatial mesh points in the x-direction. More... | |
void | setN (std::size_t n) |
Sets nX_, nY_, nZ_, the number of spatial mesh points in each cartesian direction. More... | |
void | setN (std::array< std::size_t, 3 > n) |
Sets nX_, nY_, nZ_, the number of spatial mesh points in each cartesian direction. More... | |
void | setH (Mdouble h) |
Sets nX_, nY_, nZ_, the number of spatial mesh points in each cartesian direction. However, instead of explicitly defining n, the mesh size h=(max-min)/n is defined. More... | |
void | setHX (Mdouble h) |
Sets nX_ the number of spatial mesh points in the X-direction. Instead of explicitly defining nX, the mesh size hX=(max.X-min.X)/nX is defined. More... | |
void | setHY (Mdouble h) |
Sets nX_ the number of spatial mesh points in the X-direction. Instead of explicitly defining nX, the mesh size hX=(max.X-min.X)/nX is defined. More... | |
void | setHZ (Mdouble h) |
Sets nX_ the number of spatial mesh points in the X-direction. Instead of explicitly defining nX, the mesh size hX=(max.X-min.X)/nX is defined. More... | |
void | setTimeMin (Mdouble timeMin) |
Sets timeMin_, the lower limit of the temporal domain. More... | |
void | setTimeMax (Mdouble timeMax) |
Sets timeMax_, the upper limit of the temporal domain. More... | |
Mdouble | getTimeMin () const |
Returns timeMin_, the lower limit of the temporal domain. More... | |
Mdouble | getTimeMax () const |
Returns timeMax_, the upper limit of the temporal domain. More... | |
void | setMin (Vec3D min) |
Sets max_, the lower limit of the spatial domain. More... | |
void | setX (Mdouble min, Mdouble max) |
Sets min_.X, max_.X, the limits of the spatial domain in X. More... | |
void | setY (Mdouble min, Mdouble max) |
Sets min_.Y, max_.Y, the limits of the spatial domain in Y. More... | |
void | setZ (Mdouble min, Mdouble max) |
Sets min_.Z, max_.Z, the limits of the spatial domain in Z. More... | |
void | setXGrid (Mdouble min, Mdouble max, Mdouble h) |
void | setYGrid (Mdouble min, Mdouble max, Mdouble h) |
void | setZGrid (Mdouble min, Mdouble max, Mdouble h) |
void | setGrid (Vec3D min, Vec3D max, Mdouble h) |
void | setMax (Vec3D max) |
Sets max_, the upper limit of the spatial domain. More... | |
Vec3D | getMin () const |
Returns min_, the lower limit of the spatial domain. More... | |
Vec3D | getMax () const |
Returns max_, the upper limit of the spatial domain. More... | |
void | selectSpecies (unsigned speciesIndex) |
void | setSelectedParticle (const std::function< const bool(const BaseInteractable *)> &selectedParticle) |
void | setEps (Mdouble eps) |
Mdouble | getEps () const |
void | setAverageBeyondDomain (const bool val) |
bool | getAverageBeyondDomain () const |
void | setVerbose (const bool verbose) |
bool | getVerbose () const |
virtual void | setStandardDeviation (Mdouble std)=0 |
virtual void | setRadius (Mdouble radius)=0 |
Public Member Functions inherited from BaseObject | |
BaseObject ()=default | |
Default constructor. More... | |
BaseObject (const BaseObject &p)=default | |
Copy constructor, copies all the objects BaseObject contains. More... | |
virtual | ~BaseObject ()=default |
virtual destructor More... | |
virtual std::string | getName () const =0 |
A purely virtual function. More... | |
virtual void | moveInHandler (unsigned int index) |
Except that it is virtual, it does the same thing as setIndex() does. More... | |
void | setIndex (unsigned int index) |
Allows one to assign an index to an object in the handler/container. More... | |
void | setId (unsigned long id) |
Assigns a unique identifier to each object in the handler (container) which remains constant even after the object is deleted from the container/handler. More... | |
unsigned int | getIndex () const |
Returns the index of the object in the handler. More... | |
unsigned int | getId () const |
Returns the unique identifier of any particular object. More... | |
void | setGroupId (unsigned groupId) |
unsigned | getGroupId () const |
Public Attributes | |
File | statFile |
File class to handle the output into a .stat file. More... | |
Protected Attributes | |
CGHandler * | handler_ |
std::size_t | nX_ |
std::size_t | nY_ |
std::size_t | nZ_ |
Mdouble | eps_ |
Mdouble | timeMin_ |
Mdouble | timeMax_ |
Vec3D | min_ |
Vec3D | max_ |
std::function< bool(const BaseInteractable *)> | selectedParticle_ |
bool | averageBeyondDomain_ = true |
Determines whether particles outside the domain are considered when computing the averaged fields. More... | |
bool | verbose_ = false |
Base class of all CG objects, needed to store the various CG objects in the CGHandler.
The CGHandler contains a set of BaseCG* pointers, which can contain different CG objects.
This class contains properties that any CG class needs:
BaseCG::BaseCG | ( | ) |
Simple constructor, sets default values.
References DEBUG, File::getFstream(), handler_, constants::inf, logger, max_, min_, NEVER, nX_, nY_, nZ_, selectedParticle_, File::setLastSavedTimeStep(), statFile, timeMax_, and timeMin_.
|
default |
Default copy constructor, copies all values.
|
overridedefault |
Default destructor, does nothing.
void BaseCG::clear | ( | ) |
|
pure virtual |
Copy operator. Required for BaseHandler::copyAndAddObject.
Implemented in TimeSmoothedCG< Coordinates, BaseFunction, Fields >, TimeAveragedCGXYZ< BaseFunction, Fields >, TimeAveragedCGXYZ< BaseFunction, CGFields::StandardFields >, TimeAveragedCG< Coordinates, BaseFunction, Fields >, TimeAveragedCG< CGCoordinates::XYZ, BaseFunction, CGFields::StandardFields >, CG< Coordinates, BaseFunction, Fields >, CG< Coordinates, CGFunctions::Lucy, CGFields::StandardFields >, CG< CGCoordinates::O, CGFunctions::Lucy, CGFields::StandardFields >, and TimeAveragedLebedevCG< BaseFunction, Fields >.
|
pure virtual |
Called after a given number of time steps (statFile::saveCount_) to evaluate the CG fields.
Implemented in TimeSmoothedCG< Coordinates, BaseFunction, Fields >, TimeAveragedCG< Coordinates, BaseFunction, Fields >, TimeAveragedCG< CGCoordinates::XYZ, BaseFunction, CGFields::StandardFields >, CG< Coordinates, BaseFunction, Fields >, CG< Coordinates, CGFunctions::Lucy, CGFields::StandardFields >, CG< CGCoordinates::O, CGFunctions::Lucy, CGFields::StandardFields >, and TimeAveragedLebedevCG< BaseFunction, Fields >.
Referenced by CGHandler::evaluate().
|
pure virtual |
Called at the end of the DPM simulation to finish the cg evaluation and to close the statFile.
Implemented in TimeSmoothedCG< Coordinates, BaseFunction, Fields >, TimeAveragedCG< Coordinates, BaseFunction, Fields >, TimeAveragedCG< CGCoordinates::XYZ, BaseFunction, CGFields::StandardFields >, CG< Coordinates, BaseFunction, Fields >, CG< Coordinates, CGFunctions::Lucy, CGFields::StandardFields >, and CG< CGCoordinates::O, CGFunctions::Lucy, CGFields::StandardFields >.
Referenced by CGHandler::finish().
|
inline |
References averageBeyondDomain_.
CGHandler * BaseCG::getHandler | ( | ) | const |
Vec3D BaseCG::getMax | ( | ) | const |
Vec3D BaseCG::getMin | ( | ) | const |
std::size_t BaseCG::getNX | ( | ) | const |
Returns nX_, the number of spatial mesh points in the x-direction.
References nX_.
Referenced by commandLineCG(), and setHX().
std::size_t BaseCG::getNY | ( | ) | const |
Returns nY_, the number of spatial mesh points in the y-direction.
References nY_.
Referenced by commandLineCG(), and setHY().
std::size_t BaseCG::getNZ | ( | ) | const |
Returns nZ_, the number of spatial mesh points in the z-direction.
References nZ_.
Referenced by commandLineCG(), and setHZ().
Mdouble BaseCG::getTimeMax | ( | ) | const |
Returns timeMax_, the upper limit of the temporal domain.
References timeMax_.
Referenced by CGHandler::evaluate(), and CGHandler::getTimeMax().
Mdouble BaseCG::getTimeMin | ( | ) | const |
Returns timeMin_, the lower limit of the temporal domain.
References timeMin_.
Referenced by CGHandler::evaluate(), and CGHandler::getTimeMin().
|
pure virtual |
Returns width_, the coarse-graining width.
Implemented in CG< Coordinates, BaseFunction, Fields >, CG< Coordinates, CGFunctions::Lucy, CGFields::StandardFields >, and CG< CGCoordinates::O, CGFunctions::Lucy, CGFields::StandardFields >.
Referenced by commandLineCG(), and write().
|
pure virtual |
Called at the beginning of the DPM simulation to initialise the cg evaluation and to open the statFile.
Implemented in TimeSmoothedCG< Coordinates, BaseFunction, Fields >, TimeAveragedCG< Coordinates, BaseFunction, Fields >, TimeAveragedCG< CGCoordinates::XYZ, BaseFunction, CGFields::StandardFields >, CG< Coordinates, BaseFunction, Fields >, CG< Coordinates, CGFunctions::Lucy, CGFields::StandardFields >, and CG< CGCoordinates::O, CGFunctions::Lucy, CGFields::StandardFields >.
Referenced by CGHandler::initialise().
|
overridevirtual |
Currently, no read functions are implemented for the CGHandler, but the function is required for any derivative of BaseObject.
Implements BaseObject.
void BaseCG::selectSpecies | ( | unsigned | speciesIndex | ) |
sets selectedParticle_ such that only particles of a certain species are selected
speciesIndex |
References selectedParticle_.
Referenced by commandLineCG().
|
inline |
void BaseCG::setH | ( | Mdouble | h | ) |
Sets nX_, nY_, nZ_, the number of spatial mesh points in each cartesian direction. However, instead of explicitly defining n, the mesh size h=(max-min)/n is defined.
References INFO, logger, max_, min_, nZ_, setHX(), setHY(), and setHZ().
Referenced by commandLineCG(), and setGrid().
void BaseCG::setHandler | ( | CGHandler * | handler | ) |
Sets handler_, the pointer to the CGHandler.
References handler_.
Referenced by CGHandler::addObject().
void BaseCG::setHX | ( | Mdouble | h | ) |
Sets nX_ the number of spatial mesh points in the X-direction. Instead of explicitly defining nX, the mesh size hX=(max.X-min.X)/nX is defined.
References getNX(), constants::inf, logger, max_, min_, setNX(), and Vec3D::X.
Referenced by commandLineCG(), setH(), and setXGrid().
void BaseCG::setHY | ( | Mdouble | h | ) |
Sets nX_ the number of spatial mesh points in the X-direction. Instead of explicitly defining nX, the mesh size hX=(max.X-min.X)/nX is defined.
References getNY(), constants::inf, logger, max_, min_, setNY(), and Vec3D::Y.
Referenced by commandLineCG(), setH(), and setYGrid().
void BaseCG::setHZ | ( | Mdouble | h | ) |
Sets nX_ the number of spatial mesh points in the X-direction. Instead of explicitly defining nX, the mesh size hX=(max.X-min.X)/nX is defined.
References getNZ(), constants::inf, logger, max_, min_, setNZ(), and Vec3D::Z.
Referenced by commandLineCG(), setH(), and setZGrid().
void BaseCG::setMax | ( | Vec3D | max | ) |
Sets max_, the upper limit of the spatial domain.
References max_.
Referenced by commandLineCG(), and setGrid().
void BaseCG::setMin | ( | Vec3D | min | ) |
Sets max_, the lower limit of the spatial domain.
References min_.
Referenced by commandLineCG(), and setGrid().
void BaseCG::setN | ( | std::array< std::size_t, 3 > | n | ) |
void BaseCG::setN | ( | std::size_t | n | ) |
void BaseCG::setNX | ( | std::size_t | nX | ) |
Sets nX_, the number of spatial mesh points in the x-direction.
References nX_.
Referenced by commandLineCG(), main(), and setHX().
void BaseCG::setNY | ( | std::size_t | nY | ) |
Sets nY_, the number of spatial mesh points in the y-direction.
References nY_.
Referenced by commandLineCG(), and setHY().
void BaseCG::setNZ | ( | std::size_t | nZ | ) |
Sets nZ_, the number of spatial mesh points in the z-direction.
References nZ_.
Referenced by commandLineCG(), main(), setCGHandler(), and setHZ().
|
pure virtual |
void BaseCG::setSelectedParticle | ( | const std::function< const bool(const BaseInteractable *)> & | selectedParticle | ) |
References selectedParticle_.
|
pure virtual |
void BaseCG::setTimeMax | ( | Mdouble | timeMax | ) |
Sets timeMax_, the upper limit of the temporal domain.
References timeMax_.
Referenced by commandLineCG(), and main().
void BaseCG::setTimeMin | ( | Mdouble | timeMin | ) |
Sets timeMin_, the lower limit of the temporal domain.
References timeMin_.
Referenced by commandLineCG(), and main().
|
inline |
|
pure virtual |
Sets width_, the coarse-graining width.
Implemented in CG< Coordinates, BaseFunction, Fields >, CG< Coordinates, CGFunctions::Lucy, CGFields::StandardFields >, and CG< CGCoordinates::O, CGFunctions::Lucy, CGFields::StandardFields >.
Referenced by commandLineCG().
Sets min_.X, max_.X, the limits of the spatial domain in X.
References max_, min_, and Vec3D::X.
Referenced by commandLineCG(), and setXGrid().
Sets min_.Y, max_.Y, the limits of the spatial domain in Y.
References max_, min_, and Vec3D::Y.
Referenced by commandLineCG(), and setYGrid().
Sets min_.Z, max_.Z, the limits of the spatial domain in Z.
References max_, min_, and Vec3D::Z.
Referenced by commandLineCG(), and setZGrid().
|
overridevirtual |
Writes class content into an output stream, usually a stat file.
[out] | os | output stream to which data is written |
Implements BaseObject.
Reimplemented in TimeSmoothedCG< Coordinates, BaseFunction, Fields >, TimeAveragedCG< Coordinates, BaseFunction, Fields >, TimeAveragedCG< CGCoordinates::XYZ, BaseFunction, CGFields::StandardFields >, CG< Coordinates, BaseFunction, Fields >, CG< Coordinates, CGFunctions::Lucy, CGFields::StandardFields >, and CG< CGCoordinates::O, CGFunctions::Lucy, CGFields::StandardFields >.
References BaseObject::getName(), getWidth(), max_, min_, nX_, nY_, nZ_, timeMax_, timeMin_, and verbose_.
|
protected |
Determines whether particles outside the domain are considered when computing the averaged fields.
If set to true, then the average of field f over a coordinate direction x is computed as \(\frac{1}{x_{max}-x_{min}}\int_{-\infty}^{\infty} f dx\) If set to false, then the average of field f over a coordinate direction x is computed as \(\frac{1}{x_{max}-x_{min}}\int_{x_{min}}^{x_{max}} f dx\)
should the default be false?
currently, the above description is not implemented; it simply ignores particles outside the domain.
Referenced by getAverageBeyondDomain(), and setAverageBeyondDomain().
|
protected |
|
protected |
the pointer to the CGHandler, used to get data from the CGHandler.
Referenced by BaseCG(), getHandler(), and setHandler().
|
protected |
|
protected |
min_ and max_ define the spatial dimensions of the coarse-graining volume; if these parameters are not defined by the user, they are set to the system dimensions (DPMBase::min_ and DPMBase::max_) in CG::initialize.
Referenced by BaseCG(), getMin(), setH(), setHX(), setHY(), setHZ(), setMin(), setX(), setY(), setZ(), and write().
|
protected |
nX_, nY_, and nZ_ define the size of the mesh of CGPoints, i.e. the spatial positions at which the cg variables are evaluated. nX_, nY_, and nZ_ are the number of points in x-, y-, and z-direction. the is used to set the width of the These values are set to 1 by default, unless modified by the user.
Referenced by BaseCG(), getNX(), setN(), setNX(), and write().
|
protected |
|
protected |
|
protected |
A function returning true for each particle that should be included in the statistics (all by default).
Referenced by BaseCG(), selectSpecies(), and setSelectedParticle().
File BaseCG::statFile |
File class to handle the output into a .stat file.
Referenced by BaseCG(), commandLineCG(), CGHandler::evaluate(), CGHandler::finish(), main(), and setCGHandler().
|
protected |
see timeMin_
Referenced by BaseCG(), getTimeMax(), setTimeMax(), and write().
|
protected |
timeMin_ and timeMax_ define the temporal dimensions of the coarse-graining volume; these parameters are set to \(\pm\infty\) by default, unless modified by the user; otherwise, timeMin_ is set to DPMBase::time_ in CG::initialize.
Referenced by BaseCG(), getTimeMin(), setTimeMin(), and write().
|
protected |
Referenced by getVerbose(), setVerbose(), and write().