Gauss.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2023, 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 
48 class Coordinates;
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 
119 
123  void setWidthAndCutoff(Mdouble width, Mdouble cutoff);
124 
128  Mdouble getWidth() const;
129 
134 
139  Mdouble getEps() const;
140 
145  void setEps(Mdouble eps);
146 
150  Mdouble evaluateCGFunction(const Vec3D& position, const Coordinates r);
151 
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
IntegralType
Specifies the two points between which a line integral is computed.
Definition: IntegralType.h:34
Stores information about interactions between two interactable objects; often particles but could be ...
Definition: BaseInteraction.h:60
Definition: BaseParticle.h:54
Defines the non-averaged directions on which spatial coarse-graining is applied (the x-direction for ...
Definition: R.h:52
Defines the position of the CGPoint (e.g. x, y, z) and the parameters of the Gauss coarse-graining fu...
Definition: Gauss.h:80
Mdouble evaluateCylindricalCGFunction(const Vec3D &position, const CGCoordinates::R r)
Definition: Gauss.h:156
Mdouble evaluateCGFunctionDerivativeWithFD(const Vec3D &position, const Coordinates &r, const int i)
~Gauss()=default
Destructor, does nothing, as no new'ed objects are used.
void setWidth(Mdouble width)
Sets the width of the coarse-graining function.
Mdouble getCutoff() const
Returns the cutoff of the coarse-graining function.
unsigned currentInteraction_
Definition: Gauss.h:218
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.
Mdouble getEps() const
Returns the finite difference step size used to evaluate derivatives of the CG function.
Mdouble evaluateCylindricalCGIntegral(const BaseInteraction &c, const CGCoordinates::R r, IntegralType type=IntegralType::I_TO_P)
Definition: Gauss.h:165
Coordinates CoordinatesType
Definition: Gauss.h:83
Mdouble getWidth() const
Returns the width of the coarse-graining function.
Gauss(const Gauss &c)=default
Copy constructor. It copies the GaussCoordinates and all objects it contains.
Mdouble integralPrefactor_
Definition: Gauss.h:207
Mdouble prefactor_
Definition: Gauss.h:200
Mdouble width_
Definition: Gauss.h:188
void setStandardDeviation(Mdouble std)
Sets the standard deviation of the coarse-graining function.
Mdouble evaluateCGFunction(const Vec3D &position, const Coordinates r)
Evaluates the coarse-graining function.
Vec3D normal_
Definition: Gauss.h:211
void setEps(Mdouble eps)
Sets the finite difference step size used to evaluate derivatives of the CG function.
Vec3D evaluateCGFunctionDerivatives(const Vec3D &position, const Coordinates &r)
Mdouble cutoff_
Definition: Gauss.h:194
Mdouble evaluateCGIntegral(const BaseInteraction &i, const Coordinates r, IntegralType type=IntegralType::I_TO_P)
Evaluates the line integral needed for the calculation of stresses.
void setWidthAndCutoff(Mdouble width, Mdouble cutoff)
Sets the width and cutoff of the coarse-graining function.
Mdouble eps_
Definition: Gauss.h:223
Gauss()
Default constructor, it simply creates an empty GaussCoordinates.
void write(std::ostream &os) const
Writes class content into an output stream, usually a stat file.
Mdouble normalLength_
Definition: Gauss.h:209
Template argument; use a member class of CGCoordinates to instantiate.
The DPMBase header includes quite a few header files, defining all the handlers, which are essential....
Definition: DPMBase.h:77
Definition: Vector.h:51
Contains base classes of CGPoint; CGPoint is always templated with one of these classes; these classe...
Definition: Gauss.h:48
CGFunctions::Gauss< CGCoordinates::X > GaussX
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:230
CGFunctions::Gauss< CGCoordinates::XYZ > GaussXYZ
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:242
CGFunctions::Gauss< CGCoordinates::R > GaussR
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:244
CGFunctions::Gauss< CGCoordinates::XY > GaussXY
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:240
CGFunctions::Gauss< CGCoordinates::Z > GaussZ
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:234
CGFunctions::Gauss< CGCoordinates::YZ > GaussYZ
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:236
CGFunctions::Gauss< CGCoordinates::XZ > GaussXZ
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:238
CGFunctions::Gauss< CGCoordinates::O > GaussO
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:228
CGFunctions::Gauss< CGCoordinates::Y > GaussY
Defines a short notation for the Gaussian CGFunction templated with a certain CGCoordinate.
Definition: Gauss.h:232
const Mdouble NaN
Definition: GeneralDefine.h:43
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51