]> SALOME platform Git repositories - plugins/ghs3dplugin.git/commitdiff
Salome HOME
23418: [OCC] Mesh: Minimization of memory usage of SMESH eap/23418
authoreap <eap@opencascade.com>
Fri, 22 Dec 2017 11:20:51 +0000 (14:20 +0300)
committereap <eap@opencascade.com>
Fri, 22 Dec 2017 11:20:51 +0000 (14:20 +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 eeafd0b39962f3a69f1117bae5b32352f5322da0..da1b7c3d5680396c654dc678f8e95adf5a407867 100644 (file)
@@ -42,32 +42,33 @@ using namespace std;
 
 GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen)
   : SMESH_Hypothesis(hypId, studyId, gen),
-  myToMeshHoles(DefaultMeshHoles()),
-  myToMakeGroupsOfDomains(DefaultToMakeGroupsOfDomains()),
-  myMaximumMemory(-1),
-  myInitialMemory(-1),
-  myOptimizationLevel(DefaultOptimizationLevel()),
-  myKeepFiles(DefaultKeepFiles()),
-  myWorkingDirectory(DefaultWorkingDirectory()),
-  myVerboseLevel(DefaultVerboseLevel()),
-  myToCreateNewNodes(DefaultToCreateNewNodes()),
-  myToUseBoundaryRecoveryVersion(DefaultToUseBoundaryRecoveryVersion()),
-  myToUseFemCorrection(DefaultToUseFEMCorrection()),
-  myToRemoveCentralPoint(DefaultToRemoveCentralPoint()),
-  myLogInStandardOutput(DefaultStandardOutputLog()),
-  myGradation(DefaultGradation()),
-  _enfVertexList(DefaultGHS3DEnforcedVertexList()),
-  _enfVertexCoordsSizeList(DefaultGHS3DEnforcedVertexCoordsValues()),
-  _enfVertexEntrySizeList(DefaultGHS3DEnforcedVertexEntryValues()),
-  _coordsEnfVertexMap(DefaultCoordsGHS3DEnforcedVertexMap()),
-  _geomEntryEnfVertexMap(DefaultGeomEntryGHS3DEnforcedVertexMap()),
-  _enfMeshList(DefaultGHS3DEnforcedMeshList()),
-  _entryEnfMeshMap(DefaultEntryGHS3DEnforcedMeshListMap()),
-  _enfNodes(TIDSortedNodeGroupMap()),
-  _enfEdges(TIDSortedElemGroupMap()),
-  _enfTriangles(TIDSortedElemGroupMap()),
-  _nodeIDToSizeMap(DefaultID2SizeMap()),
-  _groupsToRemove(DefaultGroupsToRemove())
+    myToMeshHoles(DefaultMeshHoles()),
+    myToMakeGroupsOfDomains(DefaultToMakeGroupsOfDomains()),
+    myMaximumMemory(-1),
+    myInitialMemory(-1),
+    myOptimizationLevel(DefaultOptimizationLevel()),
+    myKeepFiles(DefaultKeepFiles()),
+    myWorkingDirectory(DefaultWorkingDirectory()),
+    myVerboseLevel(DefaultVerboseLevel()),
+    myToCreateNewNodes(DefaultToCreateNewNodes()),
+    myToUseBoundaryRecoveryVersion(DefaultToUseBoundaryRecoveryVersion()),
+    myToUseFemCorrection(DefaultToUseFEMCorrection()),
+    myToRemoveCentralPoint(DefaultToRemoveCentralPoint()),
+    myLogInStandardOutput(DefaultStandardOutputLog()),
+    myRemoveLogOnSuccess(DefaultRemoveLogOnSuccess()),
+    myGradation(DefaultGradation()),
+    _enfVertexList(DefaultGHS3DEnforcedVertexList()),
+    _enfVertexCoordsSizeList(DefaultGHS3DEnforcedVertexCoordsValues()),
+    _enfVertexEntrySizeList(DefaultGHS3DEnforcedVertexEntryValues()),
+    _coordsEnfVertexMap(DefaultCoordsGHS3DEnforcedVertexMap()),
+    _geomEntryEnfVertexMap(DefaultGeomEntryGHS3DEnforcedVertexMap()),
+    _enfMeshList(DefaultGHS3DEnforcedMeshList()),
+    _entryEnfMeshMap(DefaultEntryGHS3DEnforcedMeshListMap()),
+    _enfNodes(TIDSortedNodeGroupMap()),
+    _enfEdges(TIDSortedElemGroupMap()),
+    _enfTriangles(TIDSortedElemGroupMap()),
+    _nodeIDToSizeMap(DefaultID2SizeMap()),
+    _groupsToRemove(DefaultGroupsToRemove())
 {
   _name = GetHypType();
   _param_algo_dim = 3;
@@ -628,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:
@@ -637,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:
@@ -654,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 };