Jet  v1.3.3
sph_kernels2.h
Go to the documentation of this file.
1 // Copyright (c) 2018 Doyub Kim
2 //
3 // I am making my contributions/submissions to this project solely in my
4 // personal capacity and am not conveying any rights to any intellectual
5 // property of any third parties.
6 //
7 // Adopted from the sample code of:
8 // Bart Adams and Martin Wicke,
9 // "Meshless Approximation Methods and Applications in Physics Based Modeling
10 // and Animation", Eurographics 2009 Tutorial
11 
12 #ifndef INCLUDE_JET_SPH_KERNELS2_H_
13 #define INCLUDE_JET_SPH_KERNELS2_H_
14 
15 #include <jet/constants.h>
16 #include <jet/vector2.h>
17 
18 namespace jet {
19 
28 struct SphStdKernel2 {
30  double h;
31 
33  double h2;
34 
36  double h3;
37 
39  double h4;
40 
43 
45  explicit SphStdKernel2(double kernelRadius);
46 
49 
51  double operator()(double distance) const;
52 
54  double firstDerivative(double distance) const;
55 
57  Vector2D gradient(const Vector2D& point) const;
58 
60  Vector2D gradient(double distance, const Vector2D& direction) const;
61 
63  double secondDerivative(double distance) const;
64 };
65 
76  double h;
77 
79  double h2;
80 
82  double h3;
83 
85  double h4;
86 
88  double h5;
89 
92 
94  explicit SphSpikyKernel2(double kernelRadius);
95 
98 
100  double operator()(double distance) const;
101 
103  double firstDerivative(double distance) const;
104 
106  Vector2D gradient(const Vector2D& point) const;
107 
109  Vector2D gradient(double distance, const Vector2D& direction) const;
110 
112  double secondDerivative(double distance) const;
113 };
114 
115 } // namespace jet
116 
117 #include "detail/sph_kernels2-inl.h"
118 
119 #endif // INCLUDE_JET_SPH_KERNELS2_H_
jet::SphStdKernel2::h
double h
Kernel radius.
Definition: sph_kernels2.h:30
jet::SphStdKernel2
Standard 2-D SPH kernel function object.
Definition: sph_kernels2.h:28
jet::SphStdKernel2::h4
double h4
Fourth-power of the kernel radius.
Definition: sph_kernels2.h:39
jet::SphSpikyKernel2::operator()
double operator()(double distance) const
Returns kernel function value at given distance.
jet::SphStdKernel2::SphStdKernel2
SphStdKernel2()
Constructs a kernel object with zero radius.
jet::SphSpikyKernel2::h3
double h3
Cubic of the kernel radius.
Definition: sph_kernels2.h:82
jet::SphStdKernel2::h2
double h2
Square of the kernel radius.
Definition: sph_kernels2.h:33
jet::SphSpikyKernel2::h4
double h4
Fourth-power of the kernel radius.
Definition: sph_kernels2.h:85
jet::SphSpikyKernel2
Spiky 2-D SPH kernel function object.
Definition: sph_kernels2.h:74
jet::SphSpikyKernel2::firstDerivative
double firstDerivative(double distance) const
Returns the first derivative at given distance.
jet::SphStdKernel2::firstDerivative
double firstDerivative(double distance) const
Returns the first derivative at given distance.
jet
Definition: advection_solver2.h:18
vector2.h
jet::SphStdKernel2::SphStdKernel2
SphStdKernel2(double kernelRadius)
Constructs a kernel object with given radius.
jet::Vector< T, 2 >
2-D vector class.
Definition: vector2.h:24
jet::SphSpikyKernel2::secondDerivative
double secondDerivative(double distance) const
Returns the second derivative at given distance.
jet::SphStdKernel2::operator()
double operator()(double distance) const
Returns kernel function value at given distance.
jet::SphStdKernel2::gradient
Vector2D gradient(double distance, const Vector2D &direction) const
Returns the gradient at a point defined by distance and direction.
jet::SphStdKernel2::h3
double h3
Cubic of the kernel radius.
Definition: sph_kernels2.h:36
jet::SphStdKernel2::SphStdKernel2
SphStdKernel2(const SphStdKernel2 &other)
Copy constructor.
constants.h
jet::SphSpikyKernel2::SphSpikyKernel2
SphSpikyKernel2(const SphSpikyKernel2 &other)
Copy constructor.
jet::SphSpikyKernel2::h5
double h5
Fifth-power of the kernel radius.
Definition: sph_kernels2.h:88
jet::SphStdKernel2::secondDerivative
double secondDerivative(double distance) const
Returns the second derivative at given distance.
jet::SphSpikyKernel2::SphSpikyKernel2
SphSpikyKernel2()
Constructs a kernel object with zero radius.
jet::SphSpikyKernel2::h2
double h2
Square of the kernel radius.
Definition: sph_kernels2.h:79
jet::SphStdKernel2::gradient
Vector2D gradient(const Vector2D &point) const
Returns the gradient at a point.
jet::SphSpikyKernel2::gradient
Vector2D gradient(double distance, const Vector2D &direction) const
Returns the gradient at a point defined by distance and direction.
jet::SphSpikyKernel2::SphSpikyKernel2
SphSpikyKernel2(double kernelRadius)
Constructs a kernel object with given radius.
jet::SphSpikyKernel2::gradient
Vector2D gradient(const Vector2D &point) const
Returns the gradient at a point.
jet::SphSpikyKernel2::h
double h
Kernel radius.
Definition: sph_kernels2.h:76