00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _STD_MESHERS_DISTRIBUTION_HXX_
00029 #define _STD_MESHERS_DISTRIBUTION_HXX_
00030
00031 #include "SMESH_StdMeshers.hxx"
00032
00033 #include <vector>
00034 #include <math_Function.hxx>
00035 #include <ExprIntrp_GenExp.hxx>
00036 #include <Expr_Array1OfNamedUnknown.hxx>
00037 #include <TColStd_Array1OfReal.hxx>
00038
00039
00040 class STDMESHERS_EXPORT Function
00041 {
00042 public:
00043 Function( const int );
00044 virtual ~Function();
00045 virtual bool value( const double, double& ) const;
00046 virtual double integral( const double, const double ) const = 0;
00047
00048 private:
00049 int myConv;
00050 };
00051
00052 class STDMESHERS_EXPORT FunctionIntegral : public Function
00053 {
00054 public:
00055 FunctionIntegral( const Function*, const double );
00056 virtual ~FunctionIntegral();
00057 virtual bool value( const double, double& ) const;
00058 virtual double integral( const double, const double ) const;
00059
00060 private:
00061 Function* myFunc;
00062 double myStart;
00063 };
00064
00065 class STDMESHERS_EXPORT FunctionTable : public Function
00066 {
00067 public:
00068 FunctionTable( const std::vector<double>&, const int );
00069 virtual ~FunctionTable();
00070 virtual bool value( const double, double& ) const;
00071 virtual double integral( const double, const double ) const;
00072
00073 private:
00074 bool findBounds( const double, int&, int& ) const;
00075
00076
00077 double integral( const int i ) const;
00078
00079
00080
00081
00082 double integral( const int i, const double d ) const;
00083
00084 private:
00085 std::vector<double> myData;
00086 };
00087
00088 class STDMESHERS_EXPORT FunctionExpr : public Function, public math_Function
00089 {
00090 public:
00091 FunctionExpr( const char*, const int );
00092 virtual ~FunctionExpr();
00093 virtual Standard_Boolean Value( const Standard_Real, Standard_Real& );
00094 virtual bool value( const double, double& ) const;
00095 virtual double integral( const double, const double ) const;
00096
00097 private:
00098 Handle(ExprIntrp_GenExp) myExpr;
00099 Expr_Array1OfNamedUnknown myVars;
00100 TColStd_Array1OfReal myValues;
00101 };
00102
00103 STDMESHERS_EXPORT
00104 bool buildDistribution( const Function& f,
00105 const double start, const double end,
00106 const int nbSeg,
00107 std::vector<double>& data,
00108 const double eps );
00109
00110 STDMESHERS_EXPORT
00111 bool buildDistribution( const TCollection_AsciiString& f, const int conv, const double start, const double end,
00112 const int nbSeg, std::vector<double>& data, const double eps );
00113 STDMESHERS_EXPORT
00114 bool buildDistribution( const std::vector<double>& f, const int conv, const double start, const double end,
00115 const int nbSeg, std::vector<double>& data, const double eps );
00116
00117 #endif