MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Gauss.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 Gauss_H
26 #define Gauss_H
27 
28 #include <GeneralDefine.h>
29 #include <iostream>
30 #include "IntegralType.h"
31 #include "CG/Coordinates/R.h"
32 #include "CG/Coordinates/X.h"
33 #include "CG/Coordinates/Y.h"
34 #include "CG/Coordinates/Z.h"
35 #include "CG/Coordinates/RZ.h"
36 #include "CG/Coordinates/XY.h"
37 #include "CG/Coordinates/XZ.h"
38 #include "CG/Coordinates/YZ.h"
39 #include "CG/Coordinates/XYZ.h"
40 #include "CG/Coordinates/O.h"
41 
42 class BaseParticle;
43 
44 class BaseInteraction;
45 
46 class DPMBase;
47 
49 
57 namespace CGFunctions
58 {
59 
78 template<class Coordinates>
79 class Gauss
80 {
81 public:
82 
84 
88  Gauss();
89 
93  Gauss(const Gauss& c) = default;
94 
98  ~Gauss() = default;
99 
103  void write(std::ostream& os) const;
104 
108  //void setStandardDeviation(Mdouble standardDeviation);
109 
113  void setWidth(Mdouble width);
114 
118  void setStandardDeviation(Mdouble std);
119 
123  void setWidthAndCutoff(Mdouble width, Mdouble cutoff);
124 
128  Mdouble getWidth() const;
129 
133  Mdouble getCutoff() const;
134 
139  Mdouble getEps() const;
140 
145  void setEps(Mdouble eps);
146 
150  Mdouble evaluateCGFunction(const Vec3D& position, const Coordinates r);
151 
152  Vec3D evaluateCGFunctionDerivatives(const Vec3D& position, const Coordinates& r);
153 
154  Mdouble evaluateCGFunctionDerivativeWithFD(const Vec3D& position, const Coordinates& r, const int i);
155 
157  { return constants::NaN; }
158 
162  Mdouble
164 
167  { return constants::NaN; }
168 
173  Mdouble
175 
176 protected:
177 
189 
195 
201 
208 
210 
212 
219 
224 
225 };
226 
245 
246 } //namespace CGFunctions
247 #include "Gauss.hcc"
248 
249 #endif
void setWidth(Mdouble width)
Sets the width of the coarse-graining function.
void setEps(Mdouble eps)
Sets the finite difference step size used to evaluate derivatives of the CG function.
Mdouble width_
Definition: Gauss.h:188
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
Definition: DPMBase.h:72
const Mdouble NaN
Definition: GeneralDefine.h:43
Mdouble getCutoff() const
Returns the cutoff of the coarse-graining function.
double Mdouble
Definition: GeneralDefine.h:34
const std::complex< Mdouble > i
Definition: ExtendedMath.h:50
Mdouble evaluateCGFunction(const Vec3D &position, const Coordinates r)
Evaluates the coarse-graining function.
CGFunctions::Gauss< CGCoordinates::Y > GaussY
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:232
CGFunctions::Gauss< CGCoordinates::X > GaussX
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:230
~Gauss()=default
Destructor, does nothing, as no new'ed objects are used.
Coordinates CoordinatesType
Definition: Gauss.h:83
void write(std::ostream &os) const
Writes class content into an output stream, usually a stat file.
Defines the position of the CGPoint (e.g. x, y, z) and the parameters of the Gauss coarse-graining fu...
Definition: Gauss.h:79
CGFunctions::Gauss< CGCoordinates::O > GaussO
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:228
Stores information about interactions between two interactable objects; often particles but could be ...
Mdouble getWidth() const
Returns the width of the coarse-graining function.
void setStandardDeviation(Mdouble std)
Sets the standard deviation of the coarse-graining function.
CGFunctions::Gauss< CGCoordinates::R > GaussR
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:244
Defines the non-averaged directions on which spatial coarse-graining is applied (the x-direction for ...
Definition: R.h:51
Mdouble evaluateCylindricalCGIntegral(const BaseInteraction &c, const CGCoordinates::R r, IntegralType type=IntegralType::I_TO_P)
Definition: Gauss.h:165
Gauss()
Default constructor, it simply creates an empty GaussCoordinates.
IntegralType
Specifies the two points between which a line integral is computed.
Definition: IntegralType.h:33
Mdouble getEps() const
Returns the finite difference step size used to evaluate derivatives of the CG function.
Mdouble evaluateCGIntegral1D(const BaseInteraction &i, const Coordinates r, IntegralType type=IntegralType::I_TO_P)
Evaluates the line integral needed for the calculation of stresses for 1D CGCoordinates.
CGFunctions::Gauss< CGCoordinates::XY > GaussXY
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:240
void setWidthAndCutoff(Mdouble width, Mdouble cutoff)
Sets the width and cutoff of the coarse-graining function.
CGFunctions::Gauss< CGCoordinates::XZ > GaussXZ
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:238
Mdouble cutoff_
Definition: Gauss.h:194
CGFunctions::Gauss< CGCoordinates::XYZ > GaussXYZ
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:242
Mdouble evaluateCGIntegral(const BaseInteraction &i, const Coordinates r, IntegralType type=IntegralType::I_TO_P)
Evaluates the line integral needed for the calculation of stresses.
CGFunctions::Gauss< CGCoordinates::YZ > GaussYZ
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:236
Vec3D evaluateCGFunctionDerivatives(const Vec3D &position, const Coordinates &r)
unsigned currentInteraction_
Definition: Gauss.h:218
CGFunctions::Gauss< CGCoordinates::Z > GaussZ
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:234
Mdouble normalLength_
Definition: Gauss.h:209
Definition: Vector.h:49
Mdouble integralPrefactor_
Definition: Gauss.h:207
Mdouble evaluateCGFunctionDerivativeWithFD(const Vec3D &position, const Coordinates &r, const int i)
Template argument; use a member class of CGCoordinates to instantiate.
Mdouble evaluateCylindricalCGFunction(const Vec3D &position, const CGCoordinates::R r)
Definition: Gauss.h:156
Mdouble prefactor_
Definition: Gauss.h:200
Mdouble eps_
Definition: Gauss.h:223