Changeset 2283 in Sophya for trunk


Ignore:
Timestamp:
Nov 29, 2002, 3:03:45 PM (23 years ago)
Author:
plaszczy
Message:

ajout de classfunc et changements dans integ pour que ca colle

Location:
trunk/SophyaLib/NTools
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/NTools/Makefile

    r1949 r2283  
    211211 $(INC)perrors.h fmath.h \
    212212 $(INC)sopemtx.h
    213 $(OBJ)integ.o: integ.cc integ.h $(INC)machdefs.h \
     213$(OBJ)integ.o: integ.cc integ.h classfunc.h $(INC)machdefs.h \
    214214 $(INC)pexceptions.h generalfit.h \
    215215 $(INC)tvector.h \
  • trunk/SophyaLib/NTools/integ.cc

    r244 r2283  
    5454{}
    5555
     56Integrator::Integrator(fun f, double xmin, double xmax)
     57//
     58//      Constructeur à partir de la fonction double->double, et des
     59//      bornes d'intégration.
     60//--
     61: mFunc(new Function(f)), mGFF(NULL), mGFFParm(NULL),
     62  mNStep(50), mDX(-1), mReqPrec(-1),
     63  mXMin(xmin), mXMax(xmax)
     64{}
     65
     66
    5667//++
    5768Integrator::Integrator(FUNC f)
     
    6677
    6778//++
     79Integrator::Integrator(fun f)
     80//
     81//      Constructeur sans spécifier les bornes. Elles sont positionnées
     82//      à [0,1], et on pourra les modifier plus tard.
     83//--
     84: mFunc(new Function(f)), mGFF(NULL), mGFFParm(NULL),
     85  mNStep(50), mDX(-1), mReqPrec(-1),
     86  mXMin(0), mXMax(1)
     87{}
     88
     89//++
    6890Integrator::Integrator(GeneralFunction* gff, double* par, double xmin, double xmax)
    6991//
     
    95117
    96118Integrator::~Integrator()
    97 {}
     119{delete mFunc;}
    98120
    99121//++
     
    193215  DBASSERT( mFunc || (mGFF && mGFFParm) );
    194216  return mFunc ? (*mFunc)(x) : mGFF->Value(&x, mGFFParm);
    195 }
     217  }
    196218
    197219double
     
    236258: Integrator(f, xmin, xmax)
    237259{}
     260//++
     261TrpzInteg::TrpzInteg(fun f, double xmin, double xmax)
     262//
     263//--
     264: Integrator(f, xmin, xmax)
     265{}
    238266
    239267//++
    240268TrpzInteg::TrpzInteg(FUNC f)
     269//
     270//--
     271: Integrator(f)
     272{}
     273
     274TrpzInteg::TrpzInteg(fun f)
    241275//
    242276//--
     
    331365  NStep(1);
    332366}
    333 
     367GLInteg::GLInteg(fun f, double xmin, double xmax)
     368//
     369//--
     370: Integrator(f, xmin, xmax), mXPos(NULL), mWeights(NULL), mOrder(8)
     371{
     372  NStep(1);
     373}
    334374//++
    335375GLInteg::GLInteg(FUNC f)
     376//
     377//--
     378: Integrator(f), mXPos(NULL), mWeights(NULL), mOrder(8)
     379{
     380  NStep(1);
     381}
     382GLInteg::GLInteg(fun f)
    336383//
    337384//--
  • trunk/SophyaLib/NTools/integ.h

    r1371 r2283  
    1010#include "pexceptions.h"
    1111#include <set>
     12#include "classfunc.h"
    1213
    1314namespace SOPHYA {
     
    1718class Integrator {
    1819public:
    19   typedef double(*FUNC)(double);
     20  //typedef double(*FUNC)(double);
     21  typedef ClassFunc *FUNC;
     22  typedef double (*fun)(double);
    2023
    2124  Integrator();
    2225  Integrator(FUNC, double xmin, double xmax);
    2326  Integrator(FUNC);
     27
     28  Integrator(fun, double xmin, double xmax);
     29  Integrator(fun);
     30
    2431  Integrator(GeneralFunction*, double* par, double xmin, double xmax);
    2532  Integrator(GeneralFunction*, double* par);
     
    6067  TrpzInteg(FUNC, double xmin, double xmax);
    6168  TrpzInteg(FUNC);
     69  TrpzInteg(fun, double xmin, double xmax);
     70  TrpzInteg(fun);
    6271  TrpzInteg(GeneralFunction*, double* par, double xmin, double xmax);
    6372  TrpzInteg(GeneralFunction*, double* par);
     
    7382  GLInteg(FUNC, double xmin, double xmax);
    7483  GLInteg(FUNC);
     84  GLInteg(fun, double xmin, double xmax);
     85  GLInteg(fun);
    7586  GLInteg(GeneralFunction*, double* par, double xmin, double xmax);
    7687  GLInteg(GeneralFunction*, double* par);
Note: See TracChangeset for help on using the changeset viewer.