diff --git a/SurfBezier.cpp b/SurfBezier.cpp index f09a71f..dbec34c 100644 --- a/SurfBezier.cpp +++ b/SurfBezier.cpp @@ -41,6 +41,7 @@ #include "/EgtDev/Include/EGkGeoPoint3d.h" #include "/EgtDev/Include/EGkIntervals.h" #include "/EgtDev/Extern/Eigen/Dense" +#include "/EgtDev/Include/EgtPerfCounter.h" using namespace std ; @@ -1797,13 +1798,18 @@ SurfBezier::GetApproxSurf( double dTol, double dSideMin) const // resetto il vettore degli edge m_mCCEdge.clear() ; m_vCCLoop.clear() ; + //debug + static PerformanceCounter Counter; + static double dTotCount = 0. ; + Counter.Start(); + //debug for ( int i = 0 ; i < (int) vTrees.size() ; ++ i) { Point3d ptMin = get<0>( vTrees[i]) ; Point3d ptMax = get<1>( vTrees[i]) ; Tree.SetSurf( this, ptMin, ptMax) ; Tree.BuildTree( dTol, dSideMin) ; - if ( ! Tree.GetPolygons( vvPL, vvPL3d, m_mCCEdge, m_vCCLoop)) - continue ; + if ( ! Tree.GetPolygons(vvPL, vvPL3d, m_mCCEdge, m_vCCLoop)) + continue ; //Tree.GetPolygonsBasic( vPL, true) ; // per usare i polygon basic // aggiorno la chiusura della superficie @@ -1813,6 +1819,12 @@ SurfBezier::GetApproxSurf( double dTol, double dSideMin) const // UpdateEdgesFromTree( Tree) ; // ora viene fatto nella GetPolygons } + //debug + dTotCount += Counter.Stop() ; + string sOut = "CalcTree=" + ToString( dTotCount, 3) ; + LOG_INFO( GetEGkLogger(), sOut.c_str()) + //debug + //// per usare i polygon basic////////////////////// //for (int k = 0 ; k < (int)vPL.size(); ++k) { // vvPL.emplace_back() ; diff --git a/Tree.h b/Tree.h index 460189f..8d7dab3 100644 --- a/Tree.h +++ b/Tree.h @@ -20,6 +20,8 @@ #include "/EgtDev/Include/EGkPolyLine.h" #include "/EgtDev/Include/EGkChainCurves.h" #include +#include "/EgtDev/Extern/abseil/Include/container.h" +#include "/EgtDev/Extern/abseil/Include/flat_hash_map.h" #include struct PairHashInt64 { @@ -312,7 +314,7 @@ class Tree private : const SurfBezier* m_pSrfBz ; // superficie di bezier bool m_bTrimmed ; // superficie trimmata - std::unordered_map m_mChunk ; // mappa in cui vengono salvati chunk di appartenza per ogni loop di trim + absl::flat_hash_map m_mChunk ; // mappa in cui vengono salvati chunk di appartenza per ogni loop di trim std::vector> m_vPlApprox ; // vettore contenente le approssimazioni dei loop // il bool indica se la curva è CCW bool m_bBilinear ; // superficie bilineare bool m_bMulti ; // superficie multi-patch @@ -323,8 +325,8 @@ class Tree int m_nDegV ; // grado della superficie nel parametro V int m_nSpanU ; // numero di span lungo il parametro U int m_nSpanV ; // numero di span lungo il parametro V - std::unordered_map m_mTree ; // mappa che contiene tutti i nodi e le foglie dell'albero. -2 è puntatore Null e -1 è root - mutable std::unordered_map,Point3d,PairHashInt64> m_mPt3d ; // mappa che contiene tutti i punti 3d della superficie calcolati (la chiave sono le coordinate, moltiplicate per 2^24 e trasformate in int) + absl::flat_hash_map m_mTree ; // mappa che contiene tutti i nodi e le foglie dell'albero. -2 è puntatore Null e -1 è root + mutable absl::flat_hash_map,Point3d,PairHashInt64> m_mPt3d ; // mappa che contiene tutti i punti 3d della superficie calcolati (la chiave sono le coordinate, moltiplicate per 2^24 e trasformate in int) INTVECTOR m_vnLeaves ; // vettore delle foglie INTVECTOR m_vnParents ; // vettore delle celle ottenute dalla divisione preliminare in singole patch ICRVCOMPOPOVECTOR m_vCCLoop2D ; // vettore che contiene le CurveCompo che rappresentano i loop di trim tenendo conto della divisione in celle diff --git a/VolZmapVolume.cpp b/VolZmapVolume.cpp index 5a86031..863ab0e 100644 --- a/VolZmapVolume.cpp +++ b/VolZmapVolume.cpp @@ -2436,7 +2436,7 @@ VolZmap::MillingGeneralMotionStep( const Point3d& ptPs, const Vector3d& vtDs, co const Point3d& ptPe, const Vector3d& vtDe, const Vector3d& vtAe) { // Flag per impostare vecchia (approssimativa) o nuova modalità di calcolo - constexpr bool OLD_LINEAR = true ; + constexpr bool OLD_LINEAR = false ; // Deve essere definito l'utensile corrente if ( m_nCurrTool < 0 || m_nCurrTool >= int( m_vTool.size())) diff --git a/stdafx.h b/stdafx.h index b85a1e6..d07ed19 100644 --- a/stdafx.h +++ b/stdafx.h @@ -34,3 +34,4 @@ #pragma comment(lib, EGTLIBDIR "EgtGeneral" EGTLIBVER ".lib") #pragma comment(lib, EGTLIBDIR "EgtNumKernel" EGTLIBVER ".lib") #pragma comment(lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib") +#pragma comment(lib, EGTLIBDIR "abseil" EGTLIBVER ".lib")