vtf-logo

hermite.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00008 #if !defined(__numerical_interpolation_hermite_h__)
00009 #define __numerical_interpolation_hermite_h__
00010 
00011 #include "../polynomial/evaluate.h"
00012 
00013 #include "../../ads/array/Array.h"
00014 
00015 #include <functional>
00016 
00017 BEGIN_NAMESPACE_NUMERICAL
00018 
00023 
00024 
00064 template<typename T>
00065 T
00066 hermiteInterpolate(T t, T value0, T value1, T derivative0, T derivative1);
00067 
00068 
00070 
00083 template<typename T>
00084 void
00085 computeHermitePolynomialCoefficients(T value0, T value1, 
00086                                      T derivative0, T derivative1,
00087                                      T* coefficients);
00088 
00089 
00090 //----------------------------------------------------------------------------
00091 
00092 
00094 
00099 template<typename T = double>
00100 class Hermite : 
00101   public std::unary_function<T,T> {
00102 private:
00103 
00104   typedef std::unary_function<T,T> Base;
00105 
00106 public:
00107 
00109   typedef T Number;
00111   typedef typename Base::argument_type argument_type;
00113   typedef typename Base::result_type result_type;
00114 
00115 private:
00116   
00117   // The lower bound of the range.
00118   Number _lowerBound;
00119   // Factor that will scale the argument to the index.
00120   Number _scaleToIndex;
00121   // Polynomial coefficients.
00122   ads::Array<1,Number> _coefficients;
00123 
00124   //
00125   // Not implemented.
00126   //
00127 
00128   // Default constructor not implemented.
00129   Hermite();
00130 
00131 public:
00132 
00134   template<typename Function, typename Derivative>
00135   Hermite(const Function& function, const Derivative& derivative,
00136           Number closedLowerBound, Number openUpperBound, int numberOfPatches);
00137 
00139 
00142   Hermite(const Hermite& other);
00143 
00145 
00148   Hermite&
00149   operator=(const Hermite& other);
00150 
00152   ~Hermite()
00153   {}
00154 
00156   result_type
00157   operator()(argument_type x) const;
00158 };
00159 
00160 
00161 //----------------------------------------------------------------------------
00162 
00163 
00165 
00169 template<typename T = double>
00170 class HermiteFunctionDerivative : 
00171   public std::unary_function<T,T> {
00172 private:
00173 
00174   typedef std::unary_function<T,T> Base;
00175 
00176 public:
00177 
00179   typedef T Number;
00181   typedef typename Base::argument_type argument_type;
00183   typedef typename Base::result_type result_type;
00184 
00185 private:
00186   
00187   // The lower bound of the range.
00188   Number _lowerBound;
00189   // Factor that will scale the argument to the index.
00190   Number _scaleToIndex;
00191   // The function and derivative values.
00192   ads::Array<1,Number> _functionAndDerivativeValues;
00193 
00194   //
00195   // Not implemented.
00196   //
00197 
00198   // Default constructor not implemented.
00199   HermiteFunctionDerivative();
00200   // Copy constructor not implemented.
00201   HermiteFunctionDerivative(const HermiteFunctionDerivative& other);
00202   // Assignment operator not implemented.
00203   HermiteFunctionDerivative&
00204   operator=(const HermiteFunctionDerivative& other);
00205 
00206 public:
00207 
00209   template<typename Function, typename Derivative>
00210   HermiteFunctionDerivative(const Function& function, const Derivative& derivative,
00211           Number closedLowerBound, Number openUpperBound, int numberOfPatches);
00212 
00214   ~HermiteFunctionDerivative()
00215   {}
00216 
00218   result_type
00219   operator()(argument_type x) const;
00220 };
00221 
00222 
00223 END_NAMESPACE_NUMERICAL
00224 
00225 #define __numerical_interpolation_hermite_ipp__
00226 #include "hermite.ipp"
00227 #undef __numerical_interpolation_hermite_ipp__
00228 
00229 #endif

Generated on Fri Aug 24 12:56:05 2007 for Numerical Algorithms Package by  doxygen 1.4.7