transfering refinement flags between triangulation of dimension <spacedim-1,spacedim> and <spacedim>

55 views
Skip to first unread message

SebG

unread,
Feb 9, 2016, 7:18:59 AM2/9/16
to deal.II User Group
Dear all,

I am working on two different triangulations and would to transfer refinement flags between them. I used a mapping like in GridGenerator::extract_boundary_mesh:

std::map< typename Triangulation<spacedim-1,spacedim>::cell_iterator , typename Triangulation<spacedim>::face_iterator > surfaceToVolumeMapping;

I know the refinement flags on the triangulation of dimension <spacedim-1,spacedim> and would like to transfer to the triangulation of dimension <spacedim>. I thought of something like this

for (typename Triangulation<
spacedim-1,spacedim>::active_cell_iterator
            cell = surfaceTriangulation.begin_active();
            cell != surfaceTriangulation.end(); ++cell)
        if ( cell -> refine_flag_set() )
            face -> set_refine_flag();

Unfortunately, the face flag cannot be set for refinement. What would be work around? Is there a way to get adjacent cells to a face.

I thought another option would be to modify the mapping the store cell iterators instead of face iterators, i.e.


std::map< typename Triangulation<spacedim-1,spacedim>::cell_iterator , std::vector< typename Triangulation<spacedim>::cell_iterator > > surfaceToVolumeMapping;

Best Sebastian

Wolfgang Bangerth

unread,
Feb 9, 2016, 10:25:58 AM2/9/16
to dea...@googlegroups.com
On 02/09/2016 06:18 AM, SebG wrote:
>
>
> I am working on two different triangulations and would to transfer
> refinement flags between them. I used a mapping like in
> GridGenerator::extract_boundary_mesh:
>
> std::map< typename Triangulation<spacedim-1,spacedim>::cell_iterator ,
> typename Triangulation<spacedim>::face_iterator > surfaceToVolumeMapping;
>
> I know the refinement flags on the triangulation of dimension
> <spacedim-1,spacedim> and would like to transfer to the triangulation of
> dimension <spacedim>. I thought of something like this
>
> for (typename Triangulation<spacedim-1,spacedim>::active_cell_iterator
> cell = surfaceTriangulation.begin_active();
> cell != surfaceTriangulation.end(); ++cell)
> if ( cell -> refine_flag_set() )
> face -> set_refine_flag();
>
> Unfortunately, the face flag cannot be set for refinement. What would be
> work around? Is there a way to get adjacent cells to a face.

There isn't. I think what I'd do is call
face->set_user_flag();
and in a later loop do
for(cell=...)
for (f=0....)
if (cell->face(f)->user_flag_set())
cell->set_refine_flag();

Of course you'll have to clear the user flags before all of this.

Best
W.

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

SebG

unread,
Feb 15, 2016, 4:58:26 AM2/15/16
to deal.II User Group
Thank You for your reply. I implemented it the way you proposed and grouped all the data structure in a MeshHandler class.

I extract the mesh of codimension one, i.e. the surface_triangulation, from the volume_triangulation. The normal vectors of the cells of the surface_triangulation are not pointing "outward". Is there a method to change the orientation like face_flip or so for cells of a mesh of codimension one? Or do I manually have to change the vertex ordering in the CellData object, which I am using to construct the surface_triangulation?

Best Sebastian

Wolfgang Bangerth

unread,
Feb 15, 2016, 11:52:48 AM2/15/16
to dea...@googlegroups.com
On 02/15/2016 03:58 AM, SebG wrote:
> Thank You for your reply. I implemented it the way you proposed and grouped
> all the data structure in a MeshHandler class.
>
> I extract the mesh of codimension one, i.e. the surface_triangulation, from
> the volume_triangulation. The normal vectors of the cells of the
> surface_triangulationare not pointing "outward". Is there a method to change
> the orientation like face_flip or so for cells of a mesh of codimension one?
> Or do I manually have to change the vertex ordering in the CellData object,
> which I am using to construct the surface_triangulation?

Sebastian,
I think I implemented this a few months ago, see
https://github.com/dealii/dealii/pull/1896
Can you try with the current development sources?

SebG

unread,
Feb 16, 2016, 8:53:46 AM2/16/16
to deal.II User Group
I modified my code according to the devolopement sources. Now, the directions are correct in my MeshHandler class.

Many thanks again.
Reply all
Reply to author
Forward
0 new messages