21#ifdef DEAL_II_WITH_CGAL
30# include <CGAL/Boolean_set_operations_2.h>
31# include <CGAL/Cartesian.h>
32# include <CGAL/Circular_kernel_intersections.h>
33# include <CGAL/Constrained_Delaunay_triangulation_2.h>
34# include <CGAL/Delaunay_mesh_face_base_2.h>
35# include <CGAL/Delaunay_mesh_size_criteria_2.h>
36# include <CGAL/Delaunay_mesher_2.h>
37# include <CGAL/Delaunay_triangulation_2.h>
38# include <CGAL/Exact_predicates_exact_constructions_kernel_with_sqrt.h>
39# include <CGAL/Kernel_traits.h>
40# include <CGAL/Polygon_2.h>
41# include <CGAL/Polygon_with_holes_2.h>
42# include <CGAL/Projection_traits_xy_3.h>
43# include <CGAL/Segment_3.h>
44# include <CGAL/Simple_cartesian.h>
45# include <CGAL/Tetrahedron_3.h>
46# include <CGAL/Triangle_2.h>
47# include <CGAL/Triangle_3.h>
48# include <CGAL/Triangulation_2.h>
49# include <CGAL/Triangulation_3.h>
50# include <CGAL/Triangulation_face_base_with_id_2.h>
51# include <CGAL/Triangulation_face_base_with_info_2.h>
111 template <
typename TargetVariant>
112 struct Repackage : boost::static_visitor<TargetVariant>
114 template <
typename T>
116 operator()(
const T &t)
const
128 template <
typename... Types>
129 std::optional<std::variant<Types...>>
157 std::list<CDT::Edge> &
border)
159 if (start->info().nesting_level != -1)
163 std::list<Face_handle> queue;
164 queue.push_back(start);
165 while (!queue.empty())
169 if (
fh->info().nesting_level == -1)
171 fh->info().nesting_level = index;
172 for (
int i = 0; i < 3; i++)
176 if (n->info().nesting_level == -1)
178 if (
ct.is_constrained(e))
193 for (CDT::Face_handle f :
cdt.all_face_handles())
195 f->info().nesting_level = -1;
197 std::list<CDT::Edge>
border;
201 CDT::Edge e =
border.front();
204 if (n->info().nesting_level == -1)
223 std::vector<CGALPoint2>>>
231 std::array<CGALPoint2, 3>
pts0,
pts1;
236 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint2, 2>);
241 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint2, 2>);
250 std::optional<std::variant<CGALPoint2, CGALSegment2>>
258 std::array<CGALPoint2, 3>
pts0;
259 std::array<CGALPoint2, 2>
pts1;
264 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint2, 2>);
266 std::transform(
segment.begin(),
269 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint2, 2>);
280 std::vector<Polygon_with_holes_2>
287 std::array<CGALPoint2, 4>
pts0,
pts1;
292 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint2, 2>);
297 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint2, 2>);
302 std::vector<Polygon_with_holes_2>
poly_list;
311 std::optional<std::variant<CGALPoint3, CGALSegment3>>
316# if DEAL_II_CGAL_VERSION_GTE(5, 5, 0)
321 std::array<CGALPoint3, 4>
pts0;
322 std::array<CGALPoint3, 2>
pts1;
327 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3, 3>);
329 std::transform(
segment.begin(),
332 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3, 3>);
342 "This function requires a version of CGAL greater or equal than 5.5."));
354 std::vector<CGALPoint3>>>
359# if DEAL_II_CGAL_VERSION_GTE(5, 5, 0)
364 std::array<CGALPoint3, 4>
pts0;
365 std::array<CGALPoint3, 3>
pts1;
370 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3, 3>);
375 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3, 3>);
386 "This function requires a version of CGAL greater or equal than 5.5."));
394 std::vector<std::array<Point<2>, 3>>
408 const unsigned int size_poly = poly.size();
414 {{CGALWrappers::cgal_point_to_dealii_point<2>(poly.vertex(0)),
415 CGALWrappers::cgal_point_to_dealii_point<2>(poly.vertex(1)),
416 CGALWrappers::cgal_point_to_dealii_point<2>(
422 std::vector<std::array<Point<2>, 3>>
collection;
425 cdt.insert_constraint(poly.vertices_begin(),
433 if (f->info().in_domain() &&
437 {{CGALWrappers::cgal_point_to_dealii_point<2>(
438 cdt.triangle(f).vertex(0)),
439 CGALWrappers::cgal_point_to_dealii_point<2>(
440 cdt.triangle(f).vertex(1)),
441 CGALWrappers::cgal_point_to_dealii_point<2>(
442 cdt.triangle(f).vertex(2))}});
460 std::vector<std::array<Point<2>, 2>>
468 std::array<CGALPoint2, 4>
pts;
470 std::transform(quad.begin(),
473 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint2, 2>);
478 CGALWrappers::dealii_point_to_cgal_point<CGALPoint2>(line[0]),
479 CGALWrappers::dealii_point_to_cgal_point<CGALPoint2>(line[1]));
481 cdt.insert_constraint(poly.vertices_begin(), poly.vertices_end(),
true);
482 std::vector<std::array<Point<2>, 2>>
vertices;
486 if (f->info().in_domain() &&
496 {{CGALWrappers::cgal_point_to_dealii_point<2>((*s)[0]),
497 CGALWrappers::cgal_point_to_dealii_point<2>((*s)[1])}});
506 std::vector<std::array<Point<3>, 2>>
511# if DEAL_II_CGAL_VERSION_GTE(5, 5, 0)
516 std::array<CGALPoint3_exact, 8>
pts;
522 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3_exact, 3>);
525 CGALWrappers::dealii_point_to_cgal_point<CGALPoint3_exact>(line[0]),
526 CGALWrappers::dealii_point_to_cgal_point<CGALPoint3_exact>(line[1]));
530 std::vector<std::array<Point<3>, 2>>
vertices;
543 if (s->squared_length() > tol * tol)
546 {{CGALWrappers::cgal_point_to_dealii_point<3>(
548 CGALWrappers::cgal_point_to_dealii_point<3>(
559 "This function requires a version of CGAL greater or equal than 5.5."));
567 std::vector<std::array<Point<3>, 3>>
572# if DEAL_II_CGAL_VERSION_GTE(5, 5, 0)
577 std::array<CGALPoint3_exact, 8>
pts_hex;
578 std::array<CGALPoint3_exact, 4>
pts_quad;
584 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3_exact, 3>);
590 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3_exact, 3>);
593 std::vector<std::array<Point<3>, 3>>
vertices;
624 if (
const std::vector<CGALPoint3_exact> *
vps =
625 boost::get<std::vector<CGALPoint3_exact>>(
631 for (
auto it =
tria_inter.finite_facets_begin();
639 std::array<Point<3>, 3>
verts = {
640 {CGALWrappers::cgal_point_to_dealii_point<3>(
642 CGALWrappers::cgal_point_to_dealii_point<3>(
644 CGALWrappers::cgal_point_to_dealii_point<3>(
660 "This function requires a version of CGAL greater or equal than 5.5."));
668 std::vector<std::array<Point<3>, 4>>
676 std::array<CGALPoint3_exact, 8>
pts_hex0;
677 std::array<CGALPoint3_exact, 8>
pts_hex1;
683 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3_exact, 3>);
689 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3_exact, 3>);
693 std::vector<std::array<Point<3>, 4>>
vertices;
699 for (
const auto &
c0 :
tria0.finite_cell_handles())
708 for (
const auto &
c1 :
tria1.finite_cell_handles())
730 {{CGALWrappers::cgal_point_to_dealii_point<3>(
732 CGALWrappers::cgal_point_to_dealii_point<3>(
734 CGALWrappers::cgal_point_to_dealii_point<3>(
736 CGALWrappers::cgal_point_to_dealii_point<3>(
751 template <
int structdim0,
int structdim1,
int spacedim>
752 std::vector<std::array<Point<spacedim>,
structdim1 + 1>>
764 "The intersection cannot be computed as at least one of the two cells has no vertices."));
821 template <
int structdim0,
int structdim1,
int spacedim>
822 std::vector<std::array<Point<spacedim>,
structdim1 + 1>>
831 ReferenceCells::get_hypercube<structdim0>().n_vertices(),
834 ReferenceCells::get_hypercube<structdim1>().n_vertices(),
846# include "intersections.inst"
861std::vector<std::array<Point<spacedim>,
structdim1 + 1>>
873template <
int structdim0,
int structdim1,
int spacedim>
874std::vector<std::array<Point<spacedim>,
structdim1 + 1>>
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcNeedsCGAL()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
#define DEAL_II_NOT_IMPLEMENTED()
std::vector< std::array< Point< 2 >, 2 > > compute_intersection_quad_line(const ArrayView< const Point< 2 > > &quad, const ArrayView< const Point< 2 > > &line, const double tol)
std::vector< std::array< Point< 3 >, 3 > > compute_intersection_hexa_quad(const ArrayView< const Point< 3 > > &hexa, const ArrayView< const Point< 3 > > &quad, const double tol)
void mark_domains(CDT &ct, Face_handle start, int index, std::list< CDT::Edge > &border)
std::optional< std::variant< CGALPoint3, CGALSegment3 > > compute_intersection_tetra_segment(const ArrayView< const Point< 3 > > &tetrahedron, const ArrayView< const Point< 3 > > &segment)
std::vector< Polygon_with_holes_2 > compute_intersection_rect_rect(const ArrayView< const Point< 2 > > &rectangle0, const ArrayView< const Point< 2 > > &rectangle1)
std::vector< std::array< Point< 3 >, 4 > > compute_intersection_hexa_hexa(const ArrayView< const Point< 3 > > &hexa0, const ArrayView< const Point< 3 > > &hexa1, const double tol)
std::vector< std::array< Point< 3 >, 2 > > compute_intersection_hexa_line(const ArrayView< const Point< 3 > > &hexa, const ArrayView< const Point< 3 > > &line, const double tol)
std::optional< std::variant< CGALPoint3, CGALSegment3, CGALTriangle3, std::vector< CGALPoint3 > > > compute_intersection_tetra_triangle(const ArrayView< const Point< 3 > > &tetrahedron, const ArrayView< const Point< 3 > > &triangle)
std::optional< std::variant< CGALPoint2, CGALSegment2 > > compute_intersection_triangle_segment(const ArrayView< const Point< 2 > > &triangle, const ArrayView< const Point< 2 > > &segment)
std::optional< std::variant< CGALPoint2, CGALSegment2, CGALTriangle2, std::vector< CGALPoint2 > > > compute_intersection_triangle_triangle(const ArrayView< const Point< 2 > > &triangle0, const ArrayView< const Point< 2 > > &triangle1)
std::vector< std::array< Point< 2 >, 3 > > compute_intersection_quad_quad(const ArrayView< const Point< 2 > > &quad0, const ArrayView< const Point< 2 > > &quad1, const double tol)
K::Tetrahedron_3 CGALTetra
CGAL::Surface_mesh< K_exact::Point_3 > Surface_mesh
K::Segment_2 CGALSegment2
CGAL::Exact_predicates_tag Itag
K_exact::Tetrahedron_3 CGALTetra_exact
K_exact::Triangle_3 CGALTriangle3_exact
CDT::Vertex_handle Vertex_handle
K::Triangle_3 CGALTriangle3
K::Segment_3 CGALSegment3
CDT::Face_handle Face_handle
CGAL::Triangulation_3< K_exact > Triangulation3_exact
CGAL::Constrained_Delaunay_triangulation_2< K, Tds, Itag > CDT
std::vector< std::array< Point< spacedim >, structdim1+1 > > compute_intersection_of_cells(const typename Triangulation< structdim0, spacedim >::cell_iterator &cell0, const typename Triangulation< structdim1, spacedim >::cell_iterator &cell1, const Mapping< structdim0, spacedim > &mapping0, const Mapping< structdim1, spacedim > &mapping1, const double tol=1e-9)
CGAL::Delaunay_mesh_size_criteria_2< CDT > Criteria
CGAL::Triangulation_vertex_base_2< K > Vb
CGAL::Polygon_with_holes_2< K > Polygon_with_holes_2
CGAL::Triangulation_data_structure_2< Vb, Fb > Tds
CGAL::Polygon_2< K > CGALPolygon
CGAL::Triangulation_2< K > Triangulation2
CGAL::Exact_predicates_exact_constructions_kernel K_exact
CGAL::Triangulation_3< K > Triangulation3
CGAL::Constrained_triangulation_face_base_2< K, Fbb > CFb
CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt K
K::Triangle_2 CGALTriangle2
CGAL::Delaunay_mesh_face_base_2< K, CFb > Fb
K_exact::Segment_3 CGALSegment3_exact
K_exact::Point_3 CGALPoint3_exact
CGAL::Triangulation_face_base_with_info_2< FaceInfo2, K > Fbb