Gridap.Polynomials
Gridap.Polynomials
— ModuleThis module provides a collection of multivariate polynomial bases.
The exported names are:
Gridap.Polynomials.MonomialBasis
— Typestruct MonomialBasis{D,T} <: Field
Type representing a basis of multivariate scalar-valued, vector-valued, or tensor-valued, iso- or aniso-tropic monomials. The fields of this struct
are not public This type fully implements the Field
interface, with up to second order derivatives.
Gridap.Polynomials.MonomialBasis
— MethodMonomialBasis{D}(::Type{T}, order::Int [, filter::Function]) where {D,T}
Returns an instance of MonomialBasis
representing a multivariate polynomial basis in D
dimensions, of polynomial degree order
, whose value is represented by the type T
. The type T
is typically <:Number
, e.g., Float64
for scalar-valued functions and VectorValue{D,Float64}
for vector-valued ones.
Filter function
The filter
function is used to select which terms of the tensor product space of order order
in D
dimensions are to be used. If the filter is not provided, the full tensor-product space is used by default leading to a multivariate polynomial space of type Q. The signature of the filter function is
(e,order) -> Bool
where e
is a tuple of D
integers containing the exponents of a multivariate monomial. The following filters are used to select well known polynomial spaces
- Q space:
(e,order) -> true
- P space:
(e,order) -> sum(e) <= order
- "Serendipity" space:
(e,order) -> sum( [ i for i in e if i>1 ] ) <= order
Gridap.Polynomials.MonomialBasis
— MethodMonomialBasis{D}(::Type{T}, orders::Tuple [, filter::Function]) where {D,T}
This version of the constructor allows to pass a tuple orders
containing the polynomial order to be used in each of the D
dimensions in order to construct and anisotropic tensor-product space.
Gridap.Polynomials.QCurlGradMonomialBasis
— Typestruct QCurlGradMonomialBasis{...} <: Field
This type implements a multivariate vector-valued polynomial basis spanning the space needed for Raviart-Thomas reference elements on n-cubes. The type parameters and fields of this struct
are not public. This type fully implements the Field
interface, with up to first order derivatives.
Gridap.Polynomials.QCurlGradMonomialBasis
— MethodQCurlGradMonomialBasis{D}(::Type{T},order::Int) where {D,T}
Returns a QCurlGradMonomialBasis
object. D
is the dimension of the coordinate space and T
is the type of the components in the vector-value.
Gridap.Polynomials.QGradMonomialBasis
— Typestruct QGradMonomialBasis{...} <: Field
This type implements a multivariate vector-valued polynomial basis spanning the space needed for Nedelec reference elements on n-cubes. The type parameters and fields of this struct
are not public. This type fully implements the Field
interface, with up to first order derivatives.
Gridap.Polynomials.QGradMonomialBasis
— MethodQGradMonomialBasis{D}(::Type{T},order::Int) where {D,T}
Returns a QGradMonomialBasis
object. D
is the dimension of the coordinate space and T
is the type of the components in the vector-value.
Gridap.Polynomials.change_basis
— Methodchange_basis(basis,changeofbasis::AbstractMatrix)
Examples
Compute the Lagrangian basis associated with a set of nodes
using LinearAlgebra
using Gridap.Fields
using Gridap.Polynomials
D = 2
order = 1
f = MonomialBasis{D}(Float64,order)
nodes = Point{2,Int}[(0,0),(1,0),(0,1),(1,1)]
change = inv(evaluate(f,nodes))
g = change_basis(f,change)
println(evaluate(g,nodes))
# output
[1.0 0.0 0.0 0.0; 0.0 1.0 0.0 0.0; 0.0 0.0 1.0 0.0; 0.0 0.0 0.0 1.0]
Gridap.Polynomials.get_exponents
— Methodget_exponents(b::MonomialBasis)
Get a vector of tuples with the exponents of all the terms in the monomial basis.
Examples
using Gridap.Polynomials
b = MonomialBasis{2}(Float64,2)
exponents = get_exponents(b)
println(exponents)
# output
Tuple{Int64,Int64}[(0, 0), (1, 0), (2, 0), (0, 1), (1, 1), (2, 1), (0, 2), (1, 2), (2, 2)]
Gridap.Polynomials.get_order
— Methodget_order(b::MonomialBasis)
Gridap.Polynomials.get_orders
— Methodget_orders(b::MonomialBasis)
Gridap.Polynomials.get_value_type
— MethodGridap.Polynomials.num_terms
— Methodnum_terms(f::QCurlGradMonomialBasis{D,T}) where {D,T}