Main Page   Namespace List   Class Hierarchy   Compound List   File List   Header Files   Sources   Namespace Members   Compound Members   File Members  

func.h

00001 //$Header: /home/ben/Mapper/include/RCS/func.h,v 6.4 2002/06/10 22:16:17 ben Exp $
00002 #ifndef FUNC_H
00003 #define FUNC_H
00004 // Copyright Benedict Adamson 2002.
00005 // This file is part of Mapper.
00006 
00007 // Mapper is free software; you can redistribute it and/or modify
00008 // it under the terms of the GNU General Public License as published by
00009 // the Free Software Foundation; either version 2 of the License, or
00010 // (at your option) any later version.
00011 
00012 // Mapper is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 
00017 // You should have received a copy of the GNU General Public License
00018 // along with Mapper; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 
00031 #include <vector>
00032 
00033 
00034 
00040 namespace func {
00041 
00042 
00043 
00047    class single_dimension
00048    {
00049       public: //attributes
00050 
00058          virtual double operator() ( const double x ) const = 0;
00059 
00060    };
00061 
00062 
00063 
00074    template< class T >
00075    class single_dimension_implicit
00076    {
00077       public: //constructors, destructor
00078 
00093          inline single_dimension_implicit(
00094             const T &fx,
00095             const double tol
00096             );
00097 
00098          inline virtual ~single_dimension_implicit(void);
00099 
00100       public: //attributes
00101 
00106          T default_guess;
00107 
00112      double default_tol;
00113 
00129          virtual T evaluate(
00130             const double x,
00131             T fx1,
00132             T fx2,
00133             const double tol
00134             ) const = 0;
00135 
00145          virtual T evaluate(
00146             const double x,
00147             const double tol
00148             ) const = 0;
00149 
00150    };
00151 
00152    template< class T >
00153    inline single_dimension_implicit< T >::single_dimension_implicit(
00154       const T &fx,
00155       const double tol
00156       )
00157       :
00158       default_guess( fx ),
00159       default_tol( tol )
00160       {
00161       }
00162 
00163    template< class T >
00164    inline single_dimension_implicit< T >::~single_dimension_implicit(void)
00165       {
00166          //Do nothing
00167       }
00168 
00172    class multi_dimensional
00173    {
00174       public: //attributes
00175          
00183          virtual double operator() (
00184             const vector<double> &x
00185             ) const = 0;
00186 
00187    };
00188 
00189 
00190 
00196    class multi_dimensional_with_derivatives
00197      :
00198      public multi_dimensional
00199    {
00200       public: //attributes
00201          
00209          virtual double operator() (
00210             const vector<double> &x
00211             ) const = 0;
00212 
00220          virtual void evaluate(
00221             const vector<double> &x,
00222             double &f, //output
00223             vector<double> &gradient //output
00224             ) const = 0;
00225 
00226    };
00227 
00228 
00229 
00239    class projection
00240       :public single_dimension
00241    {
00242       public: //constructors & destructors
00243          
00257          projection(
00258             const vector<double> &ix0,
00259             const vector<double> &idxdt,
00260             const multi_dimensional *f = 0
00261             );
00262 
00263          virtual ~projection(void);
00264 
00265       public: //attributes
00266 
00287          virtual double operator() ( const double x ) const;
00288 
00292          vector<double> x0;
00293 
00297          vector<double> dxdt;
00298 
00310          vector< double > line(
00311             const double t
00312             ) const;
00313 
00314       public: //associations
00315 
00319          const multi_dimensional *multi_dimensional_function;
00320 
00321    };
00322 
00323 
00324 
00325 };
00326 #endif

Generated at Sun Jul 14 20:38:08 2002 for Mapper by doxygen 1.0.0 written by Dimitri van Heesch, © 1997-1999