Updated the code to support gcc version 4.8

This commit is contained in:
mkazhdan
2018-10-14 22:55:54 -04:00
parent 7d3ba8552e
commit 22285c009f
8 changed files with 61 additions and 2 deletions
+6
View File
@@ -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() );
+17
View File
@@ -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;
+10
View File
@@ -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;
}
+6
View File
@@ -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 >
+10
View File
@@ -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<<maxDepth ) );
#if defined( __GNUC__ ) && __GNUC__ < 5
#warning "you've got me gcc version<5"
_splatPointData< true , Point< Real , Dim > >( 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;
}
}
+5
View File
@@ -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:" );
+5
View File
@@ -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:" );
+2 -2
View File
@@ -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;