Polynomial.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 Polynomial_H
6 #define Polynomial_H
7 
8 #include <GeneralDefine.h>
9 #include "IntegralType.h"
10 #include <iostream>
11 #include <vector>
12 
13 class BaseParticle;
14 
15 class BaseInteraction;
16 
17 class DPMBase;
18 
19 class Coordinates;
20 
21 namespace CGFunctions
22 {
23 
29 {
30  HEAVISIDE = 0,
31  LINEAR = 1,
32  LUCY = 2
33 };
34 
35 std::ostream& operator<<(std::ostream& os, PolynomialType type);
36 
37 std::istream& operator>>(std::istream& is, PolynomialType& type);
38 
59 template<class Coordinates>
61 {
62 public:
63 
65 
70 
75  Polynomial(const Polynomial& p) = default;
76 
80  ~Polynomial() = default;
81 
86  void write(std::ostream& os) const;
87 
91  void setPolynomialType(PolynomialType polynomialType);
92 
96  void setWidth(Mdouble width);
97 
98  Mdouble getWidth() const;
99 
104 
108  void setCutoff(Mdouble cutoff);
109 
114 
118  inline Vec3D getCutoffVector(Mdouble radius, Vec3D cellSize) const { return Vec3D(getCutoff(), getCutoff(), getCutoff()); }
119 
124 
128  Mdouble evaluateCGFunction(const Vec3D& position, const Coordinates& r);
129 
133  Mdouble evaluateCGFunction(const Vec3D& position, Mdouble rad, const Coordinates& r)
134  {
135  return evaluateCGFunction(position, r);
136  }
137 
141  Mdouble
143 
148  Mdouble
150 
151  std::vector<Mdouble> getCoefficients();
152 
154 
155  Mdouble evaluateCGFunctionDerivativeWithFD(const Vec3D& position, const Coordinates& r, const int i);
156 
161  Mdouble getEps() const;
162 
168 
169 protected:
170 
181  std::vector<Mdouble> coefficients_;
182 
189 
191 
193 
195 
201 
206 
207 };
208 
209 } //namespace CGFunctions
210 #include "Polynomial.hcc"
211 
212 #endif
int i
Definition: BiCGSTAB_step_by_step.cpp:9
IntegralType
Specifies the two points between which a line integral is computed.
Definition: IntegralType.h:14
float * p
Definition: Tutorial_Map_using.cpp:9
Stores information about interactions between two interactable objects; often particles but could be ...
Definition: BaseInteraction.h:39
Definition: BaseParticle.h:33
Defines the position of the CGPoint (e.g. x, y, z) and the parameters of a polynomial coarse-graining...
Definition: Polynomial.h:61
Mdouble evaluateCGFunction(const Vec3D &position, const Coordinates &r)
Evaluates the coarse-graining function.
void setCutoff(Mdouble cutoff)
unsigned currentInteraction_
Definition: Polynomial.h:194
void setStandardDeviation(Mdouble std)
Set the standard deviation.
Mdouble getWidth() const
Vec3D getCutoffVector(Mdouble radius, Vec3D cellSize) const
Returns the cutoff of the coarse-graining function along each direction.
Definition: Polynomial.h:118
PolynomialType polynomialType_
Definition: Polynomial.h:188
~Polynomial()=default
Destructor, it simply destructs the PolynomialCoordinates and all the objects it contains.
Mdouble getCutoff() const
Mdouble evaluateCGFunctionDerivativeWithFD(const Vec3D &position, const Coordinates &r, const int i)
Mdouble eps_
Definition: Polynomial.h:205
void setWidth(Mdouble width)
Set the cutoff radius.
std::vector< Mdouble > getCoefficients()
Mdouble evaluateCGFunction(const Vec3D &position, Mdouble rad, const Coordinates &r)
Evaluates the coarse-graining function.
Definition: Polynomial.h:133
Mdouble getEps() const
Returns the finite difference step size used to evaluate derivatives of the CG function.
void setPolynomialType(PolynomialType polynomialType)
Polynomial()
Default constructor, sets all parameters to zero.
Mdouble normalLength_
Definition: Polynomial.h:190
Vec3D normal_
Definition: Polynomial.h:192
Polynomial(const Polynomial &p)=default
Copy constructor. It copies all objects the class contains.
Vec3D evaluateCGFunctionDerivatives(const Vec3D &position, const Coordinates &r)
void setEps(Mdouble eps)
Sets the finite difference step size used to evaluate derivatives of the CG function.
void write(std::ostream &os) const
Writes class content into an output stream, usually a stat file.
Mdouble cutoff_
Definition: Polynomial.h:200
Coordinates CoordinatesType
Definition: Polynomial.h:64
std::vector< Mdouble > coefficients_
Definition: Polynomial.h:181
Mdouble evaluateCGIntegral(const BaseInteraction &i, const Coordinates &r, IntegralType type=IntegralType::I_TO_P)
Evaluates the line integral needed for the calculation of stresses.
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.
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:56
Definition: Kernel/Math/Vector.h:30
Contains base classes of CGPoint; CGPoint is always templated with one of these classes; these classe...
Definition: ExactOverlap.h:28
PolynomialType
PolynomialType is used to define how files are opened random fixed-particle bottom.
Definition: Polynomial.h:29
std::istream & operator>>(std::istream &is, PolynomialType &type)
std::ostream & operator<<(std::ostream &os, PolynomialType type)
double eps
Definition: crbond_bessel.cc:24
r
Definition: UniformPSDSelfTest.py:20
radius
Definition: UniformPSDSelfTest.py:15
type
Definition: compute_granudrum_aor.py:141