PAL21718: Composite Side Discretisation 1D Algorithm works incorrently with attached shape.

* Avoid pb with internal edges
This commit is contained in:
eap 2010-04-27 09:25:36 +00:00
parent 29e4ddd7e5
commit 48bd54b61b

View File

@ -74,24 +74,16 @@ namespace {
*/ */
//================================================================================ //================================================================================
TopoDS_Edge nextC1Edge(const TopoDS_Edge& edge, TopoDS_Edge nextC1Edge(TopoDS_Edge edge,
SMESH_Mesh & aMesh, SMESH_Mesh & aMesh,
const bool forward) const bool forward)
{ {
if (edge.Orientation() > TopAbs_REVERSED) // INTERNAL
edge.Orientation( TopAbs_FORWARD );
TopoDS_Edge eNext; TopoDS_Edge eNext;
TopTools_MapOfShape edgeCounter; TopTools_MapOfShape edgeCounter;
edgeCounter.Add( edge ); edgeCounter.Add( edge );
TopoDS_Vertex v; TopoDS_Vertex v = forward ? TopExp::LastVertex(edge,true) : TopExp::FirstVertex(edge,true);
if (edge.Orientation() <= TopAbs_REVERSED) // FORWARD || REVERSED
v = forward ? TopExp::LastVertex(edge,true) : TopExp::FirstVertex(edge,true);
else {
TopoDS_Iterator vIt (edge);
if (forward)
for (; vIt.More(); vIt.Next())
v = TopoDS::Vertex(vIt.Value()); // last
else if (vIt.More())
v = TopoDS::Vertex(vIt.Value()); // first
}
TopTools_ListIteratorOfListOfShape ancestIt = aMesh.GetAncestors( v ); TopTools_ListIteratorOfListOfShape ancestIt = aMesh.GetAncestors( v );
for ( ; ancestIt.More(); ancestIt.Next() ) for ( ; ancestIt.More(); ancestIt.Next() )
{ {
@ -102,18 +94,10 @@ namespace {
if ( edgeCounter.Extent() < 3 && !eNext.IsNull() ) { if ( edgeCounter.Extent() < 3 && !eNext.IsNull() ) {
if ( SMESH_Algo::IsContinuous( edge, eNext )) { if ( SMESH_Algo::IsContinuous( edge, eNext )) {
// care of orientation // care of orientation
TopoDS_Vertex vn; if (eNext.Orientation() > TopAbs_REVERSED) // INTERNAL
if (eNext.Orientation() <= TopAbs_REVERSED) // FORWARD || REVERSED eNext.Orientation( TopAbs_FORWARD );
vn = forward ? TopExp::FirstVertex(eNext,true) : TopExp::LastVertex(eNext,true); TopoDS_Vertex vn =
else { forward ? TopExp::FirstVertex(eNext,true) : TopExp::LastVertex(eNext,true);
TopoDS_Iterator vIt (eNext);
if (forward)
vn = TopoDS::Vertex(vIt.Value()); // first
else if (vIt.More())
for (; vIt.More(); vIt.Next())
vn = TopoDS::Vertex(vIt.Value()); // last
}
bool reverse = (!v.IsSame(vn)); bool reverse = (!v.IsSame(vn));
if ( reverse ) if ( reverse )
eNext.Reverse(); eNext.Reverse();
@ -315,14 +299,17 @@ StdMeshers_CompositeSegment_1D::GetFaceSide(SMESH_Mesh& aMesh,
const bool ignoreMeshed) const bool ignoreMeshed)
{ {
list< TopoDS_Edge > edges; list< TopoDS_Edge > edges;
edges.push_back( anEdge ); if ( anEdge.Orientation() <= TopAbs_REVERSED )
edges.push_back( anEdge );
else
edges.push_back( TopoDS::Edge( anEdge.Oriented( TopAbs_FORWARD ))); // PAL21718
list <const SMESHDS_Hypothesis *> hypList; list <const SMESHDS_Hypothesis *> hypList;
SMESH_Algo* theAlgo = aMesh.GetGen()->GetAlgo( aMesh, anEdge ); SMESH_Algo* theAlgo = aMesh.GetGen()->GetAlgo( aMesh, anEdge );
if ( theAlgo ) hypList = theAlgo->GetUsedHypothesis(aMesh, anEdge, false); if ( theAlgo ) hypList = theAlgo->GetUsedHypothesis(aMesh, anEdge, false);
for ( int forward = 0; forward < 2; ++forward ) for ( int forward = 0; forward < 2; ++forward )
{ {
TopoDS_Edge eNext = nextC1Edge( anEdge, aMesh, forward ); TopoDS_Edge eNext = nextC1Edge( edges.back(), aMesh, forward );
while ( !eNext.IsNull() ) { while ( !eNext.IsNull() ) {
if ( ignoreMeshed ) { if ( ignoreMeshed ) {
// eNext must not have computed mesh // eNext must not have computed mesh