Evaluating a solution at a vertex, step-13

37 views
Skip to first unread message

Kyle Schwiebert

unread,
Oct 20, 2021, 3:32:41 PM10/20/21
to deal.II User Group
Hello,

I'm having trouble resolving the following complier error:

error: ‘const class dealii::DoFCellAccessor<dealii::DoFHandler<3, 3>, false>’ has no member named ‘vertex_indices’; did you mean ‘vertex_index’?

I don't understand the difference between the following code and the double for-loop of step13::PointValueEvaluation::operator()

for (const auto &cell : dof_handler.active_cell_iterators())
{
 // Loop over all vertices in the current cell.
     for (const auto vertex : cell->vertex_indices()){
       // Do some computation with the solution at the vertex.

Indeed, the documentation does not list a member function "vertex_indices()" for the active cell iterator class. However, then I do not understand why the above line works in step-13. Does it have anything to do with my solution vector being a BlockVector<double> rather than Vector<double>? Perhaps (maybe even likely) I have some misunderstanding of what -> is doing. Later in the code the following line compiles just fine even though vertex() is ALSO not a documented member function of the active cell iterator class:

Point<3> currentVertex = cell->vertex(vertex);

I clearly have some grave misunderstanding I haven't been able to sort out on my own with the documentation and examples. Can someone help me figure out what is going on here?

Quick note: I'm aware that evaluation at the vertices is risky in the case of DG methods, but I am using Q2 FEs.

Regards,
Kyle

Wolfgang Bangerth

unread,
Oct 24, 2021, 11:43:31 PM10/24/21
to dea...@googlegroups.com
On 10/20/21 1:32 PM, Kyle Schwiebert wrote:
>
> error: ‘const class dealii::DoFCellAccessor<dealii::DoFHandler<3, 3>, false>’
> has no member named ‘vertex_indices’; did you mean ‘vertex_index’?

The function was only added in a recent deal.II version I believe. What
version are you using?


> I don't understand the difference between the following code and the double
> for-loop of step13::PointValueEvaluation::operator()
>
> for (const auto &cell : dof_handler.active_cell_iterators())
> {
>  // Loop over all vertices in the current cell.
>      for (const auto vertex : cell->vertex_indices()){
>        // Do some computation with the solution at the vertex.
>
> Indeed, the documentation does not list a member function "vertex_indices()"
> for the active cell iterator class.

When you write 'cell->', you get an object that is either of type
CellAccessor, or DoFCellAccessor, and the former has the function you are
looking for.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Reply all
Reply to author
Forward
0 new messages