1 // Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESH : implementation of SMESH idl descriptions
24 // File : StdMeshers_Regular_1D.hxx
25 // Moved here from SMESH_Regular_1D.hxx
26 // Author : Paul RASCLE, EDF
29 #ifndef _SMESH_REGULAR_1D_HXX_
30 #define _SMESH_REGULAR_1D_HXX_
32 #include "SMESH_StdMeshers.hxx"
34 #include "SMESH_Algo.hxx"
36 #include <TopoDS_Shape.hxx>
38 class Adaptor3d_Curve;
39 class StdMeshers_Adaptive1D;
40 class StdMeshers_FixedPoints1D;
41 class StdMeshers_SegmentLengthAroundVertex;
44 class STDMESHERS_EXPORT StdMeshers_Regular_1D: public SMESH_1D_Algo
47 StdMeshers_Regular_1D(int hypId, SMESH_Gen* gen);
48 virtual ~StdMeshers_Regular_1D();
50 virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
51 const TopoDS_Shape& aShape,
52 SMESH_Hypothesis::Hypothesis_Status& aStatus);
54 virtual bool Compute(SMESH_Mesh& aMesh,
55 const TopoDS_Shape& aShape);
57 virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
58 MapShapeNbElems& aResMap);
60 virtual void CancelCompute();
62 virtual const std::list <const SMESHDS_Hypothesis *> &
63 GetUsedHypothesis(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, const bool=true);
66 * \brief Sets event listener to submeshes if necessary
67 * \param subMesh - submesh where algo is set
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.
72 virtual void SetEventListener(SMESH_subMesh* subMesh);
75 * \brief Allow algo to do something after persistent restoration
76 * \param subMesh - restored submesh
78 * This method is called only if a submesh has HYP_OK algo_state.
80 void SubmeshRestored(SMESH_subMesh* subMesh);
84 virtual bool computeInternalParameters (SMESH_Mesh & theMesh,
85 Adaptor3d_Curve & theC3d,
89 std::list<double> & theParameters,
90 const bool theReverse,
91 bool theConsiderPropagation = false);
93 virtual void redistributeNearVertices (SMESH_Mesh & theMesh,
94 Adaptor3d_Curve & theC3d,
96 std::list< double > & theParameters,
97 const TopoDS_Vertex & theVf,
98 const TopoDS_Vertex & thieve);
100 bool divideIntoEqualSegments( SMESH_Mesh & theMesh,
101 Adaptor3d_Curve & theC3d,
102 smIdType theNbPoints,
107 std::list<double> & theParameters );
110 * \brief Return StdMeshers_SegmentLengthAroundVertex assigned to vertex
113 StdMeshers_SegmentLengthAroundVertex* getVertexHyp(SMESH_Mesh & theMesh,
114 const TopoDS_Vertex & theV);
116 enum HypothesisType { LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, FIXED_POINTS_1D, ADAPTIVE, GEOMETRIC_1D, DISTRIB_PROPAGATION, NONE };
119 SCALE_FACTOR_IND = 0,
140 HypothesisType _hypType;
142 const StdMeshers_FixedPoints1D* _fpHyp;
143 const StdMeshers_Adaptive1D* _adaptiveHyp;
147 std::vector<double> _vvalue[1];
148 std::string _svalue[1];
149 std::vector<int> _revEdgesIDs;
151 // a source of propagated hypothesis, is set by CheckHypothesis()
152 // always called before Compute()
153 TopoDS_Shape _mainEdge;