// 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;
//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:
//
// 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;
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++;
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();