Gaudi Framework, version v20r4

Generated: 8 Jan 2009

Helpers.cpp

Go to the documentation of this file.
00001 // $Id: Helpers.cpp,v 1.1 2003/11/19 16:55:59 mato Exp $
00002 // ============================================================================
00003 // Include files
00004 // ============================================================================
00005 // CLHEP
00006 // ============================================================================
00007 #include "CLHEP/GenericFunctions/AbsFunction.hh"
00008 // ============================================================================
00009 // local
00010 // ============================================================================
00011 #include "Helpers.h"
00012 // ============================================================================
00013 
00014 namespace Genfun
00015 {
00016   namespace GaudiMathImplementation
00017   {
00018     
00019     // ========================================================================
00020     GSL_Helper::GSL_Helper
00021     ( const Genfun::AbsFunction& function , 
00022       Genfun::Argument&          argument ,
00023       const size_t               index    )
00024       : m_function ( function ) , 
00025         m_argument ( argument ) , 
00026         m_index    ( index    ) 
00027     {};
00028     // ========================================================================
00029     
00030     // ========================================================================
00031     GSL_Helper::~GSL_Helper(){};
00032     // ========================================================================
00033     
00034     // ========================================================================
00035     double GSL_Adaptor( double x , void* params )
00036     {
00037       // get parameters 
00038       GSL_Helper* aux = (GSL_Helper*) params ;
00039       // decode parameters 
00040       const Genfun::AbsFunction& function = aux -> m_function  ;
00041       const size_t               index    = aux -> m_index     ;
00042       Genfun::Argument&          argument = aux -> m_argument  ;
00043       // save the current value of argument 
00044       const double x_prev = argument[index] ;
00045       // modify the argument 
00046       argument[index]= x       ; 
00047       // evaluate the function
00048       const double fun = function( argument ) ;
00049       // restore the argument 
00050       argument[index] = x_prev  ;
00051       return fun ;
00052     };
00053     // ========================================================================
00054     
00055   }; // end of namespace GaudiMathImplementation
00056 }; // end of namespace Genfun
00057 
00058 // ============================================================================
00059 // The END 
00060 // ============================================================================
00061 

Generated at Thu Jan 8 17:44:19 2009 for Gaudi Framework, version v20r4 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004