Fluid structure interaction suite
wrappers.h
Go to the documentation of this file.
1 #ifndef dealii_cgal_wrappers_h
2 #define dealii_cgal_wrappers_h
3 
4 #include <deal.II/base/config.h>
5 
6 #include <deal.II/base/point.h>
7 
8 #ifdef DEAL_II_WITH_CGAL
9 
10 # include <boost/config.hpp>
11 
12 # include <CGAL/Bbox_2.h>
13 # include <CGAL/Bbox_3.h>
14 # include <CGAL/Cartesian.h>
15 # include <CGAL/IO/io.h>
16 # include <CGAL/Origin.h>
17 
18 namespace CGALWrappers
19 {
20  template <typename CGALPointType, int dim>
21  inline CGALPointType
22  to_cgal(const dealii::Point<dim> &p)
23  {
24  if constexpr (dim == 1)
25  return CGALPointType(p[0]);
26  else if constexpr (dim == 2)
27  return CGALPointType(p[0], p[1]);
28  else if constexpr (dim == 3)
29  return CGALPointType(p[0], p[1], p[2]);
30  else
31  Assert(false, dealii::ExcNotImplemented());
32  }
33 
34  template <int dim, typename CGALPointType>
35  inline dealii::Point<dim>
36  to_dealii(const CGALPointType &p)
37  {
38  if constexpr (dim == 1)
39  return dealii::Point<dim>(CGAL::to_double(p.x()));
40  else if constexpr (dim == 2)
41  return dealii::Point<dim>(CGAL::to_double(p.x()), CGAL::to_double(p.y()));
42  else if constexpr (dim == 3)
43  return dealii::Point<dim>(CGAL::to_double(p.x()),
44  CGAL::to_double(p.y()),
45  CGAL::to_double(p.z()));
46  else
47  Assert(false, dealii::ExcNotImplemented());
48  }
49 } // namespace CGALWrappers
50 #endif
51 #endif
static ::ExceptionBase & ExcNotImplemented()