ARTS  2.2.66
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 
33 
35 
74 struct GridPos {
76  Numeric fd[2];
78 };
79 
81 
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 
104 void gridpos_1to1(
105  ArrayOfGridPos& gp,
106  ConstVectorView grid );
107 
108 void gridpos_copy( GridPos& gp_new, const GridPos& gp_old );
109 
110 Numeric fractional_gp( const GridPos& gp );
111 
112 void gridpos_check_fd( GridPos& gp );
113 
115  GridPos& gp,
116  const Index& n );
117 
119  GridPos& gp,
120  const Index& ie );
121 
123  ArrayOfGridPos& gp,
124  const Index& ie );
125 
127  const GridPos& gp,
128  const Index& i,
129  const bool& strict=true );
130 
132  const GridPos& gp,
133  const bool& upwards );
134 
135 
136 
137 
139 // Red Interpolation
141 
142 void interpweights( VectorView itw,
143  const GridPos& tc );
144 
145 void interpweights( VectorView itw,
146  const GridPos& tr,
147  const GridPos& tc );
148 
149 void interpweights( VectorView itw,
150  const GridPos& tp,
151  const GridPos& tr,
152  const GridPos& tc );
153 
154 void interpweights( VectorView itw,
155  const GridPos& tb,
156  const GridPos& tp,
157  const GridPos& tr,
158  const GridPos& tc );
159 
160 void interpweights( VectorView itw,
161  const GridPos& ts,
162  const GridPos& tb,
163  const GridPos& tp,
164  const GridPos& tr,
165  const GridPos& tc );
166 
167 void interpweights( VectorView itw,
168  const GridPos& tv,
169  const GridPos& ts,
170  const GridPos& tb,
171  const GridPos& tp,
172  const GridPos& tr,
173  const GridPos& tc );
174 
176  ConstVectorView a,
177  const GridPos& tc );
178 
180  ConstMatrixView a,
181  const GridPos& tr,
182  const GridPos& tc );
183 
185  ConstTensor3View a,
186  const GridPos& tp,
187  const GridPos& tr,
188  const GridPos& tc );
189 
191  ConstTensor4View a,
192  const GridPos& tb,
193  const GridPos& tp,
194  const GridPos& tr,
195  const GridPos& tc );
196 
198  ConstTensor5View a,
199  const GridPos& ts,
200  const GridPos& tb,
201  const GridPos& tp,
202  const GridPos& tr,
203  const GridPos& tc );
204 
206  ConstTensor6View a,
207  const GridPos& tv,
208  const GridPos& ts,
209  const GridPos& tb,
210  const GridPos& tp,
211  const GridPos& tr,
212  const GridPos& tc );
213 
214 
215 
216 
217 
219 // Blue interpolation
221 
222 void interpweights( MatrixView itw,
223  const ArrayOfGridPos& cgp );
224 
225 void interpweights( MatrixView itw,
226  const ArrayOfGridPos& rgp,
227  const ArrayOfGridPos& cgp );
228 
229 void interpweights( MatrixView itw,
230  const ArrayOfGridPos& pgp,
231  const ArrayOfGridPos& rgp,
232  const ArrayOfGridPos& cgp );
233 
234 void interpweights( MatrixView itw,
235  const ArrayOfGridPos& bgp,
236  const ArrayOfGridPos& pgp,
237  const ArrayOfGridPos& rgp,
238  const ArrayOfGridPos& cgp );
239 
240 void interpweights( MatrixView itw,
241  const ArrayOfGridPos& sgp,
242  const ArrayOfGridPos& bgp,
243  const ArrayOfGridPos& pgp,
244  const ArrayOfGridPos& rgp,
245  const ArrayOfGridPos& cgp );
246 
247 void interpweights( MatrixView itw,
248  const ArrayOfGridPos& vgp,
249  const ArrayOfGridPos& sgp,
250  const ArrayOfGridPos& bgp,
251  const ArrayOfGridPos& pgp,
252  const ArrayOfGridPos& rgp,
253  const ArrayOfGridPos& cgp );
254 
255 void interp( VectorView ia,
256  ConstMatrixView itw,
257  ConstVectorView a,
258  const ArrayOfGridPos& cgp);
259 
260 void interp( VectorView ia,
261  ConstMatrixView itw,
262  ConstMatrixView a,
263  const ArrayOfGridPos& rgp,
264  const ArrayOfGridPos& cgp);
265 
266 void interp( VectorView ia,
267  ConstMatrixView itw,
268  ConstTensor3View a,
269  const ArrayOfGridPos& pgp,
270  const ArrayOfGridPos& rgp,
271  const ArrayOfGridPos& cgp);
272 
273 void interp( VectorView ia,
274  ConstMatrixView itw,
275  ConstTensor4View a,
276  const ArrayOfGridPos& bgp,
277  const ArrayOfGridPos& pgp,
278  const ArrayOfGridPos& rgp,
279  const ArrayOfGridPos& cgp);
280 
281 void interp( VectorView ia,
282  ConstMatrixView itw,
283  ConstTensor5View a,
284  const ArrayOfGridPos& sgp,
285  const ArrayOfGridPos& bgp,
286  const ArrayOfGridPos& pgp,
287  const ArrayOfGridPos& rgp,
288  const ArrayOfGridPos& cgp);
289 
290 void interp( VectorView ia,
291  ConstMatrixView itw,
292  ConstTensor6View a,
293  const ArrayOfGridPos& vgp,
294  const ArrayOfGridPos& sgp,
295  const ArrayOfGridPos& bgp,
296  const ArrayOfGridPos& pgp,
297  const ArrayOfGridPos& rgp,
298  const ArrayOfGridPos& cgp);
299 
300 
301 
302 
303 
305 // Green interpolation
307 
308 void interpweights( Tensor3View itw,
309  const ArrayOfGridPos& rgp,
310  const ArrayOfGridPos& cgp );
311 
312 void interpweights( Tensor4View itw,
313  const ArrayOfGridPos& pgp,
314  const ArrayOfGridPos& rgp,
315  const ArrayOfGridPos& cgp );
316 
317 void interpweights( Tensor5View itw,
318  const ArrayOfGridPos& bgp,
319  const ArrayOfGridPos& pgp,
320  const ArrayOfGridPos& rgp,
321  const ArrayOfGridPos& cgp );
322 
323 void interpweights( Tensor6View itw,
324  const ArrayOfGridPos& sgp,
325  const ArrayOfGridPos& bgp,
326  const ArrayOfGridPos& pgp,
327  const ArrayOfGridPos& rgp,
328  const ArrayOfGridPos& cgp );
329 
330 void interpweights( Tensor7View itw,
331  const ArrayOfGridPos& vgp,
332  const ArrayOfGridPos& sgp,
333  const ArrayOfGridPos& bgp,
334  const ArrayOfGridPos& pgp,
335  const ArrayOfGridPos& rgp,
336  const ArrayOfGridPos& cgp );
337 
338 void interp( MatrixView ia,
339  ConstTensor3View itw,
340  ConstMatrixView a,
341  const ArrayOfGridPos& rgp,
342  const ArrayOfGridPos& cgp);
343 
344 void interp( Tensor3View ia,
345  ConstTensor4View itw,
346  ConstTensor3View a,
347  const ArrayOfGridPos& pgp,
348  const ArrayOfGridPos& rgp,
349  const ArrayOfGridPos& cgp);
350 
351 void interp( Tensor4View ia,
352  ConstTensor5View itw,
353  ConstTensor4View a,
354  const ArrayOfGridPos& bgp,
355  const ArrayOfGridPos& pgp,
356  const ArrayOfGridPos& rgp,
357  const ArrayOfGridPos& cgp);
358 
359 void interp( Tensor5View ia,
360  ConstTensor6View itw,
361  ConstTensor5View a,
362  const ArrayOfGridPos& sgp,
363  const ArrayOfGridPos& bgp,
364  const ArrayOfGridPos& pgp,
365  const ArrayOfGridPos& rgp,
366  const ArrayOfGridPos& cgp);
367 
368 void interp( Tensor6View ia,
369  ConstTensor7View itw,
370  ConstTensor6View a,
371  const ArrayOfGridPos& vgp,
372  const ArrayOfGridPos& sgp,
373  const ArrayOfGridPos& bgp,
374  const ArrayOfGridPos& pgp,
375  const ArrayOfGridPos& rgp,
376  const ArrayOfGridPos& cgp);
377 
379  ConstVectorView y,
380  const Numeric& x_i,
381  const GridPos& gp);
382 
383 void polint(Numeric& y_int,
384  Numeric& dy_int,
385  ConstVectorView xa,
386  ConstVectorView ya,
387  const Index& i,
388  const Numeric& x);
389 
390 #endif // interpolation_h
Tensor7View
The Tensor7View class.
Definition: matpackVII.h:780
MatrixView
The MatrixView class.
Definition: matpackI.h:679
gridpos_force_end_fd
void gridpos_force_end_fd(GridPos &gp, const Index &n)
gridpos_force_end_fd
Definition: interpolation.cc:602
gridpos_check_fd
void gridpos_check_fd(GridPos &gp)
gridpos_check_fd
Definition: interpolation.cc:559
ConstTensor7View
A constant view of a Tensor7.
Definition: matpackVII.h:162
ArrayOfArrayOfGridPos
Array< Array< GridPos > > ArrayOfArrayOfGridPos
Definition: interpolation.h:86
ArrayOfGridPos
Array< GridPos > ArrayOfGridPos
An Array of grid positions.
Definition: interpolation.h:85
gridpos2gridrange
Index gridpos2gridrange(const GridPos &gp, const bool &upwards)
gridpos2gridrange
Definition: interpolation.cc:747
gridpos_copy
void gridpos_copy(GridPos &gp_new, const GridPos &gp_old)
gridpos_copy
Definition: interpolation.cc:517
GridPos::fd
Numeric fd[2]
Definition: interpolation.h:76
gridpos_upperend_check
void gridpos_upperend_check(GridPos &gp, const Index &ie)
gridpos_upperend_check
Definition: interpolation.cc:643
interp
Numeric interp(ConstVectorView itw, ConstVectorView a, const GridPos &tc)
Red 1D Interpolate.
Definition: interpolation.cc:1046
interp_poly
Numeric interp_poly(ConstVectorView x, ConstVectorView y, const Numeric &x_i, const GridPos &gp)
Polynomial interpolation.
Definition: interpolation.cc:2955
ConstTensor4View
A constant view of a Tensor4.
Definition: matpackIV.h:141
Tensor3View
The Tensor3View class.
Definition: matpackIII.h:232
Array< GridPos >
interpweights
void interpweights(VectorView itw, const GridPos &tc)
Red 1D interpolation weights.
Definition: interpolation.cc:802
VectorView
The VectorView class.
Definition: matpackI.h:372
ConstTensor6View
A constant view of a Tensor6.
Definition: matpackVI.h:159
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:29
Tensor5View
The Tensor5View class.
Definition: matpackV.h:276
ArrayOfArrayOfArrayOfGridPos
Array< Array< Array< GridPos > > > ArrayOfArrayOfArrayOfGridPos
Definition: interpolation.h:87
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:167
gridpos_1to1
void gridpos_1to1(ArrayOfGridPos &gp, ConstVectorView grid)
gridpos_1to1
Definition: interpolation.cc:488
ConstMatrixView
A constant view of a Matrix.
Definition: matpackI.h:596
GridPos
Structure to store a grid position.
Definition: interpolation.h:74
operator<<
ostream & operator<<(ostream &os, const GridPos &gp)
Output operator for GridPos.
Definition: interpolation.cc:105
ConstTensor3View
A constant view of a Tensor3.
Definition: matpackIII.h:139
Tensor4View
The Tensor4View class.
Definition: matpackIV.h:243
GridPos::idx
Index idx
Definition: interpolation.h:75
fractional_gp
Numeric fractional_gp(const GridPos &gp)
fractional_gp
Definition: interpolation.cc:539
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:35
ConstVectorView
A constant view of a Vector.
Definition: matpackI.h:292
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:702
ConstTensor5View
A constant view of a Tensor5.
Definition: matpackV.h:152
mystring.h
This file contains the definition of String, the ARTS string class.
matpackVII.h
Tensor6View
The Tensor6View class.
Definition: matpackVI.h:449
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:3141