MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StandardFields.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 #ifndef StandardFields_H
26 #define StandardFields_H
27 
28 #include <Math/Matrix.h>
29 #include <Math/MatrixSymmetric.h>
31 #include <array>
32 
33 class BaseParticle;
34 
35 class BaseInteraction;
36 
37 namespace CGFields
38 {
39 
51 {
52 public:
53 
58 
62  StandardFields(const StandardFields& P) = default;
63 
68  ~StandardFields() = default;
69 
70  static void writeNames(std::ostream& os, unsigned countVariables);
71 
75  void write(std::ostream& os) const;
76 
80  void output(std::ostream& os) const;
81 
85  void setZero();
86 
90  StandardFields getSquared() const;
91 
96 
101 
106 
111 
117 
123  void addParticleStatistics(Mdouble phi, const StandardFields& currentInteraction);
124 
125  void addParticleDifferentialStatistics(Vec3D& dphi, const StandardFields& currentInteraction);
126 
132  void addInteractionStatistics(Mdouble psi, const StandardFields& currentInteraction);
133 
139  void addContactPointStatistics(Mdouble phi, const StandardFields& currentInteraction);
140 
141  void setFields(const BaseInteraction& c, IntegralType type);
142 
144 
145  void setFields(const BaseParticle& p);
146 
147  void setCylindricalFields(const BaseParticle& p);
148 
149 
154  static bool doInteractionStatistics();
155 
157  {
158  return volumeFraction_;
159  }
160 
162  {
163  return density_;
164  }
165 
167  {
168  return momentum_;
169  }
170 
172  {
173  return momentumFlux_;
174  }
175 
177  {
178  return contactStress_;
179  }
180 
182  {
184  }
185 
187  {
188  return particleSizeDensity_[i];
189  }
190 
191  std::array<Mdouble, 6> getParticleSizeDensity() const
192  {
193  return particleSizeDensity_;
194  }
195 
196  std::array<Mdouble, 6> getParticleSizeMomenta() const;
197 
198  std::array<Mdouble, 6> getCentralParticleSizeMomenta() const;
199 
200  std::array<Mdouble, 6> getStandardisedParticleSizeMomenta() const;
201 
202  void outputStandardisedParticleSizeMomenta(std::ostream& os) const;
203 
205  {
206  return false;
207  }
208 
213  static bool isDifferentialField()
214  {
215  return false;
216  }
217 
218 private:
219 
227 
235 
247 
259 
271 
281 
291  std::array<Mdouble, 6> particleSizeDensity_;
292 
293 };
294 
295 }
296 #endif
void write(std::ostream &os) const
Writes class content into an output stream, typically a stat file.
Mdouble getDensity() const
double Mdouble
Definition: GeneralDefine.h:34
std::array< Mdouble, 6 > getCentralParticleSizeMomenta() const
Vec3D getInteractionForceDensity() const
const std::complex< Mdouble > i
Definition: ExtendedMath.h:50
StandardFields & operator/=(Mdouble a)
Divides the field values on the LHS by the RHS of the equation.
Matrix3D getContactStress() const
std::array< Mdouble, 6 > getParticleSizeDensity() const
Mdouble getParticleSizeDensity(size_t i) const
Stores information about interactions between two interactable objects; often particles but could be ...
MatrixSymmetric3D momentumFlux_
StandardFields & operator=(const StandardFields &P)
Copies all field values.
IntegralType
Specifies the two points between which a line integral is computed.
Definition: IntegralType.h:33
void addParticleStatistics(Mdouble phi, const StandardFields &currentInteraction)
This function should be called from within a loop over all particles to compute all the fields that a...
Mdouble getVolumeFraction() const
std::array< Mdouble, 6 > getParticleSizeMomenta() const
StandardFields operator*(Mdouble a) const
Multiplies the field values on the left of the '*' by the scalar value on the right of the '*' and re...
static bool isDifferentialField()
Vec3D getMomentum() const
void addInteractionStatistics(Mdouble psi, const StandardFields &currentInteraction)
This function should be called from within a loop over all Interactions to compute all the fields tha...
void outputStandardisedParticleSizeMomenta(std::ostream &os) const
void setZero()
Sets all fields to zero.
~StandardFields()=default
Destructor, it simply destructs the StandardFields and all the objects it contains.
StandardFields & operator+=(const StandardFields &P)
Adds the field values on the RHS to the LHS of the equation.
std::array< Mdouble, 6 > particleSizeDensity_
void addParticleDifferentialStatistics(Vec3D &dphi, const StandardFields &currentInteraction)
std::array< Mdouble, 6 > getStandardisedParticleSizeMomenta() const
StandardFields & operator-=(const StandardFields &P)
Subtracts the field values on the RHS from the LHS of the equation.
void output(std::ostream &os) const
Writes human-readable class content into an output stream, typically a stat file. ...
Implementation of a 3D matrix.
Definition: Matrix.h:37
Definition: Vector.h:49
void setCylindricalFields(const BaseInteraction &c, IntegralType type)
MatrixSymmetric3D getMomentumFlux() const
Contains the computed field values, like density, momentum and stress.
void addContactPointStatistics(Mdouble phi, const StandardFields &currentInteraction)
This function should be called from within a loop over all Interactions to compute all the fields tha...
static bool doInteractionStatistics()
Returns true if the class contains fields that are defined as a sum over all Interactions (e...
static void writeNames(std::ostream &os, unsigned countVariables)
Implementation of a 3D symmetric matrix.
StandardFields getSquared() const
Returns the square of all field values (to calculate standard deviation).
static bool evaluateFixedParticles()
StandardFields()
Default constructor, sets all field values to zero.
void setFields(const BaseInteraction &c, IntegralType type)