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,
SMESH_Mesh & aMesh,
const bool forward)
TopoDS_Edge nextC1Edge(TopoDS_Edge edge,
SMESH_Mesh & aMesh,
const bool forward)
{
if (edge.Orientation() > TopAbs_REVERSED) // INTERNAL
edge.Orientation( TopAbs_FORWARD );
TopoDS_Edge eNext;
TopTools_MapOfShape edgeCounter;
edgeCounter.Add( edge );
TopoDS_Vertex v;
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
}
TopoDS_Vertex v = forward ? TopExp::LastVertex(edge,true) : TopExp::FirstVertex(edge,true);
TopTools_ListIteratorOfListOfShape ancestIt = aMesh.GetAncestors( v );
for ( ; ancestIt.More(); ancestIt.Next() )
{
@ -102,18 +94,10 @@ namespace {
if ( edgeCounter.Extent() < 3 && !eNext.IsNull() ) {
if ( SMESH_Algo::IsContinuous( edge, eNext )) {
// care of orientation
TopoDS_Vertex vn;
if (eNext.Orientation() <= TopAbs_REVERSED) // FORWARD || REVERSED
vn = forward ? TopExp::FirstVertex(eNext,true) : TopExp::LastVertex(eNext,true);
else {
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
}
if (eNext.Orientation() > TopAbs_REVERSED) // INTERNAL
eNext.Orientation( TopAbs_FORWARD );
TopoDS_Vertex vn =
forward ? TopExp::FirstVertex(eNext,true) : TopExp::LastVertex(eNext,true);
bool reverse = (!v.IsSame(vn));
if ( reverse )
eNext.Reverse();
@ -315,14 +299,17 @@ StdMeshers_CompositeSegment_1D::GetFaceSide(SMESH_Mesh& aMesh,
const bool ignoreMeshed)
{
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;
SMESH_Algo* theAlgo = aMesh.GetGen()->GetAlgo( aMesh, anEdge );
if ( theAlgo ) hypList = theAlgo->GetUsedHypothesis(aMesh, anEdge, false);
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() ) {
if ( ignoreMeshed ) {
// eNext must not have computed mesh