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