Skip to content
Snippets Groups Projects
Verified Commit 21d46511 authored by Florian Atteneder's avatar Florian Atteneder
Browse files

rm BernsteinElement again

parent 9025b78f
No related branches found
No related tags found
No related merge requests found
...@@ -5,32 +5,6 @@ using dg1d ...@@ -5,32 +5,6 @@ using dg1d
using LinearAlgebra using LinearAlgebra
struct BernsteinElement
Npts::Int64
N::Int64
x::Vector{Float64}
M::Matrix{Float64}
invM::Matrix{Float64}
S::Matrix{Float64}
MDM::Matrix{Float64} # = (M^-1 D^T M) = M^-1 S^T
MB_lhs::Vector{Float64} # = M^(-1) Bn(-1)
MB_rhs::Vector{Float64} # = M^(-1) Bn(-1)
end
function BernsteinElement(Npts)
N = Npts-1
x = collect(range(-1.0,1.0,length=Npts))
M = mass_matrix(Npts)
invM = inv(M)
S = stiffness_matrix(Npts)
MDM = invM * transpose(S)
MB_lhs = invM[:,1] # because Bn(-1) = δ(n,1)
MB_rhs = invM[:,end] # because Bn(1) = δ(n,Npts)
return BernsteinElement(Npts, N, x, M, invM, S, MDM, MB_lhs, MB_rhs)
end
# Normalized so that bernstein_polynomial(-1,0,N) == bernstein_polynomial(1,N,N) == 1 # Normalized so that bernstein_polynomial(-1,0,N) == bernstein_polynomial(1,N,N) == 1
function bernstein_polynomial(x, n::Integer, N::Integer) function bernstein_polynomial(x, n::Integer, N::Integer)
return binomial(N, n) / 2^N * (1 + x)^n * (1 - x)^(N-n) return binomial(N, n) / 2^N * (1 + x)^n * (1 - x)^(N-n)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment