PLaSK library
Loading...
Searching...
No Matches
rectangular_masked_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_RECTANGULARMASKEDSPLINE_H
15
#define PLASK__MESH_RECTANGULARMASKEDSPLINE_H
16
17
#include "../math.hpp"
18
#include "
rectangular_masked2d.hpp
"
19
#include "
rectangular_masked3d.hpp
"
20
#include "
interpolation.hpp
"
21
22
namespace
plask
{
23
24
template
<
typename
DstT,
typename
SrcT>
25
struct
SplineMaskedRect2DLazyDataImpl
:
public
InterpolatedLazyDataImpl
<DstT, RectangularMaskedMesh2D, const SrcT>
26
{
27
typedef
RectangularMaskedMesh2D
MeshType
;
28
29
DataVector<SrcT>
diff0
,
diff1
;
30
31
SplineMaskedRect2DLazyDataImpl
(
const
shared_ptr<const RectangularMaskedMesh2D>&
src_mesh
,
32
const
DataVector<const SrcT>
&
src_vec
,
33
const
shared_ptr<
const
MeshD<2>
>&
dst_mesh
,
34
const
InterpolationFlags
&
flags
):
35
InterpolatedLazyDataImpl
<
DstT
,
RectangularMaskedMesh2D
,
const
SrcT
>(
src_mesh
,
src_vec
,
dst_mesh
,
flags
),
36
diff0
(
src_mesh
->
size
()),
diff1
(
src_mesh
->
size
()) {}
37
38
DstT
at
(std::size_t index)
const override
;
39
};
40
41
template
<
typename
DstT,
typename
SrcT>
42
struct
SplineMaskedRectElement2DLazyDataImpl
:
public
InterpolatedLazyDataImpl
<DstT, RectangularMaskedMesh2D::ElementMesh, const SrcT>
43
{
44
typedef
RectangularMaskedMesh2D::ElementMesh
MeshType
;
45
46
DataVector<SrcT>
diff0
,
diff1
;
47
48
SplineMaskedRectElement2DLazyDataImpl
(
const
shared_ptr<const RectangularMaskedMesh2D::ElementMesh>&
src_mesh
,
49
const
DataVector<const SrcT>
&
src_vec
,
50
const
shared_ptr<
const
MeshD<2>
>&
dst_mesh
,
51
const
InterpolationFlags
&
flags
):
52
InterpolatedLazyDataImpl
<
DstT
,
RectangularMaskedMesh2D
::ElementMesh,
const
SrcT
>(
src_mesh
,
src_vec
,
dst_mesh
,
flags
),
53
diff0
(
src_mesh
->
size
()),
diff1
(
src_mesh
->
size
()) {}
54
55
DstT
at
(std::size_t index)
const override
;
56
};
57
58
59
template
<
typename
DstT,
typename
SrcT>
60
struct
SplineMaskedRect3DLazyDataImpl
:
public
InterpolatedLazyDataImpl
<DstT, RectangularMaskedMesh3D, const SrcT>
61
{
62
typedef
RectangularMaskedMesh3D
MeshType
;
63
64
DataVector<SrcT>
diff0
,
diff1
,
diff2
;
65
66
SplineMaskedRect3DLazyDataImpl
(
const
shared_ptr<const RectangularMaskedMesh3D>&
src_mesh
,
67
const
DataVector<const SrcT>
&
src_vec
,
68
const
shared_ptr<
const
MeshD<3>
>&
dst_mesh
,
69
const
InterpolationFlags
&
flags
):
70
InterpolatedLazyDataImpl
<
DstT
,
RectangularMaskedMesh3D
,
const
SrcT
>(
src_mesh
,
src_vec
,
dst_mesh
,
flags
),
71
diff0
(
src_mesh
->
size
()),
diff1
(
src_mesh
->
size
()),
diff2
(
src_mesh
->
size
()) {}
72
73
DstT
at
(std::size_t index)
const override
;
74
};
75
76
template
<
typename
DstT,
typename
SrcT>
77
struct
SplineMaskedRectElement3DLazyDataImpl
:
public
InterpolatedLazyDataImpl
<DstT, RectangularMaskedMesh3D::ElementMesh, const SrcT>
78
{
79
typedef
RectangularMaskedMesh3D::ElementMesh
MeshType
;
80
81
DataVector<SrcT>
diff0
,
diff1
,
diff2
;
82
83
SplineMaskedRectElement3DLazyDataImpl
(
const
shared_ptr<const RectangularMaskedMesh3D::ElementMesh>&
src_mesh
,
84
const
DataVector<const SrcT>
&
src_vec
,
85
const
shared_ptr<
const
MeshD<3>
>&
dst_mesh
,
86
const
InterpolationFlags
&
flags
):
87
InterpolatedLazyDataImpl
<
DstT
,
RectangularMaskedMesh3D
::ElementMesh,
const
SrcT
>(
src_mesh
,
src_vec
,
dst_mesh
,
flags
),
88
diff0
(
src_mesh
->
size
()),
diff1
(
src_mesh
->
size
()),
diff2
(
src_mesh
->
size
()) {}
89
90
DstT
at
(std::size_t index)
const override
;
91
};
92
93
94
template
<
typename
DstT,
typename
SrcT,
typename
BaseT=SplineMaskedRect2DLazyDataImpl<DstT, SrcT>>
95
struct
PLASK_API
HymanSplineMaskedRect2DLazyDataImpl
:
public
BaseT
96
{
97
HymanSplineMaskedRect2DLazyDataImpl
(
const
shared_ptr<const typename BaseT::MeshType>
& src_mesh,
98
const
DataVector<const SrcT>
& src_vec,
99
const
shared_ptr<
const
MeshD<2>
>& dst_mesh,
100
const
InterpolationFlags
& flags);
101
};
102
103
template
<
typename
SrcT,
typename
DstT>
104
struct
InterpolationAlgorithm
<
RectangularMaskedMesh2D
,
SrcT
,
DstT
,
INTERPOLATION_SPLINE
> {
105
static
LazyData<DstT>
interpolate
(
const
shared_ptr<const RectangularMaskedMesh2D>& src_mesh,
106
const
DataVector<const SrcT>
& src_vec,
107
const
shared_ptr<
const
MeshD<2>
>& dst_mesh,
108
const
InterpolationFlags
& flags) {
109
return
new
HymanSplineMaskedRect2DLazyDataImpl<typename std::remove_const<DstT>::type
,
110
typename
std::remove_const<SrcT>::type>
111
(src_mesh, src_vec, dst_mesh, flags);
112
}
113
114
};
115
116
template
<
typename
SrcT,
typename
DstT>
117
struct
InterpolationAlgorithm
<
RectangularMaskedMesh2D
::ElementMesh,
SrcT
,
DstT
,
INTERPOLATION_SPLINE
> {
118
static
LazyData<DstT>
interpolate
(
const
shared_ptr<const RectangularMaskedMesh2D::ElementMesh>& src_mesh,
119
const
DataVector<const SrcT>
& src_vec,
120
const
shared_ptr<
const
MeshD<2>
>& dst_mesh,
121
const
InterpolationFlags
& flags) {
122
return
new
HymanSplineMaskedRect2DLazyDataImpl<typename std::remove_const<DstT>::type
,
123
typename
std::remove_const<SrcT>::type,
124
SplineMaskedRectElement2DLazyDataImpl<DstT, SrcT>
>
125
(src_mesh, src_vec, dst_mesh, flags);
126
}
127
128
};
129
130
131
template
<
typename
DstT,
typename
SrcT,
typename
BaseT=SplineMaskedRect3DLazyDataImpl<DstT, SrcT>>
132
struct
PLASK_API
HymanSplineMaskedRect3DLazyDataImpl
:
public
BaseT {
133
134
HymanSplineMaskedRect3DLazyDataImpl
(
const
shared_ptr<const typename BaseT::MeshType>
& src_mesh,
135
const
DataVector<const SrcT>
& src_vec,
136
const
shared_ptr<
const
MeshD<3>
>& dst_mesh,
137
const
InterpolationFlags
& flags);
138
};
139
140
template
<
typename
SrcT,
typename
DstT>
141
struct
InterpolationAlgorithm
<
RectangularMaskedMesh3D
,
SrcT
,
DstT
,
INTERPOLATION_SPLINE
> {
142
static
LazyData<DstT>
interpolate
(
const
shared_ptr<const RectangularMaskedMesh3D>& src_mesh,
143
const
DataVector<const SrcT>
& src_vec,
144
const
shared_ptr<
const
MeshD<3>
>& dst_mesh,
145
const
InterpolationFlags
& flags) {
146
return
new
HymanSplineMaskedRect3DLazyDataImpl<typename std::remove_const<DstT>::type
,
147
typename
std::remove_const<SrcT>::type>
148
(src_mesh, src_vec, dst_mesh, flags);
149
}
150
151
};
152
153
template
<
typename
SrcT,
typename
DstT>
154
struct
InterpolationAlgorithm
<
RectangularMaskedMesh3D
::ElementMesh,
SrcT
,
DstT
,
INTERPOLATION_SPLINE
> {
155
static
LazyData<DstT>
interpolate
(
const
shared_ptr<const RectangularMaskedMesh3D::ElementMesh>& src_mesh,
156
const
DataVector<const SrcT>
& src_vec,
157
const
shared_ptr<
const
MeshD<3>
>& dst_mesh,
158
const
InterpolationFlags
& flags) {
159
return
new
HymanSplineMaskedRect3DLazyDataImpl<typename std::remove_const<DstT>::type
,
160
typename
std::remove_const<SrcT>::type,
161
SplineMaskedRectElement3DLazyDataImpl<DstT, SrcT>
>
162
(src_mesh, src_vec, dst_mesh, flags);
163
}
164
165
};
166
167
}
// namespace plask
168
169
#endif
// PLASK__MESH_RECTANGULARMASKEDSPLINE_H
plask
mesh
rectangular_masked_spline.hpp
Generated by
1.9.8