> > Yes. Though it seems confusing to me that you call these variables
> > locally_*_cells, because they really are index sets for degrees of freedom,
> > not cells.
>
> OK, I misunderstood it. I thought the numbering of the dof is same as that of
> the cell since the degrees of freedom is 1 in FE_DGQ(0).
> They are still different, right?
They are *conceptually* different. Whether or not they are different *in
practice* is a different question, but you should never *assume* that they are
the same.
> > Yes, this does not work. That's because you confuse the index of the cell
> and
> > the index of the DoF that lives on it. You want the latter.
>
> Again now I understand they are different.
>
> However, for my project, I need to access both
>
> DoFHandler<dim> dof_handler;
> DoFHandler<dim> dof_handler_dg;
>
> at the same time.
>
> If I use the following loop,
>
> for (const auto &cell : opt->dof_handler.active_cell_iterators())
> {
> ...
> }
>
> how can I access to dof_handler_dg?
You can have two iterators into the two DoFHandlers that run in lock step just
like you do:
> My attempting solution is to set up multiple iterator, just as in the
> tutorial:
> https://www.dealii.org/current/doxygen/deal.II/group__Iterators.html,
>
> typename Triangulation<dim>::active_cell_iterator ti =
> opt->triangulation.begin_active();
> typename DoFHandler<dim>::active_cell_iterator di1 =
> opt->dof_handler.begin_active();
> typename DoFHandler<dim>::active_cell_iterator di2 =
> opt->dof_handler_dg.begin_active();
>
> Therefore, I set up the loop as follows,
>
> while (cell != opt->triangulation.end())
> {
> // do someting
>
> ++ti;
> ++di1;
> ++di2;
> }
>
> (Note: now I can access to the cell-based vector x successfully as follows,
> di2->get_dof_indices(local_dof_indices_dg);
> unsigned int local_dof_indices_dg_int = local_dof_indices_dg.at(0);
> opt->x(local_dof_indices_dg_int);
> )
>
>
> However, I found this method is very time-consuming compared to "for (const
> auto &cell : opt->dof_handler.active_cell_iterators())", like 11s vs. 1 s.
You mean time consuming to program, or to execute? The loop itself is cheap;
if it's slow, you need to figure out which part of the body is slow.
> My question now is: is there other method to access multiple DoFHandler
> or/and
> Triangulation?
You could just do everything in one DoFHandler. That's what I usually do: Put
all solution variables into the same DoFHandler.
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email: [email protected]
www: http://www.math.colostate.edu/~bangerth/
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/dfa0ef7a-8ea2-c290-a0eb-eaccc04dbdd0%40colostate.edu.