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
#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* AllocPointer( size_t size , const char* name=NULL ){ return (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* ReAllocPointer( C* c , size_t size , const char* name=NULL ){ return (C*) realloc( c , 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 static_cast<C*>(aligned_malloc( sizeof(C) * size , alignment )); }
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; }
......
......@@ -33,106 +33,106 @@ DAMAGE.
#include "PPolynomial.h"
#include "Array.h"
template< unsigned int Degree >
template< int Degree >
struct BSplineElementCoefficients
{
int coeffs[Degree+1];
BSplineElementCoefficients( void ) { memset( coeffs , 0 , sizeof( int ) * ( Degree+1 ) ); }
int& operator[]( int idx ){ return coeffs[idx]; }
const int& operator[]( int idx ) const { return coeffs[idx]; }
int coeffs[Degree+1];
BSplineElementCoefficients( void ) { memset( coeffs , 0 , sizeof( int ) * ( Degree+1 ) ); }
int& operator[]( unsigned int idx ){ if (idx <= Degree) return coeffs[idx]; return coeffs[0];}
const int& operator[]( unsigned int idx ) const {if (idx <= Degree) return coeffs[idx]; return coeffs[0];}
};
template< int Degree >
struct BSplineElements : public std::vector< BSplineElementCoefficients< Degree > >
{
static const int _off = (Degree+1)/2;
void _addLeft ( int offset , int boundary );
void _addRight( int offset , int boundary );
static const int _off = (Degree+1)/2;
void _addLeft ( int offset , int boundary );
void _addRight( int offset , int boundary );
public:
enum
{
NONE = 0,
DIRICHLET = -1,
NEUMANN = 1
};
// Coefficients are ordered as "/" "-" "\"
int denominator;
BSplineElements( void ) { denominator = 1; }
BSplineElements( int res , int offset , int boundary=NONE , int inset=0 );
void upSample( BSplineElements& high ) const;
void differentiate( BSplineElements< Degree-1 >& d ) const;
void print( FILE* fp=stdout ) const
{
enum
{
NONE = 0,
DIRICHLET = -1,
NEUMANN = 1
};
// Coefficients are ordered as "/" "-" "\"
int denominator;
BSplineElements( void ) { denominator = 1; }
BSplineElements( int res , int offset , int boundary=NONE , int inset=0 );
void upSample( BSplineElements& high ) const;
void differentiate( BSplineElements< Degree-1 >& d ) const;
void print( FILE* fp=stdout ) const
{
for( int i=0 ; i< this->size() ; i++ )
{
printf( "%d]" , i );
for( int j=0 ; j<=Degree ; j++ ) printf( " %d" , (*this)[i][j] );
printf( " (%d)\n" , denominator );
}
}
{
printf( "%d]" , i );
for( int j=0 ; j<=Degree ; j++ ) printf( " %d" , (*this)[i][j] );
printf( " (%d)\n" , denominator );
}
}
};
template< int Degree , class Real >
class BSplineData
{
bool useDotRatios;
int boundaryType;
bool useDotRatios;
int boundaryType;
public:
struct BSplineComponents
{
Polynomial< Degree > polys[Degree+1];
Polynomial< Degree >& operator[] ( int idx ) { return polys[idx]; }
const Polynomial< Degree >& operator[] ( int idx ) const { return polys[idx]; }
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 shift( double s ) const { BSplineComponents b ; for( int d=0 ; d<=Degree ; d++ ) b[d] = polys[d].shift(s) ; return b; }
};
const static int VV_DOT_FLAG = 1;
const static int DV_DOT_FLAG = 2;
const static int DD_DOT_FLAG = 4;
const static int VALUE_FLAG = 1;
const static int D_VALUE_FLAG = 2;
int depth , functionCount , sampleCount;
Pointer( Real ) vvDotTable;
Pointer( Real ) dvDotTable;
Pointer( Real ) ddDotTable;
Pointer( Real ) valueTables;
Pointer( Real ) dValueTables;
PPolynomial< Degree > baseFunction , leftBaseFunction , rightBaseFunction , leftRightBaseFunction;
PPolynomial< Degree-1 > dBaseFunction , dLeftBaseFunction , dRightBaseFunction , dLeftRightBaseFunction;
BSplineComponents baseBSpline , leftBSpline , rightBSpline , leftRightBSpline;
Pointer( PPolynomial< Degree > ) baseFunctions;
Pointer( BSplineComponents ) baseBSplines;
BSplineData(void);
~BSplineData(void);
virtual void setDotTables( int flags , bool inset=false );
virtual void clearDotTables( int flags );
virtual void setValueTables( int flags , double smooth=0 );
virtual void setValueTables( int flags , double valueSmooth , double normalSmooth );
virtual void clearValueTables( void );
void setSampleSpan( int idx , int& start , int& end , double smooth=0 ) const;
/********************************************************
* Sets the translates and scales of the basis function
* up to the prescribed depth
* <maxDepth> the maximum depth
* <useDotRatios> specifies if dot-products of derivatives
* should be pre-divided by function integrals
* <reflectBoundary> spcifies if function space should be
* forced to be reflectively symmetric across the boundary
********************************************************/
void set( int maxDepth , bool useDotRatios=true , int boundaryType=BSplineElements< Degree >::NONE );
inline int Index( int i1 , int i2 ) const;
static inline int SymmetricIndex( int i1 , int i2 );
static inline int SymmetricIndex( int i1 , int i2 , int& index );
struct BSplineComponents
{
Polynomial< Degree > polys[Degree+1];
Polynomial< Degree >& operator[] ( unsigned int idx ) { 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(); }
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( 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 DV_DOT_FLAG = 2;
const static int DD_DOT_FLAG = 4;
const static int VALUE_FLAG = 1;
const static int D_VALUE_FLAG = 2;
int depth , functionCount , sampleCount;
Pointer( Real ) vvDotTable;
Pointer( Real ) dvDotTable;
Pointer( Real ) ddDotTable;
Pointer( Real ) valueTables;
Pointer( Real ) dValueTables;
PPolynomial< Degree > baseFunction , leftBaseFunction , rightBaseFunction , leftRightBaseFunction;
PPolynomial< Degree-1 > dBaseFunction , dLeftBaseFunction , dRightBaseFunction , dLeftRightBaseFunction;
BSplineComponents baseBSpline , leftBSpline , rightBSpline , leftRightBSpline;
Pointer( PPolynomial< Degree > ) baseFunctions;
Pointer( BSplineComponents ) baseBSplines;
BSplineData(void);
~BSplineData(void);
virtual void setDotTables( int flags , bool inset=false );
virtual void clearDotTables( int flags );
virtual void setValueTables( int flags , double smooth=0 );
virtual void setValueTables( int flags , double valueSmooth , double normalSmooth );
virtual void clearValueTables( void );
void setSampleSpan( int idx , int& start , int& end , double smooth=0 ) const;
/********************************************************
* Sets the translates and scales of the basis function
* up to the prescribed depth
* <maxDepth> the maximum depth
* <useDotRatios> specifies if dot-products of derivatives
* should be pre-divided by function integrals
* <reflectBoundary> spcifies if function space should be
* forced to be reflectively symmetric across the boundary
********************************************************/
void set( int maxDepth , bool useDotRatios=true , int boundaryType=BSplineElements< Degree >::NONE );
inline int Index( int i1 , int i2 ) const;
static inline int SymmetricIndex( int i1 , int i2 );
static inline int SymmetricIndex( int i1 , int i2 , int& index );
};
template< int Degree1 , int Degree2 > void SetBSplineElementIntegrals( double integrals[Degree1+1][Degree2+1] );
......
......@@ -30,372 +30,377 @@ DAMAGE.
// BSplineData //
/////////////////
// Support[i]:
// Odd: i +/- 0.5 * ( 1 + Degree )
// i - 0.5 * ( 1 + Degree ) < 0
// <=> i < 0.5 * ( 1 + Degree )
// i + 0.5 * ( 1 + Degree ) > 0
// <=> i > - 0.5 * ( 1 + Degree )
// i + 0.5 * ( 1 + Degree ) > r
// Odd: i +/- 0.5 * ( 1 + Degree )
// i - 0.5 * ( 1 + Degree ) < 0
// <=> i < 0.5 * ( 1 + Degree )
// i + 0.5 * ( 1 + Degree ) > 0
// <=> i > - 0.5 * ( 1 + Degree )
// i + 0.5 * ( 1 + Degree ) > r
// <=> i > r - 0.5 * ( 1 + Degree )
// i - 0.5 * ( 1 + Degree ) < r
// i - 0.5 * ( 1 + Degree ) < r
// <=> i < r + 0.5 * ( 1 + Degree )
// Even: i + 0.5 +/- 0.5 * ( 1 + Degree )
// i - 0.5 * Degree < 0
// <=> i < 0.5 * Degree
// i + 1 + 0.5 * Degree > 0
// <=> i > -1 - 0.5 * Degree
// i + 1 + 0.5 * Degree > r
// <=> i > r - 1 - 0.5 * Degree
// i - 0.5 * Degree < r
// <=> i < r + 0.5 * Degree
// Even: i + 0.5 +/- 0.5 * ( 1 + Degree )
// i - 0.5 * Degree < 0
// <=> i < 0.5 * Degree
// i + 1 + 0.5 * Degree > 0
// <=> i > -1 - 0.5 * Degree
// i + 1 + 0.5 * Degree > r
// <=> i > r - 1 - 0.5 * Degree
// i - 0.5 * Degree < r
// <=> i < r + 0.5 * Degree
template< int Degree > inline bool LeftOverlap( unsigned int depth , int offset )
{
offset <<= 1;
if( Degree & 1 ) return (offset < 1+Degree) && (offset > -1-Degree );
else return (offset < Degree) && (offset > -2-Degree );
offset <<= 1;
if( Degree & 1 ) return (offset < 1+Degree) && (offset > -1-Degree );
else return (offset < Degree) && (offset > -2-Degree );
}
template< int Degree > inline bool RightOverlap( unsigned int depth , int offset )
{
offset <<= 1;
// int r = 1<<(depth+1);
if( Degree & 1 ) return (offset > 2-1-Degree) && (offset < 2+1+Degree );
else return (offset > 2-2-Degree) && (offset < 2+ Degree );
offset <<= 1;
// int r = 1<<(depth+1);
if( Degree & 1 ) return (offset > 2-1-Degree) && (offset < 2+1+Degree );
else return (offset > 2-2-Degree) && (offset < 2+ Degree );
}
template< int Degree > inline int ReflectLeft( unsigned int depth , int offset )
{
if( Degree&1 ) return -offset;
else return -1-offset;
if( Degree&1 ) return -offset;
else return -1-offset;
}
template< int Degree > inline int ReflectRight( unsigned int depth , int offset )
{
int r = 1<<(depth+1);
if( Degree&1 ) return r -offset;
else return r-1-offset;
int r = 1<<(depth+1);
if( Degree&1 ) return r -offset;
else return r-1-offset;
}
template< int Degree , class Real >
template<int Degree,class Real>
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 >();
valueTables = dValueTables = NullPointer< Real >();
functionCount = sampleCount = 0;
vvDotTable = dvDotTable = ddDotTable = NullPointer< Real >();
valueTables = dValueTables = NullPointer< Real >();
}
template< int Degree , class Real >
template<int Degree,class Real>
BSplineData< Degree , Real >::~BSplineData(void)
{
if( functionCount )
{
if( vvDotTable ) DeletePointer( vvDotTable );
if( dvDotTable ) DeletePointer( dvDotTable );
if( ddDotTable ) DeletePointer( ddDotTable );
if( valueTables ) DeletePointer( valueTables );
if( dValueTables ) DeletePointer( dValueTables );
}
functionCount = 0;
if( functionCount )
{
if( vvDotTable ) DeletePointer( vvDotTable );
if( dvDotTable ) DeletePointer( dvDotTable );
if( ddDotTable ) DeletePointer( ddDotTable );
if( valueTables ) DeletePointer( valueTables );
if( dValueTables ) DeletePointer( dValueTables );
}
functionCount = 0;
}
template< int Degree , class Real >
template<int Degree,class Real>
void BSplineData<Degree,Real>::set( int maxDepth , bool useDotRatios , int boundaryType )
{
this->useDotRatios = useDotRatios;
this->boundaryType = boundaryType;
this->useDotRatios = useDotRatios;
this->boundaryType = boundaryType;
depth = maxDepth;
// [Warning] This assumes that the functions spacing is dual
functionCount = BinaryNode< double >::CumulativeCenterCount( depth );
sampleCount = BinaryNode< double >::CenterCount( depth ) + BinaryNode< double >::CornerCount( depth );
baseFunctions = NewPointer< PPolynomial< Degree > >( functionCount );
baseBSplines = NewPointer< BSplineComponents >( functionCount );
depth = maxDepth;
// [Warning] This assumes that the functions spacing is dual
functionCount = BinaryNode< double >::CumulativeCenterCount( depth );
sampleCount = BinaryNode< double >::CenterCount( depth ) + BinaryNode< double >::CornerCount( depth );
baseFunctions = NewPointer< PPolynomial< Degree > >( functionCount );
baseBSplines = NewPointer< BSplineComponents >( functionCount );
baseFunction = PPolynomial< Degree >::BSpline();
for( int i=0 ; i<=Degree ; i++ ) baseBSpline[i] = Polynomial< Degree >::BSplineComponent( i ).shift( double(-(Degree+1)/2) + i - 0.5 );
dBaseFunction = baseFunction.derivative();
StartingPolynomial< Degree > sPolys[Degree+4];
baseFunction = PPolynomial< Degree >::BSpline();
for( int i=0 ; i<=Degree ; i++ ) baseBSpline[i] = Polynomial< Degree >::BSplineComponent( i ).shift( double(-(Degree+1)/2) + i - 0.5 );
dBaseFunction = baseFunction.derivative();
StartingPolynomial< Degree > sPolys[Degree+4];
for( int i=0 ; i<Degree+3 ; i++ )
{
sPolys[i].start = double(-(Degree+1)/2) + i - 1.5;
sPolys[i].p *= 0;
if( i<=Degree ) sPolys[i].p += baseBSpline[i ].shift( -1 ) * boundaryType;
if( i>=1 && i<=Degree+1 ) sPolys[i].p += baseBSpline[i-1];
for( int j=0 ; j<i ; j++ ) sPolys[i].p -= sPolys[j].p;
}
leftBaseFunction.set( sPolys , Degree+3 );
for( int i=0 ; i<Degree+3 ; i++ )
{
sPolys[i].start = double(-(Degree+1)/2) + i - 0.5;
sPolys[i].p *= 0;
if( i<=Degree ) sPolys[i].p += baseBSpline[i ];
if( i>=1 && i<=Degree+1 ) sPolys[i].p += baseBSpline[i-1].shift( 1 ) * boundaryType;
for( int j=0 ; j<i ; j++ ) sPolys[i].p -= sPolys[j].p;
}
rightBaseFunction.set( sPolys , Degree+3 );
for( int i=0 ; i<Degree+4 ; i++ )
{
sPolys[i].start = double(-(Degree+1)/2) + i - 1.5;
sPolys[i].p *= 0;
if( i<=Degree ) sPolys[i].p += baseBSpline[i ].shift( -1 ) * boundaryType; // The left-shifted B-spline
if( i>=1 && i<=Degree+1 ) sPolys[i].p += baseBSpline[i-1]; // The centered B-Spline
if( i>=2 && i<=Degree+2 ) sPolys[i].p += baseBSpline[i-2].shift( 1 ) * boundaryType; // The right-shifted B-spline
for( int j=0 ; j<i ; j++ ) sPolys[i].p -= sPolys[j].p;
}
leftRightBaseFunction.set( sPolys , Degree+4 );
for( int i=0 ; i<Degree+3 ; i++ )
{
sPolys[i].start = double(-(Degree+1)/2) + i - 1.5;
sPolys[i].p *= 0;
if( i<=Degree ) sPolys[i].p += baseBSpline[i ].shift( -1 ) * boundaryType;
if( i>=1 && i<=Degree+1 ) sPolys[i].p += baseBSpline[i-1];
for( int j=0 ; j<i ; j++ ) sPolys[i].p -= sPolys[j].p;
}
leftBaseFunction.set( sPolys , Degree+3 );
for( int i=0 ; i<Degree+3 ; i++ )
{
sPolys[i].start = double(-(Degree+1)/2) + i - 0.5;
sPolys[i].p *= 0;
if( i<=Degree ) sPolys[i].p += baseBSpline[i ];
if( i>=1 && i<=Degree+1 ) sPolys[i].p += baseBSpline[i-1].shift( 1 ) * boundaryType;
for( int j=0 ; j<i ; j++ ) sPolys[i].p -= sPolys[j].p;
}
rightBaseFunction.set( sPolys , Degree+3 );
for( int i=0 ; i<Degree+4 ; i++ )
{
sPolys[i].start = double(-(Degree+1)/2) + i - 1.5;
sPolys[i].p *= 0;
if( i<=Degree ) sPolys[i].p += baseBSpline[i ].shift( -1 ) * boundaryType; // The left-shifted B-spline
if( i>=1 && i<=Degree+1 ) sPolys[i].p += baseBSpline[i-1]; // The centered B-Spline
if( i>=2 && i<=Degree+2 ) sPolys[i].p += baseBSpline[i-2].shift( 1 ) * boundaryType; // The right-shifted B-spline
for( int j=0 ; j<i ; j++ ) sPolys[i].p -= sPolys[j].p;
}
leftRightBaseFunction.set( sPolys , Degree+4 );
dLeftBaseFunction = leftBaseFunction.derivative();
dRightBaseFunction = rightBaseFunction.derivative();
dLeftRightBaseFunction = leftRightBaseFunction.derivative();
leftRightBSpline = leftBSpline = rightBSpline = baseBSpline;
leftBSpline [1] += leftBSpline[2].shift( -1 ) , leftBSpline[0] *= 0;
rightBSpline[1] += rightBSpline[0].shift( 1 ) , rightBSpline[2] *= 0;
leftRightBSpline[1] += leftRightBSpline[2].shift( -1 ) + leftRightBSpline[0].shift( 1 ) , leftRightBSpline[0] *= 0 , leftRightBSpline[2] *= 0 ;
dLeftBaseFunction = leftBaseFunction.derivative();
dRightBaseFunction = rightBaseFunction.derivative();
dLeftRightBaseFunction = leftRightBaseFunction.derivative();
leftRightBSpline = leftBSpline = rightBSpline = baseBSpline;
leftBSpline [1] += leftBSpline[2].shift( -1 ) , leftBSpline[0] *= 0;
rightBSpline[1] += rightBSpline[0].shift( 1 ) , rightBSpline[2] *= 0;
leftRightBSpline[1] += leftRightBSpline[2].shift( -1 ) + leftRightBSpline[0].shift( 1 ) , leftRightBSpline[0] *= 0 , leftRightBSpline[2] *= 0 ;
double c , w;
for( int i=0 ; i<functionCount ; i++ )
{
BinaryNode< double >::CenterAndWidth( i , c , w );
baseFunctions[i] = baseFunction.scale(w).shift(c);
baseBSplines[i] = baseBSpline.scale(w).shift(c);
if( boundaryType )
{
int d , off , r;
BinaryNode< double >::DepthAndOffset( i , d , off );
r = 1<<d;
if ( off==0 && off==r-1 ) baseFunctions[i] = leftRightBaseFunction.scale(w).shift(c);
else if( off==0 ) baseFunctions[i] = leftBaseFunction.scale(w).shift(c);
else if( off==r-1 ) baseFunctions[i] = rightBaseFunction.scale(w).shift(c);
if ( off==0 && off==r-1 ) baseBSplines [i] = leftRightBSpline.scale(w).shift(c);
else if( off==0 ) baseBSplines [i] = leftBSpline.scale(w).shift(c);
else if( off==r-1 ) baseBSplines [i] = rightBSpline.scale(w).shift(c);
}
}
double c , w;
for( int i=0 ; i<functionCount ; i++ )
{
BinaryNode< double >::CenterAndWidth( i , c , w );
baseFunctions[i] = baseFunction.scale(w).shift(c);
baseBSplines[i] = baseBSpline.scale(w).shift(c);
if( boundaryType )
{
int d , off , r;
BinaryNode< double >::DepthAndOffset( i , d , off );
r = 1<<d;
if ( off==0 && off==r-1 ) baseFunctions[i] = leftRightBaseFunction.scale(w).shift(c);
else if( off==0 ) baseFunctions[i] = leftBaseFunction.scale(w).shift(c);
else if( off==r-1 ) baseFunctions[i] = rightBaseFunction.scale(w).shift(c);
if ( off==0 && off==r-1 ) baseBSplines [i] = leftRightBSpline.scale(w).shift(c);
else if( off==0 ) baseBSplines [i] = leftBSpline.scale(w).shift(c);
else if( off==r-1 ) baseBSplines [i] = rightBSpline.scale(w).shift(c);
}
}
}
template<int Degree,class Real>
void BSplineData<Degree,Real>::setDotTables( int flags , bool inset )
{
clearDotTables( flags );
int size = ( functionCount*functionCount + functionCount )>>1;
int fullSize = functionCount*functionCount;
if( flags & VV_DOT_FLAG )
{
vvDotTable = NewPointer< Real >( size );
memset( vvDotTable , 0 , sizeof(Real)*size );
}
if( flags & DV_DOT_FLAG )
{
dvDotTable = NewPointer< Real >( fullSize );
memset( dvDotTable , 0 , sizeof(Real)*fullSize );
}
if( flags & DD_DOT_FLAG )
{
ddDotTable = NewPointer< Real >( size );
memset( ddDotTable , 0 , sizeof(Real)*size );
}
double vvIntegrals[Degree+1][Degree+1];
double vdIntegrals[Degree+1][Degree ];
double dvIntegrals[Degree ][Degree+1];
double ddIntegrals[Degree ][Degree ];
int vvSums[Degree+1][Degree+1];
int vdSums[Degree+1][Degree ];
int dvSums[Degree ][Degree+1];
int ddSums[Degree ][Degree ];
SetBSplineElementIntegrals< Degree , Degree >( vvIntegrals );
SetBSplineElementIntegrals< Degree , Degree-1 >( vdIntegrals );
SetBSplineElementIntegrals< Degree-1 , Degree >( dvIntegrals );
SetBSplineElementIntegrals< Degree-1 , Degree-1 >( ddIntegrals );
clearDotTables( flags );
int size = ( functionCount*functionCount + functionCount )>>1;
int fullSize = functionCount*functionCount;
if( flags & VV_DOT_FLAG )
{
vvDotTable = NewPointer< Real >( size );
memset( vvDotTable , 0 , sizeof(Real)*size );
}
if( flags & DV_DOT_FLAG )
{
dvDotTable = NewPointer< Real >( fullSize );
memset( dvDotTable , 0 , sizeof(Real)*fullSize );
}
if( flags & DD_DOT_FLAG )
{
ddDotTable = NewPointer< Real >( size );
memset( ddDotTable , 0 , sizeof(Real)*size );
}
double vvIntegrals[Degree+1][Degree+1];
double vdIntegrals[Degree+1][Degree ];
double dvIntegrals[Degree ][Degree+1];
double ddIntegrals[Degree ][Degree ];
int vvSums[Degree+1][Degree+1];
int vdSums[Degree+1][Degree ];
int dvSums[Degree ][Degree+1];
int ddSums[Degree ][Degree ];
SetBSplineElementIntegrals< Degree , Degree >( vvIntegrals );
SetBSplineElementIntegrals< Degree , Degree-1 >( vdIntegrals );
SetBSplineElementIntegrals< Degree-1 , Degree >( dvIntegrals );
SetBSplineElementIntegrals< Degree-1 , Degree-1 >( ddIntegrals );
for( int d1=0 ; d1<=depth ; d1++ )
for( int off1=0 ; off1<(1<<d1) ; off1++ )
{
int ii = BinaryNode< Real >::CenterIndex( d1 , off1 );
BSplineElements< Degree > b1( 1<<d1 , off1 , boundaryType , inset ? ( 1<<(d1-2) ) : 0 );
BSplineElements< Degree-1 > db1;
b1.differentiate( db1 );
for( int d1=0 ; d1<=depth ; d1++ )
for( int off1=0 ; off1<(1<<d1) ; off1++ )
{
int ii = BinaryNode< Real >::CenterIndex( d1 , off1 );
BSplineElements< Degree > b1( 1<<d1 , off1 , boundaryType , inset ? ( 1<<(d1-2) ) : 0 );
BSplineElements< Degree-1 > db1;
b1.differentiate( db1 );
int start1 , end1;
int start1 , end1;
start1 = -1 , end1 = -1;
for( int i=0 ; i<int(b1.size()) ; i++ ) for( int j=0 ; j<=Degree ; j++ )
{
if( b1[i][j] && start1==-1 ) start1 = i;
if( b1[i][j] ) end1 = i+1;
}
if( start1==end1 ) continue;
for( int d2=d1 ; d2<=depth ; d2++ )
{
for( int off2=0 ; off2<(1<<d2) ; off2++ )
{
int start2 = off2-Degree;
int end2 = off2+Degree+1;
if( start2>=end1 || start1>=end2 ) continue;
start2 = std::max< int >( start1 , start2 );
end2 = std::min< int >( end1 , end2 );
if( d1==d2 && off2<off1 ) continue;
int jj = BinaryNode< Real >::CenterIndex( d2 , off2 );
BSplineElements< Degree > b2( 1<<d2 , off2 , boundaryType , inset ? ( 1<<(d2-2) ) : 0 );
BSplineElements< Degree-1 > db2;
b2.differentiate( db2 );
start1 = -1 , end1 = -1;
for( int i=0 ; i<int(b1.size()) ; i++ ) for( int j=0 ; j<=Degree ; j++ )
{