From: eap Date: Thu, 5 May 2011 11:00:25 +0000 (+0000) Subject: 1) fix pb on quadratic mesh w/o shape X-Git-Tag: V6_3_0~21 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bb5b13849353ec6555c52c2f6a2bc20e7a526e8d;p=plugins%2Fhybridplugin.git 1) fix pb on quadratic mesh w/o shape 2) fix pb on a cone meshed by MEFISTO (pb of nodes on degenerated edge) SMESH_TEST/Grids/smesh/bugs/M7 --- diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx index d849532..1074ac9 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx @@ -1250,6 +1250,7 @@ static bool writeGMFFile(const char* theMesh // count faces int nbFaces = theProxyMesh.NbFaces(); + int nbNodes; if ( nbFaces == 0 ) return false; @@ -1270,7 +1271,8 @@ static bool writeGMFFile(const char* theMesh // else anElemSet.insert(elem); nodeIt = elem->nodesIterator(); - while ( nodeIt->more() ) + nbNodes = elem->NbCornerNodes(); + while ( nodeIt->more() && nbNodes--) { // find GHS3D ID const SMDS_MeshNode* node = castToNode( nodeIt->next() ); @@ -1286,7 +1288,8 @@ static bool writeGMFFile(const char* theMesh elem = (*elemIt); isOK = true; nodeIt = elem->nodesIterator(); - while ( nodeIt->more()) { + nbNodes = 2; + while ( nodeIt->more() && nbNodes-- ) { // find GHS3D ID const SMDS_MeshNode* node = castToNode( nodeIt->next() ); // Test if point is inside shape to mesh @@ -1299,7 +1302,8 @@ static bool writeGMFFile(const char* theMesh } if (isOK) { nodeIt = elem->nodesIterator(); - while ( nodeIt->more()) { + nbNodes = 2; + while ( nodeIt->more() && nbNodes-- ) { // find GHS3D ID const SMDS_MeshNode* node = castToNode( nodeIt->next() ); int newId = aNodeToGhs3dIdMap.size() + anEnforcedNodeToGhs3dIdMap.size() + 1; // ghs3d ids count from 1 @@ -1320,7 +1324,8 @@ static bool writeGMFFile(const char* theMesh elem = (*elemIt); isOK = true; nodeIt = elem->nodesIterator(); - while ( nodeIt->more() ) { + nbNodes = 3; + while ( nodeIt->more() && nbNodes--) { // find GHS3D ID const SMDS_MeshNode* node = castToNode( nodeIt->next() ); // Test if point is inside shape to mesh @@ -1333,7 +1338,8 @@ static bool writeGMFFile(const char* theMesh } if (isOK) { nodeIt = elem->nodesIterator(); - while ( nodeIt->more() ) { + nbNodes = 3; + while ( nodeIt->more() && nbNodes--) { // find GHS3D ID const SMDS_MeshNode* node = castToNode( nodeIt->next() ); int newId = aNodeToGhs3dIdMap.size() + anEnforcedNodeToGhs3dIdMap.size() + 1; // ghs3d ids count from 1 @@ -1845,20 +1851,29 @@ static bool writeGMFFile(const char* theMeshFileName, nbev = theEnforcedVertices.size(); nben = theEnforcedNodes.size(); - nodeIt = theMeshDS->nodesIterator(); - // 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 + // The problem is in nodes on degenerated edges, we need to skip nodes which are free + // and replace not-free nodes on edges by the node on vertex + TNodeNodeMap n2nDegen; // map a node on degenerated edge to a node on vertex + TNodeNodeMap::iterator n2nDegenIt; if ( theHelper.HasDegeneratedEdges() ) { - // here we decrease total nb of nodes by nb of nodes on degenerated edges set checkedSM; for (TopExp_Explorer e(theMeshDS->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() )) { - if ( sm->GetSubMeshDS() ) - nbv -= sm->GetSubMeshDS()->NbNodes(); + if ( checkedSM.insert( sm->GetId() ).second && theHelper.IsDegenShape(sm->GetId() )) + { + if ( SMESHDS_SubMesh* smDS = sm->GetSubMeshDS() ) + { + TopoDS_Shape vertex = TopoDS_Iterator( e.Current() ).Value(); + const SMDS_MeshNode* vNode = SMESH_Algo::VertexNode( TopoDS::Vertex( vertex ), theMeshDS); + { + SMDS_NodeIteratorPtr nIt = smDS->GetNodes(); + while ( nIt->more() ) + n2nDegen.insert( make_pair( nIt->next(), vNode )); + } + } } } } @@ -1867,28 +1882,20 @@ static bool writeGMFFile(const char* theMeshFileName, theHelper.GetMesh()->NbEdges( ORDER_QUADRATIC ) || theHelper.GetMesh()->NbFaces( ORDER_QUADRATIC ) || theHelper.GetMesh()->NbVolumes( ORDER_QUADRATIC ); - if ( isQuadMesh ) - { - // descrease nbNodes by nb of medium nodes - while ( nodeIt->more() ) - { - node = nodeIt->next(); - if ( !theHelper.IsDegenShape( node->getshapeId() )) - nbv -= int( theHelper.IsMedium( node )); - } - nodeIt = theMeshDS->nodesIterator(); - } - + std::vector > VerTab; VerTab.clear(); std::vector aVerTab; // Loop from 1 to NB_NODES + nodeIt = theMeshDS->nodesIterator(); + while ( nodeIt->more() ) { node = nodeIt->next(); - if (( isQuadMesh && theHelper.IsMedium( node )) || // Issue 0021238 - theHelper.IsDegenShape( node->getshapeId() )) // Issue 0020674 + if ( isQuadMesh && theHelper.IsMedium( node )) // Issue 0021238 + continue; + if ( n2nDegen.count( node ) ) // Issue 0020674 continue; aVerTab.clear(); @@ -2040,7 +2047,10 @@ static bool writeGMFFile(const char* theMeshFileName, att.clear(); for ( int j = 0; j < 3; ++j ) { // find GHS3D ID - aSmdsID = itOnSubFace->next()->GetID(); + node = castToNode( itOnSubFace->next() ); + if (( n2nDegenIt = n2nDegen.find( node )) != n2nDegen.end() ) + node = n2nDegenIt->second; + aSmdsID = node->GetID(); itOnMap = theSmdsToGhs3dIdMap.find( aSmdsID ); ASSERT( itOnMap != theSmdsToGhs3dIdMap.end() ); att.push_back((*itOnMap).second);