From 490e2133d79d8a087c4f48eeef5792e4af93284f Mon Sep 17 00:00:00 2001 From: isn Date: Fri, 1 Dec 2017 21:33:50 +0300 Subject: [PATCH] bvh multi-threading (quick patch) --- src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx | 37 +++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx index acdac05b..a647763c 100644 --- a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx +++ b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx @@ -93,7 +93,19 @@ QList HYDROGUI_ShapeBathymetry::createShape() con return shapes; } +#include +#include +#include +#include +#include +class BVHB_dummy: public BVH_QueueBuilder +{ + BVHB_dummy(); + ~BVHB_dummy(); +public: + int* getNbThreads() {return &this->myNumOfThreads;} +}; void HYDROGUI_ShapeBathymetry::UpdateWithColorScale( const Handle(AIS_ColorScale)& theColorScale ) { if (!myCoords || getAISObjects().isEmpty()) @@ -111,8 +123,33 @@ void HYDROGUI_ShapeBathymetry::UpdateWithColorScale( const Handle(AIS_ColorScale myColors->SetValue( i, aColor ); } Handle(HYDROGUI_BathymetryPrs) aPntCloud = Handle(HYDROGUI_BathymetryPrs)::DownCast( getAISObjects()[0] ); + //const Handle(SelectMgr_Selection)& sel0 = aPntCloud->Selection(0); + //const Handle(SelectMgr_SensitiveEntity)& sens = sel0->Sensitive(); aPntCloud->SetPoints( myCoords, myColors ); getContext()->RecomputePrsOnly( aPntCloud, Standard_True ); + Handle(StdSelect_ViewerSelector3d) VS = getContext()->MainSelector(); + Handle(SelectMgr_ViewerSelector) VSD = Handle(SelectMgr_ViewerSelector)::DownCast(VS); + //size_t VSDsize = sizeof(VSD); + size_t VSDsize1 = sizeof(SelectMgr_ViewerSelector); + size_t mapSensSize = sizeof(SelectMgr_MapOfObjectSensitives); + SelectMgr_MapOfObjectSensitives* mapS = (SelectMgr_MapOfObjectSensitives*)((char*)VSD.get() + (VSDsize1 - mapSensSize)); + try + { + mapS->Size(); + NCollection_Handle& anEntitySet = mapS->ChangeFind (aPntCloud); + NCollection_Handle> BVH_Builder = anEntitySet->Builder(); + BVH_QueueBuilder* BVH_QB = dynamic_cast*>(BVH_Builder.get()); + int* nbt = static_cast(BVH_QB)->getNbThreads(); + if (*nbt == 1) + *nbt = 4; + } + catch (...) + { + + } + + //getContext()->LocalSelector(); + //aPntCloud->ComputeSelection(sel0, 0); getContext()->RecomputeSelectionOnly( aPntCloud ); } -- 2.39.2