myloaded=Standard_True;
}
-Handle(BRepTopAdaptor_TopolTool) BRepTopAdaptor_Tool::GetTopolTool() {
+Handle(BRepTopAdaptor_TopolTool) BRepTopAdaptor_Tool::GetTopolTool() const{
if(myloaded) {
return(myTopolTool);
}
}
}
-Handle(Adaptor3d_HSurface) BRepTopAdaptor_Tool::GetSurface() {
+Handle(Adaptor3d_HSurface) BRepTopAdaptor_Tool::GetSurface() const{
if(myloaded) {
return(myHSurface);
}
Standard_EXPORT void Init (const Handle(Adaptor3d_HSurface)& Surface, const Standard_Real Tol2d);
- Standard_EXPORT Handle(BRepTopAdaptor_TopolTool) GetTopolTool();
+ Standard_EXPORT Handle(BRepTopAdaptor_TopolTool) GetTopolTool() const;
Standard_EXPORT void SetTopolTool (const Handle(BRepTopAdaptor_TopolTool)& TT);
- Standard_EXPORT Handle(Adaptor3d_HSurface) GetSurface();
+ Standard_EXPORT Handle(Adaptor3d_HSurface) GetSurface() const;
Standard_EXPORT void Destroy();
~BRepTopAdaptor_Tool()
{
mySurf = S;
Standard_Integer i;
- Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S);
+ Standard_Real uinf, vinf, usup, vsup;
+ Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S, uinf, vinf, usup, vsup);
Standard_Real U,V;
// gp_Vec d1u,d1v;
gp_Vec norm;
if (nbs > 0) {
myMean = 0.;
for (i = 1; i <= nbs; i++) {
- Contap_HContTool::SamplePoint(S,i,U,V);
+ Contap_HContTool::SamplePoint(S,i,U,V, uinf, vinf, usup, vsup);
// Adaptor3d_HSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
// myMean = myMean + d1u.Crossed(d1v).Magnitude();
Contap_SurfProps::Normale(S,U,V,solpt,norm);
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
-static Standard_Real uinf,vinf,usup,vsup;
-
Standard_Integer Contap_HContTool::NbSamplesV
(const Handle(Adaptor3d_HSurface)& S,
const Standard_Real ,
}
Standard_Integer Contap_HContTool::NbSamplePoints
-(const Handle(Adaptor3d_HSurface)& S)
+(const Handle(Adaptor3d_HSurface)& S, Standard_Real& uinf, Standard_Real& vinf, Standard_Real& usup, Standard_Real& vsup)
{
uinf = S->FirstUParameter();
usup = S->LastUParameter();
void Contap_HContTool::SamplePoint (const Handle(Adaptor3d_HSurface)& S,
const Standard_Integer Index,
Standard_Real& U,
- Standard_Real& V )
+ Standard_Real& V,
+ const Standard_Real& uinf,
+ const Standard_Real& vinf,
+ const Standard_Real& usup,
+ const Standard_Real& vsup)
{
if(S->GetType() == GeomAbs_BSplineSurface) {
Standard_Integer nbIntU = NbSamplesU(S,uinf,usup)/3;
Standard_EXPORT static Standard_Integer NbSamplesV (const Handle(Adaptor3d_HSurface)& S, const Standard_Real v1, const Standard_Real v2);
- Standard_EXPORT static Standard_Integer NbSamplePoints (const Handle(Adaptor3d_HSurface)& S);
+ Standard_EXPORT static Standard_Integer NbSamplePoints (const Handle(Adaptor3d_HSurface)& S, Standard_Real& uinf, Standard_Real& vinf, Standard_Real& usup, Standard_Real& vsup);
- Standard_EXPORT static void SamplePoint (const Handle(Adaptor3d_HSurface)& S, const Standard_Integer Index, Standard_Real& U, Standard_Real& V);
+ Standard_EXPORT static void SamplePoint (const Handle(Adaptor3d_HSurface)& S, const Standard_Integer Index, Standard_Real& U, Standard_Real& V,
+ const Standard_Real& uinf, const Standard_Real& vinf, const Standard_Real& usup, const Standard_Real& vsup);
//! Returns True if all the intersection point and edges
//! are known on the Arc.
{
mySurf = S;
Standard_Integer i;
- Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S);
+ Standard_Real uinf,vinf,usup,vsup;
+ Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S,uinf,vinf,usup,vsup);
Standard_Real U,V;
gp_Vec norm;
if (nbs > 0) {
myMean = 0.;
for (i = 1; i <= nbs; i++) {
- Contap_HContTool::SamplePoint(S,i,U,V);
+ Contap_HContTool::SamplePoint(S,i,U,V,uinf,vinf,usup,vsup);
// Adaptor3d_HSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
// myMean = myMean + d1u.Crossed(d1v).Magnitude();
Contap_SurfProps::Normale(S,U,V,solpt,norm);
void HLRBRep_FaceData::Set (const TopoDS_Face& FG,
const TopAbs_Orientation Or,
const Standard_Boolean Cl,
- const Standard_Integer NW)
+ const Standard_Integer NW,
+ const Standard_Boolean isInitSurf) //TODO isInitSurf can be deleted
{
Closed(Cl);
- Geometry().Surface(FG);
+ if (isInitSurf)
+ Geometry().Surface(FG);
myTolerance = (Standard_ShortReal)(BRep_Tool::Tolerance(FG));
Orientation(Or);
Wires() = new HLRAlgo_WiresBlock(NW);
//! if the face belongs to a closed volume. <NW> is
//! the number of wires ( or block of edges ) of the
//! face.
- Standard_EXPORT void Set (const TopoDS_Face& FG, const TopAbs_Orientation Or, const Standard_Boolean Cl, const Standard_Integer NW);
+ Standard_EXPORT void Set (const TopoDS_Face& FG, const TopAbs_Orientation Or, const Standard_Boolean Cl, const Standard_Integer NW, const Standard_Boolean isInitSurf);
//! Set <NE> the number of edges of the wire number
//! <WI>.
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
+#include <OSD_Parallel.hxx>
//=======================================================================
// Function : Load
void
HLRBRep_ShapeToHLR::ExploreFace(const Handle(HLRTopoBRep_OutLiner)& S,
- const Handle(HLRBRep_Data)& DS,
+ Handle(HLRBRep_Data)& DS,
const TopTools_IndexedMapOfShape& FM,
const TopTools_IndexedMapOfShape& EM,
Standard_Integer& i,
for (Ex1.Init(theFace, TopAbs_WIRE); Ex1.More(); Ex1.Next())
nw++;
- fd.Set (theFace, orient, closed, nw);
+ fd.Set (theFace, orient, closed, nw, Standard_False);
nw = 0;
for (Ex1.Init(theFace, TopAbs_WIRE); Ex1.More(); Ex1.Next()) {
//purpose :
//=======================================================================
+
+class ParallelSurfInitFunctor
+{
+public:
+
+ ParallelSurfInitFunctor(HLRBRep_Array1OfFData& theFaceDataArr, const TopTools_IndexedMapOfShape& theFM)
+ : myFaceDataArr (theFaceDataArr), myFM (theFM)
+ {
+ }
+
+ void operator() (const Standard_Integer theIndex) const
+ {
+ const TopoDS_Face& aF = TopoDS::Face(myFM(theIndex));
+ HLRBRep_FaceData& fd = myFaceDataArr.ChangeValue(theIndex);
+ fd.Geometry().Surface( TopoDS::Face(aF.Oriented (TopAbs_FORWARD)));
+ }
+
+private:
+ ParallelSurfInitFunctor( const ParallelSurfInitFunctor& );
+ ParallelSurfInitFunctor& operator =( ParallelSurfInitFunctor& );
+
+private:
+ HLRBRep_Array1OfFData& myFaceDataArr;
+ const TopTools_IndexedMapOfShape& myFM;
+};
+
+
void
HLRBRep_ShapeToHLR::ExploreShape (const Handle(HLRTopoBRep_OutLiner)& S,
- const Handle(HLRBRep_Data)& DS,
+ Handle(HLRBRep_Data)& DS,
const TopTools_IndexedMapOfShape& FM,
const TopTools_IndexedMapOfShape& EM)
{
TopTools_MapOfShape ShapeMap;
TopExp_Explorer exshell, exface, exedge;
- Standard_Integer i = 0;
+ Standard_Integer i = 1;
+
+ ParallelSurfInitFunctor aFunctor2(DS->FDataArray(), FM);
+ OSD_Parallel::For(1, FM.Extent() + 1, aFunctor2, false);
+
+ i = 0;
for (exshell.Init (S->OriginalShape(), TopAbs_SHELL);
exshell.More ();
delete [] flag;
flag = NULL;
}
-
+
for (exface.Init(exshell.Current(), TopAbs_FACE);
exface.More();
exface.Next()) {
private:
- Standard_EXPORT static void ExploreFace (const Handle(HLRTopoBRep_OutLiner)& S, const Handle(HLRBRep_Data)& DS, const TopTools_IndexedMapOfShape& FM, const TopTools_IndexedMapOfShape& EM, Standard_Integer& i, const TopoDS_Face& F, const Standard_Boolean closed);
+ Standard_EXPORT static void ExploreFace (const Handle(HLRTopoBRep_OutLiner)& S, Handle(HLRBRep_Data)& DS, const TopTools_IndexedMapOfShape& FM, const TopTools_IndexedMapOfShape& EM, Standard_Integer& i, const TopoDS_Face& F, const Standard_Boolean closed);
- Standard_EXPORT static void ExploreShape (const Handle(HLRTopoBRep_OutLiner)& S, const Handle(HLRBRep_Data)& DS, const TopTools_IndexedMapOfShape& FM, const TopTools_IndexedMapOfShape& EM);
+ Standard_EXPORT static void ExploreShape (const Handle(HLRTopoBRep_OutLiner)& S, Handle(HLRBRep_Data)& DS, const TopTools_IndexedMapOfShape& FM, const TopTools_IndexedMapOfShape& EM);
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <HLRAlgo_Projector.hxx>
+#include <Adaptor3d_HSurface.hxx>
+#include <NCollection_Handle.hxx>
+#include <BRepAdaptor_HSurface.hxx>
+#include <OSD_Parallel.hxx>
+
+struct ContourSurfInfo
+{
+ ContourSurfInfo() : myDomain(NULL), mySurface(NULL)
+ {};
+
+ ContourSurfInfo(NCollection_Handle<Contap_Contour> theHFO,
+ const Handle(BRepTopAdaptor_TopolTool)& theDomain,
+ const Handle(Adaptor3d_HSurface) theSurface) :
+ myHFO(theHFO), myDomain (theDomain.get()), mySurface (theSurface.get())
+ {};
+
+ ContourSurfInfo& operator=( const ContourSurfInfo& otherSurfInfo)
+ {
+ myHFO = otherSurfInfo.myHFO;
+ myDomain = otherSurfInfo.myDomain;
+ mySurface = otherSurfInfo.mySurface;
+ return *this;
+ };
+
+ NCollection_Handle<Contap_Contour> myHFO;
+ const BRepTopAdaptor_TopolTool* myDomain;
+ const Adaptor3d_HSurface* mySurface;
+};
+
+struct BRTInfo
+{
+ BRTInfo()
+ {};
+
+ BRTInfo(BRepTopAdaptor_Tool* thepBRT, ContourSurfInfo* theCSI, const TopoDS_Face& theF )
+ : mypBRT (thepBRT), myCSI (theCSI), myF (theF)
+ {};
+
+ BRepTopAdaptor_Tool* mypBRT;
+ ContourSurfInfo* myCSI;
+ TopoDS_Face myF;
+};
+
+class ParallelContourFunctor
+{
+public:
+
+ ParallelContourFunctor(NCollection_Array1<ContourSurfInfo>& theContourSurfInfo)
+ : myContourSurfInfo (theContourSurfInfo)
+ {
+ }
+
+ void operator() (const Standard_Integer theIndex) const
+ {
+ ContourSurfInfo& aCSInfo = myContourSurfInfo(theIndex);
+ aCSInfo.myHFO->Perform(aCSInfo.mySurface, aCSInfo.myDomain);
+ }
+
+private:
+ ParallelContourFunctor( const ParallelContourFunctor& );
+ ParallelContourFunctor& operator =( ParallelContourFunctor& );
+
+private:
+ NCollection_Array1<ContourSurfInfo>& myContourSurfInfo;
+};
+
+
+class ParallelBRTInitFunctor
+{
+public:
+
+ ParallelBRTInitFunctor(NCollection_Array1<BRTInfo>& theBRTInfo)
+ : myBRTInfo (theBRTInfo)
+ {
+ }
+
+ void operator() (const Standard_Integer theIndex) const
+ {
+ BRTInfo& BI = myBRTInfo(theIndex);
+ BI.mypBRT->Init(BI.myF,Precision::PConfusion());
+ BI.myCSI->myDomain = BI.mypBRT->GetTopolTool().get();
+ BI.myCSI->mySurface = BI.mypBRT->GetSurface().get();
+ }
+
+private:
+ ParallelBRTInitFunctor( const ParallelBRTInitFunctor& );
+ ParallelBRTInitFunctor& operator =( ParallelBRTInitFunctor& );
+
+private:
+ NCollection_Array1<BRTInfo>& myBRTInfo;
+};
//=======================================================================
//function : Insert
//purpose : explore the faces and insert them
//=======================================================================
-
void HLRTopoBRep_DSFiller::Insert (const TopoDS_Shape& S,
- Contap_Contour& FO,
+ const HLRAlgo_Projector& P,
+ const gp_Vec& Vecz,
HLRTopoBRep_Data& DS,
BRepTopAdaptor_MapOfShapeTool& MST,
const Standard_Integer nbIso)
TopExp_Explorer ex(S,TopAbs_FACE);
DS.Clear();
Standard_Boolean withPCurve = Standard_True; // instead of nbIso != 0;
- Standard_Integer f = 0;
-
- while (ex.More()) {
- if (ShapeMap.Add(ex.Current())) {
- f++;
+
+ gp_Pnt Eye;
+ gp_Dir DirZ;
+ if (P.Perspective ())
+ Eye.SetXYZ (P.Focus ()*Vecz.XYZ ());
+ else
+ DirZ = Vecz;
+
+ NCollection_List<ContourSurfInfo> ContourSurfInfoList;
+ NCollection_List<BRTInfo> nonInitBRTs;
+
+ while (ex.More())
+ {
+ if (ShapeMap.Add(ex.Current()))
+ {
TopoDS_Face S1 = TopoDS::Face(ex.Current());
S1.Orientation(TopAbs_FORWARD);
- Handle(BRepTopAdaptor_TopolTool) Domain;
- Handle(Adaptor3d_HSurface) Surface;
- if(MST.IsBound(S1)) {
- BRepTopAdaptor_Tool& BRT = MST.ChangeFind(S1);
- Domain = BRT.GetTopolTool();
- Surface = BRT.GetSurface();
- }
- else {
- BRepTopAdaptor_Tool BRT(S1,Precision::PConfusion());
- MST.Bind(S1,BRT);
- Domain = BRT.GetTopolTool();
- Surface = BRT.GetSurface();
+ //
+ NCollection_Handle<Contap_Contour> HFO = new Contap_Contour();
+ if (P.Perspective ())
+ HFO->Init(Eye);
+ else
+ HFO->Init(DirZ);
+ //
+ BRepTopAdaptor_Tool* pBRT = MST.ChangeSeek(S1);
+ if(pBRT)
+ {
+ ContourSurfInfo CSInfo(HFO, pBRT->GetTopolTool(), pBRT->GetSurface());
+ ContourSurfInfoList.Append(CSInfo);
}
- FO.Perform(Surface, Domain);
- if (FO.IsDone()) {
- if (!FO.IsEmpty())
- InsertFace(f,S1,FO,DS,withPCurve);
+ else
+ {
+ pBRT = MST.Bound(S1,BRepTopAdaptor_Tool());
+ BRTInfo& brtI = nonInitBRTs.Append(BRTInfo());
+ brtI.mypBRT = pBRT;
+ brtI.myCSI = &ContourSurfInfoList.Append(ContourSurfInfo(HFO, NULL, NULL));
+ brtI.myF = S1;
}
- if (nbIso != 0) HLRTopoBRep_FaceIsoLiner::Perform(f,S1,DS,nbIso);
}
ex.Next();
}
+
+ //
+ NCollection_List<BRTInfo>::Iterator itBRTIt(nonInitBRTs);
+ NCollection_Array1<BRTInfo> nonInitBRTArr(1, nonInitBRTs.Extent());
+ Standard_Integer f = 1;
+ for (;itBRTIt.More();itBRTIt.Next(), f++)
+ nonInitBRTArr(f) = itBRTIt.Value();
+
+ ParallelBRTInitFunctor aFunctor1(nonInitBRTArr);
+ OSD_Parallel::For(nonInitBRTArr.Lower(), nonInitBRTArr.Upper() + 1, aFunctor1, false);
+ //
+
+ //
+ NCollection_List<ContourSurfInfo>::Iterator itCS(ContourSurfInfoList);
+ int nbC = ContourSurfInfoList.Extent();
+ f = 1;
+ NCollection_Array1<ContourSurfInfo> aContourSurfInfoArray(1, nbC);
+ for (;itCS.More();itCS.Next(), f++)
+ aContourSurfInfoArray(f) = itCS.Value();
+
+ //
+ ParallelContourFunctor aFunctor(aContourSurfInfoArray);
+ OSD_Parallel::For(aContourSurfInfoArray.Lower(), aContourSurfInfoArray.Upper() + 1, aFunctor, false);
+ //
+
+ for (f = aContourSurfInfoArray.Lower(); f <= aContourSurfInfoArray.Upper(); f++)
+ {
+ ContourSurfInfo& CSInfo = aContourSurfInfoArray(f);
+ Handle(BRepAdaptor_HSurface) BrepSurf = Handle(BRepAdaptor_HSurface)::DownCast(CSInfo.mySurface);
+ const TopoDS_Face& S1 = BrepSurf->ChangeSurface().Face();
+ if (CSInfo.myHFO->IsDone())
+ if (!CSInfo.myHFO->IsEmpty())
+ InsertFace(f,S1,*CSInfo.myHFO,DS,withPCurve);
+
+ if (nbIso != 0)
+ HLRTopoBRep_FaceIsoLiner::Perform(f,S1,DS,nbIso);
+ }
+
+ //
ProcessEdges(DS);
}
void HLRTopoBRep_DSFiller::InsertFace (const Standard_Integer /*FI*/,
const TopoDS_Face& F,
- Contap_Contour& FO,
+ const Contap_Contour& FO,
HLRTopoBRep_Data& DS,
const Standard_Boolean withPCurve)
{
class TopoDS_Vertex;
class Contap_Point;
class TopoDS_Edge;
+class HLRAlgo_Projector;
//! Provides methods to fill a HLRTopoBRep_Data.
//! Stores in <DS> the outlines of <S> using the current
//! outliner and stores the isolines in <DS> using a Hatcher.
- Standard_EXPORT static void Insert (const TopoDS_Shape& S, Contap_Contour& FO, HLRTopoBRep_Data& DS, BRepTopAdaptor_MapOfShapeTool& MST, const Standard_Integer nbIso);
+ Standard_EXPORT static void Insert (const TopoDS_Shape& S,const HLRAlgo_Projector& P, const gp_Vec& Vecz, HLRTopoBRep_Data& DS, BRepTopAdaptor_MapOfShapeTool& MST, const Standard_Integer nbIso);
//! Stores in <DS> the outlines of <F> using the current
//! outliner.
- Standard_EXPORT static void InsertFace (const Standard_Integer FI, const TopoDS_Face& F, Contap_Contour& FO, HLRTopoBRep_Data& DS, const Standard_Boolean withPCurve);
+ Standard_EXPORT static void InsertFace (const Standard_Integer FI, const TopoDS_Face& F, const Contap_Contour& FO, HLRTopoBRep_Data& DS, const Standard_Boolean withPCurve);
//! Make a vertex from an intersection point <P>and
//! store it in the data structure <DS>.
gp_Trsf Tr (P.Transformation ());
Tr.Invert ();
Vecz.Transform (Tr);
- Contap_Contour FO;
- if (P.Perspective ()) {
- gp_Pnt Eye;
- Eye.SetXYZ (P.Focus ()*Vecz.XYZ ());
- FO.Init(Eye);
- }
- else {
- gp_Dir DirZ(Vecz);
- FO.Init(DirZ);
- }
- HLRTopoBRep_DSFiller::Insert(myOriginalShape,FO,myDS,MST,nbIso);
+ HLRTopoBRep_DSFiller::Insert(myOriginalShape,P,Vecz,myDS,MST,nbIso);
BuildShape(MST);
}
}