]> SALOME platform Git repositories - modules/smesh.git/blob - src/StdMeshers/StdMeshers_Regular_1D.hxx
Salome HOME
0021825: Error in the example of "Projection Algorithms" in the user's guide
[modules/smesh.git] / src / StdMeshers / StdMeshers_Regular_1D.hxx
1 // Copyright (C) 2007-2012  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.
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 "StdMeshers_FixedPoints1D.hxx"
37
38 class Adaptor3d_Curve;
39 class TopoDS_Vertex;
40 class StdMeshers_SegmentLengthAroundVertex;
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 const std::list <const SMESHDS_Hypothesis *> &
59     GetUsedHypothesis(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, const bool=true);
60
61   /*!
62    * \brief Sets event listener to submeshes if necessary
63     * \param subMesh - submesh where algo is set
64    *
65    * This method is called when a submesh gets HYP_OK algo_state.
66    * After being set, event listener is notified on each event of a submesh.
67    */
68   virtual void SetEventListener(SMESH_subMesh* subMesh);
69
70   /*!
71    * \brief Allow algo to do something after persistent restoration
72    * \param subMesh - restored submesh
73    *
74    * This method is called only if a submesh has HYP_OK algo_state.
75    */
76   void SubmeshRestored(SMESH_subMesh* subMesh);
77
78 protected:
79
80   virtual bool computeInternalParameters (SMESH_Mesh &        theMesh,
81                                           Adaptor3d_Curve &   theC3d,
82                                           double              theLength,
83                                           double              theFirstU,
84                                           double              theLastU,
85                                           std::list<double> & theParameters,
86                                           const bool          theReverse,
87                                           bool                theConsiderPropagation = false);
88
89   virtual void redistributeNearVertices (SMESH_Mesh &          theMesh,
90                                          Adaptor3d_Curve &     theC3d,
91                                          double                theLength,
92                                          std::list< double > & theParameters,
93                                          const TopoDS_Vertex & theVf,
94                                          const TopoDS_Vertex & theVl);
95
96   /*!
97    * \brief Return StdMeshers_SegmentLengthAroundVertex assigned to vertex
98    */
99   static const
100   StdMeshers_SegmentLengthAroundVertex* getVertexHyp(SMESH_Mesh &          theMesh,
101                                                      const TopoDS_Vertex & theV);
102
103   enum HypothesisType { LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, FIXED_POINTS_1D, NONE };
104
105   enum ValueIndex {
106     SCALE_FACTOR_IND = 0,
107     BEG_LENGTH_IND   = 0,
108     END_LENGTH_IND   = 1,
109     DEFLECTION_IND   = 0,
110     PRECISION_IND    = 1
111   };
112
113   enum IValueIndex {
114     NB_SEGMENTS_IND  = 0,
115     DISTR_TYPE_IND   = 1,
116     CONV_MODE_IND    = 2
117   };
118
119   enum VValueIndex {
120     TAB_FUNC_IND  = 0
121   };
122
123   enum SValueIndex {
124     EXPR_FUNC_IND  = 0
125   };
126
127   HypothesisType _hypType;
128
129   const StdMeshers_FixedPoints1D* _fpHyp;
130
131   double _value[2];
132   int    _ivalue[3];
133   std::vector<double> _vvalue[1];
134   std::string         _svalue[1];
135   std::vector<int>    _revEdgesIDs;
136
137   // a source of propagated hypothesis, is set by CheckHypothesis()
138   // always called before Compute()
139   TopoDS_Shape _mainEdge;
140 };
141
142 #endif