41 #ifndef GETFEM_ERROR_ESTIMATE
42 #define GETFEM_ERROR_ESTIMATE
50 template <
typename VECT1,
typename VECT2>
51 void error_estimate(
const mesh_im &mim,
const mesh_fem &mf,
52 const VECT1 &UU, VECT2 &err,
55 const mesh &m = mim.linked_mesh();
57 GMM_ASSERT3(&m == &mf.linked_mesh() &&
58 gmm::vect_size(err) >= m.nb_allocated_convex(),
"");
62 getfem::ga_workspace workspace;
65 getfem::base_vector Z(nbdof);
66 getfem::base_vector U(gmm::vect_size(UU));
68 workspace.add_fem_constant(
"u", mf, U);
69 workspace.add_fem_variable(
"z", mf0, gmm::sub_interval(0, nbdof), Z);
70 workspace.add_expression
72 "*Norm_sqr(Grad_u.Normal-Interpolate(Grad_u,neighbor_element).Normal)"
73 "*(Test_z+Interpolate(Test_z,neighbor_element))", mim, inner_faces);
74 workspace.set_assembled_vector(Z);
75 workspace.assembly(1);
78 for (mr_visitor cv1(rg); !cv1.finished(); ++cv1)
79 err[cv1.cv()] = Z[mf0.ind_basic_dof_of_element(cv1.cv())[0]];
82 #ifdef EXPERIMENTAL_PURPOSE_ONLY
85 void error_estimate_nitsche(
const mesh_im & mim,
94 scalar_type vertical_force,