PLaSK library
Loading...
Searching...
No Matches
rectangular_spline.hpp
Go to the documentation of this file.
1
/*
2
* This file is part of PLaSK (https://plask.app) by Photonics Group at TUL
3
* Copyright (c) 2022 Lodz University of Technology
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, version 3.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*/
14
#ifndef PLASK__MESH_RECTANGULARSPLINE_H
15
#define PLASK__MESH_RECTANGULARSPLINE_H
16
17
#include "../math.hpp"
18
#include "
rectangular2d.hpp
"
19
#include "
rectilinear3d.hpp
"
20
#include "
rectangular3d.hpp
"
21
#include "
equilateral3d.hpp
"
22
#include "
interpolation.hpp
"
23
24
namespace
plask
{
25
26
template
<
typename
DstT,
typename
SrcT>
27
struct
SplineRect2DLazyDataImpl
:
public
InterpolatedLazyDataImpl
<DstT, RectangularMesh2D, const SrcT>
28
{
29
DataVector<SrcT>
diff0
,
diff1
;
30
31
SplineRect2DLazyDataImpl
(
const
shared_ptr<const RectangularMesh2D>&
src_mesh
,
32
const
DataVector<const SrcT>
&
src_vec
,
33
const
shared_ptr<
const
MeshD<2>
>&
dst_mesh
,
34
const
InterpolationFlags
&
flags
);
35
36
DstT
at
(std::size_t index)
const override
;
37
};
38
39
template
<
typename
DstT,
typename
SrcT>
40
struct
SplineRect3DLazyDataImpl
:
public
InterpolatedLazyDataImpl
<DstT, RectilinearMesh3D, const SrcT>
41
{
42
DataVector<SrcT>
diff0
,
diff1
,
diff2
;
43
44
SplineRect3DLazyDataImpl
(
const
shared_ptr<const RectilinearMesh3D>&
src_mesh
,
45
const
DataVector<const SrcT>
&
src_vec
,
46
const
shared_ptr<
const
MeshD<3>
>&
dst_mesh
,
47
const
InterpolationFlags
&
flags
);
48
49
DstT
at
(std::size_t index)
const override
;
50
};
51
52
53
template
<
typename
DstT,
typename
SrcT>
54
struct
PLASK_API
HymanSplineRect2DLazyDataImpl
:
public
SplineRect2DLazyDataImpl
<DstT, SrcT>
55
{
56
HymanSplineRect2DLazyDataImpl
(
const
shared_ptr<const RectangularMesh2D>& src_mesh,
57
const
DataVector<const SrcT>
& src_vec,
58
const
shared_ptr<
const
MeshD<2>
>& dst_mesh,
59
const
InterpolationFlags
& flags);
60
};
61
62
template
<
typename
SrcT,
typename
DstT>
63
struct
InterpolationAlgorithm
<
RectangularMesh2D
,
SrcT
,
DstT
,
INTERPOLATION_SPLINE
> {
64
static
LazyData<DstT>
interpolate
(
const
shared_ptr<const RectangularMesh2D>& src_mesh,
65
const
DataVector<const SrcT>
& src_vec,
66
const
shared_ptr<
const
MeshD<2>
>& dst_mesh,
67
const
InterpolationFlags
& flags) {
68
// You can have few HymanSplineRect2DLazyDataImpl variants and choose one here
69
return
new
HymanSplineRect2DLazyDataImpl<typename std::remove_const<DstT>::type
,
70
typename
std::remove_const<SrcT>::type>
71
(src_mesh, src_vec, dst_mesh, flags);
72
}
73
74
};
75
76
77
template
<
typename
DstT,
typename
SrcT>
78
struct
PLASK_API
HymanSplineRect3DLazyDataImpl
:
public
SplineRect3DLazyDataImpl
<DstT, SrcT> {
79
80
HymanSplineRect3DLazyDataImpl
(
const
shared_ptr<const RectilinearMesh3D>& src_mesh,
81
const
DataVector<const SrcT>
& src_vec,
82
const
shared_ptr<
const
MeshD<3>
>& dst_mesh,
83
const
InterpolationFlags
& flags);
84
};
85
86
template
<
typename
SrcT,
typename
DstT>
87
struct
InterpolationAlgorithm
<
RectangularMesh3D
,
SrcT
,
DstT
,
INTERPOLATION_SPLINE
> {
88
static
LazyData<DstT>
interpolate
(
const
shared_ptr<const RectangularMesh3D>
& src_mesh,
89
const
DataVector<const SrcT>
& src_vec,
90
const
shared_ptr<
const
MeshD<3>
>& dst_mesh,
91
const
InterpolationFlags
& flags) {
92
// You can have few HymanSplineRect3DLazyDataImpl variants and choose one here
93
return
new
HymanSplineRect3DLazyDataImpl<typename std::remove_const<DstT>::type
,
94
typename
std::remove_const<SrcT>::type>
95
(src_mesh, src_vec, dst_mesh, flags);
96
}
97
98
};
99
100
template
<
typename
SrcT,
typename
DstT>
101
struct
InterpolationAlgorithm
<
EquilateralMesh3D
,
SrcT
,
DstT
,
INTERPOLATION_SPLINE
> {
102
static
LazyData<DstT>
interpolate
(
const
shared_ptr<const EquilateralMesh3D>
& src_mesh,
103
const
DataVector<const SrcT>
& src_vec,
104
const
shared_ptr<
const
MeshD<3>
>& dst_mesh,
105
const
InterpolationFlags
& flags) {
106
// You can have few HymanSplineRect3DLazyDataImpl variants and choose one here
107
return
new
HymanSplineRect3DLazyDataImpl<typename std::remove_const<DstT>::type
,
108
typename
std::remove_const<SrcT>::type>
109
(src_mesh, src_vec,
EquilateralMesh3D::Transformed
(src_mesh, dst_mesh), flags);
110
}
111
112
};
113
114
115
template
<
typename
DstT,
typename
SrcT>
116
struct
PLASK_API
SmoothSplineRect2DLazyDataImpl
:
public
SplineRect2DLazyDataImpl
<DstT, SrcT>
117
{
118
SmoothSplineRect2DLazyDataImpl
(
const
shared_ptr<const RectangularMesh2D>& src_mesh,
119
const
DataVector<const SrcT>
& src_vec,
120
const
shared_ptr<
const
MeshD<2>
>& dst_mesh,
121
const
InterpolationFlags
& flags);
122
};
123
124
template
<
typename
SrcT,
typename
DstT>
125
struct
InterpolationAlgorithm
<
RectangularMesh2D
,
SrcT
,
DstT
,
INTERPOLATION_SMOOTH_SPLINE
> {
126
static
LazyData<DstT>
interpolate
(
const
shared_ptr<const RectangularMesh2D>& src_mesh,
127
const
DataVector<const SrcT>
& src_vec,
128
const
shared_ptr<
const
MeshD<2>
>& dst_mesh,
129
const
InterpolationFlags
& flags) {
130
return
new
SmoothSplineRect2DLazyDataImpl<typename std::remove_const<DstT>::type
,
131
typename
std::remove_const<SrcT>::type>
132
(src_mesh, src_vec, dst_mesh, flags);
133
}
134
135
};
136
137
138
template
<
typename
DstT,
typename
SrcT>
139
struct
PLASK_API
SmoothSplineRect3DLazyDataImpl
:
public
SplineRect3DLazyDataImpl
<DstT, SrcT> {
140
141
SmoothSplineRect3DLazyDataImpl
(
const
shared_ptr<const RectilinearMesh3D>& src_mesh,
142
const
DataVector<const SrcT>
& src_vec,
143
const
shared_ptr<
const
MeshD<3>
>& dst_mesh,
144
const
InterpolationFlags
& flags);
145
};
146
147
template
<
typename
SrcT,
typename
DstT>
148
struct
InterpolationAlgorithm
<
RectangularMesh3D
,
SrcT
,
DstT
,
INTERPOLATION_SMOOTH_SPLINE
> {
149
static
LazyData<DstT>
interpolate
(
const
shared_ptr<const RectangularMesh3D>
& src_mesh,
150
const
DataVector<const SrcT>
& src_vec,
151
const
shared_ptr<
const
MeshD<3>
>& dst_mesh,
152
const
InterpolationFlags
& flags) {
153
// You can have few SmoothSplineRect3DLazyDataImpl variants and choose one here
154
return
new
SmoothSplineRect3DLazyDataImpl<typename std::remove_const<DstT>::type
,
155
typename
std::remove_const<SrcT>::type>
156
(src_mesh, src_vec, dst_mesh, flags);
157
}
158
159
};
160
161
template
<
typename
SrcT,
typename
DstT>
162
struct
InterpolationAlgorithm
<
EquilateralMesh3D
,
SrcT
,
DstT
,
INTERPOLATION_SMOOTH_SPLINE
> {
163
static
LazyData<DstT>
interpolate
(
const
shared_ptr<const EquilateralMesh3D>
& src_mesh,
164
const
DataVector<const SrcT>
& src_vec,
165
const
shared_ptr<
const
MeshD<3>
>& dst_mesh,
166
const
InterpolationFlags
& flags) {
167
return
new
SmoothSplineRect3DLazyDataImpl<typename std::remove_const<DstT>::type
,
168
typename
std::remove_const<SrcT>::type>
169
(src_mesh, src_vec,
EquilateralMesh3D::Transformed
(src_mesh, dst_mesh), flags);
170
}
171
172
};
173
174
175
}
// namespace plask
176
177
#endif
// PLASK__MESH_RECTANGULARSPLINE_H
plask
mesh
rectangular_spline.hpp
Generated by
1.9.8