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

add temporary initial refinement

parent 4bdfb091
No related branches found
No related tags found
No related merge requests found
......@@ -77,7 +77,7 @@ function L1L2TVContext(name, mesh, m; T, tdata, S,
Vest = FeSpace(mesh, DP0(), (1,))
Vg = FeSpace(mesh, P1(), (1,))
Vu = FeSpace(mesh, P1(), (m,))
Vp1 = FeSpace(mesh, DP1(), (1,))
Vp1 = FeSpace(mesh, P1(), (1,))
Vp2 = FeSpace(mesh, DP0(), (m, d))
est = FeFunction(Vest, name="est")
......@@ -399,6 +399,7 @@ function estimate!(ctx::L1L2TVContext)
w = FeFunction(ctx.u.space)
solve_primal!(w, ctx)
#w.data .= .-w.data
# TODO: find better name: is actually a cell-wise integration
project!(ctx.est, estf; ctx.g, ctx.u, ctx.p1, ctx.p2,
nablau = nabla(ctx.u), w, nablaw = nabla(w), ctx.tdata)
......@@ -679,6 +680,7 @@ function denoise_approximation(ctx)
T(tdata, u) = u
S(u, nablau) = u
#S(u, nablau) = nablau
st = L1L2TVContext(ctx.params.name, ctx.params.mesh, 1;
T, tdata = nothing, S,
......@@ -688,6 +690,7 @@ function denoise_approximation(ctx)
#project_img!(st.g, img)
interpolate!(st.g, x -> interpolate_bilinear(ctx.params.img, x))
st.u.data .= st.g.data
#st.u.data .= rand(size(st.u.data))
save_vtk(st, i) =
output(st,
......@@ -708,6 +711,24 @@ function denoise_approximation(ctx)
pvd[0] = save_vtk(st, 0)
println("primal energy: $(primal_energy(st))")
# initial refinement
for _ in 1:14
marked_cells = Set(axes(st.mesh.cells, 2))
mesh, fs = refine(st.mesh, marked_cells;
st.est, st.g, st.u, st.p1, st.p2, st.du, st.dp1, st.dp2)
st = L1L2TVContext("run", mesh, st.d, st.m, T, nothing, S,
st.alpha1, st.alpha2, st.beta, st.lambda,
st.gamma1, st.gamma2,
fs.est, fs.g, fs.u, fs.p1, fs.p2, fs.du, fs.dp1, fs.dp2)
end
#marked_cells = Set(axes(st.mesh.cells, 2))
#mesh2, fs = refine(st.mesh, marked_cells;
# st.est, st.g, st.u, st.p1, st.p2, st.du, st.dp1, st.dp2)
#st2 = L1L2TVContext("run", mesh2, st.d, st.m, T, nothing, S,
# st.alpha1, st.alpha2, st.beta, st.lambda,
# st.gamma1, st.gamma2,
# fs.est, fs.g, fs.u, fs.p1, fs.p2, fs.du, fs.dp1, fs.dp2)
k = 0
while true
step!(st)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment