deal.II version GIT relicensing-2652-g41e7496fd4 2025-02-17 19:10:00+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
intersections.cc
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2022 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#include <deal.II/base/config.h>
16
18
19#include <algorithm>
20
21#ifdef DEAL_II_WITH_CGAL
22
25
26# include <deal.II/fe/mapping.h>
27
28# include <deal.II/grid/tria.h>
29
31# include <CGAL/Boolean_set_operations_2.h>
33
34# include <CGAL/Cartesian.h>
35# include <CGAL/Circular_kernel_intersections.h>
36# include <CGAL/Constrained_Delaunay_triangulation_2.h>
37# include <CGAL/Delaunay_mesh_face_base_2.h>
38# include <CGAL/Delaunay_mesh_size_criteria_2.h>
39# include <CGAL/Delaunay_mesher_2.h>
40# include <CGAL/Delaunay_triangulation_2.h>
41# include <CGAL/Exact_predicates_exact_constructions_kernel_with_sqrt.h>
42# include <CGAL/Kernel_traits.h>
43# include <CGAL/Polygon_2.h>
44# include <CGAL/Polygon_with_holes_2.h>
45# include <CGAL/Projection_traits_xy_3.h>
46# include <CGAL/Segment_3.h>
47# include <CGAL/Simple_cartesian.h>
48# include <CGAL/Surface_mesh/Surface_mesh.h>
49# include <CGAL/Tetrahedron_3.h>
50# include <CGAL/Triangle_2.h>
51# include <CGAL/Triangle_3.h>
52# include <CGAL/Triangulation_2.h>
53# include <CGAL/Triangulation_3.h>
54# include <CGAL/Triangulation_face_base_with_id_2.h>
55# include <CGAL/Triangulation_face_base_with_info_2.h>
57
58# include <optional>
59# include <variant>
60
62
63namespace CGALWrappers
64{
69 using CGALTriangle2 = K::Triangle_2;
70 using CGALTriangle3 = K::Triangle_3;
71 using CGALTriangle3_exact = K_exact::Triangle_3;
72 using CGALPoint2 = K::Point_2;
73 using CGALPoint3 = K::Point_3;
74 using CGALPoint3_exact = K_exact::Point_3;
75 using CGALSegment2 = K::Segment_2;
77 using CGALSegment3 = K::Segment_3;
78 using CGALSegment3_exact = K_exact::Segment_3;
79 using CGALTetra = K::Tetrahedron_3;
80 using CGALTetra_exact = K_exact::Tetrahedron_3;
84
85 struct FaceInfo2
86 {
87 FaceInfo2() = default;
89 bool
91 {
92 return nesting_level % 2 == 1;
93 }
94 };
95
104 using Vertex_handle = CDT::Vertex_handle;
105 using Face_handle = CDT::Face_handle;
106
107 template <class T, class... Types>
108 const T *
109 get_if_(const std::variant<Types...> *v)
110 {
111 return std::get_if<T>(v);
112 }
113
114 template <class T, class... Types>
115 const T *
116 get_if_(const boost::variant<Types...> *v)
117 {
118 return boost::get<T>(v);
119 }
120
121 namespace internal
122 {
123 namespace
124 {
129 template <typename TargetVariant>
130 struct Repackage : boost::static_visitor<TargetVariant>
131 {
132 template <typename T>
134 operator()(const T &t) const
135 {
136 return TargetVariant(t);
137 }
138 };
139
146 template <typename... Types>
147 std::optional<std::variant<Types...>>
148 convert_boost_to_std(const boost::optional<boost::variant<Types...>> &x)
149 {
150 if (x)
151 {
152 // The boost::optional object contains an object of type
153 // boost::variant. We need to unpack which type the
154 // variant contains, and re-package that into a
155 // std::variant. This is easily done using a visitor
156 // object.
157 using std_variant = std::variant<Types...>;
158 return boost::apply_visitor(Repackage<std_variant>(), *x);
159 }
160 else
161 {
162 // The boost::optional object was empty. Return an empty
163 // std::optional object.
164 return {};
165 }
166 }
167
168 template <typename... Types>
169 const std::optional<std::variant<Types...>> &
170 convert_boost_to_std(const std::optional<std::variant<Types...>> &opt)
171 {
172 return opt;
173 }
174 } // namespace
175
176
177
178 void
180 Face_handle start,
181 int index,
182 std::list<CDT::Edge> &border)
183 {
184 if (start->info().nesting_level != -1)
185 {
186 return;
187 }
188 std::list<Face_handle> queue;
189 queue.push_back(start);
190 while (!queue.empty())
191 {
192 Face_handle fh = queue.front();
193 queue.pop_front();
194 if (fh->info().nesting_level == -1)
195 {
196 fh->info().nesting_level = index;
197 for (int i = 0; i < 3; i++)
198 {
199 CDT::Edge e(fh, i);
200 Face_handle n = fh->neighbor(i);
201 if (n->info().nesting_level == -1)
202 {
203 if (ct.is_constrained(e))
204 border.push_back(e);
205 else
206 queue.push_back(n);
207 }
208 }
209 }
210 }
211 }
212
213
214
215 void
217 {
218 for (CDT::Face_handle f : cdt.all_face_handles())
219 {
220 f->info().nesting_level = -1;
221 }
222 std::list<CDT::Edge> border;
223 mark_domains(cdt, cdt.infinite_face(), 0, border);
224 while (!border.empty())
225 {
226 CDT::Edge e = border.front();
227 border.pop_front();
228 Face_handle n = e.first->neighbor(e.second);
229 if (n->info().nesting_level == -1)
230 {
231 mark_domains(cdt, n, e.first->info().nesting_level + 1, border);
232 }
233 }
234 }
235
236 // Collection of utilities that compute intersection between simplices
237 // identified by array of points. The return type is the one of
238 // CGAL::intersection(), i.e. a std::optional<std::variant<>>.
239 // Intersection between 2d and 3d objects and 1d/3d objects are available
240 // only with CGAL versions greater or equal than 5.5, hence the
241 // corresponding functions are guarded by #ifdef directives. All the
242 // signatures follow the convection that the first entity has an intrinsic
243 // dimension higher than the second one.
244
245 std::optional<std::variant<CGALPoint2,
248 std::vector<CGALPoint2>>>
250 const ArrayView<const Point<2>> &triangle0,
251 const ArrayView<const Point<2>> &triangle1)
252 {
253 AssertDimension(triangle0.size(), 3);
254 AssertDimension(triangle0.size(), triangle1.size());
255
256 std::array<CGALPoint2, 3> pts0, pts1;
257
258 std::transform(triangle0.begin(),
259 triangle0.end(),
260 pts0.begin(),
261 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint2, 2>);
262
263 std::transform(triangle1.begin(),
264 triangle1.end(),
265 pts1.begin(),
266 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint2, 2>);
267
272 }
273
274
275 std::optional<std::variant<CGALPoint2, CGALSegment2>>
277 const ArrayView<const Point<2>> &triangle,
278 const ArrayView<const Point<2>> &segment)
279 {
280 AssertDimension(triangle.size(), 3);
281 AssertDimension(segment.size(), 2);
282
283 std::array<CGALPoint2, 3> pts0;
284 std::array<CGALPoint2, 2> pts1;
285
286 std::transform(triangle.begin(),
287 triangle.end(),
288 pts0.begin(),
289 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint2, 2>);
290
291 std::transform(segment.begin(),
292 segment.end(),
293 pts1.begin(),
294 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint2, 2>);
295
300 }
301
302
303
304 // rectangle-rectangle
305 std::vector<Polygon_with_holes_2>
307 const ArrayView<const Point<2>> &rectangle1)
308 {
309 AssertDimension(rectangle0.size(), 4);
310 AssertDimension(rectangle0.size(), rectangle1.size());
311
312 std::array<CGALPoint2, 4> pts0, pts1;
313
314 std::transform(rectangle0.begin(),
315 rectangle0.end(),
316 pts0.begin(),
317 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint2, 2>);
318
319 std::transform(rectangle1.begin(),
320 rectangle1.end(),
321 pts1.begin(),
322 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint2, 2>);
323
324 const CGALPolygon first_poly{pts0.begin(), pts0.end()};
325 const CGALPolygon second_poly{pts1.begin(), pts1.end()};
326
327 std::vector<Polygon_with_holes_2> poly_list;
330 std::back_inserter(poly_list));
331 return poly_list;
332 }
333
334
335
336 std::optional<std::variant<CGALPoint3, CGALSegment3>>
338 const ArrayView<const Point<3>> &tetrahedron,
339 const ArrayView<const Point<3>> &segment)
340 {
341# if DEAL_II_CGAL_VERSION_GTE(5, 5, 0)
342
343 AssertDimension(tetrahedron.size(), 4);
344 AssertDimension(segment.size(), 2);
345
346 std::array<CGALPoint3, 4> pts0;
347 std::array<CGALPoint3, 2> pts1;
348
349 std::transform(tetrahedron.begin(),
350 tetrahedron.end(),
351 pts0.begin(),
352 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3, 3>);
353
354 std::transform(segment.begin(),
355 segment.end(),
356 pts1.begin(),
357 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3, 3>);
358
363# else
364 Assert(
365 false,
367 "This function requires a version of CGAL greater or equal than 5.5."));
369 (void)segment;
370 return {};
371# endif
372 }
373
374
375 // tetra, triangle
376 std::optional<std::variant<CGALPoint3,
379 std::vector<CGALPoint3>>>
381 const ArrayView<const Point<3>> &tetrahedron,
382 const ArrayView<const Point<3>> &triangle)
383 {
384# if DEAL_II_CGAL_VERSION_GTE(5, 5, 0)
385
386 AssertDimension(tetrahedron.size(), 4);
387 AssertDimension(triangle.size(), 3);
388
389 std::array<CGALPoint3, 4> pts0;
390 std::array<CGALPoint3, 3> pts1;
391
392 std::transform(tetrahedron.begin(),
393 tetrahedron.end(),
394 pts0.begin(),
395 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3, 3>);
396
397 std::transform(triangle.begin(),
398 triangle.end(),
399 pts1.begin(),
400 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3, 3>);
401
406# else
407
408 Assert(
409 false,
411 "This function requires a version of CGAL greater or equal than 5.5."));
413 (void)triangle;
414 return {};
415# endif
416 }
417
418 // quad-quad
419 std::vector<std::array<Point<2>, 3>>
421 const ArrayView<const Point<2>> &quad1,
422 const double tol)
423 {
424 AssertDimension(quad0.size(), 4);
425 AssertDimension(quad0.size(), quad1.size());
426
427 const auto intersection_test =
429
430 if (!intersection_test.empty())
431 {
432 const auto &poly = intersection_test[0].outer_boundary();
433 const unsigned int size_poly = poly.size();
434 if (size_poly == 3)
435 {
436 // intersection is a triangle itself, so directly return its
437 // vertices.
438 return {
439 {{CGALWrappers::cgal_point_to_dealii_point<2>(poly.vertex(0)),
440 CGALWrappers::cgal_point_to_dealii_point<2>(poly.vertex(1)),
441 CGALWrappers::cgal_point_to_dealii_point<2>(
442 poly.vertex(2))}}};
443 }
444 else if (size_poly >= 4)
445 {
446 // intersection is a polygon, need to triangulate it.
447 std::vector<std::array<Point<2>, 3>> collection;
448
449 CDT cdt;
450 cdt.insert_constraint(poly.vertices_begin(),
451 poly.vertices_end(),
452 true);
453
455
456 for (Face_handle f : cdt.finite_face_handles())
457 {
458 if (f->info().in_domain() &&
459 CGAL::to_double(cdt.triangle(f).area()) > tol)
460 {
461 collection.push_back(
462 {{CGALWrappers::cgal_point_to_dealii_point<2>(
463 cdt.triangle(f).vertex(0)),
464 CGALWrappers::cgal_point_to_dealii_point<2>(
465 cdt.triangle(f).vertex(1)),
466 CGALWrappers::cgal_point_to_dealii_point<2>(
467 cdt.triangle(f).vertex(2))}});
468 }
469 }
470 return collection;
471 }
472 else
473 {
474 Assert(false, ExcMessage("The polygon is degenerate."));
475 return {};
476 }
477 }
478 else
479 {
480 return {};
481 }
482 }
483
484 // Specialization for quad \cap line
485 std::vector<std::array<Point<2>, 2>>
487 const ArrayView<const Point<2>> &line,
488 const double tol)
489 {
490 AssertDimension(quad.size(), 4);
491 AssertDimension(line.size(), 2);
492
493 std::array<CGALPoint2, 4> pts;
494
495 std::transform(quad.begin(),
496 quad.end(),
497 pts.begin(),
498 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint2, 2>);
499
500 CGALPolygon poly(pts.begin(), pts.end());
501
503 CGALWrappers::dealii_point_to_cgal_point<CGALPoint2>(line[0]),
504 CGALWrappers::dealii_point_to_cgal_point<CGALPoint2>(line[1]));
505 CDT cdt;
506 cdt.insert_constraint(poly.vertices_begin(), poly.vertices_end(), true);
507 std::vector<std::array<Point<2>, 2>> vertices;
509 for (Face_handle f : cdt.finite_face_handles())
510 {
511 if (f->info().in_domain() &&
512 CGAL::to_double(cdt.triangle(f).area()) > tol &&
513 CGAL::do_intersect(segm, cdt.triangle(f)))
514 {
515 const auto intersection =
516 CGAL::intersection(segm, cdt.triangle(f));
518 {
519 vertices.push_back(
520 {{CGALWrappers::cgal_point_to_dealii_point<2>((*s)[0]),
521 CGALWrappers::cgal_point_to_dealii_point<2>((*s)[1])}});
522 }
523 }
524 }
525
526 return vertices;
527 }
528
529 // specialization for hex \cap line
530 std::vector<std::array<Point<3>, 2>>
532 const ArrayView<const Point<3>> &line,
533 const double tol)
534 {
535# if DEAL_II_CGAL_VERSION_GTE(5, 5, 0)
536
537 AssertDimension(hexa.size(), 8);
538 AssertDimension(line.size(), 2);
539
540 std::array<CGALPoint3_exact, 8> pts;
541
542 std::transform(
543 hexa.begin(),
544 hexa.end(),
545 pts.begin(),
546 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3_exact, 3>);
547
549 CGALWrappers::dealii_point_to_cgal_point<CGALPoint3_exact>(line[0]),
550 CGALWrappers::dealii_point_to_cgal_point<CGALPoint3_exact>(line[1]));
551
552 // Subdivide the hex into tetrahedrons, and intersect each one of them
553 // with the line
554 std::vector<std::array<Point<3>, 2>> vertices;
556 cgal_triangulation.insert(pts.begin(), pts.end());
557 for (const auto &c : cgal_triangulation.finite_cell_handles())
558 {
559 const auto &cgal_tetrahedron = cgal_triangulation.tetrahedron(c);
561 {
562 const auto intersection =
564 if (const CGALSegment3_exact *s =
566 {
567 if (s->squared_length() > tol * tol)
568 {
569 vertices.push_back(
570 {{CGALWrappers::cgal_point_to_dealii_point<3>(
571 s->vertex(0)),
572 CGALWrappers::cgal_point_to_dealii_point<3>(
573 s->vertex(1))}});
574 }
575 }
576 }
577 }
578 return vertices;
579# else
580 Assert(
581 false,
583 "This function requires a version of CGAL greater or equal than 5.5."));
584 (void)hexa;
585 (void)line;
586 (void)tol;
587 return {};
588# endif
589 }
590
591 std::vector<std::array<Point<3>, 3>>
593 const ArrayView<const Point<3>> &quad,
594 const double tol)
595 {
596# if DEAL_II_CGAL_VERSION_GTE(5, 5, 0)
597
598 AssertDimension(hexa.size(), 8);
599 AssertDimension(quad.size(), 4);
600
601 std::array<CGALPoint3_exact, 8> pts_hex;
602 std::array<CGALPoint3_exact, 4> pts_quad;
603
604 std::transform(
605 hexa.begin(),
606 hexa.end(),
607 pts_hex.begin(),
608 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3_exact, 3>);
609
610 std::transform(
611 quad.begin(),
612 quad.end(),
613 pts_quad.begin(),
614 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3_exact, 3>);
615
616 // Subdivide hex into tetrahedrons
617 std::vector<std::array<Point<3>, 3>> vertices;
619 triangulation_hexa.insert(pts_hex.begin(), pts_hex.end());
620
621 // Subdivide quad into triangles
623 triangulation_quad.insert(pts_quad.begin(), pts_quad.end());
624
625 for (const auto &c : triangulation_hexa.finite_cell_handles())
626 {
627 const auto &tet = triangulation_hexa.tetrahedron(c);
628
629 for (const auto &f : triangulation_quad.finite_facets())
630 {
631 if (CGAL::do_intersect(tet, triangulation_quad.triangle(f)))
632 {
633 const auto intersection =
635
636 if (const CGALTriangle3_exact *t =
638 {
639 if (CGAL::to_double(t->squared_area()) > tol * tol)
640 {
641 vertices.push_back(
645 }
646 }
647
648 if (const std::vector<CGALPoint3_exact> *vps =
649 get_if_<std::vector<CGALPoint3_exact>>(&*intersection))
650 {
652 tria_inter.insert(vps->begin(), vps->end());
653
654 for (auto it = tria_inter.finite_facets_begin();
655 it != tria_inter.finite_facets_end();
656 ++it)
657 {
658 const auto triangle = tria_inter.triangle(*it);
659 if (CGAL::to_double(triangle.squared_area()) >
660 tol * tol)
661 {
662 std::array<Point<3>, 3> verts = {
663 {CGALWrappers::cgal_point_to_dealii_point<3>(
664 triangle[0]),
665 CGALWrappers::cgal_point_to_dealii_point<3>(
666 triangle[1]),
667 CGALWrappers::cgal_point_to_dealii_point<3>(
668 triangle[2])}};
669
670 vertices.push_back(verts);
671 }
672 }
673 }
674 }
675 }
676 }
677
678 return vertices;
679# else
680 Assert(
681 false,
683 "This function requires a version of CGAL greater or equal than 5.5."));
684 (void)hexa;
685 (void)quad;
686 (void)tol;
687 return {};
688# endif
689 }
690
691 std::vector<std::array<Point<3>, 4>>
693 const ArrayView<const Point<3>> &hexa1,
694 const double tol)
695 {
696 AssertDimension(hexa0.size(), 8);
697 AssertDimension(hexa0.size(), hexa1.size());
698
699 std::array<CGALPoint3_exact, 8> pts_hex0;
700 std::array<CGALPoint3_exact, 8> pts_hex1;
701
702 std::transform(
703 hexa0.begin(),
704 hexa0.end(),
705 pts_hex0.begin(),
706 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3_exact, 3>);
707
708 std::transform(
709 hexa1.begin(),
710 hexa1.end(),
711 pts_hex1.begin(),
712 &CGALWrappers::dealii_point_to_cgal_point<CGALPoint3_exact, 3>);
713
715 // Subdivide hex into tetrahedrons
716 std::vector<std::array<Point<3>, 4>> vertices;
718
719 tria0.insert(pts_hex0.begin(), pts_hex0.end());
720 tria1.insert(pts_hex1.begin(), pts_hex1.end());
721
722 for (const auto &c0 : tria0.finite_cell_handles())
723 {
724 const auto &tet0 = tria1.tetrahedron(c0);
725 const auto &tetg0 = CGAL::make_tetrahedron(tet0.vertex(0),
726 tet0.vertex(1),
727 tet0.vertex(2),
728 tet0.vertex(3),
729 surf0);
730 (void)tetg0; // instead of C++ 17s [[maybe unused]]
731 for (const auto &c1 : tria1.finite_cell_handles())
732 {
733 const auto &tet1 = tria1.tetrahedron(c1);
734 const auto &tetg1 = CGAL::make_tetrahedron(tet1.vertex(0),
735 tet1.vertex(1),
736 tet1.vertex(2),
737 tet1.vertex(3),
738 surf1);
739 (void)tetg1; // instead of C++ 17s [[maybe unused]]
741 const bool test_intersection =
743 if (PMP::volume(sm) > tol && test_intersection)
744 {
745 // Collect tetrahedrons
747 triangulation_hexa.insert(sm.points().begin(),
748 sm.points().end());
749 for (const auto &c : triangulation_hexa.finite_cell_handles())
750 {
751 const auto &tet = triangulation_hexa.tetrahedron(c);
752 vertices.push_back(
753 {{CGALWrappers::cgal_point_to_dealii_point<3>(
754 tet.vertex(0)),
755 CGALWrappers::cgal_point_to_dealii_point<3>(
756 tet.vertex(1)),
757 CGALWrappers::cgal_point_to_dealii_point<3>(
758 tet.vertex(2)),
759 CGALWrappers::cgal_point_to_dealii_point<3>(
760 tet.vertex(3))}});
761 }
762 }
763 surf1.clear();
764 sm.clear();
765 }
766 surf0.clear();
767 }
768 return vertices;
769 }
770
771 } // namespace internal
772
773
774 template <int structdim0, int structdim1, int spacedim>
775 std::vector<std::array<Point<spacedim>, structdim1 + 1>>
777 const ArrayView<const Point<spacedim>> &vertices0,
778 const ArrayView<const Point<spacedim>> &vertices1,
779 const double tol)
780 {
781 const unsigned int n_vertices0 = vertices0.size();
782 const unsigned int n_vertices1 = vertices1.size();
783
784 Assert(
785 n_vertices0 > 0 || n_vertices1 > 0,
787 "The intersection cannot be computed as at least one of the two cells has no vertices."));
788
789 if constexpr (structdim0 == 2 && structdim1 == 2 && spacedim == 2)
790 {
791 if (n_vertices0 == 4 && n_vertices1 == 4)
792 {
794 vertices1,
795 tol);
796 }
797 }
798 else if constexpr (structdim0 == 2 && structdim1 == 1 && spacedim == 2)
799 {
800 if (n_vertices0 == 4 && n_vertices1 == 2)
801 {
803 vertices1,
804 tol);
805 }
806 }
807 else if constexpr (structdim0 == 3 && structdim1 == 1 && spacedim == 3)
808 {
809 if (n_vertices0 == 8 && n_vertices1 == 2)
810 {
812 vertices1,
813 tol);
814 }
815 }
816 else if constexpr (structdim0 == 3 && structdim1 == 2 && spacedim == 3)
817 {
818 if (n_vertices0 == 8 && n_vertices1 == 4)
819 {
821 vertices1,
822 tol);
823 }
824 }
825 else if constexpr (structdim0 == 3 && structdim1 == 3 && spacedim == 3)
826 {
827 if (n_vertices0 == 8 && n_vertices1 == 8)
828 {
830 vertices1,
831 tol);
832 }
833 }
834 else
835 {
837 return {};
838 }
839 (void)tol;
840 return {};
841 }
842
843
844 template <int structdim0, int structdim1, int spacedim>
845 std::vector<std::array<Point<spacedim>, structdim1 + 1>>
851 const double tol)
852 {
853 Assert(mapping0.get_vertices(cell0).size() ==
854 ReferenceCells::get_hypercube<structdim0>().n_vertices(),
856 Assert(mapping1.get_vertices(cell1).size() ==
857 ReferenceCells::get_hypercube<structdim1>().n_vertices(),
859
860 const auto &vertices0 =
861 CGALWrappers::get_vertices_in_cgal_order(cell0, mapping0);
862 const auto &vertices1 =
863 CGALWrappers::get_vertices_in_cgal_order(cell1, mapping1);
864
866 vertices0, vertices1, tol);
867 }
868
869// Explicit instantiations.
870//
871// We don't build the instantiations.inst file if deal.II isn't
872// configured with CGAL, but doxygen doesn't know that and tries to
873// find that file anyway for parsing -- which then of course it fails
874// on. So exclude the following from doxygen consideration.
875# ifndef DOXYGEN
876# include "cgal/intersections.inst"
877# endif
878
879} // namespace CGALWrappers
880
882
883#else
884
886
887template <int structdim0,
888 int structdim1,
889 int spacedim,
890 int n_components0,
891 int n_components1>
892std::vector<std::array<Point<spacedim>, structdim1 + 1>>
894 const std::array<Point<spacedim>, n_components0> &vertices0,
895 const std::array<Point<spacedim>, n_components1> &vertices1,
896 const double tol)
897{
900 (void)tol;
901 AssertThrow(false, ExcNeedsCGAL());
902}
903
904template <int structdim0, int structdim1, int spacedim>
905std::vector<std::array<Point<spacedim>, structdim1 + 1>>
911 const double tol)
912{
913 (void)cell0;
914 (void)cell1;
915 (void)mapping0;
916 (void)mapping1;
917 (void)tol;
918 AssertThrow(false, ExcNeedsCGAL());
919}
920
922
923#endif
constexpr void clear()
friend class Tensor
Definition tensor.h:865
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:518
#define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
Definition config.h:532
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:519
#define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
Definition config.h:575
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
const T * get_if_(const std::variant< Types... > *v)
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
K::Point_3 CGALPoint3
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
K::Point_2 CGALPoint2
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