Hello Everyone,

I am trying to merge two triangulations and the code is here:












































































*int main (){  Triangulation<2> final_triangulation;  Triangulation<2>
first_triangulation;  const std::vector<Point<2>> vertices = {
          Point<2>(0.0, 0.0),                        Point<2>(1.0, 0.0),
                    Point<2>(0.0, 1.0),
Point<2>(1.0, 1.0)};   const
std::vector<std::array<int,GeometryInfo<2>::vertices_per_cell>>
cell_vertices = {{{0, 1, 2, 3}}};        const unsigned int n_cells =
cell_vertices.size();      std::cout<<"cells"<<" "<<n_cells<<std::endl;
 std::vector<CellData<2>> cells_1(n_cells, CellData<2>());     for
(unsigned int i = 0; i < n_cells; ++i)  {    for (unsigned int j = 0; j <
cell_vertices[i].size(); ++j)    {      cells_1[i].vertices[j] =
cell_vertices[i][j];      cells_1[j].material_id = 3;    }
 cells_1[i].material_id = 4;
} first_triangulation.create_triangulation (vertices, cells_1,
SubCellData());      Triangulation<2> second_triangulation;  const
std::vector<Point<2>> vertices_1 = {                        Point<2>(0.0,
1.0),                        Point<2>(1.0, 1.0),
Point<2>(0.0, 2.0),                        Point<2>(1.0, 2.0)};   const
std::vector<std::array<int,GeometryInfo<2>::vertices_per_cell>>
cell_vertices_1 = {{{2, 3, 4, 5}}};        const unsigned int n_cells_1 =
cell_vertices_1.size();      std::cout<<"cells_2"<<"
"<<n_cells<<std::endl;      std::vector<CellData<2>> cells_2(n_cells_1,
CellData<2>());     for (unsigned int i = 0; i < n_cells_1; ++i)  {    for
(unsigned int j = 0; j < cell_vertices_1[i].size(); ++j)    {
cells_2[i].vertices[j] = cell_vertices_1[i][j];      cells_2[j].material_id
= 1;    }     cells_2[i].material_id = 2;       }
 second_triangulation.create_triangulation (vertices_1, cells_2,
SubCellData());
 GridGenerator::merge_triangulations(first_triangulation,
          second_triangulation,
final_triangulation);
//final_triangulation.refine_global(0);
//final_triangulation.set_all_manifold_ids_on_boundary(42);
//final_triangulation.execute_coarsening_and_refinement();  std::ofstream
out("grid-1.vtk");  GridOut       grid_out;
grid_out.write_vtk(final_triangulation, out);  std::cout << "Grid written
to grid-1.vtk" << std::endl;   }*

But this is showing the following error:



























*[ 66%] Linking CXX executable try2[ 66%] Built target try2[100%] Run try2
with Debug configurationcells 1cells_2
1--------------------------------------------------------An error occurred
in line <602> of file <./source/grid/grid_tools.cc> in function
std::tuple<std::vector<dealii::Point<spacedim, double>,
std::allocator<dealii::Point<spacedim, double> > >,
std::vector<dealii::CellData<dim>, std::allocator<dealii::CellData<dim> >
>, dealii::SubCellData>
dealii::GridTools::get_coarse_mesh_description(const
dealii::Triangulation<dim, spacedim>&) [with int dim = 2; int spacedim =
2]The violated condition was:     std::find(used_vertices.begin(),
used_vertices.end(), false) == used_vertices.end()Additional information:
  The level zero vertices should form a contiguous
range.Stacktrace:-----------#0
 /lib/x86_64-linux-gnu/libdeal.ii.g.so.9.3.2:
std::tuple<std::vector<dealii::Point<2, double>,
std::allocator<dealii::Point<2, double> > >,
std::vector<dealii::CellData<2>, std::allocator<dealii::CellData<2> > >,
dealii::SubCellData> dealii::GridTools::get_coarse_mesh_description<2,
2>(dealii::Triangulation<2, 2> const&)#1
 /lib/x86_64-linux-gnu/libdeal.ii.g.so.9.3.2: void
dealii::GridGenerator::merge_triangulations<2,
2>(std::vector<dealii::Triangulation<2, 2> const*,
std::allocator<dealii::Triangulation<2, 2> const*> > const&,
dealii::Triangulation<2, 2>&, double, bool)#2
 /lib/x86_64-linux-gnu/libdeal.ii.g.so.9.3.2: void
dealii::GridGenerator::merge_triangulations<2, 2>(dealii::Triangulation<2,
2> const&, dealii::Triangulation<2, 2> const&, dealii::Triangulation<2,
2>&, double, bool)#3  ./try2:
main--------------------------------------------------------make[3]: ***
[CMakeFiles/run.dir/build.make:71: CMakeFiles/run] Aborted (core
dumped)make[2]: *** [CMakeFiles/Makefile2:116: CMakeFiles/run.dir/all]
Error 2make[1]: *** [CMakeFiles/Makefile2:123: CMakeFiles/run.dir/rule]
Error 2make: *** [Makefile:137: run] Error 2*

I am not able to understand this error message.
 How to resolve this error? Please help.



Thanks & Regards,
Deepika

-- 
**************************************************************************

This e-mail is for the sole use of the intended recipient(s) and may

contain confidential and privileged information. If you are not the

intended recipient, please contact the sender by reply e-mail and destroy

all copies and the original message. Any unauthorized review, use,

disclosure, dissemination, forwarding, printing or copying of this email


is strictly prohibited and appropriate legal action will be taken. 


************************************************************************************************

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAKTdrprumQEt%3D1Bn9T7iNPOgTOdh61e7ZtY-2yaCJ7JJ5iSgzQ%40mail.gmail.com.

Reply via email to