Re: Simple merge_triangulation problem

33 views
Skip to first unread message
Message has been deleted

Bruno Turcksin

unread,
Jan 23, 2020, 9:06:48 AM1/23/20
to deal.II User Group
Konrad,

What does it mean you cannot merge the cells? Do you get the wrong results? Does the code segfault? Do you get an error message?

Best,

Bruno

On Thursday, January 23, 2020 at 8:56:34 AM UTC-5, Konrad Wiśniewski wrote:
Hi all!

I've encountered a problem with very simple two-cells merging in 2D (deal.ii v.9.0.0). 
Lets say that I have two rectangular cells (for two different material) and I want to merge it together and then refine those cells properly.
I don't have a problem with this when I want to merge cells when they are side by side 1):


but I cannot merge cells with this configuration 2):

Or even in this configuration 3):

I wonder why it is a case? It seems the most simple case for merge_triangulation() function. Can anyone show me how merge second case properly?

This is my code with the simplest coordinates of vertices:

//FIRST CELL
static const Point<2> vertices_1[]
               
= {
                       
Point<2>(0.0, 0.0),
                       
Point<2>(1.0, 0.0),
                       
Point<2>(0.0, 1.0),
                       
Point<2>(1.0, 1.0)
                 
};
             
           
// Creating CellData and vertices list for this material (in this case for only one cell):
           
const unsigned int n_vertices = 4;
            const std::vector<Point<dim>> vertices_list_2(&vertices_2[0], &vertices_2[n_vertices]);
           
static const int cell_vertices[] = {0,1,2,3};
           
CellData<dim> cells_1;

            for(unsigned int j=0;j<n_vertices;j++)
           
{
                cell_1
.vertices[j] = cell_vertices[i][j];
           
}
            cell_1
.material_id = material_one_id;

            // Create triangulation:    

            Triangulation<dim>    temp_down_triangulation;
            temp_down_triangulation
.create_triangulation(vertices_list_1,cell_1,SubCellData());


//SECOND CELL
static const Point<2> vertices_2[]
               
= {
                       
Point<2>(0.0, 1.0),
                       
Point<2>(1.0, 1.0),
                       
Point<2>(0.0, 2.0),
                       
Point<2>(1.0, 2.0)
                 
};
            // Creating CellData for second cell
            const std::vector<Point<dim>> vertices_list_2(&vertices_2[0], &vertices_2[n_vertices]);
           
CellData<dim> cell_2;

           
for(unsigned int j=0;j<n_vertices; j++){
                cell_2
.vertices[j] = cell_vertices_2[i][j];
           
}
            cell_2
.material_id = material_two_id;

            Triangulation<dim>    temp_up_triangulation;
            temp_up_triangulation
.create_triangulation(vertices_list_2, cell_2, SubCellData());

// MERGING...

            GridGenerator::merge_triangulations(temp_down_triangulation,
                            temp_up_triangulation
,
                            final_triangulation
);


Konrad Wiśniewski

unread,
Jan 23, 2020, 10:10:37 AM1/23/20
to deal.II User Group
The program is suddenly terminated with exit value -1 so, I guess it is segfault. It is very strange because the program works perfectly fine in case 1), and after I swap coordinates between cell1 and cell2 (to get the case 3) program just stop functioning.

Konrad Wiśniewski

unread,
Jan 23, 2020, 10:40:28 AM1/23/20
to deal.II User Group
Oh! Sorry for bothered you, problem lies somewhere else - this topic can be deleted!
Reply all
Reply to author
Forward
0 new messages