Salome HOME
Merge remote branch 'origin/gdd/translations'
[modules/smesh.git] / src / StdMeshers / StdMeshers_Regular_1D.hxx
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D, 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 : implementaion of SMESH idl descriptions
24 //  File   : StdMeshers_Regular_1D.hxx
25 //           Moved here from SMESH_Regular_1D.hxx
26 //  Author : Paul RASCLE, EDF
27 //  Module : SMESH
28 //
29 #ifndef _SMESH_REGULAR_1D_HXX_
30 #define _SMESH_REGULAR_1D_HXX_
31
32 #include "SMESH_StdMeshers.hxx"
33
34 #include "SMESH_Algo.hxx"
35
36 class Adaptor3d_Curve;
37 class StdMeshers_Adaptive1D;
38 class StdMeshers_FixedPoints1D;
39 class StdMeshers_SegmentLengthAroundVertex;
40 class TopoDS_Vertex;
41
42 class STDMESHERS_EXPORT StdMeshers_Regular_1D: public SMESH_1D_Algo
43 {
44 public:
45   StdMeshers_Regular_1D(int hypId, int studyId, SMESH_Gen* gen);
46   virtual ~StdMeshers_Regular_1D();
47
48   virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
49                                const TopoDS_Shape& aShape,
50                                SMESH_Hypothesis::Hypothesis_Status& aStatus);
51
52   virtual bool Compute(SMESH_Mesh& aMesh,
53                        const TopoDS_Shape& aShape);
54
55   virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
56                         MapShapeNbElems& aResMap);
57
58   virtual void CancelCompute();
59
60   virtual const std::list <const SMESHDS_Hypothesis *> &
61     GetUsedHypothesis(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, const bool=true);
62
63   /*!
64    * \brief Sets event listener to submeshes if necessary
65     * \param subMesh - submesh where algo is set
66    *
67    * This method is called when a submesh gets HYP_OK algo_state.
68    * After being set, event listener is notified on each event of a submesh.
69    */
70   virtual void SetEventListener(SMESH_subMesh* subMesh);
71
72   /*!
73    * \brief Allow algo to do something after persistent restoration
74    * \param subMesh - restored submesh
75    *
76    * This method is called only if a submesh has HYP_OK algo_state.
77    */
78   void SubmeshRestored(SMESH_subMesh* subMesh);
79
80 protected:
81
82   virtual bool computeInternalParameters (SMESH_Mesh &        theMesh,
83                                           Adaptor3d_Curve &   theC3d,
84                                           double              theLength,
85                                           double              theFirstU,
86                                           double              theLastU,
87                                           std::list<double> & theParameters,
88                                           const bool          theReverse,
89                                           bool                theConsiderPropagation = false);
90
91   virtual void redistributeNearVertices (SMESH_Mesh &          theMesh,
92                                          Adaptor3d_Curve &     theC3d,
93                                          double                theLength,
94                                          std::list< double > & theParameters,
95                                          const TopoDS_Vertex & theVf,
96                                          const TopoDS_Vertex & theVl);
97
98   /*!
99    * \brief Return StdMeshers_SegmentLengthAroundVertex assigned to vertex
100    */
101   static const
102   StdMeshers_SegmentLengthAroundVertex* getVertexHyp(SMESH_Mesh &          theMesh,
103                                                      const TopoDS_Vertex & theV);
104
105   enum HypothesisType { LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, FIXED_POINTS_1D, ADAPTIVE, GEOMETRIC_1D, NONE };
106
107   enum ValueIndex {
108     SCALE_FACTOR_IND = 0,
109     BEG_LENGTH_IND   = 0,
110     END_LENGTH_IND   = 1,
111     DEFLECTION_IND   = 0,
112     PRECISION_IND    = 1
113   };
114
115   enum IValueIndex {
116     NB_SEGMENTS_IND   = 0,
117     DISTR_TYPE_IND    = 1,
118     CONV_MODE_IND     = 2
119   };
120
121   enum VValueIndex {
122     TAB_FUNC_IND  = 0
123   };
124
125   enum SValueIndex {
126     EXPR_FUNC_IND  = 0
127   };
128
129   HypothesisType _hypType;
130
131   const StdMeshers_FixedPoints1D* _fpHyp;
132   const StdMeshers_Adaptive1D*    _adaptiveHyp;
133
134   double _value[2];
135   int    _ivalue[3];
136   std::vector<double> _vvalue[1];
137   std::string         _svalue[1];
138   std::vector<int>    _revEdgesIDs;
139
140   // a source of propagated hypothesis, is set by CheckHypothesis()
141   // always called before Compute()
142   TopoDS_Shape _mainEdge;
143   bool         _isPropagOfDistribution;
144 };
145
146 #endif