Skip to content

Commit

Permalink
Code review.
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-heltai committed May 1, 2022
1 parent 7cb4ee7 commit 92aa866
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cmake/configure/configure_cgal.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## ---------------------------------------------------------------------
##
## Copyright (C) 2017 by the deal.II authors
## Copyright (C) 2022 by the deal.II authors
##
## This file is part of the deal.II library.
##
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/FindCGAL.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## ---------------------------------------------------------------------
##
## Copyright (C) 2017 by the deal.II authors
## Copyright (C) 2022 by the deal.II authors
##
## This file is part of the deal.II library.
##
Expand Down
15 changes: 8 additions & 7 deletions include/deal.II/cgal/utilities.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ---------------------------------------------------------------------
//
// Copyright (C) 2020 by the deal.II authors
// Copyright (C) 2022 by the deal.II authors
//
// This file is part of the deal.II library.
//
Expand Down Expand Up @@ -47,18 +47,19 @@ namespace CGALWrappers
*/
template <typename CGALPointType, int dim>
inline CGALPointType
to_cgal(const dealii::Point<dim> &p);
dealii_point_to_cgal_point(const dealii::Point<dim> &p);

/**
* Convert from various CGAL point types to deal.II Point.
*
* @tparam dim Dimension of the point
* @tparam CGALPointType Any of the CGAL point types
* @param p
* @return dealii::Point<dim>
* @param p An input CGAL point type
* @return dealii::Point<dim> The corresponding deal.II point.
*/
template <int dim, typename CGALPointType>
inline dealii::Point<dim>
to_dealii(const CGALPointType &p);
cgal_point_to_dealii_point(const CGALPointType &p);
} // namespace CGALWrappers

# ifndef DOXYGEN
Expand All @@ -67,7 +68,7 @@ namespace CGALWrappers
{
template <typename CGALPointType, int dim>
inline CGALPointType
to_cgal(const dealii::Point<dim> &p)
dealii_point_to_cgal_point(const dealii::Point<dim> &p)
{
constexpr int cdim = CGALPointType::Ambient_dimension::value;
static_assert(dim <= cdim, "Only dim <= cdim supported");
Expand All @@ -86,7 +87,7 @@ namespace CGALWrappers

template <int dim, typename CGALPointType>
inline dealii::Point<dim>
to_dealii(const CGALPointType &p)
cgal_point_to_dealii_point(const CGALPointType &p)
{
constexpr int cdim = CGALPointType::Ambient_dimension::value;
if constexpr (dim == 1)
Expand Down
10 changes: 5 additions & 5 deletions tests/cgal/cgal_point_01.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ---------------------------------------------------------------------
//
// Copyright (C) 2020 by the deal.II authors
// Copyright (C) 2022 by the deal.II authors
//
// This file is part of the deal.II library.
//
Expand Down Expand Up @@ -32,15 +32,15 @@ main()
using CGALPoint = CGAL::Point_3<CGAL::Simple_cartesian<double>>;
// Test conversion from deal.II Point to CGAL Point
{
const Point<3> p(1.0, 2.0, 3.0);
const auto cgal_point = to_cgal<CGALPoint>(p);
const Point<3> dealii_point(1.0, 2.0, 3.0);
const auto cgal_point = dealii_point_to_cgal_point<CGALPoint>(dealii_point);
deallog << "CGAL Point: " << cgal_point << std::endl;
}

// Test conversion from CGAL Point to deal.II Point
{
const CGALPoint cgal_point(1.0, 2.0, 3.0);
const auto deal_ii_point = to_dealii<3>(cgal_point);
deallog << "deal.II Point: " << deal_ii_point << std::endl;
const auto dealii_point = cgal_point_to_dealii_point<3>(cgal_point);
deallog << "deal.II Point: " << dealii_point << std::endl;
}
}

0 comments on commit 92aa866

Please sign in to comment.