Salome HOME
23418: [OCC] Mesh: Minimization of memory usage of SMESH V8_5_0b1
authoreap <eap@opencascade.com>
Fri, 22 Dec 2017 11:20:51 +0000 (14:20 +0300)
committereap <eap@opencascade.com>
Thu, 5 Apr 2018 14:34:38 +0000 (17:34 +0300)
src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx
src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx
src/GHS3DPlugin/GHS3DPlugin_Optimizer.cxx

index b792999a4ef54f637f62e010a7f52e5cef207178..6c47d7e25b8355207ae869b7896df95d332960b6 100644 (file)
@@ -2386,7 +2386,9 @@ GHS3DPlugin_GHS3D::getErrorDescription(const char*                logFile,
                                        const _Ghs2smdsConvertor & toSmdsConvertor,
                                        const bool                 isOk/* = false*/ )
 {
-  SMESH_ComputeErrorPtr err = SMESH_ComputeError::New( COMPERR_ALGO_FAILED );
+  SMESH_BadInputElements* badElemsErr =
+    new SMESH_BadInputElements( toSmdsConvertor.getMesh(), COMPERR_ALGO_FAILED );
+  SMESH_ComputeErrorPtr err( badElemsErr );
 
   char* ptr = const_cast<char*>( log.c_str() );
   char* buf = ptr, * bufEnd = ptr + log.size();
@@ -2424,7 +2426,7 @@ GHS3DPlugin_GHS3D::getErrorDescription(const char*                logFile,
     if ( strncmp( ptr, "ERR ", 4 ) != 0 )
       continue;
 
-    list<const SMDS_MeshElement*>& badElems = err->myBadElements;
+    list<const SMDS_MeshElement*>& badElems = badElemsErr->myBadElements;
     vector<int> nodeIds;
 
     ptr += 4;
@@ -2632,7 +2634,7 @@ GHS3DPlugin_GHS3D::getErrorDescription(const char*                logFile,
 
   err->myComment = errDescription;
 
-  if ( err->myComment.empty() && err->myBadElements.empty() )
+  if ( err->myComment.empty() && !err->HasBadElems() )
     err = SMESH_ComputeError::New(); // OK
 
   return err;
@@ -2707,6 +2709,16 @@ const SMDS_MeshElement* _Ghs2smdsConvertor::getElement(const vector<int>& ghsNod
   return 0;
 }
 
+//================================================================================
+/*!
+ * \brief Return a mesh
+ */
+//================================================================================
+
+const SMDS_Mesh* _Ghs2smdsConvertor::getMesh() const
+{
+  return _mesh->GetMeshDS();
+}
 
 //=============================================================================
 /*!
index b5f4c8bb97a972a5db671f90c2b1add4576e98ee..a800cfc5f014cca570de15ab7dc67a9bb3fbef4c 100644 (file)
@@ -124,6 +124,7 @@ public:
                       SMESH_ProxyMesh::Ptr                        mesh);
 
   const SMDS_MeshElement* getElement(const std::vector<int>& ghsNodes) const;
+  const SMDS_Mesh*        getMesh() const;
 };
 
 #endif
index 5f1ee5dc357d42255922b9e48a02b70500b1b6c2..ab47494e579f8cddea2c8729c1d51505243e8ee4 100644 (file)
@@ -629,7 +629,6 @@ bool GHS3DPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, SM
             nodeRet = _enfNodes.insert(make_pair(node,groupName));
             added = added && nodeRet.second;
           }
-//          added = true;s
         }
         break;
       case SMESH::EDGE:
@@ -638,12 +637,12 @@ bool GHS3DPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, SM
           added = added && elemRet.second;
         }
         else if (elem->GetType() > SMDSAbs_Edge) {
-          SMDS_ElemIteratorPtr it = elem->edgesIterator();
-          for (;it->more();) {
-            const SMDS_MeshElement* anEdge = it->next();
-            elemRet = _enfEdges.insert(make_pair(anEdge,groupName));
-            added = added && elemRet.second;
-          }
+          // SMDS_ElemIteratorPtr it = elem->edgesIterator();
+          // for (;it->more();) {
+          //   const SMDS_MeshElement* anEdge = it->next();
+          //   elemRet = _enfEdges.insert(make_pair(anEdge,groupName));
+          //   added = added && elemRet.second;
+          // }
         }
         break;
       case SMESH::FACE:
@@ -655,14 +654,14 @@ bool GHS3DPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, SM
           }
         }
         else if (elem->GetType() > SMDSAbs_Face) { // Group of faces
-          SMDS_ElemIteratorPtr it = elem->facesIterator();
-          for (;it->more();) {
-            const SMDS_MeshElement* aFace = it->next();
-            if (aFace->NbCornerNodes() == 3) {
-              elemRet = _enfTriangles.insert(make_pair(aFace,groupName));
-              added = added && elemRet.second;
-            }
-          }
+          // SMDS_ElemIteratorPtr it = elem->facesIterator();
+          // for (;it->more();) {
+          //   const SMDS_MeshElement* aFace = it->next();
+          //   if (aFace->NbCornerNodes() == 3) {
+          //     elemRet = _enfTriangles.insert(make_pair(aFace,groupName));
+          //     added = added && elemRet.second;
+          //   }
+          // }
         }
         break;
       default:
index f2e5a8ae131827fb5d6caf68c1e221181dda3a83..951a050e77d037e7e26da8cfa2f4d06d2f52d773 100644 (file)
@@ -111,7 +111,7 @@ public:
 
   struct TIDMeshIDCompare {
     bool operator () (const SMDS_MeshElement* e1, const SMDS_MeshElement* e2) const
-    { return e1->getMeshId() == e2->getMeshId() ? e1->GetID() < e2->GetID() : e1->getMeshId() < e2->getMeshId() ; }
+    { return e1->GetMesh() == e2->GetMesh() ? e1->GetID() < e2->GetID() : e1->GetMesh() < e2->GetMesh() ; }
   };
   
   typedef std::map<const SMDS_MeshElement*, std::string, TIDMeshIDCompare > TIDSortedElemGroupMap;
index a2ef47547affe2879706650a21fb0f19ac7f1c18..99a7d8add400d39b8efca5d693b124ab12284a75 100644 (file)
@@ -164,7 +164,7 @@ namespace
 
     SMESHDS_Mesh* meshDS = theHelper->GetMeshDS();
     if ( meshDS->NbNodes() != meshDS->MaxNodeID() )
-      meshDS->compactMesh();
+      meshDS->CompactMesh();
 
     theMGInput->GmfSetKwd( mfile, GmfVertices, meshDS->NbNodes() );
     int TypTab[] = { GmfSca };