I encountered the following compile error in the function interpolate(cell,beta) where I wanted to access cell data inside the function and failed to debug it after several methods....
"""
error: passing ‘const multiphyProblem<3>’ as ‘this’ argument discards qualifiers [-fpermissive]
1018 | double g_o = interpolate(cell,beta);
"""
The definition of cell is:
""
5 typename DoFHandler<dim>::active_cell_iterator cell = dof_handler
4 .begin_active(),
3 endc = dof_handler.end();
""
The definition of function interpolate() is:
"""
13 template <int dim>
12 double
11 multiphyProblem<dim>::interpolate(TriaActiveIterator<dealii::DoFCellAccessor<dim, dim, false>>& cell, double &beta)
10 {
9 double g{0};
8
7 double x = cell->center()[0] - 0.5;
6 double y = cell->center()[1] - 0.5;
5
4 double r = std::sqrt(std::pow(x,2) + std::pow(y,2));
3 // definition of g
8
9 return g;
10
11 }
"""
Do you know any issue may involved in the code? and can give me some hint.
Thanks a lot.
Best regard,
Junxiang Wang