ARTS  2.4.0(git:4fb77825)
interpolation.h
Go to the documentation of this file.
1 /* Copyright (C) 2002-2012 Stefan Buehler <sbuehler@ltu.se>
2 
3  This program is free software; you can redistribute it and/or modify it
4  under the terms of the GNU General Public License as published by the
5  Free Software Foundation; either version 2, or (at your option) any
6  later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16  USA. */
17 
26 #ifndef interpolation_h
27 #define interpolation_h
28 
29 #include "arts.h"
30 #include "matpackVII.h"
31 #include "mystring.h"
32 
34 
73 struct GridPos {
75  Numeric fd[2];
77 };
78 
80 
89 
90 // Function headers (documentation is in .cc file):
91 
92 ostream& operator<<(ostream& os, const GridPos& gp);
93 
94 void gridpos(ArrayOfGridPos& gp,
95  ConstVectorView old_grid,
96  ConstVectorView new_grid,
97  const Numeric& extpolfac = 0.5);
98 
99 void gridpos(GridPos& gp,
100  ConstVectorView old_grid,
101  const Numeric& new_grid,
102  const Numeric& extpolfac = 0.5);
103 
105 
106 void gridpos_copy(GridPos& gp_new, const GridPos& gp_old);
107 
108 Numeric fractional_gp(const GridPos& gp);
109 
110 void gridpos_check_fd(GridPos& gp);
111 
112 void gridpos_force_end_fd(GridPos& gp, const Index& n);
113 
114 void gridpos_upperend_check(GridPos& gp, const Index& ie);
115 
116 void gridpos_upperend_check(ArrayOfGridPos& gp, const Index& ie);
117 
119 
120 bool is_gridpos_at_index_i(const GridPos& gp,
121  const Index& i,
122  const bool& strict = true);
123 
124 Index gridpos2gridrange(const GridPos& gp, const bool& upwards);
125 
127 // Red Interpolation
129 
130 void interpweights(VectorView itw, const GridPos& tc);
131 
132 void interpweights(VectorView itw, const GridPos& tr, const GridPos& tc);
133 
134 void interpweights(VectorView itw,
135  const GridPos& tp,
136  const GridPos& tr,
137  const GridPos& tc);
138 
139 void interpweights(VectorView itw,
140  const GridPos& tb,
141  const GridPos& tp,
142  const GridPos& tr,
143  const GridPos& tc);
144 
145 void interpweights(VectorView itw,
146  const GridPos& ts,
147  const GridPos& tb,
148  const GridPos& tp,
149  const GridPos& tr,
150  const GridPos& tc);
151 
152 void interpweights(VectorView itw,
153  const GridPos& tv,
154  const GridPos& ts,
155  const GridPos& tb,
156  const GridPos& tp,
157  const GridPos& tr,
158  const GridPos& tc);
159 
161 
163  ConstMatrixView a,
164  const GridPos& tr,
165  const GridPos& tc);
166 
169  const GridPos& tp,
170  const GridPos& tr,
171  const GridPos& tc);
172 
175  const GridPos& tb,
176  const GridPos& tp,
177  const GridPos& tr,
178  const GridPos& tc);
179 
182  const GridPos& ts,
183  const GridPos& tb,
184  const GridPos& tp,
185  const GridPos& tr,
186  const GridPos& tc);
187 
190  const GridPos& tv,
191  const GridPos& ts,
192  const GridPos& tb,
193  const GridPos& tp,
194  const GridPos& tr,
195  const GridPos& tc);
196 
198 // Blue interpolation
200 
201 void interpweights(MatrixView itw, const ArrayOfGridPos& cgp);
202 
203 void interpweights(MatrixView itw,
204  const ArrayOfGridPos& rgp,
205  const ArrayOfGridPos& cgp);
206 
207 void interpweights(MatrixView itw,
208  const ArrayOfGridPos& pgp,
209  const ArrayOfGridPos& rgp,
210  const ArrayOfGridPos& cgp);
211 
212 void interpweights(MatrixView itw,
213  const ArrayOfGridPos& bgp,
214  const ArrayOfGridPos& pgp,
215  const ArrayOfGridPos& rgp,
216  const ArrayOfGridPos& cgp);
217 
218 void interpweights(MatrixView itw,
219  const ArrayOfGridPos& sgp,
220  const ArrayOfGridPos& bgp,
221  const ArrayOfGridPos& pgp,
222  const ArrayOfGridPos& rgp,
223  const ArrayOfGridPos& cgp);
224 
225 void interpweights(MatrixView itw,
226  const ArrayOfGridPos& vgp,
227  const ArrayOfGridPos& sgp,
228  const ArrayOfGridPos& bgp,
229  const ArrayOfGridPos& pgp,
230  const ArrayOfGridPos& rgp,
231  const ArrayOfGridPos& cgp);
232 
233 void interp(VectorView ia,
234  ConstMatrixView itw,
235  ConstVectorView a,
236  const ArrayOfGridPos& cgp);
237 
238 void interp(VectorView ia,
239  ConstMatrixView itw,
240  ConstMatrixView a,
241  const ArrayOfGridPos& rgp,
242  const ArrayOfGridPos& cgp);
243 
244 void interp(VectorView ia,
245  ConstMatrixView itw,
247  const ArrayOfGridPos& pgp,
248  const ArrayOfGridPos& rgp,
249  const ArrayOfGridPos& cgp);
250 
251 void interp(VectorView ia,
252  ConstMatrixView itw,
254  const ArrayOfGridPos& bgp,
255  const ArrayOfGridPos& pgp,
256  const ArrayOfGridPos& rgp,
257  const ArrayOfGridPos& cgp);
258 
259 void interp(VectorView ia,
260  ConstMatrixView itw,
262  const ArrayOfGridPos& sgp,
263  const ArrayOfGridPos& bgp,
264  const ArrayOfGridPos& pgp,
265  const ArrayOfGridPos& rgp,
266  const ArrayOfGridPos& cgp);
267 
268 void interp(VectorView ia,
269  ConstMatrixView itw,
271  const ArrayOfGridPos& vgp,
272  const ArrayOfGridPos& sgp,
273  const ArrayOfGridPos& bgp,
274  const ArrayOfGridPos& pgp,
275  const ArrayOfGridPos& rgp,
276  const ArrayOfGridPos& cgp);
277 
279 // Green interpolation
281 
282 void interpweights(Tensor3View itw,
283  const ArrayOfGridPos& rgp,
284  const ArrayOfGridPos& cgp);
285 
286 void interpweights(Tensor4View itw,
287  const ArrayOfGridPos& pgp,
288  const ArrayOfGridPos& rgp,
289  const ArrayOfGridPos& cgp);
290 
291 void interpweights(Tensor5View itw,
292  const ArrayOfGridPos& bgp,
293  const ArrayOfGridPos& pgp,
294  const ArrayOfGridPos& rgp,
295  const ArrayOfGridPos& cgp);
296 
297 void interpweights(Tensor6View itw,
298  const ArrayOfGridPos& sgp,
299  const ArrayOfGridPos& bgp,
300  const ArrayOfGridPos& pgp,
301  const ArrayOfGridPos& rgp,
302  const ArrayOfGridPos& cgp);
303 
304 void interpweights(Tensor7View itw,
305  const ArrayOfGridPos& vgp,
306  const ArrayOfGridPos& sgp,
307  const ArrayOfGridPos& bgp,
308  const ArrayOfGridPos& pgp,
309  const ArrayOfGridPos& rgp,
310  const ArrayOfGridPos& cgp);
311 
312 void interp(MatrixView ia,
313  ConstTensor3View itw,
314  ConstMatrixView a,
315  const ArrayOfGridPos& rgp,
316  const ArrayOfGridPos& cgp);
317 
318 void interp(Tensor3View ia,
319  ConstTensor4View itw,
321  const ArrayOfGridPos& pgp,
322  const ArrayOfGridPos& rgp,
323  const ArrayOfGridPos& cgp);
324 
325 void interp(Tensor4View ia,
326  ConstTensor5View itw,
328  const ArrayOfGridPos& bgp,
329  const ArrayOfGridPos& pgp,
330  const ArrayOfGridPos& rgp,
331  const ArrayOfGridPos& cgp);
332 
333 void interp(Tensor5View ia,
334  ConstTensor6View itw,
336  const ArrayOfGridPos& sgp,
337  const ArrayOfGridPos& bgp,
338  const ArrayOfGridPos& pgp,
339  const ArrayOfGridPos& rgp,
340  const ArrayOfGridPos& cgp);
341 
342 void interp(Tensor6View ia,
343  ConstTensor7View itw,
345  const ArrayOfGridPos& vgp,
346  const ArrayOfGridPos& sgp,
347  const ArrayOfGridPos& bgp,
348  const ArrayOfGridPos& pgp,
349  const ArrayOfGridPos& rgp,
350  const ArrayOfGridPos& cgp);
351 
354  const Numeric& x_i,
355  const GridPos& gp);
356 
357 void polint(Numeric& y_int,
358  Numeric& dy_int,
360  ConstVectorView ya,
361  const Index& i,
362  const Numeric& x);
363 
364 #endif // interpolation_h
Tensor7View
The Tensor7View class.
Definition: matpackVII.h:1286
MatrixView
The MatrixView class.
Definition: matpackI.h:1093
gridpos_force_end_fd
void gridpos_force_end_fd(GridPos &gp, const Index &n)
gridpos_force_end_fd
Definition: interpolation.cc:555
gridpos_check_fd
void gridpos_check_fd(GridPos &gp)
gridpos_check_fd
Definition: interpolation.cc:509
ConstTensor7View
A constant view of a Tensor7.
Definition: matpackVII.h:147
gp4length1grid
void gp4length1grid(ArrayOfGridPos &gp)
Grid position matching a grid of length 1.
Definition: interpolation.cc:636
ArrayOfArrayOfGridPos
Array< Array< GridPos > > ArrayOfArrayOfGridPos
Definition: interpolation.h:85
ARTS::Var::xa
Vector xa(Workspace &ws) noexcept
Definition: autoarts.h:7359
ARTS::Var::y
Vector y(Workspace &ws) noexcept
Definition: autoarts.h:7401
ArrayOfGridPos
Array< GridPos > ArrayOfGridPos
An Array of grid positions.
Definition: interpolation.h:84
gridpos2gridrange
Index gridpos2gridrange(const GridPos &gp, const bool &upwards)
gridpos2gridrange
Definition: interpolation.cc:697
gridpos_copy
void gridpos_copy(GridPos &gp_new, const GridPos &gp_old)
gridpos_copy
Definition: interpolation.cc:473
GridPos::fd
Numeric fd[2]
Definition: interpolation.h:75
gridpos_upperend_check
void gridpos_upperend_check(GridPos &gp, const Index &ie)
gridpos_upperend_check
Definition: interpolation.cc:589
interp
Numeric interp(ConstVectorView itw, ConstVectorView a, const GridPos &tc)
Red 1D Interpolate.
Definition: interpolation.cc:970
interp_poly
Numeric interp_poly(ConstVectorView x, ConstVectorView y, const Numeric &x_i, const GridPos &gp)
Polynomial interpolation.
Definition: interpolation.cc:2723
ConstTensor4View
A constant view of a Tensor4.
Definition: matpackIV.h:133
Tensor3View
The Tensor3View class.
Definition: matpackIII.h:239
Array< GridPos >
interpweights
void interpweights(VectorView itw, const GridPos &tc)
Red 1D interpolation weights.
Definition: interpolation.cc:741
VectorView
The VectorView class.
Definition: matpackI.h:610
ConstTensor6View
A constant view of a Tensor6.
Definition: matpackVI.h:149
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
Tensor5View
The Tensor5View class.
Definition: matpackV.h:333
ArrayOfArrayOfArrayOfGridPos
Array< Array< Array< GridPos > > > ArrayOfArrayOfArrayOfGridPos
Definition: interpolation.h:86
ArrayOfArrayOfArrayOfArrayOfGridPos
Array< Array< Array< Array< GridPos > > > > ArrayOfArrayOfArrayOfArrayOfGridPos
Definition: interpolation.h:88
gridpos
void gridpos(ArrayOfGridPos &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Numeric &extpolfac=0.5)
Set up a grid position Array.
Definition: interpolation.cc:156
gridpos_1to1
void gridpos_1to1(ArrayOfGridPos &gp, ConstVectorView grid)
gridpos_1to1
Definition: interpolation.cc:449
ConstMatrixView
A constant view of a Matrix.
Definition: matpackI.h:982
GridPos
Structure to store a grid position.
Definition: interpolation.h:73
operator<<
ostream & operator<<(ostream &os, const GridPos &gp)
Output operator for GridPos.
Definition: interpolation.cc:96
ConstTensor3View
A constant view of a Tensor3.
Definition: matpackIII.h:132
Tensor4View
The Tensor4View class.
Definition: matpackIV.h:284
GridPos::idx
Index idx
Definition: interpolation.h:74
fractional_gp
Numeric fractional_gp(const GridPos &gp)
fractional_gp
Definition: interpolation.cc:492
ARTS::Var::x
Vector x(Workspace &ws) noexcept
Definition: autoarts.h:7346
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
ConstVectorView
A constant view of a Vector.
Definition: matpackI.h:476
is_gridpos_at_index_i
bool is_gridpos_at_index_i(const GridPos &gp, const Index &i, const bool &strict=true)
is_gridpos_at_index_i
Definition: interpolation.cc:657
ConstTensor5View
A constant view of a Tensor5.
Definition: matpackV.h:143
mystring.h
This file contains the definition of String, the ARTS string class.
matpackVII.h
Tensor6View
The Tensor6View class.
Definition: matpackVI.h:621
arts.h
The global header file for ARTS.
polint
void polint(Numeric &y_int, Numeric &dy_int, ConstVectorView xa, ConstVectorView ya, const Index &i, const Numeric &x)
Polynomial interpolation.
Definition: interpolation.cc:2883