MercuryDPM  Alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StatisticsPoint.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2014, 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 STATISTICSPOINT_H
27 #define STATISTICSPOINT_H
28 
30 enum CG
31 {
33 };
34 
35 template<StatType T>
37 
38 template<StatType T>
40 
41 template<StatType T>
42 std::ostream& operator<<(std::ostream& os, const StatisticsPoint<T> &stat);
43 
45 template<StatType T>
46 struct StatisticsPoint
47 {
48 public:
49 
50  //Constructors and Destructors
51 
54  {
55  this->Position.setZero();
56  mirrorParticle = -1;
57  //~ this->set_zero();
58  }
59 
62  {
63  *this = other;
64  mirrorParticle = -1;
65  }
66 
67  //set and get access functions
69  static void set_gb(StatisticsVector<T>* new_gb)
70  {
71  gb = new_gb;
72  }
74  void setCGShape(const char* CG_type)
75  {
76  this->gb->setCGShape(CG_type);
77  }
79  CG getCGShape() const
80  {
81  return this->gb->getCGShape();
82  }
84  void setCGWidth2(Mdouble new_)
85  {
86  this->gb->setCGWidth2(new_);
87  }
90  {
91  return this->gb->getCGWidthSquared();
92  }
95  {
96  return this->gb->getCGWidth();
97  }
100  {
101  return this->gb->getCutoff();
102  }
105  {
106  return this->gb->getCutoff2();
107  }
110  {
111  return this->gb->getXMaxStat();
112  }
115  {
116  return this->gb->getYMaxStat();
117  }
120  {
121  return this->gb->getZMaxStat();
122  }
125  {
126  return this->gb->getXMinStat();
127  }
130  {
131  return this->gb->getYMinStat();
132  }
135  {
136  return this->gb->getZMinStat();
137  }
139  void getN(int& nx_, int& ny_, int& nz_)
140  {
141  this->gb->getN(nx_, ny_, nz_);
142  }
145  {
146  return gb->evaluatePolynomial(r);
147  }
150  {
151  return gb->evaluatePolynomialGradient(r);
152  }
155  {
156  return gb->evaluateIntegral(n1, n2, t);
157  }
158 
160  void setCGInverseVolume();
161  int nonaveragedDim();
162  double averagingVolume();
165  {
166  return this->CG_invvolume;
167  }
169  void set_Gaussian_invvolume(int dim);
171  double compute_Gaussian_invvolume(int dim);
174 
176  void set_Polynomial_invvolume(int dim);
177 
179  void setPosition(Vec3D new_)
180  {
181  this->Position = new_;
182  }
185  {
186  return this->Position;
187  }
188 
190  friend std::ostream& operator<<<T>(std::ostream& os, const StatisticsPoint<T> &stat);
191 
193  void set_zero();
194 
197 
200 
203 
206 
208  inline StatisticsPoint<T>& operator/=(const Mdouble a);
209 
211  inline void firstTimeAverage(const int n);
212 
215 
217  Mdouble dotNonAveraged(const Vec3D &P, const Vec3D &Q);
218 
221 
224 
227 
229  Mdouble CG_function(const Vec3D &PI);
230 
233  Mdouble CG_function_2D(const Vec3D &PI);
234 
237  Mdouble CG_function_1D(const Vec3D &PI);
238 
241  Vec3D CG_gradient(const Vec3D &P, const Mdouble phi);
242 
245  Vec3D CG_integral_gradient(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance);
246  Mdouble CG_integral_gradient_1D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance);
247 
249  Mdouble CG_integral(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance, Vec3D& rpsi);
250 
253  Mdouble CG_integral_2D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance, Mdouble& rpsi_scalar);
254 
257  Mdouble CG_integral_1D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance, Mdouble& rpsi_scalar);
258 
260  std::string print() const;
262  std::string print_sqrt() const;
264  std::string write_variable_names();
266  std::string write() const;
267 
268 public:
269  //Values of macroscopical fields at Position
305 
309 
312 
315 
316 private:
321 
322 };
323 #endif
Vec3D crossNonAveraged(Vec3D P, Vec3D &Q)
Returns the cross product of two vectors in the coordinates that are not averaged about...
Mdouble CG_function(const Vec3D &PI)
Returns the value of the course graining function phi(P,PI)
StatisticsPoint< T > & operator/=(const Mdouble a)
Defines a division operator needed to average values ( )
Mdouble CG_invvolume
Prefactor of CG function which depends on $w.
MatrixSymmetric3D DisplacementMomentumFlux
Momentum flux from linear displacement, .
Mdouble evaluatePolynomial(Mdouble r)
see StatisticsVector::evaluatePolynomial
Matrix3D ContactCoupleStress
Mdouble Dissipation
Dissipation form collisions, .
Mdouble CG_function_1D(const Vec3D &PI)
Returns the value of the course graining function phi(P,PI) averaged along a plane.
void setCGShape(const char *CG_type)
see StatisticsVector::setCGShape
double Mdouble
Vec3D CG_integral_gradient(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance)
gradient of phi
Mdouble CG_function_2D(const Vec3D &PI)
returns the value of the course graining function phi(P,PI) averaged along a line ...
void firstTimeAverage(const int n)
Defines a division operator needed to time-average values (because the displacement does not have a v...
StatisticsPoint< T > & operator-=(const StatisticsPoint< T > &P)
Defines a plus operator needed to calculate variance.
Mdouble evaluateIntegral(Mdouble n1, Mdouble n2, Mdouble t)
see StatisticsVector::evaluateIntegral
void setZero()
Sets all elements to zero.
Definition: Vector.cc:52
Mdouble getZMinStat()
see StatisticsVector::getZMinStat
void set_Gaussian_invvolume(int dim)
sets CG_invvolume if CG_type=Gaussian
Matrix3D NormalStress
Stress from normal forces, .
Vec3D getPosition() const
returns Position
Mdouble getCGWidth() const
see StatisticsVector::getCGWidth
Matrix3D matrixCrossNonAveraged(Vec3D P, Matrix3D &Q)
Returns the cross product of two vectors in the coordinates that are not averaged about...
void set_Heaviside_invvolume()
sets CG_invvolume if CG_type=HeaviSideSphere
Vec3D CollisionalHeatFlux
Heat flux from collisions, .
std::string write_variable_names()
Outputs names of statistical variables in computer-readable format.
CG
enum used to store the type of coarse-graining function used
Mdouble Nu
Particle volume fraction, .
Vec3D NormalTraction
Traction from normal forces, .
Mdouble getCutoff()
see StatisticsVector::getCutoff
Mdouble CG_integral_2D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance, Mdouble &rpsi_scalar)
Returns the value of the coarse graining integral averaged along a line.
Vec3D DisplacementMomentum
Momentum from linear displacement, , where , with the time intervall between outputs.
MatrixSymmetric3D Fabric
Fabric tensor, .
void setCGInverseVolume()
sets CG_invvolume
std::string print() const
Outputs statistical variables in human-readable format.
StatisticsPoint(const StatisticsPoint &other)
Copy constructor; simply copies everything.
Vec3D CG_gradient(const Vec3D &P, const Mdouble phi)
gradient of phi
double averagingVolume()
int mirrorParticle
indicates that a position is a (fake) particles used for periodic walls
Vec3D EnergyFlux
Energy flux, .
Mdouble Density
Density, .
Mdouble getYMaxStat()
see StatisticsVector::getYMaxStat
MatrixSymmetric3D Displacement
Linear displacement, .
std::string write() const
Outputs statistical variables in computer-readable format.
void set_zero()
Sets all statistical variables to zero.
Mdouble getCutoff2()
see StatisticsVector::getCutoff2
Mdouble getXMinStat()
see StatisticsVector::getXMinStat
Vec3D TangentialTraction
Traction from tangential forces, .
Mdouble getCGWidthSquared() const
see StatisticsVector::getCGWidthSquared
Matrix3D LocalAngularMomentumFlux
StatisticsPoint< T > getSquared()
Squares all statistical variables; needed for variance.
Mdouble dotNonAveraged(const Vec3D &P, const Vec3D &Q)
Returns the dot product of two vectors in the coordinates that are not averaged about.
Vec3D clearAveragedDirections(Vec3D P)
Returns a vector where the averaged directions are zero.
StatisticsPoint< T > & operator+=(const StatisticsPoint< T > &P)
Defines a plus operator needed to average values ( )
Mdouble Potential
Elastic energy .
Mdouble CG_integral_gradient_1D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance)
This class stores statistical values for a given spatial position; to be used in combination with Sta...
MatrixSymmetric3D MomentumFlux
Momentum flux, .
StatisticsPoint()
Constructor sets sensible values.
This class is used to extract statistical data from MD simulations.
Mdouble getZMaxStat()
see StatisticsVector::getZMaxStat
Mdouble getCGInverseVolume()
returns CG_invvolume
void getN(int &nx_, int &ny_, int &nz_)
see StatisticsVector::get_n
double compute_Gaussian_invvolume(int dim)
computes CG_invvolume if CG_type=Gaussian
Mdouble CG_integral(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance, Vec3D &rpsi)
Returns the value of the coarse graining integral .
Implementation of a 3D matrix.
Definition: Matrix.h:36
static void set_gb(StatisticsVector< T > *new_gb)
see StatisticsVector::setCGShape
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:45
Vec3D Momentum
Momentum, .
static StatisticsVector< T > * gb
Pointer to StatisticsVector (to obtain global parameters)
Vec3D Position
Position at which evaluation occurs.
Mdouble getXMaxStat()
see StatisticsVector::getXMaxStat
void setPosition(Vec3D new_)
sets Position
Mdouble CG_integral_1D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance, Mdouble &rpsi_scalar)
Returns the value of the coarse graining integral averaged along a plane.
Implementation of a 3D symmetric matrix.
Mdouble evaluatePolynomialGradient(Mdouble r)
see StatisticsVector::evaluatePolynomialGradient
Mdouble getYMinStat()
see StatisticsVector::getYMinStat
StatisticsPoint< T > & operator=(const StatisticsPoint< T > &P)
Defines a equal operator needed for copy constructor.
void set_Polynomial_invvolume(int dim)
sets CG_invvolume if CG_type=Polynomial
std::string print_sqrt() const
Outputs root of statistical variables in human-readable format.
CG getCGShape() const
see StatisticsVector::getCGShape
Matrix3D TangentialStress
Stress from tangential forces, .
void setCGWidth2(Mdouble new_)
see StatisticsVector::setCGWidth2
Mdouble getDistanceSquaredNonAveraged(const Vec3D &P)
returns the coarse graining distance in the coordinates that are not averaged about ...