Salome HOME
0021238: EDF 1817 SMESH: GHS3D on quadratic meshes
authoreap <eap@opencascade.com>
Tue, 10 May 2011 13:08:37 +0000 (13:08 +0000)
committereap <eap@opencascade.com>
Tue, 10 May 2011 13:08:37 +0000 (13:08 +0000)
   restore a lost code about qurdatic input mesh mesh

src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx

index 9d93c0052dc2e03e654f965b8f8ea63099bbeb24..6ec26e4e05638a5bf5c3bba695e0f661b83f537c 100644 (file)
@@ -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<double> 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<int> 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