From 22285c009f20e340ceaa9bd0ffbe23b89935efc0 Mon Sep 17 00:00:00 2001 From: mkazhdan Date: Sun, 14 Oct 2018 22:55:54 -0400 Subject: [PATCH] Updated the code to support gcc version 4.8 --- Src/AdaptiveTreeVisualization.cpp | 6 ++++++ Src/FEMTree.System.inl | 17 +++++++++++++++++ Src/FEMTree.WeightedSamples.inl | 10 ++++++++++ Src/FEMTree.h | 6 ++++++ Src/FEMTree.inl | 10 ++++++++++ Src/PoissonRecon.cpp | 5 +++++ Src/SSDRecon.cpp | 5 +++++ Src/Window.h | 4 ++-- 8 files changed, 61 insertions(+), 2 deletions(-) diff --git a/Src/AdaptiveTreeVisualization.cpp b/Src/AdaptiveTreeVisualization.cpp index d042a85..bb1c7ca 100644 --- a/Src/AdaptiveTreeVisualization.cpp +++ b/Src/AdaptiveTreeVisualization.cpp @@ -142,7 +142,13 @@ void _Execute( const FEMTree< Dim , Real >* tree , FILE* fp ) typedef PlyVertex< Real , Dim > Vertex; CoredFileMeshData< Vertex > mesh; std::function< void ( Vertex& , Point< Real , Dim > , Real , Real ) > SetVertex = []( Vertex& v , Point< Real , Dim > p , Real , Real ){ v.point = p; }; +#if defined( __GNUC__ ) && __GNUC__ < 5 + #warning "you've got me gcc version<5" + static const unsigned int DataSig = FEMDegreeAndBType< 0 , BOUNDARY_FREE >::Signature; + IsoSurfaceExtractor< Dim , Real , Vertex >::template Extract< Real >( IsotropicUIntPack< Dim , FEMSig >() , UIntPack< 0 >() , UIntPack< FEMTrivialSignature >() , *tree , ( typename FEMTree< Dim , Real >::template DensityEstimator< 0 >* )NULL , ( SparseNodeData< ProjectiveData< Real , Real > , IsotropicUIntPack< Dim , DataSig > > * )NULL , coefficients , IsoValue.value , mesh , SetVertex , NonLinearFit.set , !NonManifold.set , PolygonMesh.set , FlipOrientation.set ); +#else // !__GNUC__ || __GNUC__ >=5 IsoSurfaceExtractor< Dim , Real , Vertex >::template Extract< Real >( IsotropicUIntPack< Dim , FEMSig >() , UIntPack< 0 >() , UIntPack< FEMTrivialSignature >() , *tree , ( typename FEMTree< Dim , Real >::template DensityEstimator< 0 >* )NULL , NULL , coefficients , IsoValue.value , mesh , SetVertex , NonLinearFit.set , !NonManifold.set , PolygonMesh.set , FlipOrientation.set ); +#endif // __GNUC__ || __GNUC__ < 4 if( Verbose.set ) printf( "Got iso-surface: %.2f(s)\n" , Time()-t ); if( Verbose.set ) printf( "Vertices / Polygons: %d / %d\n" , (int)( mesh.outOfCorePointCount()+mesh.inCorePoints.size() ) , (int)mesh.polygonCount() ); diff --git a/Src/FEMTree.System.inl b/Src/FEMTree.System.inl index 8018ed4..cbe4c4a 100644 --- a/Src/FEMTree.System.inl +++ b/Src/FEMTree.System.inl @@ -758,9 +758,16 @@ void FEMTree< Dim , Real >::_solveRegularMG( UIntPack< FEMSigs ... > , typename } } +#if defined( __GNUC__ ) && __GNUC__ < 5 +#warning "you've got me gcc version<5" +template< unsigned int Dim , class Real > +template< unsigned int ... FEMSigs > +int FEMTree< Dim , Real >::_getMatrixRowSize( UIntPack< FEMSigs ... > , const typename FEMTreeNode::template ConstNeighbors< UIntPack< BSplineOverlapSizes< FEMSignature< FEMSigs >::Degree >::OverlapSize ... > >& neighbors ) const +#else // !__GNUC__ || __GNUC__ >=5 template< unsigned int Dim , class Real > template< unsigned int ... FEMSigs > int FEMTree< Dim , Real >::_getMatrixRowSize( const typename FEMTreeNode::template ConstNeighbors< UIntPack< BSplineOverlapSizes< FEMSignature< FEMSigs >::Degree >::OverlapSize ... > >& neighbors ) const +#endif // __GNUC__ || __GNUC__ < 4 { typedef UIntPack< BSplineOverlapSizes< FEMSignature< FEMSigs >::Degree >::OverlapSize ... > OverlapSizes; @@ -1519,7 +1526,12 @@ int FEMTree< Dim , Real >::_getSliceMatrixAndProlongationConstraints( UIntPack< // Get the matrix row size typename FEMTreeNode::template ConstNeighbors< OverlapSizes > neighbors , pNeighbors; neighborKey.getNeighbors( OverlapRadii() , OverlapRadii() , node , pNeighbors , neighbors ); +#if defined( __GNUC__ ) && __GNUC__ < 5 +#warning "you've got me gcc version<5" + int count = _getMatrixRowSize( UIntPack< FEMSigs ... >() , neighbors ); +#else // !__GNUC__ || __GNUC__ >=5 int count = _getMatrixRowSize< FEMSigs ... >( neighbors ); +#endif // __GNUC__ || __GNUC__ < 4 // Allocate memory for the row matrix.setRowSize( i , count ); @@ -1571,7 +1583,12 @@ SparseMatrix< Real > FEMTree< Dim , Real >::systemMatrix( UIntPack< FEMSigs ... typename FEMTreeNode::template ConstNeighbors< OverlapSizes > neighbors; neighborKey.getNeighbors( OverlapRadii() , OverlapRadii() , _sNodes.treeNodes[i] , neighbors ); +#if defined( __GNUC__ ) && __GNUC__ < 5 +#warning "you've got me gcc version<5" + matrix.setRowSize( ii , _getMatrixRowSize( UIntPack< FEMSigs ... >() , neighbors ) ); +#else // !__GNUC__ || __GNUC__ >=5 matrix.setRowSize( ii , _getMatrixRowSize< FEMSigs ... >( neighbors ) ); +#endif // __GNUC__ || __GNUC__ < 4 _setMatrixRowAndGetConstraintFromProlongation( UIntPack< FEMSigs ... >() , F , neighbors , neighbors , matrix[ii] , _sNodesBegin(depth) , stencils , stencil , bsData , ( ConstPointer( T ) )NullPointer( T ) , interpolationInfo ... ); } return matrix; diff --git a/Src/FEMTree.WeightedSamples.inl b/Src/FEMTree.WeightedSamples.inl index f87a3a6..7d5452a 100644 --- a/Src/FEMTree.WeightedSamples.inl +++ b/Src/FEMTree.WeightedSamples.inl @@ -216,7 +216,12 @@ Real FEMTree< Dim , Real >::_splatPointData( const DensityEstimator< WeightDegre } width = 1.0 / ( 1<<_localDepth( temp ) ); _v = v * weight / Real( pow( width , dim ) ) * Real( dx ); +#if defined( __GNUC__ ) && __GNUC__ < 5 +#warning "you've got me gcc version<5" + _splatPointData< CreateNodes , V >( temp , position , _v , dataInfo , dataKey ); +#else // !__GNUC__ || __GNUC__ >=5 _splatPointData< CreateNodes , V , DataSigs ... >( temp , position , _v , dataInfo , dataKey ); +#endif // __GNUC__ || __GNUC__ < 4 if( fabs(1.0-dx) > 1e-6 ) { dx = Real(1.0-dx); @@ -224,7 +229,12 @@ Real FEMTree< Dim , Real >::_splatPointData( const DensityEstimator< WeightDegre width = 1.0 / ( 1<<_localDepth( temp ) ); _v = v * weight / Real( pow( width , dim ) ) * Real( dx ); +#if defined( __GNUC__ ) && __GNUC__ < 5 +#warning "you've got me gcc version<5" + _splatPointData< CreateNodes , V >( temp , position , _v , dataInfo , dataKey ); +#else // !__GNUC__ || __GNUC__ >=5 _splatPointData< CreateNodes , V , DataSigs ... >( temp , position , _v , dataInfo , dataKey ); +#endif // __GNUC__ || __GNUC__ < 4 } return weight; } diff --git a/Src/FEMTree.h b/Src/FEMTree.h index 07298a5..e2407d2 100644 --- a/Src/FEMTree.h +++ b/Src/FEMTree.h @@ -1931,8 +1931,14 @@ protected: template< unsigned int ... FEMSigs > int _getProlongedMatrixRowSize( const FEMTreeNode* node , const typename FEMTreeNode::template ConstNeighbors< UIntPack< BSplineOverlapSizes< FEMSignature< FEMSigs >::Degree >::OverlapSize ... > >& pNeighbors ) const; +#if defined( __GNUC__ ) && __GNUC__ < 5 + #warning "you've got me gcc version<5" + template< unsigned int ... FEMSigs > + int _getMatrixRowSize( UIntPack< FEMSigs ... > , const typename FEMTreeNode::template ConstNeighbors< UIntPack< BSplineOverlapSizes< FEMSignature< FEMSigs >::Degree >::OverlapSize ... > >& neighbors ) const; +#else // !__GNUC__ || __GNUC__ >=5 template< unsigned int ... FEMSigs > int _getMatrixRowSize( const typename FEMTreeNode::template ConstNeighbors< UIntPack< BSplineOverlapSizes< FEMSignature< FEMSigs >::Degree >::OverlapSize ... > >& neighbors ) const; +#endif // __GNUC__ || __GNUC__ < 4 template< typename T , unsigned int ... PointDs , unsigned int ... FEMSigs > T _setMatrixRowAndGetConstraintFromProlongation( UIntPack< FEMSigs ... > , const BaseSystem< UIntPack< FEMSignature< FEMSigs >::Degree ... > >& F , const typename FEMTreeNode::template ConstNeighbors< UIntPack< BSplineOverlapSizes< FEMSignature< FEMSigs >::Degree >::OverlapSize ... > >& pNeighbors , const typename FEMTreeNode::template ConstNeighbors< UIntPack< BSplineOverlapSizes< FEMSignature< FEMSigs >::Degree >::OverlapSize ... > >& neighbors , Pointer( MatrixEntry< Real > ) row , int offset , const PCStencils< UIntPack< FEMSignature< FEMSigs >::Degree ... > >& pcStencils , const CCStencil< UIntPack< FEMSignature< FEMSigs >::Degree ... > >& ccStencil , const PointEvaluator< UIntPack< FEMSigs ... > , UIntPack< FEMSignature< FEMSigs >::Degree ... > >& bsData , ConstPointer( T ) prolongedSolution , const InterpolationInfo< T , PointDs >* ... interpolationInfo ) const; template< typename T , unsigned int ... PointDs , unsigned int ... FEMSigs > diff --git a/Src/FEMTree.inl b/Src/FEMTree.inl index 981cde8..763f682 100644 --- a/Src/FEMTree.inl +++ b/Src/FEMTree.inl @@ -353,11 +353,21 @@ SparseNodeData< Point< Real , Dim > , UIntPack< NormalSigs ... > > FEMTree< Dim fprintf( stderr , "\n" ); continue; } +#if defined( __GNUC__ ) && __GNUC__ < 5 +#warning "you've got me gcc version<5" + if( density ) _pointWeightSum += _splatPointData< true , DensityDegree , Point< Real , Dim > >( *density , p , n , normalField , densityKey , oneKey ? *( (NormalKey*)&densityKey ) : normalKey , 0 , maxDepth , Dim , depthBias ) * sample.weight; +#else // !__GNUC__ || __GNUC__ >=5 if( density ) _pointWeightSum += _splatPointData< true , DensityDegree , Point< Real , Dim > , NormalSigs ... >( *density , p , n , normalField , densityKey , oneKey ? *( (NormalKey*)&densityKey ) : normalKey , 0 , maxDepth , Dim , depthBias ) * sample.weight; +#endif // __GNUC__ || __GNUC__ < 4 else { Real width = (Real)( 1.0 / ( 1< >( leaf( p , maxDepth ) , p , n / (Real)pow( width , Dim ) , normalField , oneKey ? *( (NormalKey*)&densityKey ) : normalKey ); +#else // !__GNUC__ || __GNUC__ >=5 _splatPointData< true , Point< Real , Dim > , NormalSigs ... >( leaf( p , maxDepth ) , p , n / (Real)pow( width , Dim ) , normalField , oneKey ? *( (NormalKey*)&densityKey ) : normalKey ); +#endif // __GNUC__ || __GNUC__ < 4 _pointWeightSum += sample.weight; } } diff --git a/Src/PoissonRecon.cpp b/Src/PoissonRecon.cpp index d18379e..15767c5 100644 --- a/Src/PoissonRecon.cpp +++ b/Src/PoissonRecon.cpp @@ -327,7 +327,12 @@ void ExtractMesh( UIntPack< FEMSigs ... > , std::tuple< SampleData ... > , FEMTr } isoStats = IsoSurfaceExtractor< Dim , Real , Vertex >::template Extract< TotalPointSampleData >( Sigs() , UIntPack< WEIGHT_DEGREE >() , UIntPack< DataSig >() , tree , density , &_sampleData , solution , isoValue , mesh , SetVertex , !LinearFit.set , !NonManifold.set , PolygonMesh.set , false ); } +#if defined( __GNUC__ ) && __GNUC__ < 5 + #warning "you've got me gcc version<5" + else isoStats = IsoSurfaceExtractor< Dim , Real , Vertex >::template Extract< TotalPointSampleData >( Sigs() , UIntPack< WEIGHT_DEGREE >() , UIntPack< DataSig >() , tree , density , (SparseNodeData< ProjectiveData< TotalPointSampleData , Real > , IsotropicUIntPack< Dim , DataSig > > *)NULL , solution , isoValue , mesh , SetVertex , !LinearFit.set , !NonManifold.set , PolygonMesh.set , false ); +#else // !__GNUC__ || __GNUC__ >=5 else isoStats = IsoSurfaceExtractor< Dim , Real , Vertex >::template Extract< TotalPointSampleData >( Sigs() , UIntPack< WEIGHT_DEGREE >() , UIntPack< DataSig >() , tree , density , NULL , solution , isoValue , mesh , SetVertex , !LinearFit.set , !NonManifold.set , PolygonMesh.set , false ); +#endif // __GNUC__ || __GNUC__ < 4 messageWriter( "Vertices / Polygons: %d / %d\n" , mesh.outOfCorePointCount()+mesh.inCorePoints.size() , mesh.polygonCount() ); messageWriter( "Corners / Vertices / Edges / Surface / Set Table / Copy Finer: %.1f / %.1f / %.1f / %.1f / %.1f / %.1f (s)\n" , isoStats.cornersTime , isoStats.verticesTime , isoStats.edgesTime , isoStats.surfaceTime , isoStats.setTableTime , isoStats.copyFinerTime ); if( PolygonMesh.set ) profiler.dumpOutput2( comments , "# Got polygons:" ); diff --git a/Src/SSDRecon.cpp b/Src/SSDRecon.cpp index 6cc3a01..9e8a52c 100644 --- a/Src/SSDRecon.cpp +++ b/Src/SSDRecon.cpp @@ -347,7 +347,12 @@ void ExtractMesh( UIntPack< FEMSigs ... > , std::tuple< SampleData ... > , FEMTr } isoStats = IsoSurfaceExtractor< Dim , Real , Vertex >::template Extract< TotalPointSampleData >( Sigs() , UIntPack< WEIGHT_DEGREE >() , UIntPack< DataSig >() , tree , density , &_sampleData , solution , isoValue , mesh , SetVertex , NonLinearFit.set , !NonManifold.set , PolygonMesh.set , false ); } +#if defined( __GNUC__ ) && __GNUC__ < 5 + #warning "you've got me gcc version<5" + else isoStats = IsoSurfaceExtractor< Dim , Real , Vertex >::template Extract< TotalPointSampleData >( Sigs() , UIntPack< WEIGHT_DEGREE >() , UIntPack< DataSig >() , tree , density , (SparseNodeData< ProjectiveData< TotalPointSampleData , Real > , IsotropicUIntPack< Dim , DataSig > > *)NULL , solution , isoValue , mesh , SetVertex , NonLinearFit.set , !NonManifold.set , PolygonMesh.set , false ); +#else // !__GNUC__ || __GNUC__ >=5 else isoStats = IsoSurfaceExtractor< Dim , Real , Vertex >::template Extract< TotalPointSampleData >( Sigs() , UIntPack< WEIGHT_DEGREE >() , UIntPack< DataSig >() , tree , density , NULL , solution , isoValue , mesh , SetVertex , NonLinearFit.set , !NonManifold.set , PolygonMesh.set , false ); +#endif // __GNUC__ || __GNUC__ < 4 messageWriter( "Vertices / Polygons: %d / %d\n" , mesh.outOfCorePointCount()+mesh.inCorePoints.size() , mesh.polygonCount() ); messageWriter( "Corners / Vertices / Edges / Surface / Set Table / Copy Finer: %.1f / %.1f / %.1f / %.1f / %.1f / %.1f (s)\n" , isoStats.cornersTime , isoStats.verticesTime , isoStats.edgesTime , isoStats.surfaceTime , isoStats.setTableTime , isoStats.copyFinerTime ); if( PolygonMesh.set ) profiler.dumpOutput2( comments , "# Got polygons:" ); diff --git a/Src/Window.h b/Src/Window.h index fde2ec0..d482205 100644 --- a/Src/Window.h +++ b/Src/Window.h @@ -305,7 +305,7 @@ struct StaticWindow< Data , UIntPack< Ress ... > > { typedef UIntPack< Ress ... > Pack; #if defined( __GNUC__ ) && defined( DEBUG ) -#pragma message "you've got me gcc" +#warning "you've got me gcc" static const unsigned int Size; #else // !( __GNUC__ && DEBUG ) static const unsigned int Size = WindowSize< Pack >::Size; @@ -331,7 +331,7 @@ struct StaticWindow< Data , UIntPack< Res > > { typedef UIntPack< Res > Pack; #if defined( __GNUC__ ) && defined( DEBUG ) -#pragma message "you've got me gcc" +#warning "you've got me gcc" static const unsigned int Size; #else // !( __GNUC__ && DEBUG ) static const unsigned int Size = Res;