BasisFunctions Module

The module defining spline basis objects and their arguments


OBJECT CONSTRUCTOR
- Basis (Int)
=>



METHODS OF BASIS TYPE
- PlotBasisFunc (Sub)
- FindSpan (Fn)
- FindMult (Fn)
- FindSpanMult (Sub)
- BasisFuns (Sub)
- OneBasisFun (Fn)
- AllBasisFuns (Sub)
- DersBasisFuns (Sub)
- DersOneBasisFun (Sub)
- InsertKnot (Sub)
- UpdateBasis (Sub)
- BSegments (Sub)
- ParLen (Fn)
- GrevilleAbscissae (Fn)
- get_nquad (Fn)
=>



TYPE CONSTRUCTORS
- basis_constructor (Fn)
=>



PROCEDURES
- bin (Fn)
- sort (Fn)
=>

Recursive quicksort using binary tree pivot.



Uses

  • module~~basisfunctions~~UsesGraph module~basisfunctions BasisFunctions ogpf ogpf module~basisfunctions->ogpf module~misc misc module~basisfunctions->module~misc module~parameters Parameters module~basisfunctions->module~parameters module~misc->module~parameters iso_fortran_env iso_fortran_env module~parameters->iso_fortran_env penf penf module~parameters->penf

Contents


Interfaces

public interface basis

Spline basis constructor

  • private pure function basisConstructor(nk, p, k) result(me)

    Arguments

    Type IntentOptional AttributesName
    integer, intent(in) :: nk

    Number of the knots

    integer, intent(in) :: p

    Polynomial degree

    real(kind=wp), intent(in) :: k(nk)

    Open knot vector
    kv(0:m)

    Return Value type(basis)

    Spline basis object


Derived Types

type, public :: basis

Spline basis function class

Read more…

Components

TypeVisibility AttributesNameInitial
integer, public :: p

Polynomial degree

integer, public :: nk

Number of the knots

integer, public :: m

The highest index of the knots ( nk-1 )

integer, public :: nb

Number of basis functions

integer, public :: n

The highest index of the basis functions ( nb-1 )

real(kind=wp), public, allocatable:: kv(:)

Open knot vector
kv(0:m)

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,= me%p-max(me%mult(2:ubound(me%mult)-1)

integer, public :: maxreg

Maximum reqularity of the basis functions,= me%p-min(me%mult(2:ubound(me%mult)-1)

integer, public :: nbez

Number of elements with nonzero measure, i.e., number of Bezier segments

Constructor

Spline basis constructor

private pure function basisConstructor(nk, p, k)

Type-Bound Procedures

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 up to

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


Functions

private pure elemental function FindSpan(me, u) result(span)

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.

Read more…

Arguments

Type IntentOptional AttributesName
class(basis), intent(in) :: me
real(kind=wp), intent(in) :: u

Given value

Return Value integer

Knot span index of value

private pure elemental function FindMult(me, i, u) result(mult)

Computes the multiplicity of a knot

Arguments

Type IntentOptional AttributesName
class(basis), intent(in) :: me
integer, intent(in) :: i

Starting index for search

real(kind=wp), intent(in) :: u

Given value

Return Value integer

Multiplicity of value

private pure elemental function OneBasisFun(me, i, u) result(Nip)

Computes a single basis function, .

Read more…

Arguments

Type IntentOptional AttributesName
class(basis), intent(in) :: me
integer, intent(in) :: i

Basis function index

real(kind=wp), intent(in) :: u

Given value

Return Value real(kind=wp)

private pure function ParLen(me) result(len)

Return the length of the parameter space, i.e., , where is the highest index of the knot vector.

Arguments

Type IntentOptional AttributesName
class(basis), intent(in) :: me

Return Value real(kind=wp)

Length of the parameter space

private pure function GrevilleAbscissae(me, dsc) result(pt)

Return the Greville abscissae, , of the knot vector,

Read more…

Arguments

Type IntentOptional AttributesName
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

Return Value real(kind=wp) (0:me%n)

The array containing Greville abscissae

private pure elemental function get_nquad(me, key, reduced_int, pdeq) result(ngp)

Return the number of quadrature points for a successive integration

Arguments

Type IntentOptional AttributesName
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
Valid inputs:
- "elementwise"
- "patchwise"

logical, intent(in), optional :: reduced_int

Reduced integration flag, if true, the routine will return
the number of quadrature points for reduced integration

character(len=*), intent(in), optional :: pdeq

Internal name of the relevant partial differential equation
Valid inputs:
- "Timoshenko"
- "Mindlin"
- "Shell"

Return Value integer

private pure function basisConstructor(nk, p, k) result(me)

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: nk

Number of the knots

integer, intent(in) :: p

Polynomial degree

real(kind=wp), intent(in) :: k(nk)

Open knot vector
kv(0:m)

Return Value type(basis)

Spline basis object

private pure function bin(n, r)

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: n
integer, intent(in) :: r

Return Value integer(kind=i8p)

private pure recursive function sort(x) result(res)

Arguments

Type IntentOptional AttributesName
real(kind=wp), intent(in), dimension(:):: x

Input array

Return Value real(kind=wp), dimension(size(x))


Subroutines

private subroutine PlotBasisFunc(me, first, last, d, plotRes, title, work, fname, terminal, showPlot)

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.

Arguments

Type IntentOptional AttributesName
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 png. Default = "BasisFunctions"

character(len=*), intent(in), optional :: terminal

GNUPlot terminal, Default = wxt

logical, intent(in), optional :: showPlot

Key to open created png files

private pure elemental subroutine FindSpanMult(me, u, k, s)

Computes the span and multiplicity of a knot

Arguments

Type IntentOptional AttributesName
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

private pure subroutine BasisFuns(me, u, N, span)

Computes the nonvanishing basis functions based on Algorithm A2.2 in the NURBS Book 1.

Read more…

Arguments

Type IntentOptional AttributesName
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

private pure subroutine AllBasisFuns(me, u, N, span)

Computes all non-zero basis function of all degrees from up to .

Read more…

Arguments

Type IntentOptional AttributesName
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

private pure subroutine DersBasisFuns(me, u, n, ders, span)

Computes all nonzero basis functions and their derivatives based on Algorithm A2.3 in the NURBS Book [^1].

Read more…

Arguments

Type IntentOptional AttributesName
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

private pure subroutine DersOneBasisFun(me, i, u, n, ders)

Computes a single basis function and its derivatives based on Algorithm A2.5 in the NURBS Book [^1].

Read more…

Arguments

Type IntentOptional AttributesName
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)

private pure subroutine InsertKnot(me, u, r, span)

Insert knot into times.

Read more…

Arguments

Type IntentOptional AttributesName
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

private pure subroutine UpdateBasis(me, nk, k, p)

Updates all component of the basis according to input knot vector.

Arguments

Type IntentOptional AttributesName
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

private pure subroutine BSegments(me, nb, knots)

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.

Arguments

Type IntentOptional AttributesName
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