Version: 9.12.0
StdMeshers_Distribution.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // SMESH StdMeshers : implementation of point distribution algorithm
24 // File : StdMeshers_Distribution.hxx
25 // Author : Alexandre SOLOVYOV
26 // Module : SMESH
27 // $Header$
28 //
29 #ifndef _STD_MESHERS_DISTRIBUTION_HXX_
30 #define _STD_MESHERS_DISTRIBUTION_HXX_
31 
32 #include "SMESH_StdMeshers.hxx"
33 
34 #include <vector>
35 #include <math_Function.hxx>
36 #include <ExprIntrp_GenExp.hxx>
37 #include <Expr_Array1OfNamedUnknown.hxx>
38 #include <TColStd_Array1OfReal.hxx>
39 
40 #include <smIdType.hxx>
41 
42 namespace StdMeshers
43 {
45 {
46 public:
47  Function( const int );
48  virtual ~Function();
49  virtual bool value( const double, double& ) const;
50  virtual double integral( const double, const double ) const = 0;
51 
52 private:
53  int myConv;
54 };
55 
57 {
58 public:
59  FunctionIntegral( const Function*, const double );
60  virtual ~FunctionIntegral();
61  virtual bool value( const double, double& ) const;
62  virtual double integral( const double, const double ) const;
63 
64 private:
66  double myStart;
67 };
68 
70 {
71 public:
72  FunctionTable( const std::vector<double>&, const int );
73  virtual ~FunctionTable();
74  virtual bool value( const double, double& ) const;
75  virtual double integral( const double, const double ) const;
76 
77 private:
78  bool findBounds( const double, int&, int& ) const;
79 
80  //integral from x[i] to x[i+1]
81  double integral( const int i ) const;
82 
83  //integral from x[i] to x[i]+d
84  //warning: function is presented as linear on interaval from x[i] to x[i]+d,
85  // for correct result d must be >=0 and <=x[i+1]-x[i]
86  double integral( const int i, const double d ) const;
87 
88 private:
89  std::vector<double> myData;
90 };
91 
93 {
94 public:
95  FunctionExpr( const char*, const int );
96  virtual ~FunctionExpr();
97  virtual Standard_Boolean Value( const Standard_Real, Standard_Real& );
98  virtual bool value( const double, double& ) const;
99  virtual double integral( const double, const double ) const;
100 
101 private:
102  Handle(ExprIntrp_GenExp) myExpr;
103  Expr_Array1OfNamedUnknown myVars;
104  TColStd_Array1OfReal myValues;
105 };
106 
108 bool buildDistribution( const Function& f,
109  const double start, const double end,
110  const smIdType nbSeg,
111  std::vector<double>& data,
112  const double eps );
113 
115 bool buildDistribution( const TCollection_AsciiString& f, const int conv, const double start, const double end,
116  const smIdType nbSeg, std::vector<double>& data, const double eps );
118 bool buildDistribution( const std::vector<double>& f, const int conv, const double start, const double end,
119  const smIdType nbSeg, std::vector<double>& data, const double eps );
120 }
121 #endif
#define STDMESHERS_EXPORT
Definition: SMESH_StdMeshers.hxx:38
IMAP::const_iterator end(const IMAP &m)
Definition: StdMeshers_Projection_2D.cxx:106
Definition: StdMeshers_Distribution.hxx:93
Expr_Array1OfNamedUnknown myVars
Definition: StdMeshers_Distribution.hxx:103
Handle(ExprIntrp_GenExp) myExpr
TColStd_Array1OfReal myValues
Definition: StdMeshers_Distribution.hxx:104
Definition: StdMeshers_Distribution.hxx:57
double myStart
Definition: StdMeshers_Distribution.hxx:66
Function * myFunc
Definition: StdMeshers_Distribution.hxx:65
Definition: StdMeshers_Distribution.hxx:70
std::vector< double > myData
Definition: StdMeshers_Distribution.hxx:89
Definition: StdMeshers_Distribution.hxx:45
int myConv
Definition: StdMeshers_Distribution.hxx:53
virtual double integral(const double, const double) const =0
float d
coefficient constant de l'équation du plan de coupe
Definition: MeshCut_DC.cxx:61
StdMeshers: interfaces to standard hypotheses and algorithms.
Definition: StdMeshers_Distribution.cxx:40
bool buildDistribution(const TCollection_AsciiString &f, const int conv, const double start, const double end, const smIdType nbSeg, vector< double > &data, const double eps)
Definition: StdMeshers_Distribution.cxx:291