00001 ////////////////////////////////////////////////////////////////////////////////////////////////// 00002 /*! \file Interpolator.h 00003 * \brief Abstract interface to the Interpolator Strategy. 00004 * \author $Author: cakinli $ 00005 * \version $Revision: 1.1.1.1 $ 00006 * \date $Date: 2005/04/26 17:41:00 $ 00007 *////////////////////////////////////////////////////////////////////////////////////////////////// 00008 /* 00009 */ 00010 ////////////////////////////////////////////////////////////////////////////////////////////////// 00011 00012 #ifndef __SSF_INTERPOLATOR_H__ 00013 #define __SSF_INTERPOLATOR_H__ 00014 #ifndef TRUE 00015 #define TRUE 1 00016 #define FALSE 0 00017 #endif 00018 00019 #include <Matrix.h> 00020 00021 namespace O_SESSAME { 00022 00023 ////////////////////////////////////////////////////////////////////////////////////////////////// 00024 /*! @defgroup InterpolationLibrary Interpolation Library 00025 * \brief Interpolation schemes. 00026 * 00027 * \detail Interpolators are used when there is a set of computed data points, but the user 00028 requires the approximated data between these data points. The interpolator creates a functional 00029 approximation of the intermediate data using any number of calculated @em mesh points. 00030 00031 \par 00032 The interpolator creates and stores the parameters corresponding to the interpolation function 00033 and functional representation. The user must enter a set of time values (independent variables) and 00034 a set of corresponding data values to be interpolated (dependent variables). Once the interpolation 00035 has been computer and has stored the functional representation, the user can Evaluate the interpolation 00036 at any point in between the valid mesh points. 00037 00038 \par Derived Classes 00039 Each derived interpolation is a specific algorithm that determines an interpolation based upon the 00040 described scheme. This may include linear, lagrangian, hermitian, or a cubic spline interpolation. 00041 The user needs to query the GetNumberDataPoints to determine how many mesh points are required to 00042 perform interpolation (the higher the order, the more number of data points). Some interpolations 00043 may also require higher order terms (first- and second-derivatives) of the dependent variables. 00044 Consult the specific class's documentation. 00045 */ 00046 00047 /*! \brief Abstract interface to the set of interpolators. 00048 * 00049 * \ingroup InterpolationLibrary 00050 * \detail 00051 */ 00052 class Interpolator 00053 { 00054 public: 00055 /*! \brief Default Deconstructor */ 00056 virtual ~Interpolator() { } 00057 00058 /*! \brief Standard Interpolation Function. 00059 * 00060 * @param _timePoints Vector of time (seconds) points of the data values. 00061 * @param _dataPoints Matrix of data points at each time step in the _timePoints vector. 00062 *\f[\begin{bmatrix} 00063 * x1(t1) & x2(t1) & x3(t1) & ... \\ 00064 * x1(t2) & x2(t2) & x3(t2)& ... \\ 00065 * x1(t3) & x2(t3) & x3(t3) & ... \\ 00066 * ... & ... & ... & ... \\ 00067 * \end{bmatrix}\f] 00068 */ 00069 virtual void Interpolate(const Vector& _timePoints, const Matrix& _dataPoints) = 0; 00070 00071 /*! \brief Evaluate interpolation curve at a specified time. 00072 * 00073 * \detail Output = m_Slope * _inputPoint + m_Offset 00074 * @param _inputPoint Input point (time) at which to evaluate the vector of interpolations. 00075 * @return Vector of output values from the evaluated interpolation. 00076 */ 00077 virtual Vector Evaluate(const double& _inputPoint) = 0; 00078 /*! \brief Returns the number of data points required for interpolation. 00079 * 00080 * \detail the number of data points is the number of X-values (time) required to interpolate. 00081 * @return the number of data points, centered about the evaluation time, req'd to interpolate. 00082 */ 00083 virtual int GetNumberDataPoints() = 0; 00084 00085 /*! \brief Return a pointer to a new instance of a derived interpolator type. 00086 * 00087 * \detail This is used to request memory for a new instance of a derived instance when the 00088 * actual type of the derived object is unknown. By calling this function, the compiler 00089 * links to the correct derived function to return a pointer and allocate memory of 00090 * the correct type. 00091 * \par Example: 00092 * \code 00093 * Interpolator* newInterp = oldInterp->NewPointer(); 00094 * \endcode 00095 * @return a pointer to a new allocation of memory for the appropriate interpolator. 00096 */ 00097 virtual Interpolator* NewPointer() = 0; 00098 00099 /*! \brief Return a pointer to a copy of a derived interpolator type. 00100 * 00101 * \detail This is used to request memory for and copy of an instance of a derived representation when the 00102 * actual type of the derived object is unknown. By calling this function, the compiler 00103 * links to the correct derived function to return a pointer and allocate memory of 00104 * the correct type and copy the data. 00105 * \par Example: 00106 \code 00107 * Interpolator* newInterp = oldInterp->Clone(); 00108 \endcode 00109 * @return a pointer to a copy of the appropriate interpolator. 00110 */ 00111 virtual Interpolator* Clone() = 0; 00112 00113 /*! \brief Returns whether the current interpolation parameters are valid. 00114 * @return TRUE if the current interpolation is valid, FALSE if it is not and should not be used to Evaluate without being reinterpolated. 00115 */ 00116 virtual bool GetValid() {return m_Valid;}; 00117 00118 protected: 00119 /*! \brief Sets the validity value of the interpolation parameters. 00120 * 00121 */ 00122 virtual void SetValid(const bool& _newValidValue) {m_Valid = _newValidValue;}; 00123 00124 /*! \brief Default constructor. Does nothing since this is an abstract class 00125 * 00126 * \detail Specifically, it sets the default value of the m_Valid flag. 00127 */ 00128 Interpolator() : m_Valid(FALSE) { }; 00129 00130 private: 00131 /*! \brief Internal storage of the interpolation's "validity" */ 00132 bool m_Valid; 00133 }; 00134 } // close namespace O_SESSAME 00135 00136 #endif 00137 00138 00139 // Do not change the comments below - they will be added automatically by CVS 00140 /***************************************************************************** 00141 * $Log: Interpolator.h,v $ 00142 * Revision 1.1.1.1 2005/04/26 17:41:00 cakinli 00143 * Adding OpenSESSAME to DSACSS distrib to capture fixed version. 00144 * 00145 * Revision 1.3 2003/06/06 00:34:47 nilspace 00146 * ? 00147 * 00148 * Revision 1.2 2003/05/15 16:05:44 nilspace 00149 * Added a TRUE and FALSE define. Move to a math header file. 00150 * 00151 * Revision 1.1 2003/05/13 18:41:23 nilspace 00152 * Initial submission. 00153 * 00154 * 00155 ******************************************************************************/