ASL
0.1.6
Advanced Simulation Library
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
debian
tmp
usr
include
ASL
math
aslInterpolation.h
Go to the documentation of this file.
1
/*
2
* Advanced Simulation Library <http://asl.org.il>
3
*
4
* Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5
*
6
*
7
* This file is part of Advanced Simulation Library (ASL).
8
*
9
* ASL is free software: you can redistribute it and/or modify it
10
* under the terms of the GNU Affero General Public License as
11
* published by the Free Software Foundation, version 3 of the License.
12
*
13
* ASL is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU Affero General Public License for more details.
17
*
18
* You should have received a copy of the GNU Affero General Public License
19
* along with ASL. If not, see <http://www.gnu.org/licenses/>.
20
*
21
*/
22
23
25
26
#ifndef ASLINTERPOLATION
27
#define ASLINTERPOLATION
28
29
30
#include "../aslUtilities.h"
31
#include <math.h>
32
33
34
namespace
asl
35
{
36
class
ElementBase;
37
typedef
std::shared_ptr<ElementBase>
Element
;
38
39
template
<
class
Func>
class
UniversalFunction
40
{
41
public
:
42
inline
double
operator()
(
double
x);
43
inline
double
operator()
(Element x);
44
};
45
47
53
class
LinearSpline
54
{
55
public
:
56
template
<
typename
T>
inline
T
operator
(T x,T r0)
57
{
58
return
fabs
(x)<r0 ? 1.-
fabs
(x)/r0 : 0;
59
}
60
};
61
63
69
class
QuadraticSpline
70
{
71
public
:
72
template
<
typename
T>
inline
T
operator
(T x,T r0)
73
{
74
T a(
fabs
(x));
75
T b((1.- a/r0));
76
return
a<r0 ? b*b : 0;
77
}
78
};
79
81
87
class
QubicSpline
88
{
89
public
:
90
template
<
typename
T>
inline
T
operator
(T x,T r0)
91
{
92
T a(
fabs
(x));
93
T b((1.- a/r0));
94
return
a<r0 ? b*b*b : 0;
95
}
96
};
97
99
105
class
QubicSpline1
106
{
107
public
:
108
template
<
typename
T>
inline
T
operator
(T x,T r0)
109
{
110
T a(
fabs
(x));
111
T b(a/r0);
112
T b2(b*b);
113
return
b < 1 ? 2. * b2*b - 3. * b2 + 1 : 0;
114
}
115
};
116
117
// --------------------------- Implementation ---------------------
118
119
template
<
class
Func>
inline
double
UniversalFunction<Func>::operator()
(
double
x)
120
{
121
return
Func(x);
122
}
123
124
template
<
class
Func>
inline
Element
UniversalFunction<Func>::operator()
(Element x)
125
{
126
return
Func(x);
127
}
128
129
}
// asl
130
131
#endif
132
asl
Advanced Simulation Library.
Definition:
aslDataInc.h:30
asl::QubicSpline::operator
T operator(T x, T r0)
Definition:
aslInterpolation.h:90
asl::QubicSpline1::operator
T operator(T x, T r0)
Definition:
aslInterpolation.h:108
acl::elementOperators::fabs
Element fabs(Element a)
std::shared_ptr< ElementBase >
asl::LinearSpline
Linear spline function.
Definition:
aslInterpolation.h:53
asl::QuadraticSpline::operator
T operator(T x, T r0)
Definition:
aslInterpolation.h:72
asl::UniversalFunction::operator()
double operator()(double x)
Definition:
aslInterpolation.h:119
asl::Element
std::shared_ptr< ElementBase > Element
Definition:
aslInterpolation.h:36
asl::LinearSpline::operator
T operator(T x, T r0)
Definition:
aslInterpolation.h:56
asl::QuadraticSpline
Quadratic spline function.
Definition:
aslInterpolation.h:69
asl::UniversalFunction
Definition:
aslInterpolation.h:39
asl::QubicSpline
Qubic spline function.
Definition:
aslInterpolation.h:87
asl::QubicSpline1
Qubic spline function.
Definition:
aslInterpolation.h:105
Generated by
1.8.11