From: gdd Date: Thu, 8 Sep 2011 08:18:47 +0000 (+0000) Subject: Fix bug when no hypothesis is set X-Git-Tag: V6_4_0a1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9e43082fc1e25992c5393648e910d17ce7285e8d;p=plugins%2Fghs3dplugin.git Fix bug when no hypothesis is set --- diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx index 8d34bb2..933363c 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx @@ -3492,7 +3492,7 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, // -------------- // read a result // -------------- - std::set groupsToRemove = _hyp->GetGroupsToRemove(); + GHS3DPlugin_Hypothesis::TSetStrings groupsToRemove = GHS3DPlugin_Hypothesis::GetGroupsToRemove(_hyp); Ok = readGMFFile(aResultFileName.ToCString(), #ifdef WITH_SMESH_CANCEL_COMPUTE @@ -3506,7 +3506,8 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, if ( Ok ) { GHS3DPlugin_Hypothesis* that = (GHS3DPlugin_Hypothesis*)this->_hyp; - that->ClearGroupsToRemove(); + if (that) + that->ClearGroupsToRemove(); } // --------------------- // remove working files diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx index c245ea7..d87d35a 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx @@ -57,18 +57,17 @@ GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen _enfVertexEntrySizeList(DefaultGHS3DEnforcedVertexEntryValues()), _coordsEnfVertexMap(DefaultCoordsGHS3DEnforcedVertexMap()), _geomEntryEnfVertexMap(DefaultGeomEntryGHS3DEnforcedVertexMap()), - _enfMeshList(DefaultGHS3DEnforcedMeshList()), _entryEnfMeshMap(DefaultEntryGHS3DEnforcedMeshListMap()), _enfNodes(TIDSortedNodeGroupMap()), _enfEdges(TIDSortedElemGroupMap()), _enfTriangles(TIDSortedElemGroupMap()), _nodeIDToSizeMap(DefaultID2SizeMap()), - _elementIDToSizeMap(DefaultID2SizeMap()) + _elementIDToSizeMap(DefaultID2SizeMap()), + _groupsToRemove(DefaultGroupsToRemove()) { _name = "GHS3D_Parameters"; _param_algo_dim = 3; - _groupsToRemove.clear(); } //======================================================================= @@ -1349,3 +1348,8 @@ GHS3DPlugin_Hypothesis::TID2SizeMap GHS3DPlugin_Hypothesis::GetElementIDToSizeMa { return hyp ? hyp->_GetElementIDToSizeMap(): DefaultID2SizeMap(); } + +GHS3DPlugin_Hypothesis::TSetStrings GHS3DPlugin_Hypothesis::GetGroupsToRemove(const GHS3DPlugin_Hypothesis* hyp) +{ + return hyp ? hyp->_GetGroupsToRemove(): DefaultGroupsToRemove(); +} diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx index 622a169..43cc1f6 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx @@ -111,6 +111,7 @@ public: typedef std::map TIDSortedElemGroupMap; typedef std::map TIDSortedNodeGroupMap; + typedef std::set TSetStrings; /*! * To mesh "holes" in a solid or not. Default is to mesh. @@ -234,6 +235,7 @@ public: const TIDSortedElemGroupMap _GetEnforcedTriangles() const { return _enfTriangles; } const TID2SizeMap _GetNodeIDToSizeMap() const {return _nodeIDToSizeMap; } const TID2SizeMap _GetElementIDToSizeMap() const {return _elementIDToSizeMap; } + const TSetStrings _GetGroupsToRemove() const {return _groupsToRemove; } /*! * \brief Return the enforced vertices */ @@ -250,8 +252,7 @@ public: static TIDSortedElemGroupMap GetEnforcedTriangles(const GHS3DPlugin_Hypothesis* hyp); static TID2SizeMap GetNodeIDToSizeMap(const GHS3DPlugin_Hypothesis* hyp); static TID2SizeMap GetElementIDToSizeMap(const GHS3DPlugin_Hypothesis* hyp); - - std::set GetGroupsToRemove() const {return _groupsToRemove;} + static TSetStrings GetGroupsToRemove(const GHS3DPlugin_Hypothesis* hyp); void ClearGroupsToRemove(); static bool DefaultMeshHoles(); @@ -280,6 +281,7 @@ public: static TIDSortedNodeGroupMap DefaultIDSortedNodeGroupMap() {return TIDSortedNodeGroupMap();} static TIDSortedElemGroupMap DefaultIDSortedElemGroupMap() {return TIDSortedElemGroupMap();} static TID2SizeMap DefaultID2SizeMap() {return TID2SizeMap();} + static TSetStrings DefaultGroupsToRemove() {return TSetStrings();} // Persistence virtual std::ostream & SaveTo(std::ostream & save); @@ -331,7 +333,7 @@ private: TID2SizeMap _elementIDToSizeMap; std::map _entryToElemsMap; - std::set _groupsToRemove; + TSetStrings _groupsToRemove; };