]> SALOME platform Git repositories - plugins/hybridplugin.git/commitdiff
Salome HOME
020674: EDF 870 SMESH: Mesh generated by Netgen not usable by GHS3D
authoreap <eap@opencascade.com>
Mon, 1 Feb 2010 13:34:04 +0000 (13:34 +0000)
committereap <eap@opencascade.com>
Mon, 1 Feb 2010 13:34:04 +0000 (13:34 +0000)
   skip nodes on degenerated edges at points writing

src/GHS3DPlugin_GHS3D.cxx

index dc7045d2c9b1f4b96b71969853b503d4a975bdc4..d34070c7aa44a41a83885ca6f3d4732210c386b7 100644 (file)
@@ -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 <int,int> &                                theSmdsToGhs3dIdMap,
-                         map <int,const SMDS_MeshNode*> &               theGhs3dIdToNodeMap,
-                         map<vector<double>,double> & theEnforcedVertices)
+static bool writePoints (ofstream &                       theFile,
+                         SMESH_MesherHelper&              theHelper,
+                         map <int,int> &                  theSmdsToGhs3dIdMap,
+                         map <int,const SMDS_MeshNode*> & theGhs3dIdToNodeMap,
+                         map<vector<double>,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<int> 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();