MercuryDPM  0.10
 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 
28 
29 template <StatType T>
31 
32 template <StatType T>
34 
35 template <StatType T>
36 std::ostream& operator<<(std::ostream& os, const StatisticsPoint<T> &stat);
37 
39 template <StatType T>
40 struct StatisticsPoint {
41 public:
42 
43  //Constructors and Destructors
44 
47  this->Position.set_zero();
48  mirrorParticle=-1;
49  //~ this->set_zero();
50  }
51 
53  StatisticsPoint(const StatisticsPoint &other) {*this = other; mirrorParticle=-1;}
54 
55  //set and get access functions
57  static void set_gb(StatisticsVector<T>* new_gb) {gb = new_gb;}
59  void set_CG_type(const char* CG_type) {this->gb->set_CG_type(CG_type);}
61  CG get_CG_type() const {return this->gb->get_CG_type();}
63  void set_w2(Mdouble new_) {this->gb->set_w2(new_);}
65  Mdouble get_w2() const {return this->gb->get_w2();}
67  Mdouble get_w() const {return this->gb->get_w();}
69  Mdouble get_cutoff() {return this->gb->get_cutoff();}
71  Mdouble get_cutoff2() {return this->gb->get_cutoff2();}
73  Mdouble get_xmaxStat() {return this->gb->get_xmaxStat();}
75  Mdouble get_ymaxStat() {return this->gb->get_ymaxStat();}
77  Mdouble get_zmaxStat() {return this->gb->get_zmaxStat();}
79  Mdouble get_xminStat() {return this->gb->get_xminStat();}
81  Mdouble get_yminStat() {return this->gb->get_yminStat();}
83  Mdouble get_zminStat() {return this->gb->get_zminStat();}
85  void get_n(int& nx_, int& ny_, int& nz_) {this->gb->get_n(nx_,ny_,nz_);}
87  Mdouble evaluatePolynomial(Mdouble r) {return gb->evaluatePolynomial(r);}
89  Mdouble evaluatePolynomialGradient(Mdouble r) {return gb->evaluatePolynomialGradient(r);}
91  Mdouble evaluateIntegral(Mdouble n1, Mdouble n2, Mdouble t) {return gb->evaluateIntegral(n1,n2,t);}
92 
94  void set_CG_invvolume();
95  int nonaveragedDim();
96  double averagingVolume();
100  void set_Gaussian_invvolume(int dim);
102  double compute_Gaussian_invvolume(int dim);
105 
107  void set_Polynomial_invvolume(int dim);
108 
110  void set_Position(Vec3D new_) {this->Position = new_;}
112  Vec3D get_Position() const {return this->Position;}
113 
115  friend std::ostream& operator<< <T>(std::ostream& os, const StatisticsPoint<T> &stat);
116 
118  void set_zero();
119 
122 
125 
128 
131 
133  inline StatisticsPoint<T>& operator/=(const Mdouble a);
134 
136  inline void firstTimeAverage(const int n);
137 
139  Mdouble get_distance2(const Vec3D &P);
140 
142  Mdouble dot(const Vec3D &P, const Vec3D &Q);
143 
146 
148  Vec3D cross(Vec3D P, Vec3D &Q);
149 
152 
154  Mdouble CG_function(const Vec3D &PI);
155 
158  Mdouble CG_function_2D(const Vec3D &PI);
159 
162  Mdouble CG_function_1D(const Vec3D &PI);
163 
166  Vec3D CG_gradient(const Vec3D &P, const Mdouble phi);
167 
170  Vec3D CG_integral_gradient(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance);
171  Mdouble CG_integral_gradient_1D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance);
172 
174  Mdouble CG_integral(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance, Vec3D& rpsi);
175 
178  Mdouble CG_integral_2D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance, Mdouble& rpsi_scalar);
179 
182  Mdouble CG_integral_1D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance, Mdouble& rpsi_scalar);
183 
184 
186  std::string print() const;
188  std::string print_sqrt() const;
190  std::string write_variable_names();
192  std::string write() const;
193 
194 
195 public:
196  //Values of macroscopical fields at Position
232 
236 
239 
242 
243 private:
248 
249 };
250 
Mdouble get_ymaxStat()
see StatisticsVector::get_ymaxStat
Mdouble CG_function(const Vec3D &PI)
Returns the value of the course graining function phi(P,PI)
Mdouble CG_invvolume
Prefactor of CG function which depends on $w.
Mdouble get_distance2(const Vec3D &P)
returns the coarse graining distance in the coordinates that are not averaged about ...
MatrixSymmetric3D DisplacementMomentumFlux
Momentum flux from linear displacement, .
Mdouble get_w() const
see StatisticsVector::get_w
Mdouble evaluatePolynomial(Mdouble r)
see StatisticsVector::evaluatePolynomial
Mdouble get_yminStat()
see StatisticsVector::get_yminStat
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.
Mdouble get_cutoff2()
see StatisticsVector::get_cutoff2
Vec3D CG_integral_gradient(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance)
gradient of phi
Mdouble get_w2() const
see StatisticsVector::get_w2
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...
Mdouble evaluateIntegral(Mdouble n1, Mdouble n2, Mdouble t)
see StatisticsVector::evaluateIntegral
void get_n(int &nx_, int &ny_, int &nz_)
see StatisticsVector::get_n
Vec3D get_Position() const
returns Position
void set_Position(Vec3D new_)
sets Position
void set_Gaussian_invvolume(int dim)
sets CG_invvolume if CG_type=Gaussian
void set_CG_invvolume()
sets CG_invvolume
Matrix3D NormalStress
Stress from normal forces, .
Mdouble get_xminStat()
see StatisticsVector::get_xminStat
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 get_zmaxStat()
see StatisticsVector::get_zmaxStat
Mdouble Nu
Particle volume fraction, .
Vec3D NormalTraction
Traction from normal forces, .
Mdouble get_cutoff()
see StatisticsVector::get_cutoff
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, .
std::string print() const
Outputs statistical variables in human-readable format.
StatisticsPoint(const StatisticsPoint &other)
Copy constructor; simply copies everything.
Vec3D cross(Vec3D P, Vec3D &Q)
Returns the cross product of two vectors in the coordinates that are not averaged about...
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, .
MatrixSymmetric3D Displacement
Linear displacement, .
std::string write() const
Outputs statistical variables in computer-readable format.
double Mdouble
Definition: ExtendedMath.h:33
void set_zero()
Sets all statistical variables to zero.
void set_w2(Mdouble new_)
see StatisticsVector::set_w2
StatisticsPoint< T > & operator+=(const StatisticsPoint< T > &P)
Defines a plus operator needed to average values ( )
StatisticsPoint< T > & operator/=(const Mdouble a)
Defines a division operator needed to average values ( )
Vec3D TangentialTraction
Traction from tangential forces, .
Matrix3D LocalAngularMomentumFlux
StatisticsPoint< T > & operator=(const StatisticsPoint< T > &P)
Defines a equal operator needed for copy constructor.
Vec3D clearAveragedDirections(Vec3D P)
Returns a vector where the averaged directions are zero.
void set_zero()
Definition: Vector.h:55
Mdouble Potential
Elastic energy .
Mdouble CG_integral_gradient_1D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance)
CG get_CG_type() const
see StatisticsVector::get_CG_type
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.
StatisticsPoint< T > & operator-=(const StatisticsPoint< T > &P)
Defines a plus operator needed to calculate variance.
This class is used to extract statistical data from MD simulations.
StatisticsPoint< T > getSquared()
Squares all statistical variables; needed for variance.
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 .
void set_CG_type(const char *CG_type)
see StatisticsVector::set_CG_type
Mdouble get_CG_invvolume()
returns CG_invvolume
Mdouble get_zminStat()
see StatisticsVector::get_zminStat
Matrix3D MatrixCross(Vec3D P, Matrix3D &Q)
Returns the cross product of two vectors in the coordinates that are not averaged about...
Implementation of a 3D matrix.
Definition: Matrix.h:35
static void set_gb(StatisticsVector< T > *new_gb)
see StatisticsVector::set_CG_type
Implementation of a 3D vector (by Vitaliy).
Definition: Vector.h:40
Vec3D Momentum
Momentum, .
Vec3D Position
Position at which evaluation occurs.
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.
static StatisticsVector< T > * gb
Pointer to StatisticsVector (to obtain global parameters)
Implementation of a 3D symmetric matrix.
Mdouble evaluatePolynomialGradient(Mdouble r)
see StatisticsVector::evaluatePolynomialGradient
Mdouble get_xmaxStat()
see StatisticsVector::get_xmaxStat
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.
Mdouble dot(const Vec3D &P, const Vec3D &Q)
Returns the dot product of two vectors in the coordinates that are not averaged about.
Matrix3D TangentialStress
Stress from tangential forces, .