From: eap Date: Fri, 22 Dec 2017 11:20:51 +0000 (+0300) Subject: 23418: [OCC] Mesh: Minimization of memory usage of SMESH X-Git-Tag: V8_5_0b1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a0105b7829931e54f165f82a6649903cac9b0943;p=plugins%2Fghs3dplugin.git 23418: [OCC] Mesh: Minimization of memory usage of SMESH --- diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx index b792999..6c47d7e 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx @@ -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( 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& badElems = err->myBadElements; + list& badElems = badElemsErr->myBadElements; vector 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& ghsNod return 0; } +//================================================================================ +/*! + * \brief Return a mesh + */ +//================================================================================ + +const SMDS_Mesh* _Ghs2smdsConvertor::getMesh() const +{ + return _mesh->GetMeshDS(); +} //============================================================================= /*! diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx index b5f4c8b..a800cfc 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.hxx @@ -124,6 +124,7 @@ public: SMESH_ProxyMesh::Ptr mesh); const SMDS_MeshElement* getElement(const std::vector& ghsNodes) const; + const SMDS_Mesh* getMesh() const; }; #endif diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx index 5f1ee5d..ab47494 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx @@ -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: diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx index f2e5a8a..951a050 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx @@ -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 TIDSortedElemGroupMap; diff --git a/src/GHS3DPlugin/GHS3DPlugin_Optimizer.cxx b/src/GHS3DPlugin/GHS3DPlugin_Optimizer.cxx index a2ef475..99a7d8a 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Optimizer.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Optimizer.cxx @@ -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 };