Commit 2b6ef96d authored by Matthias Möller's avatar Matthias Möller
Browse files

fixes some cpp check warnings

refs #1403

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free-Staging@16367 383ad7c9-94d9-4d36-a494-682f7c89f535
parent a16779e6
...@@ -90,9 +90,9 @@ template< class C > ConstArray< C > GetPointer( const std::vector< C >& v ){ ret ...@@ -90,9 +90,9 @@ template< class C > ConstArray< C > GetPointer( const std::vector< C >& v ){ ret
#define DeletePointer( ... ) { if( __VA_ARGS__ ) delete[] __VA_ARGS__ , __VA_ARGS__ = NULL; } #define DeletePointer( ... ) { if( __VA_ARGS__ ) delete[] __VA_ARGS__ , __VA_ARGS__ = NULL; }
template< class C > C* NewPointer( size_t size , const char* name=NULL ){ return new C[size]; } template< class C > C* NewPointer( size_t size , const char* name=NULL ){ return new C[size]; }
template< class C > C* AllocPointer( size_t size , const char* name=NULL ){ return (C*) malloc( sizeof(C) * size ); } template< class C > C* AllocPointer( size_t size , const char* name=NULL ){ return static_cast<C*> (malloc( sizeof(C) * size )); }
template< class C > C* AlignedAllocPointer( size_t size , size_t alignment , const char* name=NULL ){ return (C*)aligned_malloc( sizeof(C) * size , alignment ); } template< class C > C* AlignedAllocPointer( size_t size , size_t alignment , const char* name=NULL ){ return static_cast<C*>(aligned_malloc( sizeof(C) * size , alignment )); }
template< class C > C* ReAllocPointer( C* c , size_t size , const char* name=NULL ){ return (C*) realloc( c , sizeof(C) * size ); } template< class C > C* ReAllocPointer( C* c , size_t size , const char* name=NULL ){ return static_cast<C*> (realloc( c , sizeof(C) * size )); }
template< class C > C* NullPointer( void ){ return NULL; } template< class C > C* NullPointer( void ){ return NULL; }
......
...@@ -33,13 +33,13 @@ DAMAGE. ...@@ -33,13 +33,13 @@ DAMAGE.
#include "PPolynomial.h" #include "PPolynomial.h"
#include "Array.h" #include "Array.h"
template< unsigned int Degree > template< int Degree >
struct BSplineElementCoefficients struct BSplineElementCoefficients
{ {
int coeffs[Degree+1]; int coeffs[Degree+1];
BSplineElementCoefficients( void ) { memset( coeffs , 0 , sizeof( int ) * ( Degree+1 ) ); } BSplineElementCoefficients( void ) { memset( coeffs , 0 , sizeof( int ) * ( Degree+1 ) ); }
int& operator[]( int idx ){ return coeffs[idx]; } int& operator[]( unsigned int idx ){ if (idx <= Degree) return coeffs[idx]; return coeffs[0];}
const int& operator[]( int idx ) const { return coeffs[idx]; } const int& operator[]( unsigned int idx ) const {if (idx <= Degree) return coeffs[idx]; return coeffs[0];}
}; };
template< int Degree > template< int Degree >
struct BSplineElements : public std::vector< BSplineElementCoefficients< Degree > > struct BSplineElements : public std::vector< BSplineElementCoefficients< Degree > >
...@@ -83,11 +83,11 @@ public: ...@@ -83,11 +83,11 @@ public:
struct BSplineComponents struct BSplineComponents
{ {
Polynomial< Degree > polys[Degree+1]; Polynomial< Degree > polys[Degree+1];
Polynomial< Degree >& operator[] ( int idx ) { return polys[idx]; } Polynomial< Degree >& operator[] ( unsigned int idx ) { return polys[idx]; }
const Polynomial< Degree >& operator[] ( int idx ) const { return polys[idx]; } const Polynomial< Degree >& operator[] ( unsigned int idx ) const { return polys[idx]; }
void printnl( void ) const { for( int d=0 ; d<=Degree ; d++ ) polys[d].printnl(); } void printnl( void ) const { for( int d=0 ; d<=Degree ; d++ ) polys[d].printnl(); }
BSplineComponents scale( double s ) const { BSplineComponents b ; for( int d=0 ; d<=Degree ; d++ ) b[d] = polys[d].scale(s) ; return b; } BSplineComponents scale( double s ) const { BSplineComponents b ; for( unsigned int d=0 ; d<=Degree ; d++ ) b[d] = polys[d].scale(s) ; return b; }
BSplineComponents shift( double s ) const { BSplineComponents b ; for( int d=0 ; d<=Degree ; d++ ) b[d] = polys[d].shift(s) ; return b; } BSplineComponents shift( double s ) const { BSplineComponents b ; for( unsigned int d=0 ; d<=Degree ; d++ ) b[d] = polys[d].shift(s) ; return b; }
}; };
const static int VV_DOT_FLAG = 1; const static int VV_DOT_FLAG = 1;
const static int DV_DOT_FLAG = 2; const static int DV_DOT_FLAG = 2;
......
...@@ -73,16 +73,21 @@ template< int Degree > inline int ReflectRight( unsigned int depth , int offset ...@@ -73,16 +73,21 @@ template< int Degree > inline int ReflectRight( unsigned int depth , int offset
else return r-1-offset; else return r-1-offset;
} }
template< int Degree , class Real > template<int Degree,class Real>
BSplineData<Degree,Real>::BSplineData( void ) : BSplineData<Degree,Real>::BSplineData( void ) :
depth(0) useDotRatios(false),
boundaryType(0),
depth(0),
functionCount(0),
sampleCount(0),
baseFunctions(NULL),
baseBSplines(NULL)
{ {
vvDotTable = dvDotTable = ddDotTable = NullPointer< Real >(); vvDotTable = dvDotTable = ddDotTable = NullPointer< Real >();
valueTables = dValueTables = NullPointer< Real >(); valueTables = dValueTables = NullPointer< Real >();
functionCount = sampleCount = 0;
} }
template< int Degree , class Real > template<int Degree,class Real>
BSplineData< Degree , Real >::~BSplineData(void) BSplineData< Degree , Real >::~BSplineData(void)
{ {
if( functionCount ) if( functionCount )
...@@ -96,7 +101,7 @@ BSplineData< Degree , Real >::~BSplineData(void) ...@@ -96,7 +101,7 @@ BSplineData< Degree , Real >::~BSplineData(void)
functionCount = 0; functionCount = 0;
} }
template< int Degree , class Real > template<int Degree,class Real>
void BSplineData<Degree,Real>::set( int maxDepth , bool useDotRatios , int boundaryType ) void BSplineData<Degree,Real>::set( int maxDepth , bool useDotRatios , int boundaryType )
{ {
this->useDotRatios = useDotRatios; this->useDotRatios = useDotRatios;
...@@ -290,7 +295,7 @@ void BSplineData<Degree,Real>::setDotTables( int flags , bool inset ) ...@@ -290,7 +295,7 @@ void BSplineData<Degree,Real>::setDotTables( int flags , bool inset )
} }
} }
} }
template<int Degree,class Real> template< int Degree,class Real>
void BSplineData<Degree,Real>::clearDotTables( int flags ) void BSplineData<Degree,Real>::clearDotTables( int flags )
{ {
if( (flags & VV_DOT_FLAG) && vvDotTable ) DeletePointer( vvDotTable ); if( (flags & VV_DOT_FLAG) && vvDotTable ) DeletePointer( vvDotTable );
...@@ -316,7 +321,7 @@ void BSplineData< Degree , Real >::setSampleSpan( int idx , int& start , int& en ...@@ -316,7 +321,7 @@ void BSplineData< Degree , Real >::setSampleSpan( int idx , int& start , int& en
end = int( ceil( _end * (sampleCount-1) - 1 ) ); end = int( ceil( _end * (sampleCount-1) - 1 ) );
if( end>=sampleCount ) end = sampleCount-1; if( end>=sampleCount ) end = sampleCount-1;
} }
template<int Degree,class Real> template< int Degree,class Real>
void BSplineData<Degree,Real>::setValueTables( int flags , double smooth ) void BSplineData<Degree,Real>::setValueTables( int flags , double smooth )
{ {
clearValueTables(); clearValueTables();
...@@ -344,7 +349,7 @@ void BSplineData<Degree,Real>::setValueTables( int flags , double smooth ) ...@@ -344,7 +349,7 @@ void BSplineData<Degree,Real>::setValueTables( int flags , double smooth )
} }
} }
} }
template<int Degree,class Real> template< int Degree,class Real>
void BSplineData<Degree,Real>::setValueTables( int flags , double valueSmooth , double derivativeSmooth ) void BSplineData<Degree,Real>::setValueTables( int flags , double valueSmooth , double derivativeSmooth )
{ {
clearValueTables(); clearValueTables();
...@@ -369,21 +374,21 @@ void BSplineData<Degree,Real>::setValueTables( int flags , double valueSmooth , ...@@ -369,21 +374,21 @@ void BSplineData<Degree,Real>::setValueTables( int flags , double valueSmooth ,
} }
template<int Degree,class Real> template< int Degree,class Real>
void BSplineData<Degree,Real>::clearValueTables(void){ void BSplineData<Degree,Real>::clearValueTables(void){
if( valueTables ) DeletePointer( valueTables ); if( valueTables ) DeletePointer( valueTables );
if( dValueTables ) DeletePointer( dValueTables ); if( dValueTables ) DeletePointer( dValueTables );
} }
template<int Degree,class Real> template< int Degree,class Real>
inline int BSplineData<Degree,Real>::Index( int i1 , int i2 ) const { return i1*functionCount+i2; } inline int BSplineData<Degree,Real>::Index( int i1 , int i2 ) const { return i1*functionCount+i2; }
template<int Degree,class Real> template< int Degree,class Real>
inline int BSplineData<Degree,Real>::SymmetricIndex( int i1 , int i2 ) inline int BSplineData<Degree,Real>::SymmetricIndex( int i1 , int i2 )
{ {
if( i1>i2 ) return ((i1*i1+i1)>>1)+i2; if( i1>i2 ) return ((i1*i1+i1)>>1)+i2;
else return ((i2*i2+i2)>>1)+i1; else return ((i2*i2+i2)>>1)+i1;
} }
template<int Degree,class Real> template< int Degree,class Real>
inline int BSplineData<Degree,Real>::SymmetricIndex( int i1 , int i2 , int& index ) inline int BSplineData<Degree,Real>::SymmetricIndex( int i1 , int i2 , int& index )
{ {
if( i1<i2 ) if( i1<i2 )
...@@ -513,9 +518,9 @@ void BSplineElements< Degree >::differentiate( BSplineElements< Degree-1 >& d ) ...@@ -513,9 +518,9 @@ void BSplineElements< Degree >::differentiate( BSplineElements< Degree-1 >& d )
{ {
d.resize( this->size() ); d.resize( this->size() );
d.assign( d.size() , BSplineElementCoefficients< Degree-1 >() ); d.assign( d.size() , BSplineElementCoefficients< Degree-1 >() );
for( int i=0 ; i<int(this->size()) ; i++ ) for( int j=0 ; j<=Degree ; j++ ) for(int i=0 ; i<int(this->size()) ; i++ ) for(int j=0 ; j<=Degree ; j++ )
{ {
if( j-1>=0 ) d[i][j-1] -= (*this)[i][j]; if( j>0 ) d[i][j-1] -= (*this)[i][j];
if( j<Degree ) d[i][j ] += (*this)[i][j]; if( j<Degree ) d[i][j ] += (*this)[i][j];
} }
d.denominator = denominator; d.denominator = denominator;
...@@ -525,10 +530,10 @@ void BSplineElements< Degree >::differentiate( BSplineElements< Degree-1 >& d ) ...@@ -525,10 +530,10 @@ void BSplineElements< Degree >::differentiate( BSplineElements< Degree-1 >& d )
template< int Degree1 , int Degree2 > template< int Degree1 , int Degree2 >
void SetBSplineElementIntegrals( double integrals[Degree1+1][Degree2+1] ) void SetBSplineElementIntegrals( double integrals[Degree1+1][Degree2+1] )
{ {
for( int i=0 ; i<=Degree1 ; i++ ) for(int i=0 ; i<=Degree1 ; i++ )
{ {
Polynomial< Degree1 > p1 = Polynomial< Degree1 >::BSplineComponent( i ); Polynomial< Degree1 > p1 = Polynomial< Degree1 >::BSplineComponent( i );
for( int j=0 ; j<=Degree2 ; j++ ) for(int j=0 ; j<=Degree2 ; j++ )
{ {
Polynomial< Degree2 > p2 = Polynomial< Degree2 >::BSplineComponent( j ); Polynomial< Degree2 > p2 = Polynomial< Degree2 >::BSplineComponent( j );
integrals[i][j] = ( p1 * p2 ).integral( 0 , 1 ); integrals[i][j] = ( p1 * p2 ).integral( 0 , 1 );
......
...@@ -164,6 +164,9 @@ CoredFileMeshData::CoredFileMeshData( void ) ...@@ -164,6 +164,9 @@ CoredFileMeshData::CoredFileMeshData( void )
oocPointFile = new BufferedReadWriteFile(); oocPointFile = new BufferedReadWriteFile();
polygonFile = new BufferedReadWriteFile(); polygonFile = new BufferedReadWriteFile();
memset(pointFileName,0,sizeof(char)*1024);
memset(polygonFileName,0,sizeof(char)*1024);
} }
CoredFileMeshData::~CoredFileMeshData( void ) CoredFileMeshData::~CoredFileMeshData( void )
{ {
......
...@@ -29,8 +29,10 @@ DAMAGE. ...@@ -29,8 +29,10 @@ DAMAGE.
#ifndef GEOMETRY_INCLUDED #ifndef GEOMETRY_INCLUDED
#define GEOMETRY_INCLUDED #define GEOMETRY_INCLUDED
#include <math.h> #include <cmath>
#include <vector> #include <vector>
#include <cstdio>
#include <cstdlib>
#include "Hash.h" #include "Hash.h"
template<class Real> template<class Real>
...@@ -308,11 +310,11 @@ public: ...@@ -308,11 +310,11 @@ public:
{ {
Point3D< float > start , end; Point3D< float > start , end;
float value; float value;
Vertex( void ) { ; } Vertex( void ):value(0.f) { ; }
Vertex( Point3D< float > s , Point3D< float > e , float v ) { start = s , end = e , value = v; } Vertex( Point3D< float > s , Point3D< float > e , float v ):start(s),end(e),value(v) { }
Vertex( Point3D< float > s , Point3D< float > e , Point3D< float > p ) Vertex( Point3D< float > s , Point3D< float > e , Point3D< float > p ):
start(s),end(e)
{ {
start = s , end = e;
// < p , e-s > = < s + v*(e-s) , e-s > // < p , e-s > = < s + v*(e-s) , e-s >
// < p , e-s > - < s , e-s > = v || e-s || ^2 // < p , e-s > - < s , e-s > = v || e-s || ^2
// v = < p-s , e-s > / || e-s ||^2 // v = < p-s , e-s > / || e-s ||^2
......
...@@ -4,6 +4,12 @@ ...@@ -4,6 +4,12 @@
#include <hash_map> #include <hash_map>
using stdext::hash_map; using stdext::hash_map;
#else // !WIN32 #else // !WIN32
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)>= 40300 //gcc >= 4.3
#include <tr1/unordered_map>
#define hash_map std::tr1::unordered_map
#else //GCC_VERSION < 40300
#include <ext/hash_map> #include <ext/hash_map>
using namespace __gnu_cxx; using namespace __gnu_cxx;
...@@ -24,6 +30,7 @@ namespace __gnu_cxx ...@@ -24,6 +30,7 @@ namespace __gnu_cxx
size_t operator()(const unsigned long long __x) const { return __x; } size_t operator()(const unsigned long long __x) const { return __x; }
}; };
} }
#endif // gcc >= 4.3
#endif // WIN32 #endif // WIN32
#endif // HASH_INCLUDED #endif // HASH_INCLUDED
...@@ -101,7 +101,7 @@ class MemoryInfo ...@@ -101,7 +101,7 @@ class MemoryInfo
int pid; int pid;
unsigned long vm; unsigned long vm;
int n = fscanf(f, "%d %s %c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %d %ld %llu %lu %ld %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu" fscanf(f, "%d %255s %c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %d %ld %llu %lu %ld %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu"
,&pid ,s ,&c ,&d ,&d ,&d ,&d ,&d ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&ld ,&ld ,&ld ,&ld ,&d ,&ld ,&llu ,&vm ,&ld ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&d ,&d ,&lu ,&lu ); ,&pid ,s ,&c ,&d ,&d ,&d ,&d ,&d ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&ld ,&ld ,&ld ,&ld ,&d ,&ld ,&llu ,&vm ,&ld ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&lu ,&d ,&d ,&lu ,&lu );
fclose(f); fclose(f);
...@@ -182,7 +182,7 @@ class MemoryInfo ...@@ -182,7 +182,7 @@ class MemoryInfo
public: public:
static size_t Usage(void) static size_t Usage(void)
{ {
unsigned long rss, vs, psize; unsigned long rss, vs;
task_t task = MACH_PORT_NULL; task_t task = MACH_PORT_NULL;
if (task_for_pid(current_task(), getpid(), &task) != KERN_SUCCESS) if (task_for_pid(current_task(), getpid(), &task) != KERN_SUCCESS)
......
...@@ -245,7 +245,7 @@ class Octree ...@@ -245,7 +245,7 @@ class Octree
Point3D< Real > position; Point3D< Real > position;
Real coarserValue; Real coarserValue;
Real weight; Real weight;
PointData( Point3D< Real > p=Point3D< Real >() , Real w=0 ) { position = p , weight = w , coarserValue = Real(0); } PointData( Point3D< Real > p=Point3D< Real >() , Real w=0 ):position(p),coarserValue(Real(0)),weight(w){}
}; };
std::vector< PointData > _points; std::vector< PointData > _points;
......
...@@ -29,7 +29,7 @@ DAMAGE. ...@@ -29,7 +29,7 @@ DAMAGE.
#ifndef DOXY_IGNORE_THIS #ifndef DOXY_IGNORE_THIS
#include "Octree.h" #include "Octree.h"
#include "time.h" #include "Time.h"
#include "MemoryUsage.h" #include "MemoryUsage.h"
#include "PointStream.h" #include "PointStream.h"
#include "MAT.h" #include "MAT.h"
...@@ -211,7 +211,7 @@ void SortedTreeNodes::setCornerTable( CornerTableData& cData , const TreeOctNode ...@@ -211,7 +211,7 @@ void SortedTreeNodes::setCornerTable( CornerTableData& cData , const TreeOctNode
int& idx = cData[ treeNodes[i] ][c]; int& idx = cData[ treeNodes[i] ][c];
if( idx<0 ) if( idx<0 )
{ {
fprintf( stderr , "[ERROR] Found unindexed corner nodes[%d][%d] = %d (%d,%d)\n" , treeNodes[i]->nodeData.nodeIndex , c , idx , minDepth , maxDepth ); fprintf( stderr , "[ERROR] Found unindexed corner nodes[%d][%u] = %d (%d,%d)\n" , treeNodes[i]->nodeData.nodeIndex , c , idx , minDepth , maxDepth );
int _d , _off[3]; int _d , _off[3];
treeNodes[i]->depthAndOffset( _d , _off ); treeNodes[i]->depthAndOffset( _d , _off );
if( rootNode ) if( rootNode )
...@@ -521,7 +521,11 @@ Octree<Degree>::Octree(void) ...@@ -521,7 +521,11 @@ Octree<Degree>::Octree(void)
radius = 0; radius = 0;
width = 0; width = 0;
postDerivativeSmooth = 0; postDerivativeSmooth = 0;
_minDepth = 0;
_constrainValues = false; _constrainValues = false;
_boundaryType = 0;
_scale = Real(0);
normals = NULL;
} }
template< int Degree > template< int Degree >
...@@ -2303,10 +2307,10 @@ int Octree< Degree >::GetFixedDepthLaplacian( SparseSymmetricMatrix< Real >& mat ...@@ -2303,10 +2307,10 @@ int Octree< Degree >::GetFixedDepthLaplacian( SparseSymmetricMatrix< Real >& mat
} }
// Offset the constraints using the solution from lower resolutions. // Offset the constraints using the solution from lower resolutions.
int x , y , z , c; int x , y , z;
if( node->parent ) if( node->parent )
{ {
c = int( node - node->parent->children ); int c = int( node - node->parent->children );
Cube::FactorCornerIndex( c , x , y , z ); Cube::FactorCornerIndex( c , x , y , z );
} }
else x = y = z = 0; else x = y = z = 0;
...@@ -2369,10 +2373,10 @@ int Octree<Degree>::GetRestrictedFixedDepthLaplacian( SparseSymmetricMatrix< Rea ...@@ -2369,10 +2373,10 @@ int Octree<Degree>::GetRestrictedFixedDepthLaplacian( SparseSymmetricMatrix< Rea
} }
// Adjust the system constraints // Adjust the system constraints
int x , y , z , c; int x , y , z ;
if( node->parent ) if( node->parent )
{ {
c = int( node - node->parent->children ); int c = int( node - node->parent->children );
Cube::FactorCornerIndex( c , x , y , z ); Cube::FactorCornerIndex( c , x , y , z );
} }
else x = y = z = 0; else x = y = z = 0;
...@@ -2488,7 +2492,7 @@ int Octree<Degree>::_SolveFixedDepthMatrix( int depth , const SortedTreeNodes& s ...@@ -2488,7 +2492,7 @@ int Octree<Degree>::_SolveFixedDepthMatrix( int depth , const SortedTreeNodes& s
AdjacencySetFunction asf; AdjacencySetFunction asf;
AdjacencyCountFunction acf; AdjacencyCountFunction acf;
double systemTime = 0 , solveTime = 0 , memUsage = 0 , evaluateTime = 0 , gTime , sTime; double systemTime = 0 , solveTime = 0 , memUsage = 0 , evaluateTime = 0 , gTime , sTime;
Real myRadius, myRadius2; Real myRadius;
if( depth>_minDepth ) if( depth>_minDepth )
{ {
...@@ -2520,7 +2524,6 @@ int Octree<Degree>::_SolveFixedDepthMatrix( int depth , const SortedTreeNodes& s ...@@ -2520,7 +2524,6 @@ int Octree<Degree>::_SolveFixedDepthMatrix( int depth , const SortedTreeNodes& s
myRadius = 2*radius-Real(0.5); myRadius = 2*radius-Real(0.5);
myRadius = int(myRadius-ROUND_EPS)+ROUND_EPS; myRadius = int(myRadius-ROUND_EPS)+ROUND_EPS;
// myRadius2 = Real(radius+ROUND_EPS-0.5);
d = depth-startingDepth; d = depth-startingDepth;
if( _boundaryType==0 ) d++; if( _boundaryType==0 ) d++;
std::vector< int > subDimension( sNodes.nodeCount[d+1]-sNodes.nodeCount[d] ); std::vector< int > subDimension( sNodes.nodeCount[d+1]-sNodes.nodeCount[d] );
...@@ -3113,7 +3116,7 @@ void Octree<Degree>::GetMCIsoTriangles( Real isoValue , int subdivideDepth , Cor ...@@ -3113,7 +3116,7 @@ void Octree<Degree>::GetMCIsoTriangles( Real isoValue , int subdivideDepth , Cor
#ifdef USE_OPENMP #ifdef USE_OPENMP
#pragma omp parallel for num_threads( threads ) #pragma omp parallel for num_threads( threads )
#endif #endif
for( int t=0 ; t<threads ; t++ ) for( int i=(leafNodeCount*t)/threads ; i<(leafNodeCount*(t+1))/threads ; i++ ) for( int t=0 ; t<threads ; t++ ) for( int i=(leafNodeCount*t)/threads ; i<(leafNodeCount*(t+1))/threads ; ++i )
{ {
TreeOctNode* leaf = leafNodes[i]; TreeOctNode* leaf = leafNodes[i];
if( _boundaryType!=0 || _IsInset( leaf ) ) GetMCIsoTriangles( leaf , mesh , rootData , interiorPoints , offSet , sDepth , polygonMesh , barycenterPtr ); if( _boundaryType!=0 || _IsInset( leaf ) ) GetMCIsoTriangles( leaf , mesh , rootData , interiorPoints , offSet , sDepth , polygonMesh , barycenterPtr );
...@@ -3131,7 +3134,7 @@ void Octree<Degree>::GetMCIsoTriangles( Real isoValue , int subdivideDepth , Cor ...@@ -3131,7 +3134,7 @@ void Octree<Degree>::GetMCIsoTriangles( Real isoValue , int subdivideDepth , Cor
DeletePointer( rootData.edgesSet ); DeletePointer( rootData.edgesSet );
coarseRootData.interiorRoots = NullPointer< int >(); coarseRootData.interiorRoots = NullPointer< int >();
coarseRootData.boundaryValues = rootData.boundaryValues; coarseRootData.boundaryValues = rootData.boundaryValues;
for( hash_map< long long , int >::iterator iter=rootData.boundaryRoots.begin() ; iter!=rootData.boundaryRoots.end() ; iter++ ) for( hash_map< long long , int >::iterator iter=rootData.boundaryRoots.begin() ; iter!=rootData.boundaryRoots.end() ; ++iter )
coarseRootData.boundaryRoots[iter->first] = iter->second; coarseRootData.boundaryRoots[iter->first] = iter->second;
for( int d=sDepth ; d>=0 ; d-- ) for( int d=sDepth ; d>=0 ; d-- )
...@@ -4046,11 +4049,10 @@ int Octree< Degree >::SetBoundaryMCRootPositions( int sDepth , Real isoValue , R ...@@ -4046,11 +4049,10 @@ int Octree< Degree >::SetBoundaryMCRootPositions( int sDepth , Real isoValue , R
if( IsBoundaryEdge( node , i , j , k , sDepth ) ) if( IsBoundaryEdge( node , i , j , k , sDepth ) )
{ {
hits++; hits++;
long long key;
eIndex = Cube::EdgeIndex( i , j , k ); eIndex = Cube::EdgeIndex( i , j , k );
if( GetRootIndex( node , eIndex , fData.depth , ri ) ) if( GetRootIndex( node , eIndex , fData.depth , ri ) )
{ {
key = ri.key; long long key = ri.key;
if( rootData.boundaryRoots.find(key)==rootData.boundaryRoots.end() ) if( rootData.boundaryRoots.find(key)==rootData.boundaryRoots.end() )
{ {
GetRoot( ri , isoValue , position , rootData , sDepth , nonLinearFit ); GetRoot( ri , isoValue , position , rootData , sDepth , nonLinearFit );
......
...@@ -28,8 +28,9 @@ DAMAGE. ...@@ -28,8 +28,9 @@ DAMAGE.
#ifndef DOXY_IGNORE_THIS #ifndef DOXY_IGNORE_THIS
#include <stdlib.h> #include <cstdlib>
#include <math.h> #include <cmath>
#include <cstddef>
#include <algorithm> #include <algorithm>
///////////// /////////////
...@@ -288,7 +289,7 @@ void OctNode<NodeData,Real>::printRange(void) const{ ...@@ -288,7 +289,7 @@ void OctNode<NodeData,Real>::printRange(void) const{
Real width; Real width;
centerAndWidth(center,width); centerAndWidth(center,width);
for(int dim=0;dim<DIMENSION;dim++){ for(int dim=0;dim<DIMENSION;dim++){
printf("%[%f,%f]",center.coords[dim]-width/2,center.coords[dim]+width/2); printf("[%f,%f]",center.coords[dim]-width/2,center.coords[dim]+width/2);
if(dim<DIMENSION-1){printf("x");} if(dim<DIMENSION-1){printf("x");}
else printf("\n"); else printf("\n");
} }
...@@ -772,7 +773,7 @@ OctNode<NodeData,Real>& OctNode<NodeData,Real>::operator = (const OctNode<NodeDa ...@@ -772,7 +773,7 @@ OctNode<NodeData,Real>& OctNode<NodeData,Real>::operator = (const OctNode<NodeDa
} }
template <class NodeData,class Real> template <class NodeData,class Real>
int OctNode<NodeData,Real>::CompareForwardDepths(const void* v1,const void* v2){ int OctNode<NodeData,Real>::CompareForwardDepths(const void* v1,const void* v2){
return ((const OctNode<NodeData,Real>*)v1)->depth-((const OctNode<NodeData,Real>*)v2)->depth; return static_cast<const OctNode<NodeData,Real>*>(v1)->depth-static_cast<const OctNode<NodeData,Real>*>(v2)->depth;
} }
template< class NodeData , class Real > template< class NodeData , class Real >
int OctNode< NodeData , Real >::CompareByDepthAndXYZ( const void* v1 , const void* v2 ) int OctNode< NodeData , Real >::CompareByDepthAndXYZ( const void* v1 , const void* v2 )
...@@ -825,11 +826,11 @@ int OctNode<NodeData,Real>::CompareForwardPointerDepths( const void* v1 , const ...@@ -825,11 +826,11 @@ int OctNode<NodeData,Real>::CompareForwardPointerDepths( const void* v1 , const
} }
template <class NodeData,class Real> template <class NodeData,class Real>
int OctNode<NodeData,Real>::CompareBackwardDepths(const void* v1,const void* v2){ int OctNode<NodeData,Real>::CompareBackwardDepths(const void* v1,const void* v2){
return ((const OctNode<NodeData,Real>*)v2)->depth-((const OctNode<NodeData,Real>*)v1)->depth; return static_cast<const OctNode<NodeData,Real>*>(v2)->depth-static_cast<const OctNode<NodeData,Real>*>(v1)->depth;
} }
template <class NodeData,class Real> template <class NodeData,class Real>
int OctNode<NodeData,Real>::CompareBackwardPointerDepths(const void* v1,const void* v2){ int OctNode<NodeData,Real>::CompareBackwardPointerDepths(const void* v1,const void* v2){
return (*(const OctNode<NodeData,Real>**)v2)->depth()-(*(const OctNode<NodeData,Real>**)v1)->depth(); return (*static_cast<const OctNode<NodeData,Real>**>(v2))->depth()-(*static_cast<const OctNode<NodeData,Real>**>(v1))->depth();
} }
template <class NodeData,class Real> template <class NodeData,class Real>
inline int OctNode<NodeData,Real>::Overlap2(const int &depth1,const int offSet1[DIMENSION],const Real& multiplier1,const int &depth2,const int offSet2[DIMENSION],const Real& multiplier2){ inline int OctNode<NodeData,Real>::Overlap2(const int &depth1,const int offSet1[DIMENSION],const Real& multiplier1,const int &depth2,const int offSet2[DIMENSION],const Real& multiplier2){
...@@ -855,7 +856,7 @@ const OctNode<NodeData,Real>* OctNode<NodeData,Real>::faceNeighbor(int faceIndex ...@@ -855,7 +856,7 @@ const OctNode<NodeData,Real>* OctNode<NodeData,Real>::faceNeighbor(int faceIndex
template <class NodeData,class Real> template <class NodeData,class Real>
OctNode<NodeData,Real>* OctNode<NodeData,Real>::__faceNeighbor(int dir,int off,int forceChildren){ OctNode<NodeData,Real>* OctNode<NodeData,Real>::__faceNeighbor(int dir,int off,int forceChildren){
if(!parent){return NULL;} if(!parent){return NULL;}
int pIndex=int(this-parent->children); ptrdiff_t pIndex= ptrdiff_t(-(this->parent->children - this));