Version: 9.12.0
StdMeshers_NumberOfSegments.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 SMESH : implementation of SMESH idl descriptions
24 // File : StdMeshers_NumberOfSegments.hxx
25 // Moved here from SMESH_NumberOfSegments.hxx
26 // Author : Paul RASCLE, EDF
27 // Module : SMESH
28 //
29 #ifndef _SMESH_NUMBEROFSEGMENTS_HXX_
30 #define _SMESH_NUMBEROFSEGMENTS_HXX_
31 
33 #include "SMESH_Hypothesis.hxx"
34 #include "Utils_SALOME_Exception.hxx"
35 
36 #include <smIdType.hxx>
37 
38 #include <vector>
39 
47 {
48 public:
49  StdMeshers_NumberOfSegments(int hypId, SMESH_Gen* gen);
50  virtual ~StdMeshers_NumberOfSegments();
51 
52  // Builds point distribution according to passed function
53  const std::vector<double>& BuildDistributionExpr( const char*, int, int );
54  const std::vector<double>& BuildDistributionTab( const std::vector<double>&, int, int );
55 
60  void SetNumberOfSegments(smIdType segmentsNumber);
61 
65  smIdType GetNumberOfSegments() const;
66 
70  enum DistrType
71  {
75  DT_ExprFunc
76  };
77 
81  void SetDistrType(DistrType typ);
82 
86  DistrType GetDistrType() const;
87 
95  virtual void SetScaleFactor(double scaleFactor);
96 
102  double GetScaleFactor() const;
103 
113  void SetTableFunction(const std::vector<double>& table);
114 
120  const std::vector<double>& GetTableFunction() const;
121 
129  void SetExpressionFunction( const char* expr);
130 
136  const char* GetExpressionFunction() const;
137 
143  static std::string CheckExpressionFunction( const std::string& expr,
144  const int convMode);
145 
155  void SetConversionMode( int conv );
156 
162  int ConversionMode() const;
163 
170  virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
171 
176  virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
177 
178  virtual std::ostream & SaveTo(std::ostream & save);
179  virtual std::istream & LoadFrom(std::istream & load);
180  friend std::ostream& operator << (std::ostream & save, StdMeshers_NumberOfSegments & hyp);
181  friend std::istream& operator >> (std::istream & load, StdMeshers_NumberOfSegments & hyp);
182 
183 protected:
184  smIdType _numberOfSegments;
186  double _scaleFactor;
187  std::vector<double> _table, _distr;
188  std::string _func;
189  int _convMode;
190 };
191 
192 #endif
ostream & operator<<(ostream &OS, const SMDS_MeshElement *e)
Definition: SMDS_MeshElement.cxx:212
#define STDMESHERS_EXPORT
Definition: SMESH_StdMeshers.hxx:38
istream & operator>>(istream &load, StdMeshers_AutomaticLength &hyp)
Definition: StdMeshers_AutomaticLength.cxx:326
Definition: SMESH_Gen.hxx:68
virtual bool SetParametersByDefaults(const TDefaults &dflts, const SMESH_Mesh *theMesh=0)=0
Initialize my parameter values by default parameters.
virtual bool SetParametersByMesh(const SMESH_Mesh *theMesh, const TopoDS_Shape &theShape)=0
Initialize my parameter values by the mesh built on the geometry.
Definition: SMESH_Mesh.hxx:80
This class represents hypothesis for 1d algorithm.
Definition: StdMeshers_NumberOfSegments.hxx:47
const std::vector< double > & BuildDistributionTab(const std::vector< double > &, int, int)
int _convMode
flag of conversion mode: 0=exponent, 1=cut negative
Definition: StdMeshers_NumberOfSegments.hxx:189
smIdType _numberOfSegments
an edge will be split on to this number of segments
Definition: StdMeshers_NumberOfSegments.hxx:184
const std::vector< double > & BuildDistributionExpr(const char *, int, int)
void SetTableFunction(const std::vector< double > &table)
Set table function for distribution DT_TabFunc.
double _scaleFactor
the scale parameter for DT_Scale
Definition: StdMeshers_NumberOfSegments.hxx:186
std::vector< double > _distr
the table for DT_TabFunc, a sequence of pairs of numbers
Definition: StdMeshers_NumberOfSegments.hxx:187
DistrType
This enumeration presents available types of distribution.
Definition: StdMeshers_NumberOfSegments.hxx:71
@ DT_TabFunc
distribution with density function presented by table
Definition: StdMeshers_NumberOfSegments.hxx:74
@ DT_Scale
scale distribution
Definition: StdMeshers_NumberOfSegments.hxx:73
@ DT_Regular
equidistant distribution
Definition: StdMeshers_NumberOfSegments.hxx:72
DistrType _distrType
the type of distribution of density function
Definition: StdMeshers_NumberOfSegments.hxx:185
std::string _func
the expression of the function for DT_ExprFunc
Definition: StdMeshers_NumberOfSegments.hxx:188
A base of reversible 1D hypotheses.
Definition: StdMeshers_Reversible1D.hxx:39
virtual std::istream & LoadFrom(std::istream &load)
Definition: StdMeshers_Reversible1D.cxx:83
virtual std::ostream & SaveTo(std::ostream &save)
Definition: StdMeshers_Reversible1D.cxx:63
Definition: SMESH_Hypothesis.hxx:100