source: Sophya/trunk/Poubelle/DPC:FitsIOServer/NTools/integ.h@ 658

Last change on this file since 658 was 658, checked in by ansari, 26 years ago

no message

File size: 2.3 KB
Line 
1// This may look like C code, but it is really -*- C++ -*-
2//
3// integ.h
4//
5// $Id: integ.h,v 1.1.1.1 1999-11-26 16:37:10 ansari Exp $
6//
7
8#ifndef INTEG_H_SEEN
9#define INTEG_H_SEEN
10
11#include "machdefs.h"
12#include "pexceptions.h"
13#include <set>
14
15namespace SOPHYA {
16
17class GeneralFunction;
18
19class Integrator EXC_AWARE {
20public:
21 typedef double(*FUNC)(double);
22
23 Integrator();
24 Integrator(FUNC, double xmin, double xmax);
25 Integrator(FUNC);
26 Integrator(GeneralFunction*, double* par, double xmin, double xmax);
27 Integrator(GeneralFunction*, double* par);
28 virtual ~Integrator();
29
30 virtual double Value() = 0;
31 virtual double ValueBetween(double xmin, double xmax);
32 virtual operator double() {return Value();}
33
34 virtual Integrator& NStep(int);
35 virtual Integrator& DX(double);
36 virtual Integrator& ReqPrec(double); // NOT YET !
37 virtual Integrator& Limits(double xmin, double xmax);
38 virtual Integrator& Func(FUNC);
39 virtual Integrator& Func(GeneralFunction*, double* par);
40
41protected:
42 FUNC mFunc;
43 GeneralFunction* mGFF;
44 double* mGFFParm;
45
46 int mNStep; // -1 si pas fixe
47 double mDX;
48 double mReqPrec;
49 double mXMin, mXMax;
50
51 double FVal(double x) const;
52 virtual void LimitsChanged() {}
53 virtual void StepsChanged() {}
54 virtual void FuncChanged() {}
55};
56
57
58
59class TrpzInteg : public Integrator {
60public:
61 TrpzInteg();
62 TrpzInteg(FUNC, double xmin, double xmax);
63 TrpzInteg(FUNC);
64 TrpzInteg(GeneralFunction*, double* par, double xmin, double xmax);
65 TrpzInteg(GeneralFunction*, double* par);
66
67 ~TrpzInteg();
68
69 virtual double Value();
70};
71
72class GLInteg : public Integrator {
73public:
74 GLInteg();
75 GLInteg(FUNC, double xmin, double xmax);
76 GLInteg(FUNC);
77 GLInteg(GeneralFunction*, double* par, double xmin, double xmax);
78 GLInteg(GeneralFunction*, double* par);
79
80 ~GLInteg();
81
82 virtual double Value();
83 virtual GLInteg& AddBound(double x);
84 virtual GLInteg& SetOrder(int order);
85protected:
86
87 double* mXPos; // integration entre 0 et 1
88 double* mWeights; // integration entre 0 et 1
89 int mOrder; // ordre GL
90 set<double> mBounds; // limites des intervalles d'integration
91
92 void ComputeWeights();
93 void LimitsChanged();
94 void StepsChanged();
95 void InvalWeights();
96 void ComputeBounds();
97};
98
99} // Fin du namespace
100
101#endif
Note: See TracBrowser for help on using the repository browser.