-
Notifications
You must be signed in to change notification settings - Fork 0
/
bspline_base.h
93 lines (79 loc) · 3 KB
/
bspline_base.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/////////////////////////////////////////////////////////////////////////////
// einspline: a library for creating and evaluating B-splines //
// Copyright (C) 2007 Kenneth P. Esler, Jr. //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 51 Franklin Street, Fifth Floor, //
// Boston, MA 02110-1301 USA //
/////////////////////////////////////////////////////////////////////////////
#ifndef BSPLINE_BASE_H
#define BSPLINE_BASE_H
#include <complex>
typedef std::complex<float> complex_float;
typedef std::complex<double> complex_double;
// Conventions:
// Postfixes:
// s: single precision real
// d: double precision real
// c: single precision complex
// z: double precision complex
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
//// Basic type declarations ////
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
typedef enum { PERIODIC, DERIV1, DERIV2, FLAT, NATURAL, ANTIPERIODIC } bc_code;
// clang-format off
typedef enum { U1D , U2D , U3D ,
NU1D , NU2D , NU3D ,
MULTI_U1D , MULTI_U2D , MULTI_U3D,
MULTI_NU1D, MULTI_NU2D, MULTI_NU3D
} spline_code;
typedef enum { SINGLE_REAL, DOUBLE_REAL, SINGLE_COMPLEX, DOUBLE_COMPLEX }
type_code;
// clang-format on
typedef struct
{
bc_code lCode, rCode;
float lVal, rVal;
} BCtype_s;
typedef struct
{
bc_code lCode, rCode;
double lVal, rVal;
} BCtype_d;
typedef struct
{
bc_code lCode, rCode;
float lVal_r, lVal_i, rVal_r, rVal_i;
} BCtype_c;
typedef struct
{
bc_code lCode, rCode;
double lVal_r, lVal_i, rVal_r, rVal_i;
} BCtype_z;
typedef struct
{
double start, end;
int num;
// private
double delta, delta_inv;
} Ugrid;
typedef struct
{
spline_code sp_code;
type_code t_code;
void *restrict coefs;
} Bspline;
#endif