From e6e3bb2b551fc3f978bff3a098021c5aa72685fb Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 12 Mar 2010 08:34:55 +0000 Subject: [PATCH] 0020682: EDF 1222 SMESH: 3D mesh from a skin mesh and with volumic cells * Pb with internal face (StudyFiss_bugNetgen3D.hdf) + static SMESH_ComputeErrorPtr readErrors(const std::vector< const SMDS_MeshNode* >& nodeVec); which is used to show links that lead to "some edges multiple times in surface mesh" error --- src/NETGENPlugin/NETGENPlugin_Mesher.cxx | 54 ++++++++++++++++-------- src/NETGENPlugin/NETGENPlugin_Mesher.hxx | 3 ++ 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx index e86bf08..28fdd4d 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx @@ -30,14 +30,15 @@ #include "NETGENPlugin_Hypothesis_2D.hxx" #include "NETGENPlugin_SimpleHypothesis_3D.hxx" -#include +#include +#include +#include #include #include -#include +#include +#include #include -#include -#include -#include +#include #include #include @@ -1268,31 +1269,48 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap) //================================================================================ /*! - * \brief remove given file + * \brief Remove "test.out" and "problemfaces" files in current directory */ //================================================================================ -static void removeFile( const TCollection_AsciiString& fileName ) +void NETGENPlugin_Mesher::RemoveTmpFiles() { - try { - OSD_File( fileName ).Remove(); - } - catch ( Standard_ProgramError ) { - MESSAGE("Can't remove file: " << fileName.ToCString() << " ; file does not exist or permission denied"); - } + SMESH_File("test.out").remove(); + SMESH_File("problemfaces").remove(); + SMESH_File("occmesh.rep").remove(); } //================================================================================ /*! - * \brief Remove "test.out" and "problemfaces" files in current directory + * \brief Read mesh entities preventing successful computation from "test.out" file */ //================================================================================ -void NETGENPlugin_Mesher::RemoveTmpFiles() +SMESH_ComputeErrorPtr +NETGENPlugin_Mesher::readErrors(const vector& nodeVec) { - removeFile("test.out"); - removeFile("problemfaces"); - removeFile("occmesh.rep"); + SMESH_ComputeErrorPtr err = SMESH_ComputeError::New + (COMPERR_BAD_INPUT_MESH, "some edges multiple times in surface mesh"); + SMESH_File file("test.out"); + vector edge(2); + const char* badEdgeStr = " multiple times in surface mesh"; + const int badEdgeStrLen = strlen( badEdgeStr ); + while( !file.eof() ) + { + if ( strncmp( file, "Edge ", 5 ) == 0 && + file.getInts( edge ) && + strncmp( file, badEdgeStr, badEdgeStrLen ) == 0 && + edge[0] < nodeVec.size() && edge[1] < nodeVec.size()) + { + err->myBadElements.push_back( new SMDS_MeshEdge( nodeVec[ edge[0]], nodeVec[ edge[1]] )); + file += badEdgeStrLen; + } + else + { + ++file; + } + } + return err; } //================================================================================ diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.hxx b/src/NETGENPlugin/NETGENPlugin_Mesher.hxx index d10d771..20c2fcb 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.hxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.hxx @@ -31,6 +31,7 @@ #include "NETGENPlugin_Defs.hxx" #include "StdMeshers_FaceSide.hxx" #include +#include class SMESH_Mesh; class SMESH_Comment; @@ -98,6 +99,8 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Mesher static void RemoveTmpFiles(); + static SMESH_ComputeErrorPtr readErrors(const std::vector< const SMDS_MeshNode* >& nodeVec); + private: SMESH_Mesh* _mesh; const TopoDS_Shape& _shape; -- 2.39.2