revision: v0.14
BaseSpecies.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2020, 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 
26 #ifndef BASESPECIES_H
27 #define BASESPECIES_H
28 
29 #include "BaseObject.h"
30 #include "Math/ExtendedMath.h"
31 #include "Math/Helpers.h"
35 
36 class SpeciesHandler;// derived from BaseHandler<ParticleSpecies>
37 //class BaseParticle; //
38 class BaseInteractable;
39 
40 class BaseInteraction;
41 
48 //Note the getVelocity can for some Species be dependent on which point on the Species is meant.
49 class BaseSpecies : public BaseObject
50 {
51 public:
52 
54  BaseSpecies();
55 
57 
59  BaseSpecies(const BaseSpecies& p);
60 
62  ~BaseSpecies();
63 
78  virtual BaseSpecies* copy() const = 0;
79 
83  virtual void copyInto(BaseSpecies* s) const =0;
84 
86  void setHandler(SpeciesHandler* handler);
87 
89  SpeciesHandler* getHandler() const;
90 
92  static Mdouble average(Mdouble a, Mdouble b);
93 
95  static Mdouble averageInf(Mdouble a, Mdouble b);
96 
98 
106  virtual void mixAll(BaseSpecies* S, BaseSpecies* T) = 0;
107 
108 //setters and getters
109 
111 
120  virtual bool getUseAngularDOFs() const = 0;
121 
123 
130  virtual BaseInteraction* getNewInteraction(BaseInteractable* P, BaseInteractable* I, unsigned timeStamp) const = 0;
131 
132  //TODO add documentation
133  virtual BaseInteraction* getEmptyInteraction() const = 0;
134 
135  virtual void deleteEmptyInteraction(BaseInteraction* interaction) const = 0;
136 
138 
147 
149 
151 
153 
154  void setInteractionDistance(Mdouble interactionDistance);
155 
156 protected:
157 
161  void write(std::ostream& os) const override;
162 
166  void read(std::istream& is) override;
167 
174 
181 
188 
189 private:
196 
202 };
203 
204 #endif
BaseSpecies.h
BaseSpecies::getInteractionDistance
Mdouble getInteractionDistance() const
returns the largest separation distance at which adhesive short-range forces can occur.
Definition: BaseSpecies.h:146
BaseAdhesiveForce.h
BaseAdhesiveForce
Definition: BaseAdhesiveForce.h:31
BaseSpecies::getHandler
SpeciesHandler * getHandler() const
Returns the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:99
BaseSpecies::getFrictionForce
BaseFrictionForce * getFrictionForce() const
Definition: BaseSpecies.h:150
BaseSpecies::getAdhesiveForce
BaseAdhesiveForce * getAdhesiveForce() const
Definition: BaseSpecies.h:152
BaseSpecies::~BaseSpecies
~BaseSpecies()
The default destructor.
Definition: BaseSpecies.cc:64
BaseSpecies::adhesiveForce_
BaseAdhesiveForce * adhesiveForce_
A pointer to the adhesive force parameters \detail This pointer is used by the Interaction's to get a...
Definition: BaseSpecies.h:187
BaseNormalForce::setConstantRestitution
void setConstantRestitution(bool constantRestitution)
Definition: BaseNormalForce.cc:29
BaseSpecies::setInteractionDistance
void setInteractionDistance(Mdouble interactionDistance)
Definition: BaseSpecies.cc:156
logger
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
BaseSpecies::interactionDistance_
Mdouble interactionDistance_
Definition: BaseSpecies.h:201
BaseSpecies::normalForce_
BaseNormalForce * normalForce_
A pointer to the normal force parameters \detail This pointer is used by the Interaction's to get a p...
Definition: BaseSpecies.h:173
SpeciesHandler.h
BaseObject.h
BaseNormalForce
Definition: BaseNormalForce.h:31
BaseInteractable
Defines the basic properties that a interactable object can have.
Definition: BaseInteractable.h:55
BaseSpecies::write
void write(std::ostream &os) const override
Sets the boolean constantRestitution_.
Definition: BaseSpecies.cc:131
BaseSpecies::handler_
SpeciesHandler * handler_
A pointer to the handler to which this species belongs. It is initialized to nullptr and gets set whe...
Definition: BaseSpecies.h:195
BaseInteraction
Stores information about interactions between two interactable objects; often particles but could be ...
Definition: BaseInteraction.h:60
Helpers.h
BaseSpecies::copyInto
virtual void copyInto(BaseSpecies *s) const =0
BaseFrictionForce.h
Mdouble
double Mdouble
Definition: GeneralDefine.h:34
BaseSpecies
BaseSpecies is the class from which all other species are derived.
Definition: BaseSpecies.h:50
SpeciesHandler::getMixedObjects
const std::vector< BaseSpecies * > & getMixedObjects() const
Returns a pointer to the vector of all mixed objects.
Definition: SpeciesHandler.cc:751
SpeciesHandler
Container to store all ParticleSpecies.
Definition: SpeciesHandler.h:37
double
BaseSpecies::average
static Mdouble average(Mdouble a, Mdouble b)
Returns the harmonic mean of two variables.
Definition: BaseSpecies.cc:110
BaseSpecies::getEmptyInteraction
virtual BaseInteraction * getEmptyInteraction() const =0
BaseSpecies::setHandler
void setHandler(SpeciesHandler *handler)
Sets the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:91
Log::FATAL
@ FATAL
BaseSpecies::getNormalForce
BaseNormalForce * getNormalForce() const
Definition: BaseSpecies.h:148
BaseSpecies::copy
virtual BaseSpecies * copy() const =0
Creates a deep copy of the object from which it is called.
DPMBase.h
BaseInteraction.h
LinearPlasticViscoelasticNormalSpecies.h
BaseSpecies::averageInf
static Mdouble averageInf(Mdouble a, Mdouble b)
Returns the harmonic mean of two variables, returning inf if either is inf.
Definition: BaseSpecies.cc:120
BaseSpecies::mixAll
virtual void mixAll(BaseSpecies *S, BaseSpecies *T)=0
creates default values for mixed species
BaseObject
It is an abstract base class due to the purely virtual functions declared below. Even if the function...
Definition: BaseObject.h:51
BaseNormalForce::getConstantRestitution
bool getConstantRestitution() const
Definition: BaseNormalForce.h:45
BaseHandler::getObject
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613
BaseSpecies::read
void read(std::istream &is) override
Definition: BaseSpecies.cc:140
BaseObject::getId
unsigned int getId() const
Returns the unique identifier of any particular object.
Definition: BaseObject.h:125
BaseSpecies::BaseSpecies
BaseSpecies()
The default constructor.
Definition: BaseSpecies.cc:38
BaseParticle
Definition: BaseParticle.h:54
LinearPlasticViscoelasticInteraction.h
BaseSpecies::getNewInteraction
virtual BaseInteraction * getNewInteraction(BaseInteractable *P, BaseInteractable *I, unsigned timeStamp) const =0
returns new Interaction object.
BaseFrictionForce
Definition: BaseFrictionForce.h:31
ParticleSpecies::setMaxInteractionDistance
void setMaxInteractionDistance(Mdouble interactionDistance=0)
Sets maxInteractionDistance_.
Definition: ParticleSpecies.cc:220
BaseSpecies::frictionForce_
BaseFrictionForce * frictionForce_
A pointer to the friction force parameters \detail This pointer is used by the Interaction's to get a...
Definition: BaseSpecies.h:180
helpers::readOptionalVariable
bool readOptionalVariable(std::istream &is, const std::string &name, T &variable)
Reads optional variables in the restart file.
Definition: Helpers.h:247
ExtendedMath.h
BaseForce::setBaseSpecies
void setBaseSpecies(BaseSpecies *baseSpecies)
Definition: BaseForce.h:40
BaseSpecies::getUseAngularDOFs
virtual bool getUseAngularDOFs() const =0
Returns true if torques (i.e. angular degrees of freedom) have to be calculated.
constants::inf
const Mdouble inf
Definition: GeneralDefine.h:44
BaseNormalForce.h
BaseSpecies::deleteEmptyInteraction
virtual void deleteEmptyInteraction(BaseInteraction *interaction) const =0