}
return _surfaceInt;
}
- bool IsThreadSafe() const;
+ bool IsThreadSafe(set< const Standard_Transient* >& noSafeTShapes) const;
};
// --------------------------------------------------------------------------
/*!
/*
* check if its face can be safely intersected in a thread
*/
- bool FaceGridIntersector::IsThreadSafe() const
+ bool FaceGridIntersector::IsThreadSafe(set< const Standard_Transient* >& noSafeTShapes) const
{
+ bool isSafe = true;
+
// check surface
TopLoc_Location loc;
Handle(Geom_Surface) surf = BRep_Tool::Surface( _face, loc );
}
if ( surf->IsKind( STANDARD_TYPE(Geom_BSplineSurface )) ||
surf->IsKind( STANDARD_TYPE(Geom_BezierSurface )))
- return false;
+ if ( !noSafeTShapes.insert((const Standard_Transient*) _face.TShape() ).second )
+ isSafe = false;
double f, l;
TopExp_Explorer exp( _face, TopAbs_EDGE );
for ( ; exp.More(); exp.Next() )
{
+ bool edgeIsSafe = true;
const TopoDS_Edge& e = TopoDS::Edge( exp.Current() );
// check 3d curve
{
}
if ( c->IsKind( STANDARD_TYPE(Geom_BSplineCurve )) ||
c->IsKind( STANDARD_TYPE(Geom_BezierCurve )))
- return false;
+ edgeIsSafe = false;
}
}
// check 2d curve
+ if ( edgeIsSafe )
{
Handle(Geom2d_Curve) c2 = BRep_Tool::CurveOnSurface( e, surf, loc, f, l);
if ( !c2.IsNull() )
}
if ( c2->IsKind( STANDARD_TYPE(Geom2d_BSplineCurve )) ||
c2->IsKind( STANDARD_TYPE(Geom2d_BezierCurve )))
- return false;
+ edgeIsSafe = false;
}
}
+ if ( !edgeIsSafe && !noSafeTShapes.insert((const Standard_Transient*) e.TShape() ).second )
+ isSafe = false;
}
- return true;
+ return isSafe;
}
//================================================================================
/*!
nbIntHex = 0;
for ( size_t i = 0; i < intersectedHex.size(); ++i )
{
- Hexahedron * hex = intersectedHex[ i ];
+ Hexahedron * & hex = intersectedHex[ i ];
if ( hex )
{
intHexInd[ nbIntHex++ ] = i;
--nbIntHex;
}
}
+ else if ( _nbCornerNodes > 3 && !hex )
+ {
+ // all intersection of hex with geometry are at grid nodes
+ hex = new Hexahedron( *this );
+ hex->init( i );
+ intHexInd.push_back(0);
+ intHexInd[ nbIntHex++ ] = i;
+ }
}
// add elements resulted from hexadron intersection
li.LineIndex10(),
li.LineIndex01(),
li.LineIndex11() };
- bool allLinksOut = true;
+ bool allLinksOut = true, hasLinks = false;
for ( int iL = 0; iL < 4 && allLinksOut; ++iL ) // loop on 4 links parallel to iDir
{
const _Link& link = _hexLinks[ iL + 4*iDir ];
firstIntPnt = link._intNodes[0]._intPoint;
}
- if ( firstIntPnt && firstIntPnt->_transition == Trans_IN )
- allLinksOut = false;
+ if ( firstIntPnt )
+ {
+ hasLinks = true;
+ allLinksOut = ( firstIntPnt->_transition == Trans_OUT );
+ }
}
- if ( allLinksOut )
+ if ( hasLinks && allLinksOut )
return true;
}
return false;
BRepBuilderAPI_Copy copier;
for ( size_t i = 0; i < facesItersectors.size(); ++i )
{
- if ( !facesItersectors[i].IsThreadSafe() &&
- !tshapes.insert((const Standard_Transient*) facesItersectors[i]._face.TShape() ).second )
+ if ( !facesItersectors[i].IsThreadSafe(tshapes) )
{
copier.Perform( facesItersectors[i]._face );
facesItersectors[i]._face = TopoDS::Face( copier );