00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00026 #ifndef interpolation_h
00027 #define interpolation_h
00028 
00029 #include "arts.h"
00030 #include "matpackVII.h"
00031 #include "mystring.h"
00032 
00033 
00035 
00074 struct GridPos {
00075   Index   idx;                 
00076   Numeric fd[2];               
00078 };
00079 
00081 
00085 typedef Array<GridPos> ArrayOfGridPos;
00086 typedef Array<Array<GridPos> > ArrayOfArrayOfGridPos;  
00087 typedef Array<Array<Array<GridPos> > > ArrayOfArrayOfArrayOfGridPos;  
00088 typedef Array<Array<Array<Array<GridPos> > > > ArrayOfArrayOfArrayOfArrayOfGridPos;  
00089 
00090 
00091 
00092 ostream& operator<<(ostream& os, const GridPos& gp);
00093 
00094 void gridpos( ArrayOfGridPos& gp,
00095               ConstVectorView old_grid,
00096               ConstVectorView new_grid,
00097               const Numeric&  extpolfac=0.5  );
00098 
00099 void gridpos( GridPos& gp,
00100               ConstVectorView old_grid,
00101               const Numeric&  new_grid,
00102               const Numeric&  extpolfac=0.5 );
00103 
00104 void gridpos_copy( GridPos&  gp_new,  const GridPos&  gp_old );
00105 
00106 Numeric fractional_gp( const GridPos&   gp );
00107 
00108 void gridpos_check_fd( GridPos&   gp );
00109 
00110 void gridpos_force_end_fd( GridPos&   gp );
00111 
00112 bool is_gridpos_at_index_i(  
00113        const GridPos&   gp,
00114        const Index&     i );
00115 
00116 Index gridpos2gridrange(
00117        const GridPos&   gp,
00118        const bool&      upwards );
00119 
00120 
00121 
00122 
00124 
00126 
00127 void interpweights( VectorView itw,
00128                     const GridPos& tc );
00129 
00130 void interpweights( VectorView itw,
00131                     const GridPos& tr,
00132                     const GridPos& tc );
00133 
00134 void interpweights( VectorView itw,
00135                     const GridPos& tp,
00136                     const GridPos& tr,
00137                     const GridPos& tc );
00138 
00139 void interpweights( VectorView itw,
00140                     const GridPos& tb,
00141                     const GridPos& tp,
00142                     const GridPos& tr,
00143                     const GridPos& tc );
00144 
00145 void interpweights( VectorView itw,
00146                     const GridPos& ts,
00147                     const GridPos& tb,
00148                     const GridPos& tp,
00149                     const GridPos& tr,
00150                     const GridPos& tc );
00151 
00152 void interpweights( VectorView itw,
00153                     const GridPos& tv,
00154                     const GridPos& ts,
00155                     const GridPos& tb,
00156                     const GridPos& tp,
00157                     const GridPos& tr,
00158                     const GridPos& tc );
00159 
00160 Numeric interp( ConstVectorView itw,
00161                 ConstVectorView a,    
00162                 const GridPos&  tc );
00163 
00164 Numeric interp( ConstVectorView  itw,
00165                 ConstMatrixView  a,    
00166                 const GridPos&   tr,
00167                 const GridPos&   tc );
00168 
00169 Numeric interp( ConstVectorView  itw,
00170                 ConstTensor3View a,    
00171                 const GridPos&   tp,
00172                 const GridPos&   tr,
00173                 const GridPos&   tc );
00174 
00175 Numeric interp( ConstVectorView  itw,
00176                 ConstTensor4View a,    
00177                 const GridPos&   tb,
00178                 const GridPos&   tp,
00179                 const GridPos&   tr,
00180                 const GridPos&   tc );
00181 
00182 Numeric interp( ConstVectorView  itw,
00183                 ConstTensor5View a,    
00184                 const GridPos&   ts,
00185                 const GridPos&   tb,
00186                 const GridPos&   tp,
00187                 const GridPos&   tr,
00188                 const GridPos&   tc );
00189 
00190 Numeric interp( ConstVectorView  itw,
00191                 ConstTensor6View a,    
00192                 const GridPos&   tv,
00193                 const GridPos&   ts,
00194                 const GridPos&   tb,
00195                 const GridPos&   tp,
00196                 const GridPos&   tr,
00197                 const GridPos&   tc );
00198 
00199 
00200 
00201 
00202 
00204 
00206 
00207 void interpweights( MatrixView itw,
00208                     const ArrayOfGridPos& cgp );
00209 
00210 void interpweights( MatrixView itw,
00211                     const ArrayOfGridPos& rgp,
00212                     const ArrayOfGridPos& cgp );
00213 
00214 void interpweights( MatrixView itw,
00215                     const ArrayOfGridPos& pgp,
00216                     const ArrayOfGridPos& rgp,
00217                     const ArrayOfGridPos& cgp );
00218 
00219 void interpweights( MatrixView itw,
00220                     const ArrayOfGridPos& bgp,
00221                     const ArrayOfGridPos& pgp,
00222                     const ArrayOfGridPos& rgp,
00223                     const ArrayOfGridPos& cgp );
00224 
00225 void interpweights( MatrixView itw,
00226                     const ArrayOfGridPos& sgp,
00227                     const ArrayOfGridPos& bgp,
00228                     const ArrayOfGridPos& pgp,
00229                     const ArrayOfGridPos& rgp,
00230                     const ArrayOfGridPos& cgp );
00231 
00232 void interpweights( MatrixView itw,
00233                     const ArrayOfGridPos& vgp,
00234                     const ArrayOfGridPos& sgp,
00235                     const ArrayOfGridPos& bgp,
00236                     const ArrayOfGridPos& pgp,
00237                     const ArrayOfGridPos& rgp,
00238                     const ArrayOfGridPos& cgp );
00239 
00240 void interp( VectorView            ia,
00241              ConstMatrixView       itw,
00242              ConstVectorView       a,    
00243              const ArrayOfGridPos& cgp);
00244 
00245 void interp( VectorView            ia,
00246              ConstMatrixView       itw,
00247              ConstMatrixView       a,    
00248              const ArrayOfGridPos& rgp,
00249              const ArrayOfGridPos& cgp);
00250 
00251 void interp( VectorView            ia,
00252              ConstMatrixView       itw,
00253              ConstTensor3View      a,    
00254              const ArrayOfGridPos& pgp,
00255              const ArrayOfGridPos& rgp,
00256              const ArrayOfGridPos& cgp);
00257 
00258 void interp( VectorView            ia,
00259              ConstMatrixView       itw,
00260              ConstTensor4View      a,    
00261              const ArrayOfGridPos& bgp,
00262              const ArrayOfGridPos& pgp,
00263              const ArrayOfGridPos& rgp,
00264              const ArrayOfGridPos& cgp);
00265 
00266 void interp( VectorView            ia,
00267              ConstMatrixView       itw,
00268              ConstTensor5View      a,    
00269              const ArrayOfGridPos& sgp,
00270              const ArrayOfGridPos& bgp,
00271              const ArrayOfGridPos& pgp,
00272              const ArrayOfGridPos& rgp,
00273              const ArrayOfGridPos& cgp);
00274 
00275 void interp( VectorView            ia,
00276              ConstMatrixView       itw,
00277              ConstTensor6View      a,    
00278              const ArrayOfGridPos& vgp,
00279              const ArrayOfGridPos& sgp,
00280              const ArrayOfGridPos& bgp,
00281              const ArrayOfGridPos& pgp,
00282              const ArrayOfGridPos& rgp,
00283              const ArrayOfGridPos& cgp);
00284 
00285 
00286 
00287 
00288 
00290 
00292 
00293 void interpweights( Tensor3View itw,
00294                     const ArrayOfGridPos& rgp,
00295                     const ArrayOfGridPos& cgp );
00296 
00297 void interpweights( Tensor4View itw,
00298                     const ArrayOfGridPos& pgp,
00299                     const ArrayOfGridPos& rgp,
00300                     const ArrayOfGridPos& cgp );
00301 
00302 void interpweights( Tensor5View itw,
00303                     const ArrayOfGridPos& bgp,
00304                     const ArrayOfGridPos& pgp,
00305                     const ArrayOfGridPos& rgp,
00306                     const ArrayOfGridPos& cgp );
00307 
00308 void interpweights( Tensor6View itw,
00309                     const ArrayOfGridPos& sgp,
00310                     const ArrayOfGridPos& bgp,
00311                     const ArrayOfGridPos& pgp,
00312                     const ArrayOfGridPos& rgp,
00313                     const ArrayOfGridPos& cgp );
00314 
00315 void interpweights( Tensor7View itw,
00316                     const ArrayOfGridPos& vgp,
00317                     const ArrayOfGridPos& sgp,
00318                     const ArrayOfGridPos& bgp,
00319                     const ArrayOfGridPos& pgp,
00320                     const ArrayOfGridPos& rgp,
00321                     const ArrayOfGridPos& cgp );
00322 
00323 void interp( MatrixView            ia,
00324              ConstTensor3View      itw,
00325              ConstMatrixView       a,   
00326              const ArrayOfGridPos& rgp,
00327              const ArrayOfGridPos& cgp);
00328 
00329 void interp( Tensor3View           ia,
00330              ConstTensor4View      itw,
00331              ConstTensor3View      a,   
00332              const ArrayOfGridPos& pgp,
00333              const ArrayOfGridPos& rgp,
00334              const ArrayOfGridPos& cgp);
00335 
00336 void interp( Tensor4View           ia,
00337              ConstTensor5View      itw,
00338              ConstTensor4View      a,   
00339              const ArrayOfGridPos& bgp,
00340              const ArrayOfGridPos& pgp,
00341              const ArrayOfGridPos& rgp,
00342              const ArrayOfGridPos& cgp);
00343 
00344 void interp( Tensor5View           ia,
00345              ConstTensor6View      itw,
00346              ConstTensor5View      a,   
00347              const ArrayOfGridPos& sgp,
00348              const ArrayOfGridPos& bgp,
00349              const ArrayOfGridPos& pgp,
00350              const ArrayOfGridPos& rgp,
00351              const ArrayOfGridPos& cgp);
00352 
00353 void interp( Tensor6View           ia,
00354              ConstTensor7View      itw,
00355              ConstTensor6View      a,   
00356              const ArrayOfGridPos& vgp,
00357              const ArrayOfGridPos& sgp,
00358              const ArrayOfGridPos& bgp,
00359              const ArrayOfGridPos& pgp,
00360              const ArrayOfGridPos& rgp,
00361              const ArrayOfGridPos& cgp);
00362 
00363 Numeric interp_poly(ConstVectorView x,
00364                      ConstVectorView y,
00365                      const Numeric& x_i, 
00366                      const GridPos& gp);
00367 
00368 void polint(Numeric& y_int,
00369             Numeric& dy_int,
00370             ConstVectorView xa,
00371             ConstVectorView ya,
00372             const Index& i,
00373             const Numeric& x);
00374 
00375 #endif // interpolation_h