]> SALOME platform Git repositories - plugins/ghs3dplugin.git/commitdiff
Salome HOME
Fix bug when no hypothesis is set V6_4_0a1
authorgdd <gdd>
Thu, 8 Sep 2011 08:18:47 +0000 (08:18 +0000)
committergdd <gdd>
Thu, 8 Sep 2011 08:18:47 +0000 (08:18 +0000)
src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx

index 8d34bb268f3ca31f0f0f33580f3b4ce25a1ea20b..933363c5aa7b22f7c2c47d028cd464bf6cbff111 100644 (file)
@@ -3492,7 +3492,7 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh&         theMesh,
   // --------------
   // read a result
   // --------------
-  std::set<std::string> 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
index c245ea7915f6fe65c463a7bfc14268bf246a83d4..d87d35a77bf659740fadaf31569295f15e99776a 100644 (file)
@@ -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();
+}
index 622a169ceb5ae80ed652024cb234a9b5e70747bf..43cc1f6ba32e25b351036c33083c43cac4ae1de6 100644 (file)
@@ -111,6 +111,7 @@ public:
   
   typedef std::map<const SMDS_MeshElement*, std::string, TIDCompare > TIDSortedElemGroupMap;
   typedef std::map<const SMDS_MeshNode*, std::string, TIDCompare > TIDSortedNodeGroupMap;
+  typedef std::set<std::string> 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<std::string> 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<std::string, TIDSortedElemSet > _entryToElemsMap;
   
-  std::set<std::string> _groupsToRemove;
+  TSetStrings _groupsToRemove;
 };