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