G+Smo  23.12.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gismo::bspline Namespace Reference

This namespace contains implementation of B-spline related algorithms. More...

Functions

template<class T , typename KnotIterator , typename MatrixType >
void allDersBasis ()
 
template<class T , typename KnotIterator , typename MatrixType >
void allDersSingle ()
 
template<short_t d>
void buildCoeffsStrides (const gsVector< index_t, d > &size_of_coefs, gsVector< index_t, d > &strides)
 
template<typename T , typename KnotVectorType >
void computeAlpha (std::vector< std::vector< T > > &alpha, const KnotVectorType &knots, T value, int r, int k, int p, int s)
 
template<typename T , typename KnotVectorType , typename ValIt , typename newKnotsType >
void computeTensorAlpha (std::vector< std::vector< T > > &alpha, newKnotsType &nknots, const KnotVectorType &knots, ValIt valBegin, ValIt valEnd, bool sparse=false)
 
void correctNewStride (gsVector< unsigned > &new_str, const gsVector< unsigned > &str, const int direction, const int r)
 
template<class T , typename KnotIterator >
void deBoorTriangle (T u, KnotIterator knot, int deg, T N[])
 
template<class Basis_t >
void degreeElevateBSpline (Basis_t &basis, gsMatrix< typename Basis_t::Scalar_t > &coefs, short_t m)
 Increase the degree of a 1D B-spline from degree p to degree p + m.
 
template<class T , typename KnotIterator , typename MatrixType >
void derivBasis ()
 
template<class T , typename KnotIterator , typename MatrixType >
void derivBasisSingle ()
 
template<class T , typename KnotIterator , typename Derived >
void evalBasis (T u, KnotIterator knot, int deg, gsEigen::MatrixBase< Derived > const &result)
 
template<class T , typename KnotIterator , typename MatrixType >
void evalBasis2 (const T &u, const KnotIterator &knot, int deg, MatrixType &result)
 
template<class T , typename KnotIterator , typename MatrixType >
void evalBasisSingle ()
 
template<class T , typename KnotIterator , typename Derived >
void evalDeg1Basis (const T &u, const KnotIterator knot, gsEigen::MatrixBase< Derived > const &result)
 Evaluation for degree 1 B-spline basis.
 
template<class T , typename KnotIterator , typename Derived >
void evalDeg2Basis (const T &u, const KnotIterator knot, gsEigen::MatrixBase< Derived > const &result)
 Evaluation for degree 2 B-spline basis.
 
template<class T , typename KnotIterator , typename MatrixType >
void evalDeg3Basis (const T &u, const KnotIterator knot, MatrixType &result)
 Evaluation for degree 3 B-spline basis.
 
template<class T , typename KnotIterator , typename MatrixType >
void evalGeo (const T &u, const KnotIterator &knot, int deg, MatrixType coefs, MatrixType &result)
 
int getIndex (const gsVector< unsigned > &stride, const gsVector< int > &position)
 
void getLastIndex (const gsVector< unsigned > &stride, const unsigned number_of_points, gsVector< int > &last_point)
 
template<short_t d>
void getLastIndexLocal (const gsVector< index_t, d > &size_of_coef, gsVector< index_t, d > &last_point)
 
unsigned numberOfIterations (const gsVector< index_t > &nmb_of_coefs, const unsigned direction)
 

Detailed Description

This namespace contains implementation of B-spline related algorithms.

Function Documentation

void gismo::bspline::allDersBasis ( )

Input: a sequence of 2*p+1 knots, evaluation point, output the value of all derivatives up to order k supported on those knots

void gismo::bspline::allDersSingle ( )

Input: a sequence of p+2 knots, evaluation point, output the value of all derivatives up to order k supported on those knots

void gismo::bspline::buildCoeffsStrides ( const gsVector< index_t, d > &  size_of_coefs,
gsVector< index_t, d > &  strides 
)

Function builds strides from given sizes of the coefficients. We can use computed strides for calculating indices corresponding to the size of the coefficients

Parameters
size_of_coefssize of the coefficients
strideswe compute strides into this variable
void gismo::bspline::computeAlpha ( std::vector< std::vector< T > > &  alpha,
const KnotVectorType &  knots,
value,
int  r,
int  k,
int  p,
int  s 
)

Computes 2D vector of alpha values.

Parameters
alpha- to be computed
knots- knot vector
value- knot we want to insert
r- how many times we want to insert knot value
k- value in [knots[k], knots[k + 1])
p- degree corresponding B-splines
s- multiplicity of knot value
Returns
void (note "returns" value through alpha)
void gismo::bspline::computeTensorAlpha ( std::vector< std::vector< T > > &  alpha,
newKnotsType &  nknots,
const KnotVectorType &  knots,
ValIt  valBegin,
ValIt  valEnd,
bool  sparse = false 
)

Computes 2D vector of alpha values, and also computes new knot values and saves them into nknots.

Parameters
alpha- 2D vector; to be computed
nknots- new knot vector, to be computed
knots- knot vector
valBegin- iterator pointing to the begining of the vector of the knots we want to insert
valEnd- iterator pointing to the end of the vector of the knots we want to insert
sparse
Returns
void (note "returns" values through alpha and nknots)
void gismo::bspline::correctNewStride ( gsVector< unsigned > &  new_str,
const gsVector< unsigned > &  str,
const int  direction,
const int  r 
)
inline

Corrects values of a new stride according to the old stride with respect to direction of knot refinment and number of knots we want to insert.

Parameters
new_str- vector of new strides (will be modified)
str- vector of old strides
direction- direction of the refinement
r- number of knots we will insert
Returns
void (note it modifies "new_str")
void gismo::bspline::deBoorTriangle ( u,
KnotIterator  knot,
int  deg,
N[] 
)

Input: parameter position u, KnotIterator knot identifying the active interval, degree deg, Output: table N. Computes deBoor table used in Algorithm A2.5 in NURBS book. Used by evalDerSingle_into(...), evalAllDerSingle_into(...) and evalSingle_into(...).

void gismo::bspline::derivBasis ( )

Input: a sequence of 2*p+1 knots, evaluation point, output the derivatives evaluated at all functions supported on those knots

void gismo::bspline::derivBasisSingle ( )

Input: a sequence of p+2 knots, evaluation point. Output: the value of the derivative of basis function supported on those knots

void gismo::bspline::evalBasis ( u,
KnotIterator  knot,
int  deg,
gsEigen::MatrixBase< Derived > const &  result 
)

Input: an iterator pointing to the the biggest knot less than u, evaluation point u, output the value of all basis functions which are active at u. Uses B-spline recursion for evaluation

void gismo::bspline::evalBasis2 ( const T &  u,
const KnotIterator &  knot,
int  deg,
MatrixType &  result 
)

Input: a sequence of 2*p+1 knots starting at iterator position knot, evaluation point u, output the value of all basis functions which are active on u. Uses DeBoor's algorithm for evaluation

void gismo::bspline::evalBasisSingle ( )

Input: a sequence of p+2 knots, evaluation point. Output: the value of the basis function supported on those knots

void gismo::bspline::evalGeo ( const T &  u,
const KnotIterator &  knot,
int  deg,
MatrixType  coefs,
MatrixType &  result 
)

Input: a sequence of 2*p+1 knots starting at iterator position knot, evaluation point u, output the value of the B-spline defined by coefs Uses DeBoor's algorithm for evaluation

Todo:
add an overload with stride parameter for coefs
int gismo::bspline::getIndex ( const gsVector< unsigned > &  stride,
const gsVector< int > &  position 
)
inline

From strides and current position computes index (row) used in global presentation of the coefficients

Parameters
stride- vector of strides
position- current position [x0, x1, x2, x3, ...]
Returns
global index (row)
void gismo::bspline::getLastIndex ( const gsVector< unsigned > &  stride,
const unsigned  number_of_points,
gsVector< int > &  last_point 
)
inline

Computes last point of the cube, so that can be passed to nextCubePoint function

Parameters
stride- vector of strides
number_of_points- total number of coefficients (coef.rows())
last_point- throght this parameter function sets last point of the cube
Returns
void (note: "returns" value throught last_point)
void gismo::bspline::getLastIndexLocal ( const gsVector< index_t, d > &  size_of_coef,
gsVector< index_t, d > &  last_point 
)

Computes last point of a cube. We can pass the point to nextCubePoint function. Function computes last point for local algorithm.

Parameters
size_of_coefsize of the coefficients
last_pointwe compute last point into this variable
unsigned gismo::bspline::numberOfIterations ( const gsVector< index_t > &  nmb_of_coefs,
const unsigned  direction 
)
inline

Function computes necessary number of iterations for given number of the coefficients. We will iterate through cube (its size is nmb_of_coefs) in given direction.

Parameters
nmb_of_coefsnumber of the coefficients
directiondirection in which we iterate
Returns
number of iterations