since I want to encode the fact that we have Neumann data. To do so, I created a function that describes my Neumann data
template<int dim>
class NeumannData: public Function<dim> {
virtual double value(const Point<dim> &p, const unsigned int) const override;
};
template<int dim>
double NeumannData<dim>::value(const Point<dim> &p, const unsigned int) const {return p[0] + p[1];}
and hence my refine function becomes (in red what I changed w.r.t the original tutorial program)
template<int dim>
void step7<dim>::refine_grid() {
const NeumannData<dim> neumann_func;
switch (refinement_mode) {
case global_refinement: {
triangulation.refine_global(1);
break;
}
case adaptive_refinement: {
Vector<float> estimated_error_per_cell(triangulation.n_active_cells());
KellyErrorEstimator<dim>::estimate(dof_handler,
QGauss<dim - 1>(fe->degree + 1),
std::map<types::boundary_id, const Function<dim> *>(1,&neumann_func),
estimated_error_per_cell);
GridRefinement::refine_and_coarsen_fixed_number(triangulation,
estimated_error_per_cell, 0.3, 0.03);
triangulation.execute_coarsening_and_refinement();
break;
}
default: {
Assert(false, ExcNotImplemented());
}
}
}
The boundary indicator for Neumann data is 1, and I gave a pointer to a constant function as argument. Unfortunately, the compiler says: "no matching constructor for initialization of 'std::map<types::boundary_id, const Function<2> *>' (aka 'map<unsigned int, const Function<2> *>') std::map<types::boundary_id, const Function<dim> *>(1,&neumann_func),"
What am I missing?
Thanks,
Bob