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
24namespace plask {
25
26template <typename DstT, typename SrcT>
27struct SplineRect2DLazyDataImpl: public InterpolatedLazyDataImpl<DstT, RectangularMesh2D, const SrcT>
28{
30
31 SplineRect2DLazyDataImpl(const shared_ptr<const RectangularMesh2D>& src_mesh,
33 const shared_ptr<const MeshD<2>>& dst_mesh,
35
36 DstT at(std::size_t index) const override;
37};
38
39template <typename DstT, typename SrcT>
40struct SplineRect3DLazyDataImpl: public InterpolatedLazyDataImpl<DstT, RectilinearMesh3D, const SrcT>
41{
43
44 SplineRect3DLazyDataImpl(const shared_ptr<const RectilinearMesh3D>& src_mesh,
46 const shared_ptr<const MeshD<3>>& dst_mesh,
48
49 DstT at(std::size_t index) const override;
50};
51
52
53template <typename DstT, typename 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
62template <typename SrcT, typename DstT>
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
70 typename std::remove_const<SrcT>::type>
71 (src_mesh, src_vec, dst_mesh, flags);
72 }
73
74};
75
76
77template <typename DstT, typename 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
86template <typename SrcT, typename DstT>
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
94 typename std::remove_const<SrcT>::type>
95 (src_mesh, src_vec, dst_mesh, flags);
96 }
97
98};
99
100template <typename SrcT, typename DstT>
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
108 typename std::remove_const<SrcT>::type>
109 (src_mesh, src_vec, EquilateralMesh3D::Transformed(src_mesh, dst_mesh), flags);
110 }
111
112};
113
114
115template <typename DstT, typename 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
124template <typename SrcT, typename DstT>
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) {
131 typename std::remove_const<SrcT>::type>
132 (src_mesh, src_vec, dst_mesh, flags);
133 }
134
135};
136
137
138template <typename DstT, typename 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
147template <typename SrcT, typename DstT>
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
155 typename std::remove_const<SrcT>::type>
156 (src_mesh, src_vec, dst_mesh, flags);
157 }
158
159};
160
161template <typename SrcT, typename DstT>
164 const DataVector<const SrcT>& src_vec,
165 const shared_ptr<const MeshD<3>>& dst_mesh,
166 const InterpolationFlags& flags) {
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