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);


-- 
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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/8286d6a4-a1f5-4191-8f81-cbfe967ebf2f%40googlegroups.com.

Reply via email to