0021472: EDF 2080 SMESH: Projection1D2D on a Voronoi structure fails

fix GetOrderedNodes() to work if not all edges are meshed
This commit is contained in:
eap 2012-01-18 12:02:44 +00:00
parent 4f5cf5faab
commit 8a81427a0c

View File

@ -257,45 +257,46 @@ const vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst,
} }
// Put internal nodes // Put internal nodes
SMESHDS_SubMesh* sm = meshDS->MeshElements( myEdge[i] ); if ( SMESHDS_SubMesh* sm = meshDS->MeshElements( myEdge[i] ))
if ( !sm ) continue; {
vector< pair< double, const SMDS_MeshNode*> > u2nodeVec; vector< pair< double, const SMDS_MeshNode*> > u2nodeVec;
u2nodeVec.reserve( sm->NbNodes() ); u2nodeVec.reserve( sm->NbNodes() );
SMDS_NodeIteratorPtr nItr = sm->GetNodes(); SMDS_NodeIteratorPtr nItr = sm->GetNodes();
double paramSize = myLast[i] - myFirst[i]; double paramSize = myLast[i] - myFirst[i];
double r = myNormPar[i] - prevNormPar; double r = myNormPar[i] - prevNormPar;
if ( !myIsUniform[i] ) if ( !myIsUniform[i] )
while ( nItr->more() ) while ( nItr->more() )
{
const SMDS_MeshNode* node = nItr->next();
if ( myIgnoreMediumNodes && SMESH_MeshEditor::IsMedium( node, SMDSAbs_Edge ))
continue;
double u = helper.GetNodeU( myEdge[i], node, 0, &paramOK );
double aLenU = GCPnts_AbscissaPoint::Length
( const_cast<GeomAdaptor_Curve&>( myC3dAdaptor[i]), myFirst[i], u );
if ( myEdgeLength[i] < aLenU ) // nonregression test "3D_mesh_NETGEN/G6"
{ {
u2nodeVec.clear(); const SMDS_MeshNode* node = nItr->next();
break; if ( myIgnoreMediumNodes && SMESH_MeshEditor::IsMedium( node, SMDSAbs_Edge ))
continue;
double u = helper.GetNodeU( myEdge[i], node, 0, &paramOK );
double aLenU = GCPnts_AbscissaPoint::Length
( const_cast<GeomAdaptor_Curve&>( myC3dAdaptor[i]), myFirst[i], u );
if ( myEdgeLength[i] < aLenU ) // nonregression test "3D_mesh_NETGEN/G6"
{
u2nodeVec.clear();
break;
}
double normPar = prevNormPar + r*aLenU/myEdgeLength[i];
u2nodeVec.push_back( make_pair( normPar, node ));
} }
double normPar = prevNormPar + r*aLenU/myEdgeLength[i]; nItr = sm->GetNodes();
u2nodeVec.push_back( make_pair( normPar, node )); if ( u2nodeVec.empty() )
} while ( nItr->more() )
nItr = sm->GetNodes(); {
if ( u2nodeVec.empty() ) const SMDS_MeshNode* node = nItr->next();
while ( nItr->more() ) if ( myIgnoreMediumNodes && SMESH_MeshEditor::IsMedium( node, SMDSAbs_Edge ))
{ continue;
const SMDS_MeshNode* node = nItr->next(); double u = helper.GetNodeU( myEdge[i], node, 0, &paramOK );
if ( myIgnoreMediumNodes && SMESH_MeshEditor::IsMedium( node, SMDSAbs_Edge ))
continue;
double u = helper.GetNodeU( myEdge[i], node, 0, &paramOK );
// paramSize is signed so orientation is taken into account // paramSize is signed so orientation is taken into account
double normPar = prevNormPar + r * ( u - myFirst[i] ) / paramSize; double normPar = prevNormPar + r * ( u - myFirst[i] ) / paramSize;
u2nodeVec.push_back( make_pair( normPar, node )); u2nodeVec.push_back( make_pair( normPar, node ));
} }
for ( size_t j = 0; j < u2nodeVec.size(); ++j ) for ( size_t j = 0; j < u2nodeVec.size(); ++j )
u2node.insert( u2node.end(), u2nodeVec[j] ); u2node.insert( u2node.end(), u2nodeVec[j] );
}
// Put 2nd vertex node for a last edge // Put 2nd vertex node for a last edge
if ( i+1 == myEdge.size() ) { if ( i+1 == myEdge.size() ) {
@ -450,21 +451,22 @@ std::vector<const SMDS_MeshNode*> StdMeshers_FaceSide::GetOrderedNodes() const
} }
// Put internal nodes // Put internal nodes
SMESHDS_SubMesh* sm = meshDS->MeshElements( myEdge[i] ); if ( SMESHDS_SubMesh* sm = meshDS->MeshElements( myEdge[i] ))
if ( !sm ) continue;
SMDS_NodeIteratorPtr nItr = sm->GetNodes();
double paramSize = myLast[i] - myFirst[i];
double r = myNormPar[i] - prevNormPar;
while ( nItr->more() )
{ {
const SMDS_MeshNode* node = nItr->next(); SMDS_NodeIteratorPtr nItr = sm->GetNodes();
if ( myIgnoreMediumNodes && SMESH_MeshEditor::IsMedium( node, SMDSAbs_Edge )) double paramSize = myLast[i] - myFirst[i];
double r = myNormPar[i] - prevNormPar;
while ( nItr->more() )
{
const SMDS_MeshNode* node = nItr->next();
if ( myIgnoreMediumNodes && SMESH_MeshEditor::IsMedium( node, SMDSAbs_Edge ))
continue; continue;
double u = helper.GetNodeU( myEdge[i], node, 0, &paramOK ); double u = helper.GetNodeU( myEdge[i], node, 0, &paramOK );
// paramSize is signed so orientation is taken into account // paramSize is signed so orientation is taken into account
double normPar = prevNormPar + r * ( u - myFirst[i] ) / paramSize; double normPar = prevNormPar + r * ( u - myFirst[i] ) / paramSize;
u2node.insert( u2node.end(), make_pair( normPar, node )); u2node.insert( u2node.end(), make_pair( normPar, node ));
}
} }
// Put 2nd vertex node for a last edge // Put 2nd vertex node for a last edge