From 9b2a8517928c42e5f38b55218da2fdd48a64c6dc Mon Sep 17 00:00:00 2001 From: Paolo Cignoni Date: Thu, 12 Nov 2015 10:53:24 +0100 Subject: [PATCH 1/5] Two small changes to allow compilation. * _DepthAndOffset require node * diagonal is a pointer --- Src/MultiGridOctreeData.WeightedSamples.inl | 2 +- Src/SparseMatrix.inl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Src/MultiGridOctreeData.WeightedSamples.inl b/Src/MultiGridOctreeData.WeightedSamples.inl index 8cc7823..ce3b46f 100644 --- a/Src/MultiGridOctreeData.WeightedSamples.inl +++ b/Src/MultiGridOctreeData.WeightedSamples.inl @@ -477,7 +477,7 @@ V Octree< Real >::Evaluate( const SparseNodeData< V , DataDegree >& coefficients if( idx>=0 ) { int d , off[3] , pIdx[3]; - _DepthAndOffset( d , off ); + _DepthAndOffset( n , d , off ); for( int dd=0 ; dd<3 ; dd++ ) pIdx[dd] = std::max< int >( 0 , std::min< int >( BSplineData< DataDegree >::SupportSize-1 , -BSplineData< DataDegree >::SupportStart + (int)floor( ( p[dd]-s[dd] ) / w ) ) ); value += coefficients.data[idx] * diff --git a/Src/SparseMatrix.inl b/Src/SparseMatrix.inl index 45b4768..3830888 100644 --- a/Src/SparseMatrix.inl +++ b/Src/SparseMatrix.inl @@ -400,7 +400,7 @@ template< class T > template< class T2 > void SparseMatrix< T >::getDiagonal( Pointer( T2 ) diagonal , int threads ) const { - diagonal.Resize( SparseMatrix< T >::rows ); + diagonal->Resize( SparseMatrix< T >::rows ); #pragma omp parallel for num_threads( threads ) for( int i=0 ; i Date: Thu, 19 Nov 2015 17:29:53 +0100 Subject: [PATCH 2/5] Merge branch 'mkazhdan/master' # Conflicts: # Src/SparseMatrix.inl --- .gitignore | 2 ++ PoissonRecon.pro | 19 +++++++++++++++++++ Src/MultiGridOctreeData.IsoSurface.inl | 7 +++++-- Src/SparseMatrix.inl | 3 +++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100755 PoissonRecon.pro diff --git a/.gitignore b/.gitignore index 9d876da..bbfda3e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ /Debug/ /Bin/ *.opensdf + +*.user diff --git a/PoissonRecon.pro b/PoissonRecon.pro new file mode 100755 index 0000000..7944cc5 --- /dev/null +++ b/PoissonRecon.pro @@ -0,0 +1,19 @@ +INCLUDEPATH += ../../../../vcglib +INCLUDEPATH -= . +CONFIG += console stl +TEMPLATE = app +# Mac specific Config required to avoid to make application bundles +CONFIG -= app_bundle +CONFIG += console warn_off +SOURCES += Src/PoissonRecon.cpp \ + Src/MarchingCubes.cpp \ + Src/PlyFile.cpp \ + Src/CmdLineParser.cpp \ + Src/Factor.cpp \ + Src/Geometry.cpp + +QMAKE_CXXFLAGS+=-fopenmp -Wsign-compare +QMAKE_CXXFLAGS-= + +TARGET=PoissonRecon + diff --git a/Src/MultiGridOctreeData.IsoSurface.inl b/Src/MultiGridOctreeData.IsoSurface.inl index e81969d..53e6df2 100644 --- a/Src/MultiGridOctreeData.IsoSurface.inl +++ b/Src/MultiGridOctreeData.IsoSurface.inl @@ -268,8 +268,11 @@ Real Octree< Real >::GetIsoValue( const DenseNodeData< Real , FEMDegree >& solut } nodeValues[i] = value; int idx = nodeWeights.index( _sNodes.treeNodes[i] ); - Real w = nodeWeights.data[ idx ]; - if( w!=0 ) isoValue += value * w , weightSum += w; + if( idx!=-1 ) + { + Real w = nodeWeights.data[ idx ]; + if( w!=0 ) isoValue += value * w , weightSum += w; + } } } metSolution.resize( 0 ); diff --git a/Src/SparseMatrix.inl b/Src/SparseMatrix.inl index 3830888..007b7a3 100644 --- a/Src/SparseMatrix.inl +++ b/Src/SparseMatrix.inl @@ -400,7 +400,10 @@ template< class T > template< class T2 > void SparseMatrix< T >::getDiagonal( Pointer( T2 ) diagonal , int threads ) const { +<<<<<<< HEAD diagonal->Resize( SparseMatrix< T >::rows ); +======= +>>>>>>> mkazhdan/master #pragma omp parallel for num_threads( threads ) for( int i=0 ; i Date: Thu, 13 Oct 2016 16:01:06 +0200 Subject: [PATCH 3/5] removed a -fopenmp from the pro (not supported by OS X clang...) --- PoissonRecon.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PoissonRecon.pro b/PoissonRecon.pro index 7944cc5..363a02a 100755 --- a/PoissonRecon.pro +++ b/PoissonRecon.pro @@ -13,7 +13,7 @@ SOURCES += Src/PoissonRecon.cpp \ Src/Geometry.cpp QMAKE_CXXFLAGS+=-fopenmp -Wsign-compare -QMAKE_CXXFLAGS-= +macx:QMAKE_CXXFLAGS-= -fopenmp TARGET=PoissonRecon From 00a4c160153866eb6f3b8d5a088afefb0046903e Mon Sep 17 00:00:00 2001 From: Paolo Cignoni Date: Thu, 13 Oct 2016 16:52:12 +0200 Subject: [PATCH 4/5] Added omp guards, added a this-> as a workaround to a clang error --- Src/MultiGridOctreeData.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Src/MultiGridOctreeData.h b/Src/MultiGridOctreeData.h index 921c4c7..a97aecc 100644 --- a/Src/MultiGridOctreeData.h +++ b/Src/MultiGridOctreeData.h @@ -54,7 +54,9 @@ DAMAGE. #define MAX_MEMORY_GB 0 #include +#ifdef _OPENMP #include +#endif // _OPENMP #include "BSplineData.h" #include "PointStream.h" #include "Geometry.h" @@ -336,7 +338,7 @@ struct DenseNodeData Data& operator[]( const OctNode< TreeNodeData >* node ) { return _data[ node->nodeData.nodeIndex ]; } Data* operator()( const OctNode< TreeNodeData >* node ) { return ( node==NULL || node->nodeData.nodeIndex>=(int)_sz ) ? NULL : &_data[ node->nodeData.nodeIndex ]; } const Data* operator()( const OctNode< TreeNodeData >* node ) const { return ( node==NULL || node->nodeData.nodeIndex>=(int)_sz ) ? NULL : &_data[ node->nodeData.nodeIndex ]; } - int index( const OctNode< TreeNodeData >* node ) const { return ( !node || node->nodeData.nodeIndex<0 || node->nodeData.nodeIndex>=(int)_data.size() ) ? -1 : node->nodeData.nodeIndex; } + int index( const OctNode< TreeNodeData >* node ) const { return ( !node || node->nodeData.nodeIndex<0 || node->nodeData.nodeIndex>=(int)this->_data.size() ) ? -1 : node->nodeData.nodeIndex; } protected: size_t _sz; void _resize( size_t sz ){ DeletePointer( _data ) ; if( sz ) _data = NewPointer< Data >( sz ) ; else _data = NullPointer( Data ) ; _sz = sz; } From 120d8c0fb48c1dadabd2ea005e0309dd885defe0 Mon Sep 17 00:00:00 2001 From: Paolo Cignoni Date: Mon, 17 Oct 2016 23:13:29 +0200 Subject: [PATCH 5/5] Updated the pro to allow the use of openmp on mac --- PoissonRecon.pro | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/PoissonRecon.pro b/PoissonRecon.pro index 363a02a..a2e5b36 100755 --- a/PoissonRecon.pro +++ b/PoissonRecon.pro @@ -1,10 +1,25 @@ -INCLUDEPATH += ../../../../vcglib +QT -= core gui INCLUDEPATH -= . -CONFIG += console stl -TEMPLATE = app + +### begin mac specific part ################# +# On OSX xcode clang does NOT support OpenMP. +# Use these two lines if you installed an alternative clang with macport +# (something like 'sudo port install clang-3.9') +macx:QMAKE_CXX = clang++-mp-3.9 +macx:QMAKE_LFLAGS += -L/opt/local/lib/libomp -lomp + +# Use this if you want to use the standard clang distributed with xcode +# macx:QMAKE_CXXFLAGS-= -fopenmp + # Mac specific Config required to avoid to make application bundles CONFIG -= app_bundle +### end of mac specific part ################# + +QMAKE_CXXFLAGS+=-fopenmp -Wsign-compare -O3 -DRELEASE -funroll-loops -ffast-math + CONFIG += console warn_off +TEMPLATE = app + SOURCES += Src/PoissonRecon.cpp \ Src/MarchingCubes.cpp \ Src/PlyFile.cpp \ @@ -12,8 +27,6 @@ SOURCES += Src/PoissonRecon.cpp \ Src/Factor.cpp \ Src/Geometry.cpp -QMAKE_CXXFLAGS+=-fopenmp -Wsign-compare -macx:QMAKE_CXXFLAGS-= -fopenmp TARGET=PoissonRecon