21#include "rheolef/adapt.h"
22#include "rheolef/form.h"
23#include "rheolef/field_wdof_sliced.h"
24#include "rheolef/field_expr.h"
29template<
class T,
class M>
30geo_basic<T,M>
adapt_gmsh (
const field_basic<T,M>& uh,
const adapt_option& opts);
31template<
class T,
class M>
32geo_basic<T,M>
adapt_bamg (
const field_basic<T,M>& uh,
const adapt_option& opts);
37template<
class T,
class M>
42 if (Uh.get_approx() == approx)
return uh;
54template<
class T,
class M>
58 check_macro (Xh.get_approx() ==
"P1",
"smooth: expect P1 approx, but have " << Xh.get_approx());
63 for (
size_t i = 0; i < n; i++) {
71template<
class T,
class M>
78 check_macro (Xh.valued() ==
"scalar",
"hessian: unexpected "<<Xh.valued()<<
"-valued field");
79 check_macro (Xh.get_approx() ==
"P1",
"hessian: unexpected "<<Xh.get_approx()<<
" approximation");
86 gh.set_u() = smv.
solve ((bv*uh).
u());
102template<
class T,
class M>
117 for (
size_type i_comp = 0; i_comp <
d; i_comp++) {
118 for (
size_type j_comp = 0; j_comp <
d; j_comp++) {
119 hh_comp[i_comp][j_comp].proxy_assign (hh(i_comp,j_comp));
125 T uh_scale = std::max(cut_off, fabs(uh.
max() - uh.
min()));
126 T factor = opts.
hcoef*sqrt(uh_scale)*
pow(opts.
err,1./(k+1));
127 T eps = std::numeric_limits<T>::epsilon();
128 for (
size_type idof = 0, ndof = uh.
ndof(); idof < ndof; idof++) {
129 for (
size_type i_comp = 0; i_comp <
d; i_comp++) {
130 for (
size_type j_comp = 0; j_comp <
d; j_comp++) {
131 h_value(i_comp,j_comp) = hh(i_comp,j_comp).
dof (idof);
133 const bool use_svd_when_2d =
true;
135 if (use_svd_when_2d &&
d == 2) {
142 for (
size_type i_comp = 0; i_comp <
d; i_comp++) {
143 if (fabs(
lambda[i_comp]) < eps)
continue;
149 h_min = std::min (h_min,
h_local[i_comp]);
152 sh.
dof (idof) = h_min;
156 for (
size_type i_comp = 0; i_comp <
d; i_comp++) {
157 for (
size_type j_comp = 0; j_comp <
d; j_comp++) {
158 mh(i_comp,j_comp).
dof (idof) = m_value(i_comp,j_comp);
165 trace_macro (
"uh_scale="<<uh_scale<<
", factor="<<uh_scale<<
" => sh.min="<<sh.
min()<<
", sh.max="<<sh.
max());
177template<
class T,
class M>
183 size_t d = uh.
get_geo().dimension();
195#define _RHEOLEF_instanciation(T,M) \
196template field_basic<T,M> proj (const field_basic<T,M>&, const std::string&); \
197template field_basic<T,M> smooth (const field_basic<T,M>&, size_t); \
198template field_basic<T,M> hessian (const field_basic<T,M>&); \
199template field_basic<T,M> hessian_criterion (const field_basic<T,M>&, const adapt_option&); \
200template geo_basic<T,M> adapt (const field_basic<T,M>&, const adapt_option&);
203#ifdef _RHEOLEF_HAVE_MPI
#define _RHEOLEF_instanciation(T, M, A)
field::size_type size_type
field gh(Float epsilon, Float t, const field &uh, const test &v)
see the Float page for the full documentation
const geo_type & get_geo() const
const space_type & get_space() const
const std::string & valued() const
generic mesh with rerefence counting
vec< T, M > solve(const vec< T, M > &b) const
point_basic< T > eig(tensor_basic< T > &q, size_t dim=3) const
point_basic< T > svd(tensor_basic< T > &u, tensor_basic< T > &v, size_t dim=3) const
#define trace_macro(message)
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
This file is part of Rheolef.
field_basic< T, M > hessian_criterion(const field_basic< T, M > &uh0, const adapt_option &opts)
geo_basic< T, M > adapt(const field_basic< T, M > &uh, const adapt_option &opts)
adapt(uh,opts): see the adapt page for the full documentation
field_basic< T, M > hessian(const field_basic< T, M > &uh)
space_mult_list< T, M > pow(const space_basic< T, M > &X, size_t n)
field_basic< T, M > proj(const field_basic< T, M > &uh, const std::string &approx="P1")
geo_basic< T, M > adapt_gmsh(const field_basic< T, M > &uh, const adapt_option &opts)
field_basic< T, M > smooth(const field_basic< T, M > &uh, size_t n=1)
details::field_expr_v2_nonlinear_terminal_function< details::h_local_pseudo_function< Float > > h_local()
h_local: see the expression page for the full documentation
geo_basic< T, M > adapt_bamg(const field_basic< T, M > &uh, const adapt_option &opts)
csr< T, M > diag(const vec< T, M > &d)
csr< T, sequential > trans(const csr< T, sequential > &a)
trans(a): see the form page for the full documentation
adapt_option: see the adapt page for the full documentation
size_type n_smooth_metric