Version: 9.16.0
StdMeshers_NumberOfSegments.hxx
Go to the documentation of this file.
1// Copyright (C) 2007-2026 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{
48public:
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
71 {
76 DT_BetaLaw
77 };
78
82 void SetDistrType(DistrType typ);
83
87 DistrType GetDistrType() const;
88
92 bool IsValidDistrType(int distrType) const;
93
101 virtual void SetScaleFactor(double scaleFactor);
102
108 double GetScaleFactor() const;
109
116 virtual void SetBeta(double scaleFactor);
117
123 double GetBeta() const;
124
134 void SetTableFunction(const std::vector<double>& table);
135
141 const std::vector<double>& GetTableFunction() const;
142
150 void SetExpressionFunction( const char* expr);
151
157 const char* GetExpressionFunction() const;
158
164 static std::string CheckExpressionFunction( const std::string& expr,
165 const int convMode);
166
176 void SetConversionMode( int conv );
177
183 int ConversionMode() const;
184
191 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
192
197 virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
198
199 virtual std::ostream & SaveTo(std::ostream & save);
200 virtual std::istream & LoadFrom(std::istream & load);
201 friend std::ostream& operator << (std::ostream & save, StdMeshers_NumberOfSegments & hyp);
202 friend std::istream& operator >> (std::istream & load, StdMeshers_NumberOfSegments & hyp);
203
204protected:
208 double _beta;
209 std::vector<double> _table, _distr;
210 std::string _func;
212};
213
214#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
int _convMode
flag of conversion mode: 0=exponent, 1=cut negative
Definition: StdMeshers_NumberOfSegments.hxx:211
const std::vector< double > & BuildDistributionTab(const std::vector< double > &, int, int)
virtual void SetBeta(double scaleFactor)
Set beta coefficient for Beta Law distribution.
smIdType _numberOfSegments
an edge will be split on to this number of segments
Definition: StdMeshers_NumberOfSegments.hxx:205
void SetTableFunction(const std::vector< double > &table)
Set table function for distribution DT_TabFunc.
double _beta
beta coefficient for DT_BetaLaw
Definition: StdMeshers_NumberOfSegments.hxx:208
double _scaleFactor
the scale parameter for DT_Scale
Definition: StdMeshers_NumberOfSegments.hxx:207
std::vector< double > _distr
the table for DT_TabFunc, a sequence of pairs of numbers
Definition: StdMeshers_NumberOfSegments.hxx:209
DistrType
This enumeration presents available types of distribution.
Definition: StdMeshers_NumberOfSegments.hxx:71
@ DT_ExprFunc
distribution with density function presented by expression
Definition: StdMeshers_NumberOfSegments.hxx:75
@ 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:206
const std::vector< double > & BuildDistributionExpr(const char *, int, int)
std::string _func
the expression of the function for DT_ExprFunc
Definition: StdMeshers_NumberOfSegments.hxx:210
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