COMP: support compilation with CGAL-6.0 (#3234)

- CGAL-6 uses c++17 std::optional, std::variant instead of boost versions
This commit is contained in:
Mark Olesen
2024-12-16 10:42:59 +01:00
parent 4c21ad3d3f
commit e64d93ffdb
2 changed files with 23 additions and 2 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd. Copyright (C) 2016-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -119,7 +119,13 @@ typedef std::vector<Triangle>::iterator Iterator;
typedef CGAL::AABB_triangle_primitive<K, Iterator> Primitive; typedef CGAL::AABB_triangle_primitive<K, Iterator> Primitive;
typedef CGAL::AABB_traits<K, Primitive> AABB_triangle_traits; typedef CGAL::AABB_traits<K, Primitive> AABB_triangle_traits;
typedef CGAL::AABB_tree<AABB_triangle_traits> Tree; typedef CGAL::AABB_tree<AABB_triangle_traits> Tree;
// Used boost::optional prior to CGAL-6.0
#if (CGAL_VERSION_NR < 1060000910)
typedef boost::optional typedef boost::optional
#else
typedef std::optional
#endif
< <
Tree::Intersection_and_primitive_id<Segment>::Type Tree::Intersection_and_primitive_id<Segment>::Type
> Segment_intersection; > Segment_intersection;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd. Copyright (C) 2016-2024 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -108,7 +108,12 @@ typedef CGAL::AABB_face_graph_triangle_primitive
typedef CGAL::AABB_traits<K, Primitive> Traits; typedef CGAL::AABB_traits<K, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree; typedef CGAL::AABB_tree<Traits> Tree;
// Used boost::optional prior to CGAL-6.0
#if (CGAL_VERSION_NR < 1060000910)
typedef boost::optional typedef boost::optional
#else
typedef std::optional
#endif
< <
Tree::Intersection_and_primitive_id<Segment>::Type Tree::Intersection_and_primitive_id<Segment>::Type
> Segment_intersection; > Segment_intersection;
@ -647,7 +652,12 @@ labelPair edgeIntersectionsCGAL
// Get intersection object // Get intersection object
if if
( (
// Used boost::variant prior to CGAL-6.0
#if (CGAL_VERSION_NR < 1060000910)
const Point* ptPtr = boost::get<Point>(&(intersect->first)) const Point* ptPtr = boost::get<Point>(&(intersect->first))
#else
const Point* ptPtr = std::get_if<Point>(&(intersect->first))
#endif
) )
{ {
point pt point pt
@ -679,7 +689,12 @@ labelPair edgeIntersectionsCGAL
} }
else if else if
( (
// Used boost::variant prior to CGAL-6.0
#if (CGAL_VERSION_NR < 1060000910)
const Segment* sPtr = boost::get<Segment>(&(intersect->first)) const Segment* sPtr = boost::get<Segment>(&(intersect->first))
#else
const Segment* sPtr = std::get_if<Segment>(&(intersect->first))
#endif
) )
{ {
#if defined (CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1041400000) #if defined (CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1041400000)