Salome HOME
PAL13639 (EDF PAL 317 : SMESH : Create "0D Hypothesis")
[modules/smesh.git] / src / StdMeshers / StdMeshers_Regular_1D.hxx
index b038a91d2f7f1bcbfffc98ca7ab8626d9a481601..f0e82262d87002a40e9050a8c6377b20f2f16220 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
 
 #include "SMESH_1D_Algo.hxx"
 
-#include <TopoDS_Shape.hxx>
-#include <TopTools_ListOfShape.hxx>
+class Adaptor3d_Curve;
+class TopoDS_Vertex;
+class StdMeshers_SegmentLengthAroundVertex;
 
-class TopoDS_Edge;
-
-class StdMeshers_Regular_1D:
-  public SMESH_1D_Algo
+class StdMeshers_Regular_1D: public SMESH_1D_Algo
 {
 public:
   StdMeshers_Regular_1D(int hypId, int studyId, SMESH_Gen* gen);
@@ -52,39 +50,81 @@ public:
                       const TopoDS_Shape& aShape);
 
   virtual const std::list <const SMESHDS_Hypothesis *> &
-          GetUsedHypothesis (SMESH_Mesh & aMesh, const TopoDS_Shape & aShape);
-
-  ostream & SaveTo(ostream & save);
-  istream & LoadFrom(istream & load);
-  friend ostream & operator << (ostream & save, StdMeshers_Regular_1D & hyp);
-  friend istream & operator >> (istream & load, StdMeshers_Regular_1D & hyp);
+    GetUsedHypothesis(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, const bool=true);
+
+  /*!
+   * \brief Sets event listener to submeshes if necessary
+    * \param subMesh - submesh where algo is set
+   *
+   * This method is called when a submesh gets HYP_OK algo_state.
+   * After being set, event listener is notified on each event of a submesh.
+   */
+  virtual void SetEventListener(SMESH_subMesh* subMesh);
+
+  /*!
+   * \brief Allow algo to do something after persistent restoration
+   * \param subMesh - restored submesh
+   *
+   * This method is called only if a submesh has HYP_OK algo_state.
+   */
+  void SubmeshRestored(SMESH_subMesh* subMesh);
 
 protected:
 
-  Standard_Boolean IsPropagated (SMESH_Mesh         & theMesh,
-                                 const TopoDS_Shape & theShape);
-
-  void GetOppositeEdges (const TopoDS_Shape&   theShape,
-                         const TopoDS_Shape&   theEdge,
-                         TopTools_ListOfShape& theOppositeEdges) const;
-
-  bool computeInternalParameters (const TopoDS_Edge&    theEdge,
-                                  std::list< double > & theParameters ) const;
+  virtual bool computeInternalParameters (Adaptor3d_Curve &     theC3d,
+                                          double                theLength,
+                                          double                theFirstU,
+                                          double                theLastU,
+                                          std::list< double > & theParameters,
+                                          const bool            theReverse) const;
+
+  virtual void redistributeNearVertices (SMESH_Mesh &          theMesh,
+                                         Adaptor3d_Curve &     theC3d,
+                                         double                theLength,
+                                         std::list< double > & theParameters,
+                                         const TopoDS_Vertex & theVf,
+                                         const TopoDS_Vertex & theVl) const;
+
+  /*!
+   * \brief Return StdMeshers_SegmentLengthAroundVertex assigned to vertex
+   */
+  static const
+  StdMeshers_SegmentLengthAroundVertex* getVertexHyp(SMESH_Mesh &          theMesh,
+                                                     const TopoDS_Vertex & theV);
 
   enum HypothesisType { LOCAL_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, NONE };
 
   enum ValueIndex {
-    NB_SEGMENTS_IND  = 0,
-    SCALE_FACTOR_IND = 1,
+    SCALE_FACTOR_IND = 0,
     BEG_LENGTH_IND   = 0,
     END_LENGTH_IND   = 1,
     DEFLECTION_IND   = 0
     };
-  
+
+  enum IValueIndex {
+    NB_SEGMENTS_IND  = 0,
+    DISTR_TYPE_IND   = 1,
+    CONV_MODE_IND     = 2
+  };
+
+  enum VValueIndex {
+    TAB_FUNC_IND  = 0
+  };
+
+  enum SValueIndex {
+    EXPR_FUNC_IND  = 0
+  };
+
   HypothesisType _hypType;
 
   double _value[2];
-  
+  int    _ivalue[3];
+  std::vector<double> _vvalue[1];
+  std::string         _svalue[1];
+
+  // a source of propagated hypothesis, is set by CheckHypothesis()
+  // always called before Compute()
+  TopoDS_Shape _mainEdge;
 };
 
 #endif