diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx index 7da62dc..4cab2a9 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx @@ -1375,9 +1375,11 @@ bool NETGENPlugin_Mesher::FillNgMesh(netgen::OCCGeometry& occgeom, PShapeIteratorPtr solidIt=helper.GetAncestors(geomFace,*sm->GetFather(),TopAbs_SOLID); if ( const TopoDS_Shape * solid = solidIt->next() ) sm = _mesh->GetSubMesh( *solid ); - SMESH_ComputeErrorPtr& smError = sm->GetComputeError(); - smError.reset( new SMESH_ComputeError(COMPERR_BAD_INPUT_MESH,"Not triangle sub-mesh")); - smError->myBadElements.push_back( f ); + SMESH_BadInputElements* badElems = + new SMESH_BadInputElements( helper.GetMeshDS(), COMPERR_BAD_INPUT_MESH, + "Not triangle sub-mesh"); + badElems->add( f ); + sm->GetComputeError().reset( badElems ); return false; } @@ -3318,7 +3320,7 @@ bool NETGENPlugin_Mesher::Compute() _mesh->GetMeshDS()->RemoveFreeNode( nodeVec[i], 0, /*fromGroups=*/false ); } SMESH_ComputeErrorPtr readErr = ReadErrors(nodeVec); - if ( readErr && !readErr->myBadElements.empty() ) + if ( readErr && readErr->HasBadElems() ) { error = readErr; if ( !comment.empty() && !readErr->myComment.empty() ) comment += "\n"; @@ -3380,9 +3382,10 @@ bool NETGENPlugin_Mesher::Compute() { smError->myName = COMPERR_WARNING; } - else if ( !smError->myBadElements.empty() ) // bad surface mesh + else if ( smError->HasBadElems() ) // bad surface mesh { - if ( !hasBadElemOnSolid( smError->myBadElements, sm )) + if ( !hasBadElemOnSolid + ( static_cast( smError.get() )->myBadElements, sm )) smError.reset(); } } @@ -3712,8 +3715,10 @@ double NETGENPlugin_Mesher::GetProgress(const SMESH_Algo* holder, SMESH_ComputeErrorPtr NETGENPlugin_Mesher::ReadErrors(const vector& nodeVec) { - SMESH_ComputeErrorPtr err = SMESH_ComputeError::New - (COMPERR_BAD_INPUT_MESH, "Some edges multiple times in surface mesh"); + if ( nodeVec.size() < 2 ) return SMESH_ComputeErrorPtr(); + SMESH_BadInputElements* err = + new SMESH_BadInputElements( nodeVec.back()->GetMesh(), COMPERR_BAD_INPUT_MESH, + "Some edges multiple times in surface mesh"); SMESH_File file("test.out"); vector two(2); vector three1(3), three2(3); @@ -3773,7 +3778,7 @@ NETGENPlugin_Mesher::ReadErrors(const vector& nodeVec) if ( nbBadElems ) nbBadElems++; // avoid warning: variable set but not used #endif - return err; + return SMESH_ComputeErrorPtr( err ); } //================================================================================ diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx index 6b20474..c987256 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx @@ -538,7 +538,7 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh, if ( err ) { SMESH_ComputeErrorPtr ce = NETGENPlugin_Mesher::ReadErrors(nodeVec); - if ( ce && !ce->myBadElements.empty() ) + if ( ce && ce->HasBadElems() ) error( ce ); } diff --git a/src/NETGENPlugin/NETGENPlugin_Remesher_2D.cxx b/src/NETGENPlugin/NETGENPlugin_Remesher_2D.cxx index 08f05b5..030d571 100644 --- a/src/NETGENPlugin/NETGENPlugin_Remesher_2D.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Remesher_2D.cxx @@ -109,7 +109,8 @@ namespace { // set bad faces into a compute error const char* text = "Non-manifold mesh. Only manifold mesh can be re-meshed"; - SMESH_ComputeErrorPtr error = SMESH_ComputeError::New( COMPERR_BAD_INPUT_MESH, text ); + SMESH_BadInputElements* error = + new SMESH_BadInputElements( myMeshDS, COMPERR_BAD_INPUT_MESH, text ); SMESH::Controls::MultiConnection2D fun; fun.SetMesh( myMeshDS ); SMDS_ElemIteratorPtr fIt = myMeshDS->elementsIterator( SMDSAbs_Face ); @@ -119,7 +120,7 @@ namespace if ( fun.GetValue( f->GetID() ) > 2 ) error->myBadElements.push_back( f ); } - theMesh.GetSubMesh( theMesh.GetShapeToMesh() )->GetComputeError() = error; + theMesh.GetSubMesh( theMesh.GetShapeToMesh() )->GetComputeError().reset( error ); throw SALOME_Exception( text ); } @@ -153,12 +154,13 @@ namespace if ( !freeBords._coincidentGroups.empty() ) { const char* text = "Can't re-meshed a mesh with coincident free edges"; - SMESH_ComputeErrorPtr error = SMESH_ComputeError::New( COMPERR_BAD_INPUT_MESH, text ); + SMESH_BadInputElements* error = + new SMESH_BadInputElements( myMeshDS, COMPERR_BAD_INPUT_MESH, text ); for ( size_t i = 0; i < freeBords._borders.size(); ++i ) error->myBadElements.insert( error->myBadElements.end(), freeBords._borders[i].begin(), freeBords._borders[i].end() ); - theMesh.GetSubMesh( theMesh.GetShapeToMesh() )->GetComputeError() = error; + theMesh.GetSubMesh( theMesh.GetShapeToMesh() )->GetComputeError().reset( error ); throw SALOME_Exception( text ); } }