NearestNeighborIpol.hpp

00001 
00002 //
00003 // $Id: NearestNeighborIpol.hpp,v 1.1 2006/07/07 14:10:53 werner Exp $
00004 //
00005 // $Log: NearestNeighborIpol.hpp,v $
00006 // Revision 1.1  2006/07/07 14:10:53  werner
00007 // Intermediate state: multidimensional interpolation with on-demand
00008 // fractional loading appears to work, but still problem with vectorfield
00009 // interpolation.
00010 //
00011 // Revision 1.4  2004/08/12 16:08:45  werner
00012 // Various improvements for implementing the tangential space
00013 //
00014 // Revision 1.3  2004/07/09 20:15:26  werner
00015 // Added local alignment capability when interpolating vector fields and
00016 // option to compute the interpolated derivative.
00017 //
00018 // Revision 1.2  2004/07/04 17:24:03  werner
00019 // Recursive multidimensional Interpolation interface implemented.
00020 //
00021 // Revision 1.1  2004/06/15 22:45:31  werner
00022 // Enhanced the fixed array member functions.
00023 // Using better name for interpolation template parameters.
00024 //
00025 // Revision 1.1  2004/06/14 22:42:00  werner
00026 // Moved interpolation files from light++ to VecAl and Multindex from Fiber to VecAl.
00027 //
00029 #ifndef __IPOL_CONSTANT_HPP
00030 #define __IPOL_CONSTANT_HPP "Created 11.06.2004 22:28:21 by bzfbenge"
00031 
00032 #include "Index.hpp"
00033 #include <assert.h>
00034 
00035 namespace Fiber
00036 {
00037 
00044 template <class T>
00045 class   NearestNeighborIpol
00046 {
00047 
00048 public:
00049 
00050         template <class Storage1D, class Limiter>
00051 static  T interpolate(const Storage1D&Data, double t, index_t size, const Limiter&L)
00052         {
00053                 // TODO: Check for Samplings.size() < 2 !
00054                 assert(size > 2);
00055 
00056                 if (t<0     ) return Data[0];
00057                 if (t>=size ) return Data[size-1];
00058 
00059         index_t i = index_t(t+0.5);
00060 
00061                 return Data[i];
00062         }
00063 
00064         template <class Storage1D>
00065 static  T derivative(const Storage1D&Data, double t, index_t size)
00066         {
00067                 return 0;
00068         }
00069 };
00070 
00071 } /* namespace VecAl */ 
00072 
00073 #endif /* __IPOL_CONSTANT_HPP */