// count faces
int nbFaces = theProxyMesh.NbFaces();
+ int nbNodes;
if ( nbFaces == 0 )
return false;
// 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() );
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
}
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
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
}
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
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<int> 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 ));
+ }
+ }
}
}
}
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<std::vector<double> > VerTab;
VerTab.clear();
std::vector<double> 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();
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);