EgtGeomJKernel :
- in Zmap sostituiti mutex con atomic_flag.
This commit is contained in:
@@ -21,9 +21,8 @@
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include <unordered_map>
|
||||
#include <stack>
|
||||
#include <mutex>
|
||||
#include <atomic>
|
||||
#include <tuple>
|
||||
#include <atomic>
|
||||
|
||||
typedef std::pair<Point3d, Vector3d> PNTVEC3D ;
|
||||
typedef std::vector<PNTVEC3D> PNTVEC3DVECTOR ; // vettore di intersezioni punto, vettore, tipo superficie
|
||||
@@ -557,9 +556,9 @@ class VolZmap : public IVolZmap, public IGeoObjRW
|
||||
mutable std::vector<InterVoxMatter> m_SliceXY ;
|
||||
mutable std::vector<InterVoxMatter> m_SliceXZ ;
|
||||
mutable std::vector<InterVoxMatter> m_SliceYZ ;
|
||||
mutable std::mutex m_SliceMutex ;
|
||||
mutable std::atomic_flag m_SliceFlag ;
|
||||
|
||||
std::atomic<bool> m_bIsBox ;
|
||||
bool m_bIsBox ;
|
||||
|
||||
int m_nCurrTool ;
|
||||
std::vector<Tool> m_vTool ;
|
||||
|
||||
+24
-12
@@ -1271,13 +1271,15 @@ VolZmap::ExtMarchingCubes( int nBlock, VoxelContainer& vVox) const
|
||||
bDefTopology = true ;
|
||||
}
|
||||
if ( GetBlockNFromIJK( nSlBlockIJK, nSlBlockN)) {
|
||||
m_SliceMutex.lock() ;
|
||||
while ( m_SliceFlag.test_and_set( memory_order_acquire))
|
||||
m_SliceFlag.wait( true, memory_order_relaxed) ;
|
||||
auto it = m_SliceYZ[nSlBlockN].find( nSliceN) ;
|
||||
if ( it != m_SliceYZ[nSlBlockN].end()) {
|
||||
bMatOnSlice = it->second ;
|
||||
bDefTopology = true ;
|
||||
}
|
||||
m_SliceMutex.unlock() ;
|
||||
m_SliceFlag.clear( memory_order_release) ;
|
||||
m_SliceFlag.notify_one() ;
|
||||
}
|
||||
}
|
||||
else if ( abs( nAdjVox3[nCount]) == 2) {
|
||||
@@ -1287,13 +1289,15 @@ VolZmap::ExtMarchingCubes( int nBlock, VoxelContainer& vVox) const
|
||||
bDefTopology = true ;
|
||||
}
|
||||
if ( GetBlockNFromIJK( nSlBlockIJK, nSlBlockN)) {
|
||||
m_SliceMutex.lock() ;
|
||||
while ( m_SliceFlag.test_and_set( memory_order_acquire))
|
||||
m_SliceFlag.wait( true, memory_order_relaxed) ;
|
||||
auto it = m_SliceXZ[nSlBlockN].find( nSliceN) ;
|
||||
if ( it != m_SliceXZ[nSlBlockN].end()) {
|
||||
bMatOnSlice = it->second ;
|
||||
bDefTopology = true ;
|
||||
}
|
||||
m_SliceMutex.unlock() ;
|
||||
m_SliceFlag.clear( memory_order_release) ;
|
||||
m_SliceFlag.notify_one() ;
|
||||
}
|
||||
}
|
||||
else if ( abs( nAdjVox3[nCount]) == 3) {
|
||||
@@ -1303,13 +1307,15 @@ VolZmap::ExtMarchingCubes( int nBlock, VoxelContainer& vVox) const
|
||||
bDefTopology = true ;
|
||||
}
|
||||
if ( GetBlockNFromIJK( nSlBlockIJK, nSlBlockN)) {
|
||||
m_SliceMutex.lock() ;
|
||||
while ( m_SliceFlag.test_and_set( memory_order_acquire))
|
||||
m_SliceFlag.wait( true, memory_order_relaxed) ;
|
||||
auto it = m_SliceXY[nSlBlockN].find( nSliceN) ;
|
||||
if ( it != m_SliceXY[nSlBlockN].end()) {
|
||||
bMatOnSlice = it->second ;
|
||||
bDefTopology = true ;
|
||||
}
|
||||
m_SliceMutex.unlock() ;
|
||||
m_SliceFlag.clear( memory_order_release) ;
|
||||
m_SliceFlag.notify_one() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1374,27 +1380,33 @@ VolZmap::ExtMarchingCubes( int nBlock, VoxelContainer& vVox) const
|
||||
if ( nSlBlockN == nBlock)
|
||||
SliceYZ.emplace( nSliceN, bMatOnSlice) ;
|
||||
else {
|
||||
m_SliceMutex.lock() ;
|
||||
while ( m_SliceFlag.test_and_set( memory_order_acquire))
|
||||
m_SliceFlag.wait( true, memory_order_relaxed) ;
|
||||
m_SliceYZ[nSlBlockN].emplace( nSliceN, bMatOnSlice) ;
|
||||
m_SliceMutex.unlock() ;
|
||||
m_SliceFlag.clear( memory_order_release) ;
|
||||
m_SliceFlag.notify_one() ;
|
||||
}
|
||||
}
|
||||
else if ( abs(nAdjVox3[nCount]) == 2) {
|
||||
if ( nSlBlockN == nBlock)
|
||||
SliceXZ.emplace( nSliceN, bMatOnSlice) ;
|
||||
else {
|
||||
m_SliceMutex.lock() ;
|
||||
while ( m_SliceFlag.test_and_set( memory_order_acquire))
|
||||
m_SliceFlag.wait( true, memory_order_relaxed) ;
|
||||
m_SliceXZ[nSlBlockN].emplace( nSliceN, bMatOnSlice) ;
|
||||
m_SliceMutex.unlock() ;
|
||||
m_SliceFlag.clear( memory_order_release) ;
|
||||
m_SliceFlag.notify_one() ;
|
||||
}
|
||||
}
|
||||
else if ( abs(nAdjVox3[nCount]) == 3) {
|
||||
if ( nSlBlockN == nBlock)
|
||||
SliceXY.emplace(nSliceN, bMatOnSlice) ;
|
||||
else {
|
||||
m_SliceMutex.lock() ;
|
||||
while ( m_SliceFlag.test_and_set( memory_order_acquire))
|
||||
m_SliceFlag.wait( true, memory_order_relaxed) ;
|
||||
m_SliceXY[nSlBlockN].emplace( nSliceN, bMatOnSlice) ;
|
||||
m_SliceMutex.unlock() ;
|
||||
m_SliceFlag.clear( memory_order_release) ;
|
||||
m_SliceFlag.notify_one() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user