16 static float compute(
float h) {
return 10.0f / (7.0f * 3.14159265f * h * h); }
20 static float compute(
float h) {
return 1.0f / (3.14159265f * h * h * h); }
28 const float H = 2.0f * h;
31 const float h5 = h * h * h * h * h;
32 const float d = H - r;
33 return (-15.0f / (16.0f * 3.14159265f * h5)) * d * d;
39 const float H = 2.0f * h;
40 if (r >= H || r < 1e-10f)
42 const float H6 = H * H * H * H * H * H;
43 const float d = H - r;
44 return -45.0f / (3.14159265f * H6) * d * d;
52 static_assert(Dim == 2 || Dim == 3,
"SPHKernel: Dim must be 2 or 3");
54 static float W(
float r,
float h) {
56 const float q = r / h;
58 return sigma * (1.0f - 1.5f * q * q + 0.75f * q * q * q);
60 const float t = 2.0f - q;
61 return sigma * 0.25f * t * t * t;
66 static float dW_dr(
float r,
float h) {
68 const float q = r / h;
70 return (sigma / h) * (-3.0f * q + 2.25f * q * q);
72 const float t = 2.0f - q;
73 return (sigma / h) * (-0.75f * t * t);
82 static std::array<float, Dim>
Spiky_gradW(std::array<float, Dim> r_vec,
85 std::array<float, Dim> g{};
86 if (r < 1e-10f || r >= 2.0f * h)
89 for (
int d = 0; d < Dim; ++d)
static std::array< float, Dim > Spiky_gradW(std::array< float, Dim > r_vec, float r, float h)
static float dW_dr(float r, float h)
static float Spiky_dW_dr(float r, float h)
static float W(float r, float h)
static float compute(float h)
static float compute(float h)
static float compute(float r, float h)
static float compute(float r, float h)