OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
z_spline.hpp
1/*
2 * z_spline.hpp
3 *
4 * Created on: May 8, 2017
5 * Author: i-bird
6 */
7
8#ifndef OPENFPM_NUMERICS_SRC_INTERPOLATION_Z_SPLINE_HPP_
9#define OPENFPM_NUMERICS_SRC_INTERPOLATION_Z_SPLINE_HPP_
10
11#include "mp4_kernel.hpp"
12
13template<typename st, unsigned int ord>
15{
16public:
17
18 static const int np = 4;
19
20 static inline st value(st x, size_t i)
21 {
22 std::cerr << __FILE__ << ":" << __LINE__ << ": Error this order has not been implemented" << std::endl;
23 return 0.0;
24 }
25};
26
27template<typename st>
28class z_kernel<st,1>
29{
30public:
31
32 static const int np = 2;
33
34 static inline st value(st x, size_t i)
35 {
36 if (i == 0)
37 return x + 1;
38 else if (i == 1)
39 return 1-x;
40 return 0.0;
41 }
42};
43
44template<typename st>
45class z_kernel<st,2>: public mp4_kernel<st>
46{
47
48};
49
50template<typename st>
51class z_kernel<st,3>
52{
53public:
54
55 static const int np = 6;
56
57 static inline st value(st x, size_t i)
58 {
59 if (i == 0)
60 return 18.0 + ( 38.25 + (31.875 + ( 313.0/24.0 + (2.625 + 5.0/24.0*x)*x)*x)*x)*x;
61 else if (i == 1)
62 return -4.0 + (-18.75 + (-30.625 + (-545.0/24.0 + ( -7.875 - 25.0/24.0*x)*x)*x)*x)*x;
63 else if (i == 2)
64 return 1.0 + (-1.25 +(35.0/12.0 +(5.25 + 25.0/12.0*x)*x)*x)*x*x;
65 else if (i == 3)
66 return 1.0 + (-1.25 +(-35.0/12.0 +(5.25 - 25.0/12.0*x)*x)*x)*x*x;
67 else if (i == 4)
68 return -4.0 + (18.75 + (-30.625 + (545.0/24.0 + ( -7.875 + 25.0/24.0*x)*x)*x)*x)*x;
69 else if (i == 5)
70 return 18.0 + (-38.25 + (31.875 + (-313.0/24.0 + (2.625 - 5.0/24.0*x)*x)*x)*x)*x;
71
72 return 0.0;
73 }
74};
75
76template<typename st>
77class z_kernel<st,4>
78{
79public:
80
81 static const int np = 8;
82
83 static inline st value(st x, size_t i)
84 {
85 if (i == 0)
86 return 726.4 + ( 1491.2 + (58786.0/45.0 + ( 633.0 + (26383.0/144.0 + (22807.0/720.0 + (727.0/240.0 + 89.0/720.0*x)*x)*x)*x)*x)*x)*x;
87 else if (i == 1)
88 return -440 +( -1297.45 + ( -117131/72.0 + ( -1123.5 + ( -66437.0/144.0 + ( -81109.0/720.0 + ( -727.0/48.0 - 623.0/720.0*x)*x)*x)*x)*x)*x)*x;
89 else if (i == 2)
90 return 27.6 + (8617.0/60.0 +(321.825 +(395.5 +( 284.8125 + (119.7875 +(27.2625 + 623.0/240.0*x)*x)*x)*x)*x)*x)*x;
91 else if (i == 3)
92 return 1.0 + (( -49.0/36.0 + (( -959.0/144.0 + ( -2569.0/144.0 + ( -727.0/48.0 - 623.0/144.0*x)*x)*x)*x)*x)*x)*x;
93 else if (i == 4)
94 return 1.0 + (( -49.0/36.0 + (( -959.0/144.0 + ( 2569.0/144.0 + ( -727.0/48.0 + 623.0/144.0*x)*x)*x)*x)*x)*x)*x;
95 else if (i == 5)
96 return 27.6 + (-8617.0/60.0 +(321.825 +(-395.5 +( 284.8125 + (-119.7875 +(27.2625 - 623.0/240.0*x)*x)*x)*x)*x)*x)*x;
97 else if (i == 6)
98 return -440 +( 1297.45 + ( -117131/72.0 + ( 1123.5 + ( -66437.0/144.0 + ( 81109.0/720.0 + ( -727.0/48.0 + 623.0/720.0*x)*x)*x)*x)*x)*x)*x;
99 else if (i == 7)
100 return 726.4 + ( -1491.2 + (58786.0/45.0 + ( -633.0 + (26383.0/144.0 + (-22807.0/720.0 + (727.0/240.0 - 89.0/720.0*x)*x)*x)*x)*x)*x)*x;
101
102 return 0.0;
103 }
104};
105
106#endif /* OPENFPM_NUMERICS_SRC_INTERPOLATION_Z_SPLINE_HPP_ */