Spline basis function class
Procedures assume basis with open knot vector
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | p | Polynomial degree |
|||
integer, | public | :: | nk | Number of the knots |
|||
integer, | public | :: | m | The highest index of the knots |
|||
integer, | public | :: | nb | Number of basis functions |
|||
integer, | public | :: | n | The highest index of the basis functions |
|||
real(kind=wp), | public, | allocatable | :: | kv(:) | Open knot vector |
||
real(kind=wp), | public, | allocatable | :: | unik(:) | Unique knot values |
||
integer, | public, | allocatable | :: | mult(:) | Multiplicity of each unique knot value |
||
integer, | public | :: | minreg | Minimum reqularity of the basis functions, |
|||
integer, | public | :: | maxreg | Maximum reqularity of the basis functions, |
|||
integer, | public | :: | nbez | Number of elements with nonzero measure, i.e., number of Bezier segments |
Spline basis constructor
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | nk | Number of the knots |
||
integer, | intent(in) | :: | p | Polynomial degree |
||
real(kind=wp), | intent(in) | :: | k(nk) | Open knot vector |
Spline basis object
Knot span index search
This procedure is an elemental function and does a binary search and return the integer :: span
value, where lies on. Note that, indexing starts with zero. If , the index is , i.e., , where "nb
" is number of control points of the univariate spline basis object.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(basis), | intent(in) | :: | me | |||
real(kind=wp), | intent(in) | :: | u | Given value |
Knot span index of value
Knot multiplicity computation
Computes the multiplicity of a knot
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(basis), | intent(in) | :: | me | |||
integer, | intent(in) | :: | i | Starting index for search |
||
real(kind=wp), | intent(in) | :: | u | Given value |
Multiplicity of value
Knot span and multiplicity computation
Computes the span and multiplicity of a knot
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(basis), | intent(in) | :: | me | |||
real(kind=wp), | intent(in) | :: | u | Given value |
||
integer, | intent(out) | :: | k | Knot span index of value |
||
integer, | intent(out) | :: | s | Multiplicity of value |
Computation of the non-vanishing basis functions
Computes the nonvanishing basis functions based on Algorithm A2.2 in the NURBS Book 1.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(basis), | intent(in) | :: | me | |||
real(kind=wp), | intent(in) | :: | u | Given value |
||
real(kind=wp), | intent(out) | :: | N(0:me%p) |
|
||
integer, | intent(in), | optional | :: | span | Knot span where lies on |
Computation of a single basis function
Computes a single basis function, .
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(basis), | intent(in) | :: | me | |||
integer, | intent(in) | :: | i | Basis function index |
||
real(kind=wp), | intent(in) | :: | u | Given value |
Computation of a all non-zero basis function of all degrees from up to
Computes all non-zero basis function of all degrees from up to .
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(basis), | intent(in) | :: | me | |||
real(kind=wp), | intent(in) | :: | u | Given value |
||
real(kind=wp), | intent(out) | :: | N(0:me%p,0:me%p) |
|
||
integer, | intent(in), | optional | :: | span | Knot span where lies on |
Computation of the derivatives of the non-vanishing basis functions
Computes all nonzero basis functions and their derivatives based on Algorithm A2.3 in the NURBS Book [^1].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(basis), | intent(in) | :: | me | |||
real(kind=wp), | intent(in) | :: | u | Given value |
||
integer, | intent(in) | :: | n | Number of derivatives () |
||
real(kind=wp), | intent(out) | :: | ders(0:me%p,0:n) |
|
||
integer, | intent(in), | optional | :: | span | Knot span where lies on |
Computation of the the derivatives of a single basis function
Computes a single basis function and its derivatives based on Algorithm A2.5 in the NURBS Book [^1].
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(basis), | intent(in) | :: | me | |||
integer, | intent(in) | :: | i | Basis function index |
||
real(kind=wp), | intent(in) | :: | u | Given value |
||
integer, | intent(in) | :: | n | Number of derivatives () |
||
real(kind=wp), | intent(out) | :: | ders(0:n) |
|
Knot insertion of a given knot into the knot vector
Insert knot into times.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(basis), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in) | :: | u | knot value |
||
integer, | intent(in) | :: | r | multiplicity of new knot value |
||
integer, | intent(in), | optional | :: | span | knot span |
Updating the basis (the same contents with constructor)
Updates all component of the basis according to input knot vector.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(basis), | intent(inout) | :: | me | |||
integer, | intent(in) | :: | nk | Number of the knots |
||
real(kind=wp), | intent(in) | :: | k(nk) | New knot vector |
||
integer, | intent(in), | optional | :: | p | New basis degree |
Computation of the segments' data of the basis
Returns the number of Bezier segments, integer :: nb
, of the basis and the real(wp) :: knots(:)
array containing the unique values of the knot vector.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(basis), | intent(in) | :: | me | |||
integer, | intent(out) | :: | nb | Number of Bezier segments |
||
real(kind=wp), | intent(out), | optional | allocatable | :: | knots(:) | The unique knot values |
Get the length of parameter space
Computation of the Greville abscissae
Return the Greville abscissae, , of the knot vector,
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(basis), | intent(in) | :: | me | |||
logical, | intent(in), | optional | :: | dsc | If true, then the Greville abscissae are modified by shifting the boundary points into the domain |
The array containing Greville abscissae
Plot basis functions
This subroutine plots the basis functions or their th order derivatives having index from first
to last
by computing at interpolation points defined by plotRes
, and print the image file into "|cwd|
/data/work
/fname
.ext" if the workspace work
is presented, "|cwd|
/data/img/fname
.ext" if else. Plotting requires GNUPlot installed on your computer. The input parameter terminal
set the output terminal of GNUPlot.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(basis), | intent(in) | :: | me | |||
integer, | intent(in), | optional | :: | first | First index to be plotted |
|
integer, | intent(in), | optional | :: | last | Last index to be plotted |
|
integer, | intent(in), | optional | :: | d | Derivatives degree |
|
integer, | intent(in), | optional | :: | plotRes | Resolution of the calculation, Default = 100 |
|
character(len=*), | intent(in), | optional | :: | title | Title of the graph, Default = "Basis functions" |
|
character(len=*), | intent(in), | optional | :: | work | Current work name to create folder |
|
character(len=*), | intent(in), | optional | :: | fname | Filename of the *.png output, if GNUPlot terminal is |
|
character(len=*), | intent(in), | optional | :: | terminal | GNUPlot terminal, Default = |
|
logical, | intent(in), | optional | :: | showPlot | Key to open created |
Get the number of quadrature points
Return the number of quadrature points for a successive integration
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(basis), | intent(in) | :: | me | |||
character(len=*), | intent(in), | optional | :: | key | The key defining whether the quadrature is over the Bezier segments or over whole patch |
|
logical, | intent(in), | optional | :: | reduced_int | Reduced integration flag, if true, the routine will return |
|
character(len=*), | intent(in), | optional | :: | pdeq | Internal name of the relevant partial differential equation |
type :: basis
!<
integer :: p !< Polynomial degree \(p\)
integer :: nk !< Number of the knots
integer :: m !< The highest index of the knots ` ( nk-1 ) `
integer :: nb !< Number of basis functions
integer :: n !< The highest index of the basis functions ` ( nb-1 ) `
real(wp), allocatable :: kv(:) !< [Open knot vector](../page/01.fooiga/eqns.html#openvec)
!< ` kv(0:m) ` \( = \left\{u_{0},..., u_{m}\right\} \)
real(wp), allocatable :: unik(:) !< Unique knot values
integer, allocatable :: mult(:) !< Multiplicity of each unique knot value
integer :: minreg !< Minimum reqularity of the basis functions,` = me%p-max(me%mult(2:ubound(me%mult)-1) `
integer :: maxreg !< Maximum reqularity of the basis functions,` = me%p-min(me%mult(2:ubound(me%mult)-1) `
integer :: nbez !< Number of elements with nonzero measure, i.e., number of Bezier segments
contains
!< Procedures assume basis with **open knot vector**
procedure, public :: FindSpan !< **Knot span index search **
procedure, public :: FindMult !< **Knot multiplicity computation **
procedure, public :: FindSpanMult !< **Knot span and multiplicity computation **
procedure, public :: BasisFuns !< **Computation of the non-vanishing basis functions **
procedure, public :: OneBasisFun !< **Computation of a single basis function **
procedure, public :: AllBasisFuns !< **Computation of a all non-zero basis function of all degrees from \(0\) up to \(p\) **
procedure, public :: DersBasisFuns !< **Computation of the derivatives of the non-vanishing basis functions **
procedure, public :: DersOneBasisFun !< **Computation of the the derivatives of a single basis function **
procedure, public :: InsertKnot !< **Knot insertion of a given knot into the knot vector **
procedure, public :: UpdateBasis !< **Updating the basis (the same contents with constructor) **
procedure, public :: BSegments !< **Computation of the segments' data of the basis **
procedure, public :: ParLen !< **Get the length of parameter space **
procedure, public :: GrevilleAbscissae !< **Computation of the Greville abscissae **
procedure, public :: Plot => PlotBasisFunc !< **Plot basis functions **
procedure, public :: get_nquad !< **Get the number of quadrature points **
end type basis