0021144: [CEA 441] Problem with projection

care of degenerated geom EDGEs
This commit is contained in:
eap 2011-01-27 13:41:06 +00:00
parent b337ba17f3
commit 237e3eaae1
3 changed files with 52 additions and 31 deletions

View File

@ -1318,15 +1318,15 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
// Get ordered bottom edges // Get ordered bottom edges
list< TopoDS_Edge > orderedEdges; list< TopoDS_Edge > orderedEdges;
list< int > nbVertexInWires; list< int > nbEInW;
SMESH_Block::GetOrderedEdges( TopoDS::Face( botSM->GetSubShape().Reversed() ), SMESH_Block::GetOrderedEdges( TopoDS::Face( botSM->GetSubShape().Reversed() ),
V000, orderedEdges, nbVertexInWires ); V000, orderedEdges, nbEInW );
// if ( nbVertexInWires.size() != 1 ) // if ( nbEInW.size() != 1 )
// RETURN_BAD_RESULT("Wrong prism geometry"); // RETURN_BAD_RESULT("Wrong prism geometry");
// Get Wall faces corresponding to the ordered bottom edges // Get Wall faces corresponding to the ordered bottom edges
list< TopoDS_Face > wallFaces; list< TopoDS_Face > wallFaces;
if ( !GetWallFaces( Mesh(), shape3D, botSM->GetSubShape(), orderedEdges, wallFaces)) if ( !GetWallFaces( Mesh(), shape3D, botSM->GetSubShape(), orderedEdges, nbEInW, wallFaces))
return error(COMPERR_BAD_SHAPE, "Can't find side faces"); return error(COMPERR_BAD_SHAPE, "Can't find side faces");
// Find columns of wall nodes and calculate edges' lengths // Find columns of wall nodes and calculate edges' lengths
@ -1335,7 +1335,7 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
myParam2ColumnMaps.clear(); myParam2ColumnMaps.clear();
myParam2ColumnMaps.resize( orderedEdges.size() ); // total nb edges myParam2ColumnMaps.resize( orderedEdges.size() ); // total nb edges
int iE, nbEdges = nbVertexInWires.front(); // nb outer edges int iE, nbEdges = nbEInW.front(); // nb outer edges
vector< double > edgeLength( nbEdges ); vector< double > edgeLength( nbEdges );
map< double, int > len2edgeMap; map< double, int > len2edgeMap;
@ -1665,6 +1665,7 @@ bool StdMeshers_PrismAsBlock::GetLayersTransformation(vector<gp_Trsf> & trsf) co
list< TopoDS_Edge >::iterator edgeIt = orderedEdges.begin(); list< TopoDS_Edge >::iterator edgeIt = orderedEdges.begin();
for ( int iE = 0; iE < nbEdgesInWires.front(); ++iE, ++edgeIt ) for ( int iE = 0; iE < nbEdgesInWires.front(); ++iE, ++edgeIt )
{ {
if ( BRep_Tool::Degenerated( *edgeIt )) continue;
const TParam2ColumnMap& u2colMap = const TParam2ColumnMap& u2colMap =
GetParam2ColumnMap( myHelper->GetMeshDS()->ShapeToIndex( *edgeIt ), isReverse ); GetParam2ColumnMap( myHelper->GetMeshDS()->ShapeToIndex( *edgeIt ), isReverse );
isReverse = ( edgeIt->Orientation() == TopAbs_REVERSED ); isReverse = ( edgeIt->Orientation() == TopAbs_REVERSED );
@ -1766,31 +1767,49 @@ bool StdMeshers_PrismAsBlock::IsForwardEdge(SMESHDS_Mesh* meshDS,
*/ */
//================================================================================ //================================================================================
bool StdMeshers_PrismAsBlock::GetWallFaces( SMESH_Mesh* mesh, bool StdMeshers_PrismAsBlock::GetWallFaces( SMESH_Mesh* mesh,
const TopoDS_Shape & mainShape, const TopoDS_Shape & mainShape,
const TopoDS_Shape & bottomFace, const TopoDS_Shape & bottomFace,
const std::list< TopoDS_Edge >& bottomEdges, std::list< TopoDS_Edge >& bottomEdges,
std::list< TopoDS_Face >& wallFaces) std::list< int > & nbEInW,
std::list< TopoDS_Face >& wallFaces)
{ {
wallFaces.clear(); wallFaces.clear();
TopTools_IndexedMapOfShape faceMap; TopTools_IndexedMapOfShape faceMap;
TopExp::MapShapes( mainShape, TopAbs_FACE, faceMap ); TopExp::MapShapes( mainShape, TopAbs_FACE, faceMap );
list< TopoDS_Edge >::const_iterator edge = bottomEdges.begin(); list< TopoDS_Edge >::iterator edge = bottomEdges.begin();
for ( ; edge != bottomEdges.end(); ++edge ) std::list< int >::iterator nbE = nbEInW.begin();
int iE = 0;
while ( edge != bottomEdges.end() )
{ {
TopTools_ListIteratorOfListOfShape ancestIt = mesh->GetAncestors( *edge ); ++iE;
for ( ; ancestIt.More(); ancestIt.Next() ) if ( BRep_Tool::Degenerated( *edge ))
{ {
const TopoDS_Shape& ancestor = ancestIt.Value(); edge = bottomEdges.erase( edge );
if ( ancestor.ShapeType() == TopAbs_FACE && // face --iE;
!bottomFace.IsSame( ancestor ) && // not bottom --(*nbE);
faceMap.FindIndex( ancestor )) // belongs to the prism }
else
{
PShapeIteratorPtr fIt = myHelper->GetAncestors( *edge, *mesh, TopAbs_FACE );
while ( fIt->more() )
{ {
wallFaces.push_back( TopoDS::Face( ancestor )); const TopoDS_Shape* face = fIt->next();
break; if ( !bottomFace.IsSame( *face ) && // not bottom
faceMap.FindIndex( *face )) // belongs to the prism
{
wallFaces.push_back( TopoDS::Face( *face ));
break;
}
} }
++edge;
}
if ( iE == *nbE )
{
iE = 0;
++nbE;
} }
} }
return ( wallFaces.size() == bottomEdges.size() ); return ( wallFaces.size() == bottomEdges.size() );

View File

@ -230,11 +230,12 @@ public:
* \param bottomEdges - edges bounding the bottom face * \param bottomEdges - edges bounding the bottom face
* \param wallFaces - faces list to fill in * \param wallFaces - faces list to fill in
*/ */
static bool GetWallFaces( SMESH_Mesh* mesh, bool GetWallFaces( SMESH_Mesh* mesh,
const TopoDS_Shape & mainShape, const TopoDS_Shape & mainShape,
const TopoDS_Shape & bottomFace, const TopoDS_Shape & bottomFace,
const std::list< TopoDS_Edge >& bottomEdges, std::list< TopoDS_Edge >& bottomEdges,
std::list< TopoDS_Face >& wallFaces); std::list< int > & nbEInW,
std::list< TopoDS_Face >& wallFaces);
private: private:

View File

@ -979,13 +979,14 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
list< TopoDS_Edge > edges1, edges2; list< TopoDS_Edge > edges1, edges2;
int nbE = FindFaceAssociation( face1, VV1, face2, VV2, edges1, edges2 ); int nbE = FindFaceAssociation( face1, VV1, face2, VV2, edges1, edges2 );
if ( !nbE ) RETURN_BAD_RESULT("FindFaceAssociation() failed"); if ( !nbE ) RETURN_BAD_RESULT("FindFaceAssociation() failed");
if ( nbE == 2 ) // only 2 edges // take care of proper association of propagated edges
bool same1 = edge1.IsSame( edges1.front() );
bool same2 = edge2.IsSame( edges2.front() );
if ( same1 != same2 )
{ {
// take care of proper association of propagated edges Reverse(edges2, nbE);
bool same1 = edge1.IsSame( edges1.front() ); if ( nbE != 2 ) // 2 degen edges of 4 (issue 0021144)
bool same2 = edge2.IsSame( edges2.front() ); edges2.splice( edges2.end(), edges2, edges2.begin());
if ( same1 != same2 )
Reverse(edges2, nbE);
} }
// store association // store association
list< TopoDS_Edge >::iterator eIt1 = edges1.begin(); list< TopoDS_Edge >::iterator eIt1 = edges1.begin();