Junxiang Wang,

it looks like you are using a const multiphyProblem instance but its
member function interpolate is not const. Try

multiphyProblem<dim>::interpolate(TriaActiveIterator<dealii::DoFCellAccessor<dim,
dim, false>>& cell, double      &beta) const

Best,
Daniel

On Wed, Dec 4, 2024 at 1:44 AM Junxiang Wang <wangjx0...@gmail.com> wrote:
>
> Dear DEAL.II Communities,
>
> 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
>
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see 
> https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups 
> "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to dealii+unsubscr...@googlegroups.com.
> To view this discussion visit 
> https://groups.google.com/d/msgid/dealii/35e14bbf-7409-4c59-bedc-1b62f3d118fen%40googlegroups.com.

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/dealii/CAOYDWb%2BziHEiQH%3D1VvQ%3DmQ%3D9w%2Bwc1n0qe6g1FE3VmkJtuWK%2BfA%40mail.gmail.com.

Reply via email to