1 // SMESH SMESH : implementaion of SMESH idl descriptions
3 // Copyright (C) 2003 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.
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESH_subMesh.hxx
25 // Author : Paul RASCLE, EDF
29 #ifndef _SMESH_SUBMESH_HXX_
30 #define _SMESH_SUBMESH_HXX_
32 #include "SMESHDS_Mesh.hxx"
33 #include "SMESHDS_SubMesh.hxx"
34 #include "Utils_SALOME_Exception.hxx"
35 #include <TopoDS_Shape.hxx>
36 #include <TColStd_IndexedMapOfTransient.hxx>
37 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
44 class SMESH_Hypothesis;
51 const Handle(SMESHDS_Mesh)& meshDS,
52 const TopoDS_Shape & aSubShape);
53 virtual ~SMESH_subMesh();
57 // bool Contains(const TopoDS_Shape & aSubShape)
58 // throw (SALOME_Exception);
60 const Handle(SMESHDS_SubMesh)& GetSubMeshDS()
61 throw (SALOME_Exception);
63 SMESH_subMesh* GetFirstToCompute()
64 throw (SALOME_Exception);
66 const map<int, SMESH_subMesh*>& DependsOn();
67 const map<int, SMESH_subMesh*>& Dependants();
69 const TopoDS_Shape& GetSubShape();
71 bool _vertexSet; // only for vertex subMesh, set to false for dim > 0
73 enum compute_state { NOT_READY, READY_TO_COMPUTE,
74 COMPUTE_OK, FAILED_TO_COMPUTE };
75 enum algo_state { NO_ALGO, MISSING_HYP, HYP_OK };
76 enum algo_event {ADD_HYP, ADD_ALGO,
77 REMOVE_HYP, REMOVE_ALGO,
78 ADD_FATHER_HYP, ADD_FATHER_ALGO,
79 REMOVE_FATHER_HYP, REMOVE_FATHER_ALGO};
80 enum compute_event {MODIF_HYP, MODIF_ALGO_STATE, COMPUTE,
81 CLEAN, CLEANDEP, SUBMESH_COMPUTED};
83 bool AlgoStateEngine(int event, SMESH_Hypothesis* anHyp)
84 throw (SALOME_Exception);
86 void SubMeshesAlgoStateEngine(int event, SMESH_Hypothesis* anHyp)
87 throw (SALOME_Exception);
89 void DumpAlgoState(bool isMain);
91 bool ComputeStateEngine(int event)
92 throw (SALOME_Exception);
94 int GetComputeState() {return _computeState;};
97 void InsertDependence(const TopoDS_Shape aSubShape);
98 // void FinalizeDependence(list<TopoDS_Shape>& shapeList);
100 bool SubMeshesComputed()
101 throw (SALOME_Exception);
103 bool SubMeshesReady();
105 void RemoveSubMeshElementsAndNodes();
106 void UpdateDependantsState();
107 void CleanDependants();
108 void ExtractDependants(const TopTools_IndexedDataMapOfShapeListOfShape& M,
109 const TopAbs_ShapeEnum etype);
110 void SetAlgoState(int state);
112 TopoDS_Shape _subShape;
113 Handle (SMESHDS_Mesh) _meshDS;
114 Handle (SMESHDS_SubMesh) _subMeshDS;
117 map<int, SMESH_subMesh*> _mapDepend;
118 map<int, SMESH_subMesh*> _mapDependants;
119 bool _dependenceAnalysed;
120 bool _dependantsFound;