| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

# Genfun::GaudiMathImplementation::SplineBase Class Reference

`#include <Splines.h>`

List of all members.

## Public Types
typedef std::vector< double > | Data1D
typedef std::vector< std::pair < double, double > > | Data2D
## Public Member Functions
| SplineBase (const Data1D &x, const Data1D &y, const GaudiMath::Interpolation::Type type)
| constructor from vectors and type
| SplineBase (const Data2D &data, const GaudiMath::Interpolation::Type type)
| constructor from vector of (x,y(x)) pairs
template<class DATAX , class DATAY >
| SplineBase (const GaudiMath::Interpolation::Type type, DATAX begin_x, DATAX end_x, DATAY begin_y)
| templated constructor in the spirit of STL-algorithms
template<class DATA >
| SplineBase (const GaudiMath::Interpolation::Type type, DATA begin, DATA end)
| templated constructor from the sequence of (x,y(x)) pairs as sequence of pairs the class TabulatedProperty can be used
| SplineBase (const SplineBase &)
| copy constructor
virtual | ~SplineBase ()
| destructor
double | eval (const double x) const
| evaluate the function
double | deriv (const double x) const
| evaluate the first derivative
double | deriv2 (const double x) const
| evaluate the second derivative
double | integ (const double a, const double b) const
| evaluate the integral on [a,b]
## Protected Member Functions
void | initialize () const
## Private Member Functions
| SplineBase ()
SplineBase & | operator= (const SplineBase &)
## Private Attributes
bool | m_init
size_t | m_dim
double * | m_x
double * | m_y
gsl_spline * | m_spline
gsl_interp_accel * | m_accel
GaudiMath::Interpolation::Type | m_type

## Detailed Description

Definition at line 36 of file Splines.h.

## Member Typedef Documentation

typedef std::vector<double> Genfun::GaudiMathImplementation::SplineBase::Data1D

Definition at line 39 of file Splines.h.

typedef std::vector<std::pair<double,double> > Genfun::GaudiMathImplementation::SplineBase::Data2D

Definition at line 40 of file Splines.h.

## Constructor & Destructor Documentation

Genfun::GaudiMathImplementation::SplineBase::SplineBase | ( | const Data1D & | x,
|  | const Data1D & | y,
|  | const GaudiMath::Interpolation::Type | type
| ) |  |

constructor from vectors and type

Parameters:

  x | vector of x
  y | vector of y(x)
  type | interpolation type

Definition at line 34 of file Splines.cpp.

          : m_init      ( false    )
          , m_dim       ( x.size() )
          , m_x         ( new double[ x.size() ] )
          , m_y         ( new double[ y.size() ] )
          , m_spline    ( 0 )
          , m_accel     ( 0 )
          , m_type      ( type )
        {
    #ifdef WIN32
    // Disable the warning
    //    C4996: 'std::copy': Function call with parameters that may be unsafe
    // The parameters are checked
    #pragma warning(push)
    #pragma warning(disable:4996)
    #endif
          std::copy( x.begin() , x.end() , m_x ) ;
          std::copy( y.begin() , y.end() , m_y ) ;
    #ifdef WIN32
    #pragma warning(pop)
    #endif

        }

Genfun::GaudiMathImplementation::SplineBase::SplineBase | ( | const Data2D & | data,
|  | const GaudiMath::Interpolation::Type | type
| ) |  |

constructor from vector of (x,y(x)) pairs

Parameters:

  data | vector of (x,y(x)) pairs
  type | interpolaiton type

Definition at line 68 of file Splines.cpp.

          : m_init      ( false       )
          , m_dim       ( data.size() )
          , m_x         ( new double[ data.size() ] )
          , m_y         ( new double[ data.size() ] )
          , m_spline    ( 0    )
          , m_accel     ( 0    )
          , m_type      ( type )
        {
          double*  _x = m_x ;
          double*  _y = m_y ;
          for( Data2D::const_iterator it =
                 data.begin() ; data.end() != it ; ++it )
          {
            *_x = it -> first  ; ++_x ;
            *_y = it -> second ; ++_y ;
          }
        }

template<class DATAX , class DATAY >

Genfun::GaudiMathImplementation::SplineBase::SplineBase | ( | const GaudiMath::Interpolation::Type | type,
|  | DATAX | begin_x,
|  | DATAX | end_x,
|  | DATAY | begin_y
| ) |  | `[inline]`

templated constructor in the spirit of STL-algorithms

Parameters:

  type | interpolation type
  begin_x | begin of X-sequence
  end_x | end of X-sequence
  begin_Y | begin of Y-sequence

Definition at line 66 of file Splines.h.

            : m_init      ( false           )
            , m_dim       ( end_x - begin_x )
            , m_x         ( new double[ end_x - begin_x ] )
            , m_y         ( new double[ end_x - begin_x ] )
            , m_spline    ( 0    )
            , m_accel     ( 0    )
            , m_type      ( type )
          {
            std::copy ( begin_x , end_x                         , m_x ) ;
            std::copy ( begin_y , begin_y + ( end_x - begin_x ) , m_y ) ;
          }

template<class DATA >

Genfun::GaudiMathImplementation::SplineBase::SplineBase | ( | const GaudiMath::Interpolation::Type | type,
|  | DATA | begin,
|  | DATA | end
| ) |  | `[inline]`

templated constructor from the sequence of (x,y(x)) pairs as sequence of pairs the class TabulatedProperty can be used

Parameters:

  type | interpolation type
  begin | begin of sequence of (x,y(x)) pairs
  end | end of sequence of (x,y(x)) pairs

Definition at line 90 of file Splines.h.

            : m_init      ( false        )
            , m_dim       ( end - begin  )
            , m_x         ( new double[ end - begin ] )
            , m_y         ( new double[ end - begin ] )
            , m_spline    ( 0    )
            , m_accel     ( 0    )
            , m_type      ( type )
          {
            double* _x = m_x ;
            double* _y = m_y ;
            for ( DATA it = begin ; end != it ; ++ it )
            {
              *_x = it -> first  ; ++_x ;
              *_y = it -> second ; ++_y ;
            };
          }

Genfun::GaudiMathImplementation::SplineBase::SplineBase | ( | const SplineBase & | right ) |

copy constructor

Definition at line 92 of file Splines.cpp.

          : m_init      ( false       )
          , m_dim       ( right.m_dim )
          , m_x         ( new double[ right.m_dim ] )
          , m_y         ( new double[ right.m_dim ] )
          , m_spline    ( 0            )
          , m_accel     ( 0            )
          , m_type      ( right.m_type )
        {
          std::memcpy(m_x, right.m_x, m_dim);
          std::memcpy(m_y, right.m_y, m_dim);
        }

Genfun::GaudiMathImplementation::SplineBase::~SplineBase | ( | ) | `[virtual]`

destructor

Definition at line 109 of file Splines.cpp.

        {
          if ( 0 != m_spline ) { gsl_spline_free       ( m_spline ) ; }
          if ( 0 != m_accel  ) { gsl_interp_accel_free ( m_accel  ) ; }

          if ( 0 != m_x      ) { delete[] m_x      ; }
          if ( 0 != m_y      ) { delete[] m_y      ; }
        }

Genfun::GaudiMathImplementation::SplineBase::SplineBase | ( | ) | `[private]`

## Member Function Documentation

double Genfun::GaudiMathImplementation::SplineBase::deriv | ( | const double | x ) | const

evaluate the first derivative

Definition at line 164 of file Splines.cpp.

        {
          if ( !m_init ) { initialize() ; }
          return gsl_spline_eval_deriv  ( m_spline , x , m_accel );
        }

double Genfun::GaudiMathImplementation::SplineBase::deriv2 | ( | const double | x ) | const

evaluate the second derivative

Definition at line 172 of file Splines.cpp.

        {
          if ( !m_init ) { initialize() ; }
          return gsl_spline_eval_deriv2 ( m_spline , x , m_accel );
        }

double Genfun::GaudiMathImplementation::SplineBase::eval | ( | const double | x ) | const

evaluate the function

Definition at line 156 of file Splines.cpp.

        {
          if ( !m_init ) { initialize() ; }
          return gsl_spline_eval ( m_spline , x , m_accel );
        }

void Genfun::GaudiMathImplementation::SplineBase::initialize | ( | ) | const`[protected]`

Definition at line 120 of file Splines.cpp.

        {
          if ( m_init ) { return ; }                                 // RETURN

          const gsl_interp_type* T = 0 ;

          switch ( m_type )
          {
          case GaudiMath::Interpolation::Linear           :
            T = gsl_interp_linear            ; break ;
          case GaudiMath::Interpolation::Polynomial       :
            T = gsl_interp_polynomial        ; break ;
          case GaudiMath::Interpolation::Cspline          :
            T = gsl_interp_cspline           ; break ;
          case GaudiMath::Interpolation::Cspline_Periodic :
            T = gsl_interp_cspline_periodic  ; break ;
          case GaudiMath::Interpolation::Akima            :
            T = gsl_interp_akima             ; break ;
          case GaudiMath::Interpolation::Akima_Periodic   :
            T = gsl_interp_akima_periodic    ; break ;
          default :
            T = gsl_interp_cspline           ; break ;
          };

          m_spline = gsl_spline_alloc( T , m_dim ) ;

          gsl_spline_init( m_spline , m_x , m_y , m_dim ) ;

          m_accel  = gsl_interp_accel_alloc() ;

          m_init   = true ;

        }

double Genfun::GaudiMathImplementation::SplineBase::integ | ( | const double | a,
|  | const double | b
| ) |  | const

evaluate the integral on [a,b]

Definition at line 180 of file Splines.cpp.

        {
          if ( !m_init ) { initialize() ; }
          return gsl_spline_eval_integ ( m_spline , a , b , m_accel ) ;
        }

SplineBase& Genfun::GaudiMathImplementation::SplineBase::operator= | ( | const SplineBase & | ) | `[private]`

## Member Data Documentation

gsl_interp_accel* Genfun::GaudiMathImplementation::SplineBase::m_accel`[mutable, private]`

Definition at line 136 of file Splines.h.

size_t Genfun::GaudiMathImplementation::SplineBase::m_dim`[private]`

Definition at line 132 of file Splines.h.

bool Genfun::GaudiMathImplementation::SplineBase::m_init`[mutable, private]`

Definition at line 131 of file Splines.h.

gsl_spline* Genfun::GaudiMathImplementation::SplineBase::m_spline`[mutable, private]`

Definition at line 135 of file Splines.h.

GaudiMath::Interpolation::Type Genfun::GaudiMathImplementation::SplineBase::m_type`[private]`

Definition at line 137 of file Splines.h.

double* Genfun::GaudiMathImplementation::SplineBase::m_x`[private]`

Definition at line 133 of file Splines.h.

double* Genfun::GaudiMathImplementation::SplineBase::m_y`[private]`

Definition at line 134 of file Splines.h.

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r0/GaudiGSL/GaudiMath/Splines.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r0/GaudiGSL/src/Lib/Splines.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines