StatisticsPoint.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 STATISTICSPOINT_H
6 #define STATISTICSPOINT_H
7 
9 enum CG_TYPE
10 {
12 };
13 
14 template<StatType T>
15 class StatisticsVector;
16 
17 template<StatType T>
18 struct StatisticsPoint;
19 
20 template<StatType T>
21 std::ostream& operator<<(std::ostream& os, const StatisticsPoint<T>& stat);
22 
24 template<StatType T>
26 {
27 public:
28 
29  //Constructors and Destructors
30 
33  {
34  this->Position.setZero();
35  mirrorParticle = -1;
36  //~ this->set_zero();
37  }
38 
41  {
42  *this = other;
43  mirrorParticle = -1;
44  }
45 
46  //set and get access functions
48  static void set_gb(StatisticsVector<T>* new_gb)
49  {
50  gb = new_gb;
51  }
52 
54  void setCGShape(const char* CG_type)
55  {
56  this->gb->setCGShape(CG_type);
57  }
58 
61  {
62  return this->gb->getCGShape();
63  }
64 
66  void setCGWidth2(Mdouble new_)
67  {
68  this->gb->setCGWidth2(new_);
69  }
70 
73  {
74  return this->gb->getCGWidthSquared();
75  }
76 
79  {
80  return this->gb->getCGWidth();
81  }
82 
85  {
86  return this->gb->getCutoff();
87  }
88 
91  {
92  return this->gb->getCutoff2();
93  }
94 
97  {
98  return this->gb->getXMaxStat();
99  }
100 
103  {
104  return this->gb->getYMaxStat();
105  }
106 
109  {
110  return this->gb->getZMaxStat();
111  }
112 
115  {
116  return this->gb->getXMinStat();
117  }
118 
121  {
122  return this->gb->getYMinStat();
123  }
124 
127  {
128  return this->gb->getZMinStat();
129  }
130 
132  void getN(int& nx_, int& ny_, int& nz_)
133  {
134  this->gb->getN(nx_, ny_, nz_);
135  }
136 
139  {
140  return gb->evaluatePolynomial(r);
141  }
142 
145  {
146  return gb->evaluatePolynomialGradient(r);
147  }
148 
151  {
152  return gb->evaluateIntegral(n1, n2, t);
153  }
154 
157 
159 
160  double averagingVolume();
161 
164  {
165  return this->CG_invvolume;
166  }
167 
169  void set_Gaussian_invvolume(int dim);
170 
172  double compute_Gaussian_invvolume(int dim);
173 
176 
179 
181  void setPosition(Vec3D new_)
182  {
183  this->Position = new_;
184  }
185 
188  {
189  return this->Position;
190  }
191 
193  friend std::ostream& operator<<<T>(std::ostream& os, const StatisticsPoint<T>& stat);
194 
196  void set_zero();
197 
200 
203 
206 
209 
212 
214  inline void firstTimeAverage(const int n);
215 
218 
220  Mdouble dotNonAveraged(const Vec3D& P, const Vec3D& Q);
221 
224 
227 
230 
233 
237 
241 
244  Vec3D CG_gradient(const Vec3D& P, const Mdouble phi);
245 
248  Vec3D CG_integral_gradient(Vec3D& P1, Vec3D& P2, Vec3D& P1_P2_normal, Mdouble P1_P2_distance);
249 
250  Mdouble CG_integral_gradient_1D(Vec3D& P1, Vec3D& P2, Vec3D& P1_P2_normal, Mdouble P1_P2_distance);
251 
253  Mdouble CG_integral(Vec3D& P1, Vec3D& P2, Vec3D& P1_P2_normal, Mdouble P1_P2_distance, Vec3D& rpsi);
254 
257  Mdouble CG_integral_2D(Vec3D& P1, Vec3D& P2, Vec3D& P1_P2_normal, Mdouble P1_P2_distance, Mdouble& rpsi_scalar);
258 
261  Mdouble CG_integral_1D(Vec3D& P1, Vec3D& P2, Vec3D& P1_P2_normal, Mdouble P1_P2_distance, Mdouble& rpsi_scalar);
262 
265 
268 
271 
274 
275 public:
276  //Values of macroscopical fields at Position
312 
316 
319 
322 
323 private:
328 
329 };
330 
331 #endif
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
MatrixXf Q
Definition: HouseholderQR_householderQ.cpp:1
CG_TYPE
enum used to store the type of coarse-graining function used
Definition: StatisticsPoint.h:10
@ HeavisideSphere
Definition: StatisticsPoint.h:11
@ Polynomial
Definition: StatisticsPoint.h:11
@ Gaussian
Definition: StatisticsPoint.h:11
std::ostream & operator<<(std::ostream &s, const DenseBase< Derived > &m)
Definition: IO.h:222
Implementation of a 3D matrix.
Definition: Kernel/Math/Matrix.h:17
Implementation of a 3D symmetric matrix.
Definition: MatrixSymmetric.h:16
This class is used to extract statistical data from MD simulations.
Definition: StatisticsVector.h:41
Definition: Kernel/Math/Vector.h:30
void setZero()
Sets all elements to zero.
Definition: Vector.cc:23
const Scalar * a
Definition: level2_cplx_impl.h:32
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:77
r
Definition: UniformPSDSelfTest.py:20
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
t
Definition: plotPSD.py:36
This class stores statistical values for a given spatial position; to be used in combination with Sta...
Definition: StatisticsPoint.h:26
StatisticsPoint< T > & operator+=(const StatisticsPoint< T > &P)
Defines a plus operator needed to average values ( )
CG_TYPE getCGShape() const
see StatisticsVector::getCGShape
Definition: StatisticsPoint.h:60
Vec3D crossNonAveraged(Vec3D P, Vec3D &Q)
Returns the cross product of two vectors in the coordinates that are not averaged about.
Mdouble CG_function_2D(const Vec3D &PI)
StatisticsPoint< T > & operator-=(const StatisticsPoint< T > &P)
Defines a plus operator needed to calculate variance.
Mdouble getYMinStat()
see StatisticsVector::getYMinStat
Definition: StatisticsPoint.h:120
Mdouble CG_integral_gradient_1D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance)
std::string print_sqrt() const
Outputs root of statistical variables in human-readable format.
Mdouble getCutoff2()
see StatisticsVector::getCutoff2
Definition: StatisticsPoint.h:90
Mdouble evaluatePolynomial(Mdouble r)
see StatisticsVector::evaluatePolynomial
Definition: StatisticsPoint.h:138
Mdouble CG_invvolume
Prefactor of CG function which depends on $w.
Definition: StatisticsPoint.h:318
MatrixSymmetric3D MomentumFlux
Momentum flux, .
Definition: StatisticsPoint.h:288
void setCGInverseVolume()
sets CG_invvolume
Vec3D CG_integral_gradient(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance)
StatisticsPoint< T > getSquared()
Squares all statistical variables; needed for variance.
Mdouble getYMaxStat()
see StatisticsVector::getYMaxStat
Definition: StatisticsPoint.h:102
Mdouble getCGWidth() const
see StatisticsVector::getCGWidth
Definition: StatisticsPoint.h:78
Vec3D CG_gradient(const Vec3D &P, const Mdouble phi)
double averagingVolume()
Matrix3D NormalStress
Stress from normal forces, .
Definition: StatisticsPoint.h:294
std::string write_variable_names()
Outputs names of statistical variables in computer-readable format.
std::string write() const
Outputs statistical variables in computer-readable format.
Matrix3D ContactCoupleStress
Definition: StatisticsPoint.h:315
Mdouble getXMaxStat()
see StatisticsVector::getXMaxStat
Definition: StatisticsPoint.h:96
Vec3D EnergyFlux
Energy flux, .
Definition: StatisticsPoint.h:292
Mdouble getCGWidthSquared() const
see StatisticsVector::getCGWidthSquared
Definition: StatisticsPoint.h:72
Mdouble getZMaxStat()
see StatisticsVector::getZMaxStat
Definition: StatisticsPoint.h:108
void set_Gaussian_invvolume(int dim)
sets CG_invvolume if CG_type=Gaussian
Mdouble Nu
Particle volume fraction, .
Definition: StatisticsPoint.h:278
MatrixSymmetric3D DisplacementMomentumFlux
Momentum flux from linear displacement, .
Definition: StatisticsPoint.h:290
double compute_Gaussian_invvolume(int dim)
computes CG_invvolume if CG_type=Gaussian
Vec3D NormalTraction
Traction from normal forces, .
Definition: StatisticsPoint.h:298
Mdouble evaluateIntegral(Mdouble n1, Mdouble n2, Mdouble t)
see StatisticsVector::evaluateIntegral
Definition: StatisticsPoint.h:150
void setCGWidth2(Mdouble new_)
see StatisticsVector::setCGWidth2
Definition: StatisticsPoint.h:66
Matrix3D LocalAngularMomentumFlux
Definition: StatisticsPoint.h:314
Matrix3D TangentialStress
Stress from tangential forces, .
Definition: StatisticsPoint.h:296
MatrixSymmetric3D Displacement
Linear displacement, .
Definition: StatisticsPoint.h:286
StatisticsPoint()
Constructor sets sensible values.
Definition: StatisticsPoint.h:32
Mdouble evaluatePolynomialGradient(Mdouble r)
see StatisticsVector::evaluatePolynomialGradient
Definition: StatisticsPoint.h:144
std::string print() const
Outputs statistical variables in human-readable format.
Vec3D LocalAngularMomentum
Definition: StatisticsPoint.h:313
void getN(int &nx_, int &ny_, int &nz_)
see StatisticsVector::get_n
Definition: StatisticsPoint.h:132
void set_Polynomial_invvolume(int dim)
sets CG_invvolume if CG_type=Polynomial
Mdouble getXMinStat()
see StatisticsVector::getXMinStat
Definition: StatisticsPoint.h:114
MatrixSymmetric3D Fabric
Fabric tensor, .
Definition: StatisticsPoint.h:302
Mdouble CG_integral_2D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance, Mdouble &rpsi_scalar)
Mdouble CG_function_1D(const Vec3D &PI)
Mdouble getCutoff()
see StatisticsVector::getCutoff
Definition: StatisticsPoint.h:84
void setCGShape(const char *CG_type)
see StatisticsVector::setCGShape
Definition: StatisticsPoint.h:54
Vec3D CollisionalHeatFlux
Definition: StatisticsPoint.h:305
Vec3D getPosition() const
returns Position
Definition: StatisticsPoint.h:187
Mdouble dotNonAveraged(const Vec3D &P, const Vec3D &Q)
Returns the dot product of two vectors in the coordinates that are not averaged about.
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 .
Mdouble CG_function(const Vec3D &PI)
Returns the value of the course graining function phi(P,PI)
Mdouble Density
Density, .
Definition: StatisticsPoint.h:280
Mdouble Potential
Definition: StatisticsPoint.h:311
static void set_gb(StatisticsVector< T > *new_gb)
see StatisticsVector::setCGShape
Definition: StatisticsPoint.h:48
void set_Heaviside_invvolume()
sets CG_invvolume if CG_type=HeaviSideSphere
Vec3D Momentum
Momentum, .
Definition: StatisticsPoint.h:282
int mirrorParticle
indicates that a position is a (fake) particles used for periodic walls
Definition: StatisticsPoint.h:321
Mdouble getCGInverseVolume()
returns CG_invvolume
Definition: StatisticsPoint.h:163
StatisticsPoint< T > & operator/=(const Mdouble a)
Defines a division operator needed to average values ( )
StatisticsPoint(const StatisticsPoint &other)
Copy constructor; simply copies everything.
Definition: StatisticsPoint.h:40
Vec3D clearAveragedDirections(Vec3D P)
Returns a vector where the averaged directions are zero.
static StatisticsVector< T > * gb
Pointer to StatisticsVector (to obtain global parameters)
Definition: StatisticsPoint.h:325
Vec3D TangentialTraction
Traction from tangential forces, .
Definition: StatisticsPoint.h:300
Vec3D DisplacementMomentum
Momentum from linear displacement, , where , with the time intervall between outputs.
Definition: StatisticsPoint.h:284
Mdouble Dissipation
Definition: StatisticsPoint.h:308
void setPosition(Vec3D new_)
sets Position
Definition: StatisticsPoint.h:181
StatisticsPoint< T > & operator=(const StatisticsPoint< T > &P)
Defines a equal operator needed for copy constructor.
Matrix3D matrixCrossNonAveraged(Vec3D P, Matrix3D &Q)
Returns the cross product of two vectors in the coordinates that are not averaged about.
Vec3D Position
Position at which evaluation occurs.
Definition: StatisticsPoint.h:327
void firstTimeAverage(const int n)
Defines a division operator needed to time-average values (because the displacement does not have a v...
Mdouble getZMinStat()
see StatisticsVector::getZMinStat
Definition: StatisticsPoint.h:126
void set_zero()
Sets all statistical variables to zero.
Mdouble getDistanceSquaredNonAveraged(const Vec3D &P)
returns the coarse graining distance in the coordinates that are not averaged about
Mdouble CG_integral_1D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance, Mdouble &rpsi_scalar)