Skip to content
Snippets Groups Projects
Commit 546035b3 authored by Stephan Hilb's avatar Stephan Hilb
Browse files

add basic mesh refinement test

parent bd4638ef
Branches
Tags
No related merge requests found
......@@ -28,3 +28,24 @@ Random.seed!(0)
@test img == img_sampled
end
@testset "mesh refinement" begin
# simple hashing
val(f) = integrate(f.space.mesh, (x; f) -> dot(f, f); f)
mesh = init_grid(zeros(5, 5))
f = FeFunction(FeSpace(mesh, P1(), (2, 3)))
f.data .= rand(size(f.data)...)
for i = 1:2
# refine roughly half of all cells
cells_ref = Set(findall(_ -> rand(Bool), cells(mesh)))
mesh_new, (f_new,) = refine(mesh, cells_ref; f)
@test isapprox(val(f), val(f_new))
(mesh, f) = (mesh_new, f_new)
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment