From a9d99cb0866aec51c624325d8c4d5a1133b952e1 Mon Sep 17 00:00:00 2001 From: mkazhdan Date: Wed, 24 Apr 2019 08:36:18 -0400 Subject: [PATCH] Version 11.02: Added error handling for numerical imprecision issues occuring when too many samples fall into a signle leaf node (in single-precision). --- README.md | 13 ++++++--- Src/FEMTree.Initialize.inl | 54 ++++++++++++++++++++++++++++++++++++++ Src/PreProcessor.h | 2 +- 3 files changed, 65 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8a61ff5..05b0626 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -

Adaptive Multigrid Solvers (Version 11.01)

+

Adaptive Multigrid Solvers (Version 11.02)

links executables @@ -27,10 +27,11 @@ This code-base was born from the Poisson Surface Reconstruction code. It has evo [Kazhdan and Hoppe, 2013]
Executables: -Win64
+Win64
Source Code: -ZIP GitHub
+ZIP GitHub
Older Versions: +V11.01, V11.00, V10.07, V10.06, @@ -859,9 +860,15 @@ Similarly, to reduce compilation times, support for specific degrees can be remo
  • Fixed bug with _mktemp that caused the code to crash on Windows machine with more than 26 cores. +Version 11.02: +
      +
    1. Added error handling for numerical imprecision issues arrising when too many samples fall into a leaf node. +
    +
    SUPPORT
    This work genersouly supported by NSF grants #0746039 and #1422325. + diff --git a/Src/FEMTree.Initialize.inl b/Src/FEMTree.Initialize.inl index 827774a..2488872 100644 --- a/Src/FEMTree.Initialize.inl +++ b/Src/FEMTree.Initialize.inl @@ -93,6 +93,33 @@ size_t FEMTreeInitializer< Dim , Real >::Initialize( FEMTreeNode& root , InputPo pointStream.reset(); } if( outOfBoundPoints ) WARN( "Found out-of-bound points: " , outOfBoundPoints ); + if( std::is_same< Real , float >::value ) + { + std::vector< size_t > badNodeCounts( ThreadPool::NumThreads() , 0 ); + ThreadPool::Parallel_for( 0 , samplePoints.size() , [&]( unsigned int thread , size_t i ) + { + Point< Real , Dim > start; + Real width; + samplePoints[i].node->startAndWidth( start , width ); + Point< Real , Dim > p = samplePoints[i].sample.data / samplePoints[i].sample.weight; + bool foundBadNode = false; + for( int d=0 ; dstart[d]+width ) p[d] = start[d] + width; + foundBadNode = true; + } + if( foundBadNode ) + { + samplePoints[i].sample.data = p * samplePoints[i].sample.weight; + badNodeCounts[ thread ]++; + } + } + ); + size_t badNodeCount = 0; + for( int i=0 ; i::MemoryUsage(); return pointCount; } @@ -165,6 +192,33 @@ size_t FEMTreeInitializer< Dim , Real >::Initialize( FEMTreeNode& root , InputPo } if( outOfBoundPoints ) WARN( "Found out-of-bound points: " , outOfBoundPoints ); if( badData ) WARN( "Found bad data: " , badData ); + if( std::is_same< Real , float >::value ) + { + std::vector< size_t > badNodeCounts( ThreadPool::NumThreads() , 0 ); + ThreadPool::Parallel_for( 0 , samplePoints.size() , [&]( unsigned int thread , size_t i ) + { + Point< Real , Dim > start; + Real width; + samplePoints[i].node->startAndWidth( start , width ); + Point< Real , Dim > p = samplePoints[i].sample.data / samplePoints[i].sample.weight; + bool foundBadNode = false; + for( int d=0 ; dstart[d]+width ) p[d] = start[d] + width; + foundBadNode = true; + } + if( foundBadNode ) + { + samplePoints[i].sample.data = p * samplePoints[i].sample.weight; + badNodeCounts[ thread ]++; + } + } + ); + size_t badNodeCount = 0; + for( int i=0 ; i::MemoryUsage(); return pointCount; } diff --git a/Src/PreProcessor.h b/Src/PreProcessor.h index 294c159..b7d76b9 100644 --- a/Src/PreProcessor.h +++ b/Src/PreProcessor.h @@ -44,7 +44,7 @@ DAMAGE. #define USE_DEEP_TREE_NODES // Chances are that if you are using big data, you want to support a tree with depth>15. #endif // BIG_DATA -#define VERSION "11.01" // The version of the code +#define VERSION "11.02" // The version of the code #define MEMORY_ALLOCATOR_BLOCK_SIZE 1<<12 // The chunk size for memory allocation #endif // PRE_PROCESSOR_INCLUDED \ No newline at end of file