MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ParticleSpecies.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 ParticleSpecies_H
27 #define ParticleSpecies_H
28 
29 #include "BaseSpecies.h"
30 #include "Math/ExtendedMath.h"
32 
33 class BaseInteractable;
34 
35 //Note the getVelocity can for some Species be dependent on which point on the Species is meant.
37 {
38 public:
41 
44 
47 
48  ParticleSpecies(BaseNormalForce* normalForce, BaseFrictionForce* frictionForce, BaseAdhesiveForce* adhesiveForce);
49 
52 
57  ParticleSpecies* copy() const override = 0;
58 
63  virtual BaseSpecies* copyMixed() const = 0;
64 
66  void read(std::istream& is) override;
67 
69  void write(std::ostream& os) const override;
70 
72  std::string getBaseName() const;
73 
76  void setDensity(Mdouble density);
77 
80  Mdouble getMassFromRadius(Mdouble radius) const;
81 
82  Mdouble getMassFromRadius(const Mdouble radius,SpeciesHandler& speciesHandler);
83 
84  Mdouble getVolumeFromRadius(Mdouble radius) const;
85 
87  Mdouble getDensity() const;
88 
92  void computeMass(BaseParticle* p) const;
93 
94  void setTemperatureDependentDensity(const std::function<double(double)>& temperatureDependentDensity);
95 
96  const std::function<double(double)>& getTemperatureDependentDensity() const;
97 
103 
105 
114 
119  void setMaxInteractionDistance(Mdouble interactionDistance=0);
120 
121  const BaseSpecies* getMixedSpecies(const ParticleSpecies* s) const;
122 
123 private:
124 
130 
135 
140  std::function<double(double temperature)> temperatureDependentDensity_;
141 
146 
147 
148 };
149 
150 #endif
Container to store all ParticleSpecies.
BaseSpecies MixedSpeciesType
Mdouble maxInteractionDistance_
Returns the max distance between particles of this species and any other species below which adhesive...
void setMaxInteractionDistance(Mdouble interactionDistance=0)
Sets maxInteractionDistance_.
BaseSpecies is the class from which all other species are derived.
Definition: BaseSpecies.h:49
double Mdouble
Definition: GeneralDefine.h:34
const std::function< double(double)> & getTemperatureDependentDensity() const
std::function< double(double temperature)> temperatureDependentDensity_
void computeMass(BaseParticle *p) const
Compute Particle mass function, which required a reference to the Species vector. It computes the Par...
Mdouble getMassFromRadius(Mdouble radius) const
Mdouble getVolumeFromRadius(Mdouble radius) const
Mdouble getMaxInteractionDistance() const
returns the largest separation distance at which adhesive short-range forces can occur.
Stores information about interactions between two interactable objects; often particles but could be ...
std::string getBaseName() const
Used in Species::getName to obtain a unique name for each Species.
const BaseSpecies * getMixedSpecies(const ParticleSpecies *s) const
virtual BaseSpecies * copyMixed() const =0
Creates a new MixedSpecies with the same force properties as the Species from which it is called...
ParticleSpecies * copy() const override=0
Creates a deep copy of the object from which it is called.
void setDensity(Mdouble density)
Allows density_ to be changed.
ParticleSpecies()
The default constructor.
Mdouble getLargestInverseParticleMassLocal() const
Computes inverse mass of the lightest particle (by mass) belonging to this species. If MPI is used, this computation is done locally on each node.
Mdouble density_
The mass density.
Defines the basic properties that a interactable object can have.
Mdouble getDensity() const
Allows density_ to be accessed.
void write(std::ostream &os) const override
Writes the species properties to an output stream.
BaseInteraction InteractionType
Mdouble getSmallestParticleMass() const
Computes mass of the lightest particle (by mass) belonging to this species. This computation calls ge...
~ParticleSpecies()
The default destructor.
void setTemperatureDependentDensity(const std::function< double(double)> &temperatureDependentDensity)
void read(std::istream &is) override
Reads the species properties from an input stream.