BaseSpecies.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 BASESPECIES_H
6 #define BASESPECIES_H
7 
8 #include "BaseObject.h"
9 #include "Math/ExtendedMath.h"
10 #include "Math/Helpers.h"
14 
15 class SpeciesHandler;// derived from BaseHandler<ParticleSpecies>
16 //class BaseParticle; //
17 class BaseInteractable;
18 
19 class BaseInteraction;
20 
27 //Note the getVelocity can for some Species be dependent on which point on the Species is meant.
28 class BaseSpecies : public BaseObject
29 {
30 public:
31 
33  BaseSpecies();
34 
36 
38  BaseSpecies(const BaseSpecies& p);
39 
41  ~BaseSpecies();
42 
57  virtual BaseSpecies* copy() const = 0;
58 
62  virtual void copyInto(BaseSpecies* s) const =0;
63 
65  void setHandler(SpeciesHandler* handler);
66 
68  SpeciesHandler* getHandler() const;
69 
71  static Mdouble average(Mdouble a, Mdouble b);
72 
75 
77 
85  virtual void mixAll(BaseSpecies* S, BaseSpecies* T) = 0;
86 
87 //setters and getters
88 
90 
99  virtual bool getUseAngularDOFs() const = 0;
100 
102 
109  virtual BaseInteraction* getNewInteraction(BaseInteractable* P, BaseInteractable* I, unsigned timeStamp) const = 0;
110 
112  virtual BaseInteraction* getEmptyInteraction() const = 0;
113 
114  virtual void deleteEmptyInteraction(BaseInteraction* interaction) const = 0;
115 
117 
126 
128 
130 
132 
133  void setInteractionDistance(Mdouble interactionDistance);
134 
135 protected:
136 
140  void write(std::ostream& os) const override;
141 
145  void read(std::istream& is) override;
146 
153 
160 
167 
168 private:
175 
181 };
182 
183 #endif
double Mdouble
Definition: GeneralDefine.h:13
float * p
Definition: Tutorial_Map_using.cpp:9
Scalar * b
Definition: benchVecAdd.cpp:17
Definition: BaseAdhesiveForce.h:10
Definition: BaseFrictionForce.h:10
Defines the basic properties that a interactable object can have.
Definition: BaseInteractable.h:34
Stores information about interactions between two interactable objects; often particles but could be ...
Definition: BaseInteraction.h:39
Definition: BaseNormalForce.h:11
It is an abstract base class due to the purely virtual functions declared below. Even if the function...
Definition: BaseObject.h:30
BaseSpecies is the class from which all other species are derived.
Definition: BaseSpecies.h:29
BaseAdhesiveForce * adhesiveForce_
A pointer to the adhesive force parameters.
Definition: BaseSpecies.h:166
Mdouble getInteractionDistance() const
returns the largest separation distance at which adhesive short-range forces can occur.
Definition: BaseSpecies.h:125
BaseSpecies()
The default constructor.
Definition: BaseSpecies.cc:17
virtual void mixAll(BaseSpecies *S, BaseSpecies *T)=0
creates default values for mixed species
virtual BaseSpecies * copy() const =0
Creates a deep copy of the object from which it is called.
virtual void copyInto(BaseSpecies *s) const =0
void read(std::istream &is) override
Definition: BaseSpecies.cc:119
SpeciesHandler * handler_
A pointer to the handler to which this species belongs. It is initialized to nullptr and gets set whe...
Definition: BaseSpecies.h:174
virtual BaseInteraction * getEmptyInteraction() const =0
BaseFrictionForce * getFrictionForce() const
Definition: BaseSpecies.h:129
virtual void deleteEmptyInteraction(BaseInteraction *interaction) const =0
~BaseSpecies()
The default destructor.
Definition: BaseSpecies.cc:43
BaseNormalForce * getNormalForce() const
Definition: BaseSpecies.h:127
BaseFrictionForce * frictionForce_
A pointer to the friction force parameters.
Definition: BaseSpecies.h:159
static Mdouble average(Mdouble a, Mdouble b)
Returns the harmonic mean of two variables.
Definition: BaseSpecies.cc:89
Mdouble interactionDistance_
Definition: BaseSpecies.h:180
BaseNormalForce * normalForce_
A pointer to the normal force parameters.
Definition: BaseSpecies.h:152
SpeciesHandler * getHandler() const
Returns the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:78
virtual bool getUseAngularDOFs() const =0
Returns true if torques (i.e. angular degrees of freedom) have to be calculated.
virtual BaseInteraction * getNewInteraction(BaseInteractable *P, BaseInteractable *I, unsigned timeStamp) const =0
returns new Interaction object.
BaseAdhesiveForce * getAdhesiveForce() const
Definition: BaseSpecies.h:131
void write(std::ostream &os) const override
Sets the boolean constantRestitution_.
Definition: BaseSpecies.cc:110
static Mdouble averageInf(Mdouble a, Mdouble b)
Returns the harmonic mean of two variables, returning inf if either is inf.
Definition: BaseSpecies.cc:99
void setInteractionDistance(Mdouble interactionDistance)
Definition: BaseSpecies.cc:135
void setHandler(SpeciesHandler *handler)
Sets the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:70
Container to store all ParticleSpecies.
Definition: SpeciesHandler.h:15
RealScalar s
Definition: level1_cplx_impl.h:130
const Scalar * a
Definition: level2_cplx_impl.h:32
#define I
Definition: main.h:127
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:77
@ S
Definition: quadtree.h:62