From cd43a7a60fbf74d06e2935a51c9458228e7f6d76 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Fri, 10 Jun 2022 21:48:20 -0500 Subject: [PATCH] GridGenerator: Remove CGAL implementation --- source/grid/grid_generator.cc | 122 ----------------------------- source/grid/grid_generator.inst.in | 8 -- 2 files changed, 130 deletions(-) diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index e4a2afbcdc..d1e491dcc6 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -31,11 +31,6 @@ #include -#ifdef DEAL_II_WITH_CGAL -// Functions needed by the CGAL mesh generation utilities are inside -# include -#endif - #include #include #include @@ -8643,123 +8638,6 @@ namespace GridGenerator AssertThrow(false, ExcNotImplemented()) } } - - - - template - void - implicit_function(Triangulation &tria, - const Function<3> & dealii_implicit_function, - const CGALWrappers::AdditionalData &data, - const Point<3> & interior_point, - const double & outer_ball_radius) - { -# ifdef DEAL_II_WITH_CGAL - Assert(dealii_implicit_function.n_components == 1, - ExcMessage( - "The implicit function must have exactly one component.")); - Assert(dealii_implicit_function.value(interior_point) < 0, - ExcMessage( - "The implicit function must be negative at the interior point.")); - Assert(outer_ball_radius > 0, - ExcMessage("The outer ball radius must be positive.")); - Assert(tria.n_active_cells() == 0, - ExcMessage("The triangulation must be empty.")); - - if constexpr (dim == 3) - { - using K = CGAL::Exact_predicates_inexact_constructions_kernel; - using NumberType = K::FT; - using Point_3 = K::Point_3; - using Sphere_3 = K::Sphere_3; - - using Mesh_domain = CGAL::Labeled_mesh_domain_3; - using Tr = - CGAL::Mesh_triangulation_3::type; - using C3t3 = CGAL::Mesh_complex_3_in_triangulation_3; - using Mesh_criteria = CGAL::Mesh_criteria_3; - - - auto cgal_implicit_function = [&](const Point_3 &p) { - return NumberType( - dealii_implicit_function.value(Point<3>(p.x(), p.y(), p.z()))); - }; - - Mesh_domain domain = Mesh_domain::create_implicit_mesh_domain( - cgal_implicit_function, - K::Sphere_3( - Point_3(interior_point[0], interior_point[1], interior_point[2]), - outer_ball_radius * outer_ball_radius)); - - Mesh_criteria criteria(CGAL::parameters::facet_size = data.facet_size, - CGAL::parameters::facet_angle = data.facet_angle, - CGAL::parameters::facet_distance = - data.facet_distance, - CGAL::parameters::cell_radius_edge_ratio = - data.cell_radius_edge_ratio, - CGAL::parameters::cell_size = data.cell_size); - - auto cgal_triangulation = CGAL::make_mesh_3(domain, criteria); - CGALWrappers::cgal_triangulation_to_dealii_triangulation( - cgal_triangulation, tria); - } - else if constexpr (dim == 2) - { - // default triangulation for Surface_mesher - using Tr = CGAL::Surface_mesh_default_triangulation_3; - using C2t3 = CGAL::Complex_2_in_triangulation_3; - using GT = Tr::Geom_traits; - using Sphere_3 = GT::Sphere_3; - using Point_3 = GT::Point_3; - using FT = GT::FT; - typedef FT (*Function)(Point_3); - using Surface_3 = CGAL::Implicit_surface_3; - using Surface_mesh = CGAL::Surface_mesh; - - - auto cgal_implicit_function = [&](const Point_3 &p) { - return FT( - dealii_implicit_function.value(Point<3>(p.x(), p.y(), p.z()))); - }; - - Surface_3 surface(cgal_implicit_function, - Sphere_3(Point_3(interior_point[0], - interior_point[1], - interior_point[2]), - outer_ball_radius * outer_ball_radius)); - - Tr tr; - C2t3 c2t3(tr); - Surface_mesh mesh; - - CGAL::Surface_mesh_default_criteria_3 criteria(data.angular_bound, - data.radius_bound, - data.distance_bound); - CGAL::make_surface_mesh(c2t3, - surface, - criteria, - CGAL::Non_manifold_tag()); - CGAL::facets_in_complex_2_to_triangle_mesh(c2t3, mesh); - CGALWrappers::cgal_surface_mesh_to_dealii_triangulation(mesh, tria); - } - else - { - Assert(false, ExcImpossibleInDim(dim)); - } - -# else - - (void)tria; - (void)dealii_implicit_function; - (void)data; - (void)interior_point; - (void)outer_ball_radius; - AssertThrow(false, ExcMessage("This function needs CGAL to be installed.")); - -# endif - } } // namespace GridGenerator // explicit instantiations diff --git a/source/grid/grid_generator.inst.in b/source/grid/grid_generator.inst.in index 0ef6acbddf..05d1fff1c2 100644 --- a/source/grid/grid_generator.inst.in +++ b/source/grid/grid_generator.inst.in @@ -228,14 +228,6 @@ for (deal_II_dimension : DIMENSIONS) hyper_ball_balanced(Triangulation &, const Point &, const double); - - template void - implicit_function( - Triangulation &, - const Function<3> &, - const CGALWrappers::AdditionalData &, - const Point<3> &, - const double &); #endif \} } -- 2.39.5