From b203a4095e7de23f866cebc3d9bf93bb35f8eed7 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 10 May 2011 13:08:37 +0000 Subject: [PATCH] 0021238: EDF 1817 SMESH: GHS3D on quadratic meshes restore a lost code about qurdatic input mesh mesh --- src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx | 29 ++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx index 9d93c00..6ec26e4 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx @@ -1269,7 +1269,7 @@ static bool writeGMFFile(const char* theMesh GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues & theEnforcedVertices) { MESSAGE("writeGMFFile w/o geometry"); - int idx, idxRequired, idxSol; + int idx, idxRequired = 0, idxSol; const int dummyint = 0; GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues::const_iterator vertexIt; std::vector enfVertexSizes; @@ -2484,17 +2484,16 @@ static bool writePoints (ofstream & theFile, const TopoDS_Shape shapeToMesh = theMeshDS->ShapeToMesh(); int aGhs3dID = 1; - SMDS_NodeIteratorPtr it = theMeshDS->nodesIterator(); + SMDS_NodeIteratorPtr nodeIt = theMeshDS->nodesIterator(); const SMDS_MeshNode* node; -// + // 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 nodes which are free - // and replace not-free nodes on edges by the node on vertex + // and replace not-free nodes on degenerated 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() ) { - set checkedSM; for (TopExp_Explorer e(theMeshDS->ShapeToMesh(), TopAbs_EDGE ); e.More(); e.Next()) { @@ -2513,14 +2512,25 @@ static bool writePoints (ofstream & theFile, } } } + nbNodes -= n2nDegen.size(); } - + const bool isQuadMesh = 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() )) + nbNodes -= int( theHelper.IsMedium( node )); + } + nodeIt = theMeshDS->nodesIterator(); + } - const char* space = " "; const int dummyint = 0; @@ -2534,13 +2544,14 @@ static bool writePoints (ofstream & theFile, std::cout << " " << nbEnforcedNodes << " enforced nodes" << std::endl; std::cout << std::endl; std::cout << "Start writing in 'points' file ..." << std::endl; + theFile << nbNodes << std::endl; // Loop from 1 to NB_NODES - while ( it->more() ) + while ( nodeIt->more() ) { - node = it->next(); + node = nodeIt->next(); if ( isQuadMesh && theHelper.IsMedium( node )) // Issue 0021238 continue; if ( n2nDegen.count( node ) ) // Issue 0020674 -- 2.39.2