Dear Nitish,

If you are wanting to iterate over cell centres (or, rather, iterate over 
cells and query them for their centre), then you would do very similar to 
what you've posted:

    for (typename Triangulation<dim>::active_cell_iterator
        cell=triangulation.begin_active();
        cell!=triangulation.end(); ++cell)
{
  const Point<dim> cell_center = cell->center(); 
  // ... Do whatever...
}

Is that what you were asking for?

Regards,
Jean-Paul

On Friday, August 18, 2017 at 1:39:32 PM UTC+2, Nitish Anand wrote:
>
> Hello, 
>
> I am new to deal-ii and for my application, I wish to iterate over all the 
> cell centers.
>
> Should be somewhere here.. 
>
>     for (typename Triangulation<dim>::active_cell_iterator
>          cell=triangulation.begin_active();
>          cell!=triangulation.end(); ++cell)
>       for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
>
>         if (cell->face(f)->at_boundary())
>           {
>             const Point<dim> face_center = cell->face(f)->center();
>
>             if (std::sqrt(face_center[0]*face_center[0] +
>                                face_center[1]*face_center[1])
>                      <= inner_radius)
>               {cell->face(f)->set_boundary_id (0);
>                B0++;}
>             //else if (face_center[2]==height)
>             //  {cell->face(f)->set_boundary_id (1);B1++;}
>             else if (std::sqrt(face_center[0]*face_center[0] +
>                                face_center[1]*face_center[1])
>                      <
>                      (inner_radius + outer_radius) / 2)
>               {cell->face(f)->set_boundary_id (2);B2++;}
>             else
>               {cell->face(f)->set_boundary_id (3);B3++;}
>           }
>
> I would be glad if someone can tell me how to do it or point me towards 
> the right direction.
>
> --Nitish 
>

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to