ASL 0.1.7
Advanced Simulation Library
Loading...
Searching...
No Matches
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 <cmath>
32
33
34namespace 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
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
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
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
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
125 {
126 return Func(x);
127 }
128
129} // asl
130
131#endif
132
Linear spline function.
T operator(T x, T r0)
Quadratic spline function.
Qubic spline function.
Qubic spline function.
T operator(T x, T r0)
double operator()(double x)
SPDataWrapperACLData generateDataContainerACL_SP(const Block &b, unsigned int n=1)
generates pointer to ACL Data field with n components
Advanced Simulation Library.
Definition aslDataInc.h:31
std::shared_ptr< ElementBase > Element