-
Notifications
You must be signed in to change notification settings - Fork 708
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conversion from CGAL surface to deal.II tria
- Loading branch information
1 parent
ce3c581
commit 65984f2
Showing
8 changed files
with
662 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// --------------------------------------------------------------------- | ||
// | ||
// Copyright (C) 2022 by the deal.II authors | ||
// | ||
// This file is part of the deal.II library. | ||
// | ||
// The deal.II library is free software; you can use it, redistribute | ||
// it, and/or modify it under the terms of the GNU Lesser General | ||
// Public License as published by the Free Software Foundation; either | ||
// version 2.1 of the License, or (at your option) any later version. | ||
// The full text of the license can be found in the file LICENSE.md at | ||
// the top level directory of deal.II. | ||
// | ||
// --------------------------------------------------------------------- | ||
|
||
// Convert a closed CGAL::Surface_mesh or a closed CGAL::Polyhedron_3 to a | ||
// deal.II triangulation. The input mesh is a quad torus. | ||
|
||
#include <deal.II/base/config.h> | ||
|
||
#include <deal.II/grid/grid_generator.h> | ||
#include <deal.II/grid/grid_out.h> | ||
#include <deal.II/grid/tria.h> | ||
|
||
#include <CGAL/IO/io.h> | ||
#include <deal.II/cgal/triangulation.h> | ||
|
||
#include <fstream> | ||
|
||
#include "../tests.h" | ||
|
||
using namespace CGALWrappers; | ||
using Kernel = CGAL::Simple_cartesian<double>; | ||
using CGALPoint = CGAL::Point_3<Kernel>; | ||
using Mesh = CGAL::Surface_mesh<CGALPoint>; | ||
using Polyhedron = CGAL::Polyhedron_3<Kernel>; | ||
|
||
int | ||
main() | ||
{ | ||
initlog(); | ||
Triangulation<2, 3> tria; | ||
GridOut go; | ||
{ | ||
deallog << "Surface mesh" << std::endl; | ||
Mesh sm; | ||
std::ifstream input_sm(SOURCE_DIR "/input_grids/torus_quad.off"); | ||
input_sm >> sm; | ||
cgal_surface_mesh_to_dealii_triangulation(sm, tria); | ||
go.write_msh(tria, deallog.get_file_stream()); | ||
} | ||
tria.clear(); | ||
|
||
// Now do the same with a Polyhedron | ||
deallog << "Polyhedron test" << std::endl; | ||
{ | ||
Polyhedron P; | ||
std::ifstream input_p(SOURCE_DIR "/input_grids/torus_quad.off"); | ||
input_p >> P; | ||
cgal_surface_mesh_to_dealii_triangulation(P, tria); | ||
go.write_msh(tria, deallog.get_file_stream()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
|
||
DEAL::Surface mesh | ||
$NOD | ||
25 | ||
1 0.107677 -1.54743e-18 -0.331395 | ||
2 -0.281902 -1.54743e-18 -0.204814 | ||
3 -0.281902 -1.54743e-18 0.204814 | ||
4 0.107676 -1.54743e-18 0.331395 | ||
5 0.348450 -1.54743e-18 8.92032e-08 | ||
6 0.182080 0.331395 -0.560383 | ||
7 -0.476691 0.331395 -0.346336 | ||
8 -0.476691 0.331395 0.346336 | ||
9 0.182080 0.331395 0.560384 | ||
10 0.589223 0.331395 8.92032e-08 | ||
11 0.302466 0.204814 -0.930895 | ||
12 -0.791866 0.204814 -0.575325 | ||
13 -0.791866 0.204814 0.575324 | ||
14 0.302466 0.204814 0.930895 | ||
15 0.978801 0.204814 8.92032e-08 | ||
16 0.302466 -0.204814 -0.930895 | ||
17 -0.791866 -0.204814 -0.575325 | ||
18 -0.791866 -0.204814 0.575324 | ||
19 0.302466 -0.204814 0.930895 | ||
20 0.978801 -0.204814 8.92032e-08 | ||
21 0.182080 -0.331395 -0.560383 | ||
22 -0.476691 -0.331395 -0.346336 | ||
23 -0.476691 -0.331395 0.346336 | ||
24 0.182080 -0.331395 0.560384 | ||
25 0.589222 -0.331395 8.92032e-08 | ||
$ENDNOD | ||
$ELM | ||
25 | ||
1 3 0 0 4 6 7 2 1 | ||
2 3 0 0 4 7 8 3 2 | ||
3 3 0 0 4 8 9 4 3 | ||
4 3 0 0 4 9 10 5 4 | ||
5 3 0 0 4 10 6 1 5 | ||
6 3 0 0 4 11 12 7 6 | ||
7 3 0 0 4 12 13 8 7 | ||
8 3 0 0 4 13 14 9 8 | ||
9 3 0 0 4 14 15 10 9 | ||
10 3 0 0 4 15 11 6 10 | ||
11 3 0 0 4 16 17 12 11 | ||
12 3 0 0 4 17 18 13 12 | ||
13 3 0 0 4 18 19 14 13 | ||
14 3 0 0 4 19 20 15 14 | ||
15 3 0 0 4 20 16 11 15 | ||
16 3 0 0 4 21 22 17 16 | ||
17 3 0 0 4 22 23 18 17 | ||
18 3 0 0 4 23 24 19 18 | ||
19 3 0 0 4 24 25 20 19 | ||
20 3 0 0 4 25 21 16 20 | ||
21 3 0 0 4 1 2 22 21 | ||
22 3 0 0 4 2 3 23 22 | ||
23 3 0 0 4 3 4 24 23 | ||
24 3 0 0 4 4 5 25 24 | ||
25 3 0 0 4 5 1 21 25 | ||
$ENDELM | ||
DEAL::Polyhedron test | ||
$NOD | ||
25 | ||
1 0.107677 -1.54743e-18 -0.331395 | ||
2 -0.281902 -1.54743e-18 -0.204814 | ||
3 -0.281902 -1.54743e-18 0.204814 | ||
4 0.107676 -1.54743e-18 0.331395 | ||
5 0.348450 -1.54743e-18 8.92032e-08 | ||
6 0.182080 0.331395 -0.560383 | ||
7 -0.476691 0.331395 -0.346336 | ||
8 -0.476691 0.331395 0.346336 | ||
9 0.182080 0.331395 0.560384 | ||
10 0.589223 0.331395 8.92032e-08 | ||
11 0.302466 0.204814 -0.930895 | ||
12 -0.791866 0.204814 -0.575325 | ||
13 -0.791866 0.204814 0.575324 | ||
14 0.302466 0.204814 0.930895 | ||
15 0.978801 0.204814 8.92032e-08 | ||
16 0.302466 -0.204814 -0.930895 | ||
17 -0.791866 -0.204814 -0.575325 | ||
18 -0.791866 -0.204814 0.575324 | ||
19 0.302466 -0.204814 0.930895 | ||
20 0.978801 -0.204814 8.92032e-08 | ||
21 0.182080 -0.331395 -0.560383 | ||
22 -0.476691 -0.331395 -0.346336 | ||
23 -0.476691 -0.331395 0.346336 | ||
24 0.182080 -0.331395 0.560384 | ||
25 0.589222 -0.331395 8.92032e-08 | ||
$ENDNOD | ||
$ELM | ||
25 | ||
1 3 0 0 4 6 7 2 1 | ||
2 3 0 0 4 7 8 3 2 | ||
3 3 0 0 4 8 9 4 3 | ||
4 3 0 0 4 9 10 5 4 | ||
5 3 0 0 4 10 6 1 5 | ||
6 3 0 0 4 11 12 7 6 | ||
7 3 0 0 4 12 13 8 7 | ||
8 3 0 0 4 13 14 9 8 | ||
9 3 0 0 4 14 15 10 9 | ||
10 3 0 0 4 15 11 6 10 | ||
11 3 0 0 4 16 17 12 11 | ||
12 3 0 0 4 17 18 13 12 | ||
13 3 0 0 4 18 19 14 13 | ||
14 3 0 0 4 19 20 15 14 | ||
15 3 0 0 4 20 16 11 15 | ||
16 3 0 0 4 21 22 17 16 | ||
17 3 0 0 4 22 23 18 17 | ||
18 3 0 0 4 23 24 19 18 | ||
19 3 0 0 4 24 25 20 19 | ||
20 3 0 0 4 25 21 16 20 | ||
21 3 0 0 4 1 2 22 21 | ||
22 3 0 0 4 2 3 23 22 | ||
23 3 0 0 4 3 4 24 23 | ||
24 3 0 0 4 4 5 25 24 | ||
25 3 0 0 4 5 1 21 25 | ||
$ENDELM |
Oops, something went wrong.