MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
Container to store all ParticleSpecies.
virtual void deleteEmptyInteraction(BaseInteraction *interaction) const =0
Mdouble interactionDistance_
Returns the distance between particles of this species below which adhesive forces can occur (needed ...
Definition: BaseSpecies.h:201
BaseSpecies is the class from which all other species are derived.
Definition: BaseSpecies.h:49
BaseNormalForce * normalForce_
A pointer to the normal force parameters This pointer is used by the Interaction's to get a pointer ...
Definition: BaseSpecies.h:173
~BaseSpecies()
The default destructor.
Definition: BaseSpecies.cc:64
double Mdouble
Definition: GeneralDefine.h:34
BaseAdhesiveForce * getAdhesiveForce() const
Definition: BaseSpecies.h:152
It is an abstract base class due to the purely virtual functions declared below. Even if the function...
Definition: BaseObject.h:50
void setInteractionDistance(Mdouble interactionDistance)
Sets BaseSpecies::interactionDistance_.
Definition: BaseSpecies.cc:156
virtual void copyInto(BaseSpecies *s) const =0
BaseNormalForce * getNormalForce() const
Definition: BaseSpecies.h:148
BaseAdhesiveForce * adhesiveForce_
A pointer to the adhesive force parameters This pointer is used by the Interaction's to get a pointe...
Definition: BaseSpecies.h:187
Mdouble getInteractionDistance() const
returns the largest separation distance at which adhesive short-range forces can occur.
Definition: BaseSpecies.h:146
Stores information about interactions between two interactable objects; often particles but could be ...
SpeciesHandler * getHandler() const
Returns the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:99
void write(std::ostream &os) const override
Sets the boolean constantRestitution_.
Definition: BaseSpecies.cc:131
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
BaseFrictionForce * getFrictionForce() const
Definition: BaseSpecies.h:150
static Mdouble averageInf(Mdouble a, Mdouble b)
Returns the harmonic mean of two variables, returning inf if either is inf.
Definition: BaseSpecies.cc:120
static Mdouble average(Mdouble a, Mdouble b)
Returns the harmonic mean of two variables.
Definition: BaseSpecies.cc:110
virtual BaseInteraction * getEmptyInteraction() const =0
void read(std::istream &is) override
Definition: BaseSpecies.cc:140
void setHandler(SpeciesHandler *handler)
Sets the pointer to the handler to which this species belongs.
Definition: BaseSpecies.cc:91
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 bool getUseAngularDOFs() const =0
Returns true if torques (i.e. angular degrees of freedom) have to be calculated.
BaseSpecies()
The default constructor.
Definition: BaseSpecies.cc:38
BaseFrictionForce * frictionForce_
A pointer to the friction force parameters This pointer is used by the Interaction's to get a pointe...
Definition: BaseSpecies.h:180
Defines the basic properties that a interactable object can have.
virtual BaseInteraction * getNewInteraction(BaseInteractable *P, BaseInteractable *I, unsigned timeStamp) const =0
returns new Interaction object.