From fb17a87cd1a3652ec445c2c6033568a19607bea6 Mon Sep 17 00:00:00 2001
From: Stephan Hilb <stephan@ecshi.net>
Date: Fri, 6 May 2022 11:12:44 +0200
Subject: [PATCH] experimentally enable refinement according to local
 projection error

---
 scripts/run_experiments.jl | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/scripts/run_experiments.jl b/scripts/run_experiments.jl
index 94670c9..70dd2da 100644
--- a/scripts/run_experiments.jl
+++ b/scripts/run_experiments.jl
@@ -20,7 +20,7 @@ using SemiSmoothNewton
 using SemiSmoothNewton: HMesh, ncells, refine, area, mesh_size, ndofs, diam,
     elmap, assemble_lumped, norm_gradient, integrate_lumped
 using SemiSmoothNewton: project!, project_l2_lagrange!, project_qi_lagrange!,
-    project_l2_pixel!
+    project_l2_pixel!, compute_local_error
 using SemiSmoothNewton: vtk_mesh, vtk_append!, vtk_save
 
 include("util.jl")
@@ -1375,6 +1375,14 @@ function inpaint(ctx)
             println("refine ...")
             #estimate_res!(st)
             marked_cells = Set(mark(st; theta = 0.5))
+
+            # EXPERIMENTAL: mark according to projection error
+            g_err = compute_local_error(st.g, g_arr)
+            # st.est was written out above and used for marking and is no
+            # longer needed
+            st.est.data .= g_err.data
+            union!(marked_cells, Set(mark(st; theta = 0.5)))
+
             # manually mark all cell within inpainting domain, since the
             # estimator is not reliable there
             for cell in cells(mesh)
@@ -1427,7 +1435,7 @@ function experiment_inpaint_denoise(ctx)
 
     params = (
         name = "test",
-        n_refine = 0,
+        n_refine = 5,
         g_arr, mask_arr, mesh,
         noise_sigma = 0.1, noise_p = 0.02,
         alpha1 = 0.2, alpha2 = 8., lambda = 1., #= beta see below =#
-- 
GitLab