## Sunday, June 19, 2016

### B-Spline geometry interface

Hello all,

In the past few weeks, I have almost finished a complete B-Spline geometry interface and NURBS as well except for the inverse.

In this post, I'm going to describe the important aspects of the B-Spline geometry interface. As you can easily get all the functions required for a DUNE geometry interface, I am not going to elaborate all of them here. But I would like to specifically point out the mathematical model behind some tricky functions in case you want to review the code later.

1, LocalCoordinate global (const GlobalCoordinate &global) const
The function defines the mapping from the parameter space to the physical space. In isogemetric analysis, each valid(not repeated knots) knot span acts as an element. From definition, we know that a pth-order B-Spline geometry is a weighted sum of all the control points, where the weights are the p-th order basis functions defined on the given knot vector. Normally, we need to build the whole basis function pyramid from the bottom to top to get the p-th order basis we need. But actually for a specific parameter, most values in the pyramid are zeros and the nonzero values will form  an inverted triangle. We also store the knot differences in another triangle as we may need them quite often both for the evaluation and other operations(e.g. derivatives of the basis functions). So together they form an (p+1) by (p+1) table. Please check "The NURBS book" for more details about this algorithm. The computation of the p+1 non-vanishing basis functions of order p are achieved via the getBasis function. Then in the global function, the control points corresponding to the non-zero basis functions will be picked and multiplied with the them.

Fig.1. A B-Spline surface

2.JacobianTransposed jacobianTransposed (const LocalCoordinate &local) const
This function requires all first partial derivative of the B-Spline geometry. And the B-Spline derivative can boil down into the derivative of the basis function. The derivative of a p-th order B-Spline function requires two neighboring (p-1)order B-Spline basis functions. Similar to the computation of the basis functions, we only compute the non-zero basis derivatives. So we can reuse the table build by the getBasis function. We need to compute the derivative vector for each parameter variable, decided by the dimensionality of the B-Spline geometry. Each time, we replace the basis function by the derivative of the basis function with respect to a certain parameter in the original B-Spline definition formula.

Some other interface functions like the inverse mapping  and the volume are very challenging in B-Spline scenarios and also not quite useful, so we decided to skip them and move forward to other more important functionalities.