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

dg1d: Teach `MeshInterpolator` how to deal with different DG kinds...

dg1d: Teach `MeshInterpolator` how to deal with different DG kinds (!220)
parent 73e636ee
No related branches found
No related tags found
1 merge request!220dg1d: Teach `MeshInterpolator` how to deal with different DG kinds
Pipeline #7233 passed
......@@ -687,14 +687,28 @@ function MeshInterpolator(smpl_x::AbstractArray{<:Float64}, ref_mesh::Mesh1d)
# find all sample indices of nodes which fall into the same reference cell
same_idxs = findall(ref_idx -> ref_idx == cell_idx, ref_cell_indices)
smpl_idxs = [ current_idx ]
if length(same_idxs) == 1
if length(same_idxs) != 1
append!(smpl_idxs, same_idxs[2:end])
end
# extract the sample nodes
smpl_xs = smpl_x[smpl_idxs]
# generate interpolation matrix
box = ref_mesh.boxes[cell_idx]
(xmin, xmax), = box.extends
ref_xs = @. (2*smpl_xs - (xmax+xmin))/(xmax-xmin)
# generate interpolation matrix
push!(interpolation_matrices,
(cell_idx, dg1d.barycentric_interp_matrix(smpl_xs, ref_x[:,cell_idx])))
if ref_mesh.element.kind === :modal_bspline1
push!(interpolation_matrices,
(cell_idx, dg1d.Bspline.vandermonde_matrix(ref_xs, ref_mesh.element.bs1)))
elseif ref_mesh.element.kind === :modal_bsplinea2
push!(interpolation_matrices,
(cell_idx, dg1d.Bspline.vandermonde_matrix(ref_xs, ref_mesh.element.bs2)))
else
push!(interpolation_matrices,
(cell_idx, dg1d.barycentric_interp_matrix(smpl_xs, ref_x[:,cell_idx])))
end
current_idx += length(smpl_idxs)
if current_idx > length(ref_cell_indices)
......
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