-
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.
- Loading branch information
1 parent
4c8162e
commit c965b7f
Showing
10 changed files
with
1,150 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// --------------------------------------------------------------------- | ||
// | ||
// 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 vector of deal.II points to a cgal Triangulation | ||
|
||
#include <deal.II/base/config.h> | ||
|
||
#include <deal.II/grid/grid_generator.h> | ||
#include <deal.II/grid/tria.h> | ||
|
||
#include <CGAL/IO/io.h> | ||
#include <CGAL/Triangulation_3.h> | ||
#include <deal.II/cgal/triangulation.h> | ||
|
||
#include "../tests.h" | ||
|
||
using namespace CGALWrappers; | ||
|
||
using K = CGAL::Simple_cartesian<double>; | ||
using CGALTriangulation = CGAL::Triangulation_3<K>; | ||
|
||
template <int dim, int spacedim> | ||
void | ||
test() | ||
{ | ||
Triangulation<dim, spacedim> tria; | ||
GridGenerator::hyper_cube(tria); | ||
CGALTriangulation tr; | ||
add_points_to_cgal_triangulation(tria.get_vertices(), tr); | ||
deallog << "dim " << dim << ", spacedim " << spacedim << std::endl | ||
<< tr << std::endl; | ||
} | ||
|
||
int | ||
main() | ||
{ | ||
initlog(); | ||
test<1, 1>(); | ||
test<1, 2>(); | ||
test<1, 3>(); | ||
test<2, 2>(); | ||
test<2, 3>(); | ||
test<3, 3>(); | ||
} |
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,170 @@ | ||
|
||
DEAL::dim 1, spacedim 1 | ||
DEAL::1 | ||
2 | ||
0.00000 0.00000 0.00000 | ||
1.00000 0.00000 0.00000 | ||
3 | ||
0 1 | ||
1 2 | ||
2 0 | ||
1 2 | ||
2 0 | ||
0 1 | ||
|
||
|
||
|
||
|
||
DEAL::dim 1, spacedim 2 | ||
DEAL::1 | ||
2 | ||
0.00000 0.00000 0.00000 | ||
1.00000 0.00000 0.00000 | ||
3 | ||
0 1 | ||
1 2 | ||
2 0 | ||
1 2 | ||
2 0 | ||
0 1 | ||
|
||
|
||
|
||
|
||
DEAL::dim 1, spacedim 3 | ||
DEAL::1 | ||
2 | ||
0.00000 0.00000 0.00000 | ||
1.00000 0.00000 0.00000 | ||
3 | ||
0 1 | ||
1 2 | ||
2 0 | ||
1 2 | ||
2 0 | ||
0 1 | ||
|
||
|
||
|
||
|
||
DEAL::dim 2, spacedim 2 | ||
DEAL::2 | ||
4 | ||
0.00000 0.00000 0.00000 | ||
1.00000 0.00000 0.00000 | ||
0.00000 1.00000 0.00000 | ||
1.00000 1.00000 0.00000 | ||
6 | ||
0 1 3 | ||
1 2 3 | ||
2 1 0 | ||
4 2 0 | ||
4 0 3 | ||
4 3 2 | ||
1 4 2 | ||
5 0 2 | ||
0 3 1 | ||
2 4 5 | ||
0 5 3 | ||
1 3 4 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
DEAL::dim 2, spacedim 3 | ||
DEAL::2 | ||
4 | ||
0.00000 0.00000 0.00000 | ||
1.00000 0.00000 0.00000 | ||
0.00000 1.00000 0.00000 | ||
1.00000 1.00000 0.00000 | ||
6 | ||
0 1 3 | ||
1 2 3 | ||
2 1 0 | ||
4 2 0 | ||
4 0 3 | ||
4 3 2 | ||
1 4 2 | ||
5 0 2 | ||
0 3 1 | ||
2 4 5 | ||
0 5 3 | ||
1 3 4 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
DEAL::dim 3, spacedim 3 | ||
DEAL::3 | ||
8 | ||
0.00000 0.00000 0.00000 | ||
1.00000 0.00000 0.00000 | ||
0.00000 1.00000 0.00000 | ||
1.00000 1.00000 0.00000 | ||
0.00000 0.00000 1.00000 | ||
1.00000 0.00000 1.00000 | ||
0.00000 1.00000 1.00000 | ||
1.00000 1.00000 1.00000 | ||
18 | ||
0 1 3 5 | ||
1 2 3 5 | ||
1 3 2 0 | ||
2 1 0 5 | ||
4 0 3 7 | ||
4 6 0 8 | ||
4 3 2 5 | ||
4 2 3 0 | ||
4 2 0 6 | ||
6 2 0 5 | ||
8 6 0 7 | ||
4 2 6 5 | ||
7 0 3 5 | ||
4 7 3 5 | ||
4 6 7 5 | ||
7 6 0 5 | ||
4 8 0 7 | ||
4 6 8 7 | ||
1 12 3 2 | ||
6 0 3 2 | ||
7 3 0 1 | ||
0 9 1 2 | ||
12 13 16 7 | ||
10 16 17 8 | ||
1 11 13 7 | ||
2 4 8 6 | ||
9 5 11 7 | ||
3 15 11 8 | ||
15 16 17 5 | ||
9 14 6 8 | ||
0 13 15 4 | ||
12 6 14 4 | ||
15 13 11 17 | ||
9 12 14 10 | ||
10 4 17 5 | ||
10 16 14 5 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
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,53 @@ | ||
// --------------------------------------------------------------------- | ||
// | ||
// 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 vector of deal.II points to a cgal Triangulation_2 | ||
|
||
#include <deal.II/base/config.h> | ||
|
||
#include <deal.II/grid/grid_generator.h> | ||
#include <deal.II/grid/tria.h> | ||
|
||
#include <CGAL/IO/io.h> | ||
#include <CGAL/Triangulation_2.h> | ||
#include <deal.II/cgal/triangulation.h> | ||
|
||
#include "../tests.h" | ||
|
||
using namespace CGALWrappers; | ||
|
||
using K = CGAL::Simple_cartesian<double>; | ||
using CGALTriangulation = CGAL::Triangulation_2<K>; | ||
|
||
template <int dim, int spacedim> | ||
void | ||
test() | ||
{ | ||
Triangulation<dim, spacedim> tria; | ||
GridGenerator::hyper_cube(tria); | ||
CGALTriangulation tr; | ||
add_points_to_cgal_triangulation(tria.get_vertices(), tr); | ||
deallog << "dim " << dim << ", spacedim " << spacedim << std::endl | ||
<< tr << std::endl; | ||
} | ||
|
||
int | ||
main() | ||
{ | ||
initlog(); | ||
test<1, 1>(); | ||
test<1, 2>(); | ||
test<2, 2>(); | ||
} |
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,48 @@ | ||
|
||
DEAL::dim 1, spacedim 1 | ||
DEAL::3 3 1 | ||
0.00000 0.00000 | ||
1.00000 0.00000 | ||
|
||
2 0 | ||
1 2 | ||
0 1 | ||
|
||
2 1 | ||
0 2 | ||
1 0 | ||
|
||
DEAL::dim 1, spacedim 2 | ||
DEAL::3 3 1 | ||
0.00000 0.00000 | ||
1.00000 0.00000 | ||
|
||
2 0 | ||
1 2 | ||
0 1 | ||
|
||
2 1 | ||
0 2 | ||
1 0 | ||
|
||
DEAL::dim 2, spacedim 2 | ||
DEAL::5 6 2 | ||
0.00000 0.00000 | ||
1.00000 0.00000 | ||
0.00000 1.00000 | ||
1.00000 1.00000 | ||
|
||
4 0 3 | ||
1 2 3 | ||
2 0 4 | ||
0 1 3 | ||
2 1 0 | ||
2 4 3 | ||
|
||
3 5 2 | ||
5 3 4 | ||
0 5 4 | ||
1 0 4 | ||
3 2 1 | ||
0 1 2 | ||
|
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,59 @@ | ||
// --------------------------------------------------------------------- | ||
// | ||
// 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 cgal Triangulation_2 to a dealii::Triangulation<2, ...> | ||
|
||
#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 <CGAL/Triangulation_2.h> | ||
#include <deal.II/cgal/triangulation.h> | ||
|
||
#include "../tests.h" | ||
|
||
using namespace CGALWrappers; | ||
|
||
using K = CGAL::Simple_cartesian<double>; | ||
using CGALTriangulation = CGAL::Triangulation_2<K>; | ||
|
||
template <int dim, int spacedim> | ||
void | ||
test() | ||
{ | ||
Triangulation<dim, spacedim> tria; | ||
GridGenerator::hyper_cube(tria); | ||
CGALTriangulation tr; | ||
add_points_to_cgal_triangulation(tria.get_vertices(), tr); | ||
|
||
tria.clear(); | ||
// Test the other way around | ||
cgal_triangulation_to_dealii_triangulation(tr, tria); | ||
deallog << "dim " << dim << ", spacedim " << spacedim << std::endl; | ||
GridOut go; | ||
go.write_vtk(tria, deallog.get_file_stream()); | ||
} | ||
|
||
int | ||
main() | ||
{ | ||
initlog(); | ||
test<1, 1>(); | ||
test<1, 2>(); | ||
test<2, 2>(); | ||
} |
Oops, something went wrong.