Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CGAL improvement backported from CDT_3 branch #8170

Merged
merged 85 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
b3c2bac
Add issue
afabri Apr 25, 2023
68261eb
STL_extension: Add parameter for value type to Prevent_deref
afabri Apr 26, 2023
2a41598
cosmetic changes (indent, spaces, naming)
lrineau Apr 27, 2023
b866677
add the last static_assert to the test
lrineau Apr 27, 2023
04a9026
make sure the iterator is bidirectional
sloriot Jun 28, 2023
33969b7
Why does this compile without the second template parameter???
afabri Jun 28, 2023
74b8ddf
Fix ToS_2
afabri Jun 28, 2023
57b2b7b
Partial fix for SMDS_3. What is different for cells_in_complex() ?
afabri Jun 28, 2023
54b7ae4
add missing const
sloriot Jun 28, 2023
5e0e021
Remove blank in front of point ending a comment
afabri Jun 28, 2023
1349093
fix test
sloriot Jun 29, 2023
13cf0b6
Move a range test
afabri Jun 29, 2023
aa09a28
Merge remote-tracking branch 'cgal/master' into STL_extension-Fix_Pre…
lrineau Sep 19, 2023
0f8e3eb
add contexts_range(T va, T vb
lrineau Dec 12, 2019
98f1e53
Improve I/O
lrineau Mar 8, 2023
e313fdc
Add Compare_xy_2 to TriangulationTraits_2
lrineau Mar 20, 2023
53b438e
STL_extension: Add parameter for value type to Prevent_deref
afabri Apr 26, 2023
952d34c
cosmetic changes (indent, spaces, naming)
lrineau Apr 27, 2023
8e1744f
fix constness
lrineau Jul 4, 2023
f219cdf
minor tweak with constexpr in CT_2
lrineau Apr 11, 2024
1ca6c17
use boost::unordered_flat_map to optimize Polyline_constraint_hierarc…
lrineau Apr 15, 2024
6096748
Allow to compile with Epeck
lrineau Feb 13, 2023
c2fe327
fix the std::formatter for Output_rep
lrineau Jun 28, 2023
4c75012
oformat(x, tag) passed the tag value to the Output_rep
lrineau Jan 15, 2024
877e832
fix oformat
lrineau Apr 22, 2024
bc76d8c
add CGAL_CAN_USE_CXX20_FORMAT macro for <format> support (C++20)
lrineau Apr 26, 2024
f39b906
Fix CMake warning: remove usage of VTK_USE_FILE
lrineau Mar 8, 2023
ee07b44
add a missing include
lrineau Apr 24, 2024
f53e169
fix include of <cstdint>
lrineau Apr 26, 2024
15d4d78
add Compare_angle_3 with 6 points
lrineau Apr 26, 2024
4adf7e7
fix Compare_angle_3 with six points
lrineau Jan 16, 2024
cfb8722
add comments on Compare_angle_3
lrineau Jan 16, 2024
3148e8a
make Circulator_from_container somewhat compatible with C++20 ranges
lrineau Apr 24, 2024
cb933b1
make Unique_hash_map movable
lrineau Nov 6, 2023
ac47f30
experiment adding tuple-like support for Segment_3
lrineau Sep 8, 2023
ca90296
macros to support C++20 concepts conditionally
lrineau Apr 26, 2024
ed26ee0
fix missing include of <cstdint.h>
lrineau Apr 22, 2024
5c63682
TDS::is_valid add a check of number_of_cells()
lrineau Feb 22, 2024
ad30644
add CGAL::Scope_exit
lrineau Apr 11, 2024
1ee8152
patch to speed up `incident_cells` in 3D
lrineau Apr 9, 2024
05d1cfa
speed-up is_edge with function_output_iterator.
lrineau Apr 11, 2024
9194bb0
speed up incident_cells_threadsafe
lrineau Apr 11, 2024
70c7323
reimplement TDS_3::is_edge (speed-up by a factor 7)
lrineau Apr 11, 2024
56054ce
fix io_signature issue
lrineau Jan 30, 2024
cc5fdfb
remove CGAL::cpp17, useless now that CGAL requires C++17
lrineau Apr 25, 2024
612d6e3
cosmetic change
lrineau Apr 26, 2024
4bf1c43
Add a tool to list non triangulated off files
lrineau Jan 26, 2023
127163f
cosmetic changes in debug messages
lrineau Jun 28, 2023
1fb3e0d
cosmetic change
lrineau Apr 26, 2024
78001c1
missing include
lrineau Apr 26, 2024
3ce8085
Add issue
afabri Apr 25, 2023
7579026
add the last static_assert to the test
lrineau Apr 27, 2023
69aa7b8
use using instead of typedef (and use base cstr)
lrineau Apr 26, 2024
11402df
Add With_offset_tag
lrineau Jan 16, 2024
4d95e4c
fix a compilation error with C++<20
lrineau Jan 22, 2024
ce58f38
move With_point_and_info_tag to Compact_container.h
lrineau Feb 13, 2024
ec1d97b
fix the timestamp system
lrineau Feb 21, 2024
33c3d22
simpler timestamp system
lrineau Feb 22, 2024
488668b
remove less_cpp14
lrineau Apr 10, 2024
d9d5a02
fix CC time_stamper
lrineau Apr 22, 2024
ab06136
add const to understand better the semantic
lrineau Jan 16, 2023
3fda4e6
Triangulation_3: rewrite the code a little
lrineau Mar 9, 2023
3f92648
add T_3::is_facet(u, v, w)
lrineau Mar 10, 2023
75689f3
use std::invoke (C++17) for IILE
lrineau Nov 9, 2023
52393d1
small factorization with a lambda expression
lrineau Nov 14, 2023
90b2aa5
T_3:::copy_triangulation_into_hole postpone *cit++
lrineau Feb 22, 2024
48eaf9c
remove a possible filter failure, when the target is a vertex
lrineau Apr 24, 2024
ffc5541
CGAL_USE
afabri May 13, 2024
008752c
Use macro CGAL_NO_UNIQUE_ADDRESS
afabri May 13, 2024
3da3481
Fix Interpolation
afabri May 13, 2024
bd62ca5
Fix NewKernel_d
afabri May 13, 2024
bff4417
whitespace
afabri May 15, 2024
e96aaf3
Merge branch 'master' into pr/afabri/7410
lrineau May 17, 2024
797c056
Prevent_deref, major changes
lrineau May 21, 2024
1289cad
fix iterators types in c3t3
lrineau May 21, 2024
ce16436
fix for ToS
lrineau May 21, 2024
70464ea
Merge remote-tracking branch 'afabri/STL_extension-Fix_Prevent_deref-…
lrineau May 21, 2024
6160887
fix warning
lrineau May 22, 2024
df28ddc
Revert "Fix CMake warning: remove usage of VTK_USE_FILE"
lrineau May 22, 2024
b8022cb
Revert "experiment adding tuple-like support for Segment_3"
lrineau May 22, 2024
d99891b
Fix the detection of C++20 `<format>` header
lrineau May 22, 2024
c0cb990
Revert "use boost::unordered_flat_map to optimize Polyline_constraint…
lrineau May 22, 2024
342d30f
Revert "cosmetic change"
lrineau May 23, 2024
0c0b22b
add tests and assertions for the timestamper
lrineau May 23, 2024
3f5d8e2
Announce the breaking change about Compare_xy_2
lrineau May 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ class Arrangement_on_surface_2 {
}

/*!
returns a range over handles of the arrangement vertices .
returns a range over handles of the arrangement vertices.
*/
Iterator_range<Prevent_deref<Vertex_iterator> >
vertex_handles()
Expand All @@ -1068,7 +1068,7 @@ class Arrangement_on_surface_2 {
}

/*!
returns a const range (model of `ConstRange`) over handles of the arrangement vertices .
returns a const range (model of `ConstRange`) over handles of the arrangement vertices.
*/
Iterator_range<Prevent_deref<Vertex_const_iterator> >
vertex_handles() const
Expand Down Expand Up @@ -1098,7 +1098,7 @@ class Arrangement_on_surface_2 {
}

/*!
returns a range over handles of the arrangement halfedges .
returns a range over handles of the arrangement halfedges.
*/
Iterator_range<Prevent_deref<Halfedge_iterator> >
halfedge_handles()
Expand All @@ -1122,7 +1122,7 @@ class Arrangement_on_surface_2 {
_Is_valid_halfedge(&m_topol_traits)));
}
/*!
returns a const range (model of `ConstRange`) over handles of the arrangement halfedges .
returns a const range (model of `ConstRange`) over handles of the arrangement halfedges.
*/
Iterator_range<Prevent_deref<Halfedge_const_iterator> >
halfedge_handles() const
Expand All @@ -1149,7 +1149,7 @@ class Arrangement_on_surface_2 {
}

/*!
returns a range over handles of the arrangement edges .
returns a range over handles of the arrangement edges.
*/
Iterator_range<Prevent_deref<Edge_iterator> >
edge_handles()
Expand All @@ -1172,7 +1172,7 @@ class Arrangement_on_surface_2 {
}

/*!
returns a const range (model of `ConstRange`) over handles of the arrangement edges .
returns a const range (model of `ConstRange`) over handles of the arrangement edges.
*/
Iterator_range<Prevent_deref<Edge_const_iterator> >
edge_handles() const
Expand All @@ -1199,7 +1199,7 @@ class Arrangement_on_surface_2 {
}

/*!
returns a range over handles of the arrangement faces .
returns a range over handles of the arrangement faces.
*/
Iterator_range<Prevent_deref<Face_iterator> >
face_handles()
Expand All @@ -1221,7 +1221,7 @@ class Arrangement_on_surface_2 {
}

/*!
returns a const range (model of `ConstRange`) over handles of the arrangement faces .
returns a const range (model of `ConstRange`) over handles of the arrangement faces.
*/
Iterator_range<Prevent_deref<Face_const_iterator> >
face_handles() const
Expand Down
44 changes: 24 additions & 20 deletions Circulator/include/CGAL/circulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -698,14 +698,18 @@ typedef Iterator_from_circulator< C, const_reference, const_pointer>
};
template <class Container>
class Circulator_from_container {
static auto begin(Container* c) {
using std::begin;
return begin(*c);
}

static auto end(Container* c) {
using std::end;
return end(*c);
}

typedef Circulator_from_container<Container> Self;
typedef typename Container::iterator container_iterator;
typedef typename Container::const_iterator container_const_iterator;
typedef std::conditional_t<
std::is_const<Container>::value,
container_const_iterator,
container_iterator
> iterator;
using iterator = decltype(begin(std::declval<Container*>()));
typedef std::iterator_traits<iterator> iterator_traits;
public:
typedef typename iterator_traits::value_type value_type;
Expand All @@ -717,7 +721,7 @@ class Circulator_from_container {
typename iterator_traits::iterator_category
>::iterator_category iterator_category;

typedef typename Container::size_type size_type;
using size_type = decltype(std::size(std::declval<Container&>()));
private:
Container* ctnr;
iterator i;
Expand All @@ -734,27 +738,27 @@ class Circulator_from_container {
bool operator==( std::nullptr_t p) const {
CGAL_USE(p);
CGAL_assertion( p == nullptr);
return (ctnr == nullptr) || (ctnr->begin() == ctnr->end());
return (ctnr == nullptr) || (begin(ctnr) == end(ctnr));
}
bool operator!=( std::nullptr_t p) const { return !(*this == p); }
bool operator==( const Self& c) const { return i == c.i; }
bool operator!=( const Self& c) const { return !(*this == c); }
reference operator*() const {
CGAL_assertion( ctnr != nullptr);
CGAL_assertion( i != ctnr->end());
CGAL_assertion( i != end(ctnr));
return *i;
}
pointer operator->() const {
CGAL_assertion( ctnr != nullptr);
CGAL_assertion( i != ctnr->end());
CGAL_assertion( i != end(ctnr));
return i.operator->();
}
Self& operator++() {
CGAL_assertion( ctnr != nullptr);
CGAL_assertion( i != ctnr->end());
CGAL_assertion( i != end(ctnr));
++i;
if ( i == ctnr->end())
i = ctnr->begin();
if ( i == end(ctnr))
i = begin(ctnr);
return *this;
}
Self operator++(int) {
Expand All @@ -764,9 +768,9 @@ class Circulator_from_container {
}
Self& operator--() {
CGAL_assertion( ctnr != nullptr);
CGAL_assertion( i != ctnr->end());
if ( i == ctnr->begin())
i = ctnr->end();
CGAL_assertion( i != end(ctnr));
if ( i == begin(ctnr))
i = end(ctnr);
--i;
return *this;
}
Expand All @@ -777,15 +781,15 @@ class Circulator_from_container {
}
Self& operator+=( difference_type n) {
CGAL_assertion( ctnr != nullptr);
CGAL_assertion( i != ctnr->end());
typename Container::difference_type j = i - ctnr->begin();
CGAL_assertion( i != end(ctnr));
typename Container::difference_type j = i - begin(ctnr);
typename Container::difference_type size = ctnr->size();
CGAL_assertion( j >= 0);
CGAL_assertion( size >= 0);
j = non_negative_mod( j + n, size);
CGAL_assertion( j >= 0);
CGAL_assertion( j < size);
i = ctnr->begin() + j;
i = begin(ctnr) + j;
return *this;
}
Self operator+( difference_type n) const {
Expand Down
36 changes: 36 additions & 0 deletions Hash_map/include/CGAL/Hash_map/internal/chained_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <CGAL/memory.h>
#include <iostream>
#include <limits>
#include <type_traits>
#include <utility>

namespace CGAL {

Expand Down Expand Up @@ -85,6 +87,10 @@ class chained_map
chained_map(std::size_t n = default_size, const T& d = T());
chained_map(const chained_map<T, Allocator>& D);
chained_map& operator=(const chained_map<T, Allocator>& D);
chained_map(chained_map<T, Allocator>&& D)
noexcept(std::is_nothrow_move_constructible_v<Allocator> && std::is_nothrow_move_constructible_v<T>);
chained_map& operator=(chained_map<T, Allocator>&& D)
noexcept(std::is_nothrow_move_assignable_v<Allocator> && std::is_nothrow_move_assignable_v<T>);

void reserve(std::size_t n);
void clear();
Expand Down Expand Up @@ -246,6 +252,18 @@ chained_map<T, Allocator>::chained_map(const chained_map<T, Allocator>& D)
}
}
}
template <typename T, typename Allocator>
chained_map<T, Allocator>::chained_map(chained_map<T, Allocator>&& D)
noexcept(std::is_nothrow_move_constructible_v<Allocator> && std::is_nothrow_move_constructible_v<T>)
: table(std::exchange(D.table, nullptr))
, table_end(std::exchange(D.table_end, nullptr))
, free(std::exchange(D.free, nullptr))
, table_size(std::exchange(D.table_size, 0))
, table_size_1(std::exchange(D.table_size_1, 0))
, alloc(std::move(D.alloc))
, reserved_size(std::exchange(D.reserved_size, 0))
, def(std::move(D.def))
{}

template <typename T, typename Allocator>
chained_map<T, Allocator>& chained_map<T, Allocator>::operator=(const chained_map<T, Allocator>& D)
Expand All @@ -263,6 +281,24 @@ chained_map<T, Allocator>& chained_map<T, Allocator>::operator=(const chained_ma
return *this;
}

template <typename T, typename Allocator>
chained_map<T, Allocator>& chained_map<T, Allocator>::operator=(chained_map<T, Allocator>&& D)
noexcept(std::is_nothrow_move_assignable_v<Allocator> && std::is_nothrow_move_assignable_v<T>)
{
clear();

table = std::exchange(D.table, nullptr);
table_end = std::exchange(D.table_end, nullptr);
free = std::exchange(D.free, nullptr);
table_size = std::exchange(D.table_size, 0);
table_size_1 = std::exchange(D.table_size_1, 0);
alloc = std::move(D.alloc);
reserved_size = std::exchange(D.reserved_size, 0);
def = std::move(D.def);

return *this;
}

template <typename T, typename Allocator>
void chained_map<T, Allocator>::reserve(std::size_t n)
{
Expand Down
6 changes: 6 additions & 0 deletions Hash_map/test/Hash_map/Unique_hash_map_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <list>
#include <CGAL/Unique_hash_map.h>
#include <CGAL/test_macros.h>
#include <type_traits>

using namespace std;
typedef list<int>::iterator Iterator;
Expand All @@ -24,6 +25,10 @@ int main() {
H1[it1] = 2;
CGAL_TEST(H1[it1]==2);
CGAL_TEST(H2[it1]==-1);
static_assert(std::is_nothrow_move_constructible_v<decltype(H1)>);
auto H1_moved = std::move(H1);
CGAL_TEST(H1_moved[it1]==2);
CGAL_TEST(H1[it1]==H1.default_value());
H1.clear();
H2.clear(-2);
H2[it1] = 2;
Expand Down Expand Up @@ -67,6 +72,7 @@ int main() {
CGAL_TEST(get(H4_pmap, L.begin()) == 0);

typedef CGAL::Unique_hash_map<int, int, Integer_hash_function> Int_hmap;
static_assert(std::is_nothrow_move_constructible_v<Int_hmap>);
typedef boost::associative_property_map<Int_hmap> Int_pmap;
Int_hmap H5(-1);
Int_pmap H5_pmap(H5);
Expand Down
9 changes: 5 additions & 4 deletions Installation/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
Release History
===============
# Release History

[Release 6.0](https://github.com/CGAL/cgal/releases/tag/v6.0)
-----------
## [Release 6.0](https://github.com/CGAL/cgal/releases/tag/v6.0)

Release date: June 2024

Expand Down Expand Up @@ -119,6 +117,9 @@ Release date: June 2024
### [Surface Mesh Parameterization](https://doc.cgal.org/6.0/Manual/packages.html#PkgSurfaceMeshParameterization)
- **Breaking change**: LSCM_parameterizer_3 needs Eigen

### [2D Triangulations](https://doc.cgal.org/6.0/Manual/packages.html#PkgTriangulation2)
- **Breaking change**: the concept [`TriangulationTraits_2`](https://doc.cgal.org/6.0/Triangulation_2/classTriangulationTraits__2.html) now requires an additional functor `Compare_xy_2`.

### [3D Triangulations](https://doc.cgal.org/6.0/Manual/packages.html#PkgTriangulation3)
- Added three functions `vertices()` to the class `Triangulation_3`.
Each of them returns an array containing the vertices of the given triangulation simplex.
Expand Down
20 changes: 19 additions & 1 deletion Installation/include/CGAL/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ using std::max;
// Macros to detect features of clang. We define them for the other
// compilers.
// See https://clang.llvm.org/docs/LanguageExtensions.html
// See also https://en.cppreference.com/w/cpp/experimental/feature_test
//
// Some of those macro have been standardized. See C++20 feature testing:
// https://en.cppreference.com/w/cpp/feature_test
#ifndef __has_feature
#define __has_feature(x) 0 // Compatibility with non-clang compilers.
#endif
Expand All @@ -316,6 +318,10 @@ using std::max;
#define __has_warning(x) 0 // Compatibility with non-clang compilers.
#endif

#if __has_include(<version>)
# include <version>
#endif

// Macro to specify a 'unused' attribute.
#if __has_cpp_attribute(maybe_unused)
# define CGAL_UNUSED [[maybe_unused]]
Expand Down Expand Up @@ -470,6 +476,14 @@ namespace cpp11{
}//namespace cpp11
} //namespace CGAL

#if __cpp_lib_concepts >= 201806L
# define CGAL_CPP20_REQUIRE_CLAUSE(x) requires x
# define CGAL_TYPE_CONSTRAINT(x) x
#else
# define CGAL_CPP20_REQUIRE_CLAUSE(x)
# define CGAL_TYPE_CONSTRAINT(x) typename
#endif

// The fallthrough attribute
// See for clang:
// https://clang.llvm.org/docs/AttributeReference.html#statement-attributes
Expand All @@ -487,6 +501,10 @@ namespace cpp11{
# define CGAL_FALLTHROUGH while(false){}
#endif

#if __cpp_lib_format >= 201907L || (__has_include(<format>) && (__cplusplus >= 202000L || _MSVC_LANG >= 202000L))
# define CGAL_CAN_USE_CXX20_FORMAT 1
#endif

#ifndef CGAL_NO_ASSERTIONS
# define CGAL_NO_ASSERTIONS_BOOL false
#else
Expand Down
22 changes: 22 additions & 0 deletions Interpolation/include/CGAL/Voronoi_intersection_2_traits_3.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,24 @@ class Voronoi_intersection_2_traits_3
typedef typename Rep::Less_distance_to_point_3 Less_distance_to_point_2;
typedef typename Rep::Compute_squared_distance_3 Compute_squared_distance_2;

struct Compare_xy_2 {
Compare_x_2 cx_2;
Compare_y_2 cy_2;

Compare_xy_2(const Compare_x_2& cx_2, const Compare_y_2& cy_2)
: cx_2(cx_2), cy_2(cy_2)
{}

Comparison_result operator()(const Point_2& p, const Point_2& q) const
{
Comparison_result res = cx_2(p, q);
if (res == EQUAL) {
return cy_2(p, q);
}
return res;
}
};

//instantiations and creation of functors:
//for the triangulation:
Orientation_2
Expand All @@ -312,6 +330,10 @@ class Voronoi_intersection_2_traits_3
compare_y_2_object() const
{ return Compare_y_2(normal); }

Compare_xy_2
compare_xy_2_object() const
{ return Compare_xy_2(compare_x_2_object(), compare_y_2_object()); }

Less_x_2
less_x_2_object() const
{ return compare_to_less(compare_x_2_object()); }
Expand Down
Loading