Pearl,
> InterGridMap<DoFHandler<dim> > state_to_control_grid_map;
> state_to_control_grid_map.make_mapping(state_dof_handler,
> dof_handler);
>
> // skipping some code here
>
> typename DoFHandler<dim>::active_cell_iterator cell =
> dof_handler.begin_active(),
> end_cell = dof_handler.end();
> for (;cell!=end_cell; ++cell) //iterate over the state cells
> {
> if (cell->subdomain_id() ==
> triangulation->locally_owned_subdomain())//for cells on this processor
> {
> // skipping some code here
>
> control_function.set_active_cell(state_to_control_grid_map[cell]);
>
> control_function.value_list(fe_values.get_quadrature_points(),
> control_values);
> }
>
> But when I try to compile, I get the following error:
>
> source/../include/StateAdjointMatrices.h:55: error: no matching function
> for call to
> ‘InterFunction<3>::set_active_cell(dealii::TriaIterator<dealii::DoFCellAcce
>ssor<dealii::DoFHandler<3, 3> > >) const’
> source/../include/InterFunction.h:118: note: candidates are: void
> InterFunction<dim>::set_active_cell(typename dealii::DoFHandler<dim,
> dim>::active_cell_iterator&) [with int dim = 3]
The call should succeed if you make sure that InterFunction is not const --
note that it tries to call a const version of the function but only finds a
non-const one.
I think your approach with the intergrid map and the FEFieldFunction is not a
bad approach. The way I do this sort of thing is that I have a DoFHandler on
the fine mesh that holds both the values of state and controls. To get at the
values of the controls, I build the reverse map (i.e. control->state
DoFHandler). Then, at the beginning of the Newton step loop through my
control mesh, do
cell->get_dof_values (...)
to get the values of coefficient on this cell and do some version of
control_to_state_map[cell]->set_dof_values_by_interpolation (...)
to set the corresponding values of the control variable on the finer state
mesh.
I think my approach might be slightly faster, but I don't think it really
makes that much of a difference.
Best
W.
--
-------------------------------------------------------------------------
Wolfgang Bangerth email: [email protected]
www: http://www.math.tamu.edu/~bangerth/
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii