From: eap Date: Mon, 1 Feb 2010 13:34:04 +0000 (+0000) Subject: 020674: EDF 870 SMESH: Mesh generated by Netgen not usable by GHS3D X-Git-Tag: V5_1_4a1~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8ec12cf51f63c2c1106c0d22a16f0a82e30e0d5f;p=plugins%2Fghs3dplugin.git 020674: EDF 870 SMESH: Mesh generated by Netgen not usable by GHS3D skip nodes on degenerated edges at points writing --- diff --git a/src/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin_GHS3D.cxx index dc7045d..d34070c 100644 --- a/src/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin_GHS3D.cxx @@ -305,6 +305,10 @@ static bool writeFaces (ofstream & theFile, // find GHS3D ID aSmdsID = itOnSubFace->next()->GetID(); itOnMap = theSmdsToGhs3dIdMap.find( aSmdsID ); +// if ( itOnMap == theSmdsToGhs3dIdMap.end() ) { +// cout << "not found node: " << aSmdsID << endl; +// return false; +// } ASSERT( itOnMap != theSmdsToGhs3dIdMap.end() ); theFile << space << (*itOnMap).second; @@ -416,11 +420,11 @@ static bool writeFaces (ofstream & theFile, //purpose : //======================================================================= -static bool writePoints (ofstream & theFile, - SMESHDS_Mesh * theMesh, - map & theSmdsToGhs3dIdMap, - map & theGhs3dIdToNodeMap, - map,double> & theEnforcedVertices) +static bool writePoints (ofstream & theFile, + SMESH_MesherHelper& theHelper, + map & theSmdsToGhs3dIdMap, + map & theGhs3dIdToNodeMap, + map,double> & theEnforcedVertices) { // record structure: // @@ -428,11 +432,25 @@ static bool writePoints (ofstream & theFile, // Loop from 1 to NB_NODES // X Y Z DUMMY_INT + SMESHDS_Mesh * theMesh = theHelper.GetMeshDS(); int nbNodes = theMesh->NbNodes(); if ( nbNodes == 0 ) return false; int nbEnforcedVertices = theEnforcedVertices.size(); + // Issue 020674: EDF 870 SMESH: Mesh generated by Netgen not usable by GHS3D + // The problem is in nodes on degenerated edges, we need to skip them + if ( theHelper.HasDegenenaratedEdges() ) + { + // here we decrease total nb of nodes by nb of nodes on degenerated edges + set checkedSM; + for (TopExp_Explorer e(theMesh->ShapeToMesh(), TopAbs_EDGE ); e.More(); e.Next()) + { + SMESH_subMesh* sm = theHelper.GetMesh()->GetSubMesh( e.Current() ); + if ( checkedSM.insert( sm->GetId() ).second && theHelper.IsDegenShape(sm->GetId() )) + nbNodes -= sm->GetSubMeshDS()->NbNodes(); + } + } const char* space = " "; const int dummyint = 0; @@ -456,6 +474,10 @@ static bool writePoints (ofstream & theFile, while ( it->more() ) { node = it->next(); + if ( node->GetPosition()->GetTypeOfPosition() == SMDS_TOP_EDGE && + theHelper.IsDegenShape( node->GetPosition()->GetShapeId() )) // Issue 020674 + continue; + theSmdsToGhs3dIdMap.insert( make_pair( node->GetID(), aGhs3dID )); theGhs3dIdToNodeMap.insert( make_pair( aGhs3dID, node )); aGhs3dID++; @@ -1177,7 +1199,10 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, catch(...) { } - Ok = writePoints( aPointsFile, meshDS, aSmdsToGhs3dIdMap, aGhs3dIdToNodeMap, enforcedVertices) && + SMESH_MesherHelper helper( theMesh ); + helper.SetSubShape( theShape ); + + Ok = writePoints( aPointsFile, helper, aSmdsToGhs3dIdMap, aGhs3dIdToNodeMap, enforcedVertices) && writeFaces ( aFacesFile, meshDS, aSmdsToGhs3dIdMap ); aFacesFile.close();