29 #ifndef BSPLINE_DATA_INCLUDED
30 #define BSPLINE_DATA_INCLUDED
32 #define NEW_BSPLINE_CODE 1
41 template<
int Degree >
54 template<
int Degree >
55 struct BSplineElements :
public std::vector< BSplineElementCoefficients< Degree > >
57 static const bool _Primal = (Degree&1)==1;
58 static const int _Off = (Degree+1)/2;
75 void print( FILE* fp=stdout )
const
77 for(
int i=0 ; i<std::vector< BSplineElementCoefficients< Degree > >
::size() ; i++ )
80 for(
int j=0 ; j<=Degree ; j++ ) printf(
" %d" , (*
this)[i][j] );
85 #define BSPLINE_SET_BOUNDS( name , s , e ) \
86 static const int name ## Start = (s); \
87 static const int name ## End = (e); \
88 static const int name ## Size = (e)-(s)+1
91 #define _FLOOR_OF_HALF( x ) ( (x) >>1 )
92 #define _CEIL_OF_HALF( x ) ( ( (x)+1 )>>1 )
94 #define FLOOR_OF_HALF( x ) ( (x)<0 ? - _CEIL_OF_HALF( -(x) ) : _FLOOR_OF_HALF( x ) )
95 #define CEIL_OF_HALF( x ) ( (x)<0 ? - _FLOOR_OF_HALF( -(x) ) : _CEIL_OF_HALF( x ) )
96 #define SMALLEST_INTEGER_LARGER_THAN_HALF( x ) ( CEIL_OF_HALF( (x)+1 ) )
97 #define LARGEST_INTEGER_SMALLER_THAN_HALF( x ) ( FLOOR_OF_HALF( (x)-1 ) )
98 #define SMALLEST_INTEGER_LARGER_THAN_OR_EQUAL_TO_HALF( x ) ( CEIL_OF_HALF( x ) )
99 #define LARGEST_INTEGER_SMALLER_THAN_OR_EQUAL_TO_HALF( x ) ( FLOOR_OF_HALF( x ) )
101 template<
int Degree >
106 static double Value(
int depth ,
int off ,
double s ,
bool dirichlet ,
bool derivative );
108 static int Dimension(
int depth ){
return ( 1<<depth ) + ( Degree&1 ); }
117 static const int Inset = (Degree&1) ? 0 : 1;
150 void printnl(
void )
const {
for(
int d=0 ; d<=Degree ; d++ ) printf(
"[%d] " , d ) ,
_polys[d].printnl(); }
180 double value(
int fIdx ,
int cIdx ,
bool d )
const;
190 double value(
int fIdx ,
int cIdx ,
bool d )
const;
216 double value(
int fIdx ,
int cIdx ,
bool d )
const;
226 double value(
int fIdx ,
int cIdx ,
bool d )
const;
266 double value(
int pIdx ,
int cIdx )
const;
275 template<
int Degree1 ,
int Degree2 >
279 static double Dot(
int depth1 ,
int off1 ,
bool dirichlet1 ,
bool d1 ,
int depth2 ,
int off2 ,
bool dirichlet2 ,
bool d2 );
317 double dot(
int fIdx1 ,
int fidx2 ,
bool d1 ,
bool d2 )
const;
327 double dot(
int fIdx1 ,
int fidx2 ,
bool d1 ,
bool d2 )
const;
338 #undef BSPLINE_SET_BOUNDS
339 #undef _FLOOR_OF_HALF
343 #undef SMALLEST_INTEGER_LARGER_THAN_HALF
344 #undef LARGEST_INTEGER_SMALLER_THAN_HALF
345 #undef SMALLEST_INTEGER_LARGER_THAN_OR_EQUAL_TO_HALF
346 #undef LARGEST_INTEGER_SMALLER_THAN_OR_EQUAL_TO_HALF
348 template<
int Degree >
372 void set(
int maxDepth ,
bool dirichlet=
false );
378 #include "BSplineData.inl"
#define SMALLEST_INTEGER_LARGER_THAN_OR_EQUAL_TO_HALF(x)
#define LARGEST_INTEGER_SMALLER_THAN_HALF(x)
void SetBSplineElementIntegrals(double integrals[Degree1+1][Degree2+1])
#define SMALLEST_INTEGER_LARGER_THAN_HALF(x)
#define BSPLINE_SET_BOUNDS(name, s, e)
#define LARGEST_INTEGER_SMALLER_THAN_OR_EQUAL_TO_HALF(x)
static int RemapOffset(int depth, int idx, bool &reflect)
static int Dimension(int depth)
static int Centers(int depth)
static int TotalSampleCount(int depth)
static void FactorFunctionIndex(int idx, int &depth, int &offset)
static int Corners(int depth)
static void SampleSpan(int depth, int &sStart, int &sEnd)
void set(int maxDepth, bool dirichlet=false)
static int FunctionIndex(int depth, int offset)
static void FunctionSpan(int depth, int &fStart, int &fEnd)
BSplineEvaluationData< Degree >::BSplineComponents * baseBSplines
static int TotalFunctionCount(int depth)
static void SetCornerEvaluator(typename CornerEvaluator::Evaluator &evaluator, int depth, bool dirichlet)
static void SetChildCenterEvaluator(typename CenterEvaluator::ChildEvaluator &evaluator, int parentDepth, bool dirichlet)
static const int DownSampleEnd[]
static const int ChildCornerSize
BSplineEvaluationData(void)
static void SetUpSampleEvaluator(UpSampleEvaluator &evaluator, int lowDepth, bool dirichlet)
static int Dimension(int depth)
static void SetEvaluator(Evaluator &evaluator, int depth, bool dirichlet)
static double Value(int depth, int off, double s, bool dirichlet, bool derivative)
static void InteriorSupportedSpan(int depth, int &begin, int &end)
static const int ChildSupportEnd
static void SetChildCornerEvaluator(typename CornerEvaluator::ChildEvaluator &evaluator, int parentDepth, bool dirichlet)
static const int ChildSupportSize
static const int DownSampleSize[]
static const int SupportEnd
static void SetChildEvaluator(ChildEvaluator &evaluator, int depth, bool dirichlet)
static const int SupportSize
static const int SupportStart
static const int DownSampleStart[]
static const int ChildSupportStart
static void SetCenterEvaluator(typename CenterEvaluator::Evaluator &evaluator, int depth, bool dirichlet)
static const int CornerSize
static const int UpSampleSize
static const int ParentOverlapSize[]
static const int OverlapEnd
static const int ParentOverlapEnd[]
static const int ParentOverlapStart[]
static void InteriorOverlappedSpan(int depth, int &begin, int &end)
static const int ChildOverlapEnd
BSplineEvaluationData< Degree2 > EData2
BSplineEvaluationData< Degree1 > EData1
static const int OverlapSupportStart
static const int ChildOverlapSize
static const int ChildOverlapStart
static void SetChildIntegrator(typename FunctionIntegrator::ChildIntegrator &integrator, int parentDepth, bool dirichlet1, bool dirichlet2)
static const int OverlapSupportEnd
static const int OverlapSize
static void SetIntegrator(typename FunctionIntegrator::Integrator &integrator, int depth, bool dirichlet1, bool dirichlet2)
static double Dot(int depth1, int off1, bool dirichlet1, bool d1, int depth2, int off2, bool dirichlet2, bool d2)
static const int OverlapStart
static int CornerIndex(int depth, int offSet)
static void CornerDepthAndOffset(int idx, int &depth, int &offset)
static int CumulativeCenterCount(int maxDepth)
static int CenterCount(int depth)
static int CornerCount(int depth)
static int CenterIndex(int depth, int offSet)
static void CenterDepthAndOffset(int idx, int &depth, int &offset)
static int CumulativeCornerCount(int maxDepth)
__host__ __device__ float3 reflect(float3 i, float3 n)
const int & operator[](int idx) const
int & operator[](int idx)
BSplineElementCoefficients(void)
static const bool _Primal
void print(FILE *fp=stdout) const
static int _RotateLeft(int offset, int res)
BSplineElements(int res, int offset, bool dirichlet)
static int _RotateRight(int offset, int res)
static int _ReflectLeft(int offset, int res)
void upSample(BSplineElements &high) const
void differentiate(BSplineElements< Degree-1 > &d) const
void _addPeriodic(int offset, bool negate)
static int _ReflectRight(int offset, int res)
Polynomial< Degree > _polys[Degree+1]
const Polynomial< Degree > & operator[](int idx) const
BSplineComponents(int depth, int offset, bool dirichlet)
int _coefficients[UpSampleSize]
double operator[](int idx)
BSplineUpSamplingCoefficients(void)
BSplineUpSamplingCoefficients(int depth, int offset, bool dirichlet)
double _pcValues[2][Size][ChildSupportSize]
int childDepth(void) const
double value(int fIdx, int cIdx, bool d) const
int parentDepth(void) const
friend BSplineEvaluationData
friend BSplineEvaluationData
double _ccValues[2][Size][SupportSize]
double value(int fIdx, int cIdx, bool d) const
static const int Index(int depth, int offset)
double cornerValue(int fIdx, int cIdx, bool d) const
double centerValue(int fIdx, int cIdx, bool d) const
CenterEvaluator::ChildEvaluator centerEvaluator
CornerEvaluator::ChildEvaluator cornerEvaluator
int childDepth(void) const
int parentDepth(void) const
friend BSplineEvaluationData
double _pcValues[2][Size][ChildCornerSize]
double value(int fIdx, int cIdx, bool d) const
friend BSplineEvaluationData
double value(int fIdx, int cIdx, bool d) const
double _ccValues[2][Size][CornerSize]
static const int Index(int depth, int offset)
CenterEvaluator::Evaluator centerEvaluator
double cornerValue(int fIdx, int cIdx, bool d) const
CornerEvaluator::Evaluator cornerEvaluator
double centerValue(int fIdx, int cIdx, bool d) const
friend BSplineEvaluationData
double value(int pIdx, int cIdx) const
static const int Index(int depth, int offset)
double _pcValues[Size][UpSampleSize]
double dot(int fIdx1, int fidx2, bool d1, bool d2) const
int parentDepth(void) const
int childDepth(void) const
double _pcIntegrals[2][2][Size][ChildOverlapSize]
friend BSplineIntegrationData
friend BSplineIntegrationData
double dot(int fIdx1, int fidx2, bool d1, bool d2) const
double _ccIntegrals[2][2][Size][OverlapSize]
static const int Index(int depth, int offset)