NaturalCubicSplineInterpolator.cpp

Go to the documentation of this file.
00001 
00002 
00008 /*
00009 */
00011 
00012 #include "NaturalCubicSplineInterpolator.h"
00013 
00014 namespace O_SESSAME {
00015 NaturalCubicSplineInterpolator::NaturalCubicSplineInterpolator() : m_NumDataPoints(2), m_NumElements(0), m_Acoeff(m_NumElements), m_Bcoeff(m_NumElements), m_Ccoeff(m_NumElements), m_Dcoeff(m_NumElements), m_tempOutput(m_NumElements)
00016 {
00017 
00018 }
00019 
00020 NaturalCubicSplineInterpolator::NaturalCubicSplineInterpolator(const Vector& _timePoints, const Matrix& _dataPoints) : m_NumDataPoints(2), m_NumElements(_dataPoints[MatrixRowsIndex].getIndexBound()), m_Acoeff(m_NumElements), m_Bcoeff(m_NumElements), m_Ccoeff(m_NumElements), m_Dcoeff(m_NumElements), m_tempOutput(m_NumElements)
00021 {
00022     Interpolate(_timePoints, _dataPoints);
00023 }
00024 
00025 NaturalCubicSplineInterpolator::~NaturalCubicSplineInterpolator()
00026 {
00027 }
00028 
00029 void NaturalCubicSplineInterpolator::Interpolate(const Vector& _timePoints, const Matrix& _dataPoints)
00030 {
00031     m_NumElements = _dataPoints[MatrixColsIndex].getIndexBound();
00032     if(m_Acoeff.getIndexBound() < m_NumElements)
00033         m_Acoeff.initialize(m_NumElements);
00034     if(m_Bcoeff.getIndexBound() < m_NumElements)
00035         m_Bcoeff.initialize(m_NumElements);
00036     if(m_Ccoeff.getIndexBound() < m_NumElements)
00037         m_Ccoeff.initialize(m_NumElements);
00038     if(m_Dcoeff.getIndexBound() < m_NumElements)
00039         m_Dcoeff.initialize(m_NumElements);    
00040             
00041     for(int ii = MatrixIndexBase; ii <= m_NumElements; ++ii)
00042     {
00043         BuildNaturalCubicSplineInterpolation(_timePoints(VectorIndexBase), _dataPoints(VectorIndexBase,ii), 
00044                         _timePoints(VectorIndexBase+1), _dataPoints(VectorIndexBase+1,ii), 
00045                         m_Slope(ii), m_Offset(ii));
00046     }
00047     SetValid(TRUE);
00048 }
00049 
00050 Vector NaturalCubicSplineInterpolator::Evaluate(const double& _timeEvalPoint)
00051 {
00052     if(m_tempOutput.getIndexBound() < m_NumElements)
00053         m_tempOutput.initialize(m_NumElements);
00054         
00055     for(int ii = VectorIndexBase; ii <= m_NumElements; ++ii)
00056     {
00057         //m_tempOutput(ii) = ;
00058     }
00059     return m_tempOutput;
00060 }
00061 
00062 void NaturalCubicSplineInterpolator::BuildNaturalCubicSplineInterpolation(const double& _x1, const double& _y1, const double& _x2, const double& _y2, double& _Slope, double& _Offset)
00063 {
00064 
00065 }
00066 
00067 NaturalCubicSplineInterpolator* NaturalCubicSplineInterpolator::NewPointer()
00068 {
00069     return new NaturalCubicSplineInterpolator();
00070 }
00071 
00072 NaturalCubicSplineInterpolator* NaturalCubicSplineInterpolator::Clone()
00073 {
00074     return new NaturalCubicSplineInterpolator(*this);
00075 }
00076 
00077 } // close namespace O_SESSAME
00078 
00079 
00080 // Do not change the comments below - they will be added automatically by CVS
00081 /*****************************************************************************
00082 *       $Log: NaturalCubicSplineInterpolator.cpp,v $
00083 *
00084 ******************************************************************************/

Generated on Wed Aug 6 12:58:49 2003 for Open-Sessame Framework by doxygen1.3