diff --git a/Mesh_3/include/CGAL/Mesh_3/global_parameters.h b/BGL/include/CGAL/boost/parameter.h similarity index 61% rename from Mesh_3/include/CGAL/Mesh_3/global_parameters.h rename to BGL/include/CGAL/boost/parameter.h index bde73012406..1c5c1b8e979 100644 --- a/Mesh_3/include/CGAL/Mesh_3/global_parameters.h +++ b/BGL/include/CGAL/boost/parameter.h @@ -1,10 +1,9 @@ -// Copyright (c) 2009 INRIA Sophia-Antipolis (France). -// All rights reserved. +// Copyright (c) 2014 GeometryFactory (France). All rights reserved. // -// This file is part of CGAL (www.cgal.org). -// You can redistribute it and/or modify it under the terms of the GNU -// General Public License as published by the Free Software Foundation, -// either version 3 of the License, or (at your option) any later version. +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. // // Licensees holding a valid commercial license may use this file in // accordance with the commercial license agreement provided with the software. @@ -14,23 +13,16 @@ // // $URL$ // $Id$ -// SPDX-License-Identifier: GPL-3.0+ +// SPDX-License-Identifier: LGPL-3.0+ +// // -// -// Author(s) : Stephane Tayeb -// -//****************************************************************************** -// File Description : -//****************************************************************************** - -#ifndef CGAL_MESH_3_GLOBAL_PARAMETERS_H -#define CGAL_MESH_3_GLOBAL_PARAMETERS_H - -#include +// Author(s) : Andreas Fabri +#ifndef CGAL_BOOST_PARAMETER_H +#define CGAL_BOOST_PARAMETER_H #include -#include + #ifdef BOOST_PARAMETER_MAX_ARITY # if (BOOST_PARAMETER_MAX_ARITY < 12) @@ -39,14 +31,34 @@ #else # define BOOST_PARAMETER_MAX_ARITY 12 #endif - #include +#include -namespace CGAL { +#if defined(__clang__) || (BOOST_GCC >= 40600) +# define CGAL_IGNORE_UNUSED_VARIABLES \ + _Pragma("GCC diagnostic ignored \"-Wunused-variable\"") \ + _Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") +#else +# define CGAL_IGNORE_UNUSED_VARIABLES +#endif +#if __has_warning("-Wunneeded-internal-declaration") +# define CGAL_IGNORE_UNUSED_INTERNAL_DECLARATION \ + _Pragma("clang diagnostic ignored \"-Wunneeded-internal-declaration\"") +#else +# define CGAL_IGNORE_UNUSED_INTERNAL_DECLARATION +#endif -namespace parameters { +#define CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS \ + CGAL_IGNORE_UNUSED_VARIABLES \ + CGAL_IGNORE_UNUSED_INTERNAL_DECLARATION + +namespace CGAL +{ +namespace parameters +{ + template struct Base { @@ -56,33 +68,39 @@ private: T t_; }; -#define CGAL_MESH_BOOLEAN_PARAMETER(Class, function_true, function_false) \ +#define CGAL_BOOLEAN_PARAMETER(Class, function_true, function_false) \ struct Class : public Base { Class(bool b) : Base(b){} }; \ inline Class function_true() { return Class(true); } \ inline Class function_false() { return Class(false); } -#define CGAL_MESH_DOUBLE_PARAMETER(Class, function, precondition) \ +#define CGAL_DOUBLE_PARAMETER(Class, function, precondition) \ struct Class : public Base \ { Class(double d) : Base(d) { precondition(d); } }; \ inline Class function(double d) { return Class(d); } // see CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS +// see +CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS BOOST_PARAMETER_NAME( c3t3 ) BOOST_PARAMETER_NAME( domain ) BOOST_PARAMETER_NAME( criteria ) - +BOOST_PARAMETER_NAME( cdt ) + +BOOST_PARAMETER_NAME( (seeds_begin, tag) seeds_begin_) +BOOST_PARAMETER_NAME( (seeds_end, tag) seeds_end_) +BOOST_PARAMETER_NAME( (mark, tag) mark_) + BOOST_PARAMETER_NAME( (time_limit, tag) time_limit_ ) +BOOST_PARAMETER_NAME( (convergence, tag) convergence_) +BOOST_PARAMETER_NAME( (max_iteration_number, tag) max_iteration_number_ ) +BOOST_PARAMETER_NAME( (freeze_bound, tag) freeze_bound_) + BOOST_PARAMETER_NAME( (sliver_bound, tag) sliver_bound_) BOOST_PARAMETER_NAME( (sliver_criterion, tag) sliver_criterion_) BOOST_PARAMETER_NAME( (perturbation_vector, tag) perturbation_vector_) -BOOST_PARAMETER_NAME( (freeze_bound, tag) freeze_bound_) BOOST_PARAMETER_NAME( (do_freeze, tag) do_freeze_) -BOOST_PARAMETER_NAME( (max_iteration_number, tag) max_iteration_number_ ) -BOOST_PARAMETER_NAME( (convergence, tag) convergence_) BOOST_PARAMETER_NAME( (mesh_topology, tag) mesh_topology_) @@ -97,12 +115,8 @@ BOOST_PARAMETER_NAME( (maximal_number_of_vertices, tag ) maximal_number_of_verti BOOST_PARAMETER_NAME( (pointer_to_error_code, tag ) pointer_to_error_code_) CGAL_PRAGMA_DIAG_POP -} // end namespace parameters +} // parameters +} // CGAL - - - -} //namespace CGAL - -#endif // CGAL_MESH_3_GLOBAL_PARAMETERS_H +#endif // CGAL_BOOST_PARAMETER_H diff --git a/CGAL_Core/include/CGAL/CORE/CoreDefs.h b/CGAL_Core/include/CGAL/CORE/CoreDefs.h index 499d7b1dbf3..0d53c442bcc 100644 --- a/CGAL_Core/include/CGAL/CORE/CoreDefs.h +++ b/CGAL_Core/include/CGAL/CORE/CoreDefs.h @@ -55,7 +55,7 @@ #else // CGAL_HEADER_ONLY #define CGAL_GLOBAL_STATE_VAR(TYPE, NAME, VALUE) \ - CGAL_CORE_EXPORT extern TYPE NAME; \ + CGAL_EXPORT extern TYPE NAME; \ inline TYPE& get_static_##NAME() \ { \ return NAME; \ @@ -343,4 +343,6 @@ inline void setPositionalFormat(std::ostream& o = std::cout) { #include +#undef CGAL_GLOBAL_STATE_VAR + #endif // _CORE_COREDEFS_H_ diff --git a/CGAL_ImageIO/include/CGAL/ImageIO/gif_impl.h b/CGAL_ImageIO/include/CGAL/ImageIO/gif_impl.h index 64e8b484e83..7e9e81c3dfe 100644 --- a/CGAL_ImageIO/include/CGAL/ImageIO/gif_impl.h +++ b/CGAL_ImageIO/include/CGAL/ImageIO/gif_impl.h @@ -699,3 +699,5 @@ static int GifError(const char *st) { return -1; } +#undef CGAL_GLOBAL_STATE_VAR + diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 1b76dc8aeaa..728e16f2ec5 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -1262,6 +1262,7 @@ LEDA_FOUND is false.") endif() endif() if(NOT skip_hdr) + LIST( APPEND list_of_headers_to_test ${header}) string(REPLACE "/" "__" header2 "${header}") string(REPLACE "." "_" header2 "${header2}") string(REPLACE ";" " " include_options_str "${include_options}") @@ -1326,7 +1327,26 @@ ${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}" list(REMOVE_DUPLICATES packages_deps) endif() endforeach() # loop on packages - add_custom_target(check_headers DEPENDS ${check_pkg_target_list}) + + #Now check that a cpp file including all documented headers compiles + file(WRITE ${CGAL_BINARY_DIR}/test_headers.cpp "#define BOOST_PARAMETER_MAX_ARITY 12 \n") + foreach(header ${list_of_headers_to_test}) + file(APPEND ${CGAL_BINARY_DIR}/test_headers.cpp "#include <${header}>\n") + endforeach() #loop on headers to include in test file + file(APPEND ${CGAL_BINARY_DIR}/test_headers.cpp "int main(){}\n") + + add_custom_target(check_headers + DEPENDS ${check_pkg_target_list}) + + string(REPLACE " " ";" compile_options ${compile_options}) + string(REPLACE " " ";" include_options ${include_options_str}) + add_custom_command(TARGET check_headers + POST_BUILD + COMMAND ${CMAKE_CXX_COMPILER} + ${compile_options} ${include_options} + -x c++ -fsyntax-only ${CGAL_BINARY_DIR}/test_headers.cpp + ) + add_custom_target(packages_dependencies DEPENDS ${packages_deps}) message( " \n\ You can now check the headers with the target `check_headers`\n\ diff --git a/Mesh_2/include/CGAL/lloyd_optimize_mesh_2.h b/Mesh_2/include/CGAL/lloyd_optimize_mesh_2.h index 48b1457c19f..ee2f6e42d48 100644 --- a/Mesh_2/include/CGAL/lloyd_optimize_mesh_2.h +++ b/Mesh_2/include/CGAL/lloyd_optimize_mesh_2.h @@ -31,47 +31,18 @@ #include #include #include +#include #include -#if ( defined( __clang__ ) || (BOOST_GCC >= 40600 ) ) && (BOOST_VERSION < 106000) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - -#ifdef BOOST_PARAMETER_MAX_ARITY -# if (BOOST_PARAMETER_MAX_ARITY < 8) -# error "BOOST_PARAMETER_MAX_ARITY must be at least 8 for CGAL::lloyd_optimize_mesh_2()" -# endif -#else -# define BOOST_PARAMETER_MAX_ARITY 8 -#endif -#include -#include - -namespace CGAL -{ -namespace parameters -{ - - -BOOST_PARAMETER_NAME( cdt ) -BOOST_PARAMETER_NAME( (max_iteration_number, tag) max_iteration_number_ ) -BOOST_PARAMETER_NAME( (convergence, tag) convergence_) -BOOST_PARAMETER_NAME( (time_limit, tag) time_limit_ ) -BOOST_PARAMETER_NAME( (freeze_bound, tag) freeze_bound_) -BOOST_PARAMETER_NAME( (seeds_begin, tag) seeds_begin_) -BOOST_PARAMETER_NAME( (seeds_end, tag) seeds_end_) -BOOST_PARAMETER_NAME( (mark, tag) mark_) - -}//end namespace parameters -}//end namespace CGAL +// see +CGAL_PRAGMA_DIAG_PUSH +// see +CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS namespace CGAL { - using namespace parameters; #if defined(BOOST_MSVC) # pragma warning(push) @@ -81,7 +52,7 @@ namespace CGAL BOOST_PARAMETER_FUNCTION( (Mesh_optimization_return_code), lloyd_optimize_mesh_2, - tag, + parameters::tag, (required (in_out(cdt),*)) (optional (max_iteration_number_, *, 0 ) @@ -179,11 +150,7 @@ namespace CGAL } //end namespace CGAL -//CGAL_PRAGMA_DIAG_POP -#if ( defined( __clang__ ) || (BOOST_GCC >= 40600 ) ) && (BOOST_VERSION < 106000) -#pragma GCC diagnostic pop -#endif - +CGAL_PRAGMA_DIAG_POP #include diff --git a/Mesh_2/package_info/Mesh_2/dependencies b/Mesh_2/package_info/Mesh_2/dependencies index 8e839394994..a0eb105c10e 100644 --- a/Mesh_2/package_info/Mesh_2/dependencies +++ b/Mesh_2/package_info/Mesh_2/dependencies @@ -1,4 +1,5 @@ Algebraic_foundations +BGL Circulator Distance_2 Hash_map diff --git a/Mesh_3/include/CGAL/Mesh_3/config.h b/Mesh_3/include/CGAL/Mesh_3/config.h index f952e80cd7f..53b408812e3 100644 --- a/Mesh_3/include/CGAL/Mesh_3/config.h +++ b/Mesh_3/include/CGAL/Mesh_3/config.h @@ -67,22 +67,4 @@ # endif #endif -#if defined(__clang__) || (BOOST_GCC >= 40600) -# define CGAL_MESH_3_IGNORE_UNUSED_VARIABLES \ - _Pragma("GCC diagnostic ignored \"-Wunused-variable\"") \ - _Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") -#else -# define CGAL_MESH_3_IGNORE_UNUSED_VARIABLES -#endif -#if __has_warning("-Wunneeded-internal-declaration") -# define CGAL_MESH_3_IGNORE_UNUSED_INTERNAL_DECLARATION \ - _Pragma("clang diagnostic ignored \"-Wunneeded-internal-declaration\"") -#else -# define CGAL_MESH_3_IGNORE_UNUSED_INTERNAL_DECLARATION -#endif - -#define CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS \ - CGAL_MESH_3_IGNORE_UNUSED_VARIABLES \ - CGAL_MESH_3_IGNORE_UNUSED_INTERNAL_DECLARATION - #endif // CGAL_MESH_3_CONFIG_H diff --git a/Mesh_3/include/CGAL/Mesh_criteria_3.h b/Mesh_3/include/CGAL/Mesh_criteria_3.h index 2360fb78a3c..ecb5ead9ffb 100644 --- a/Mesh_3/include/CGAL/Mesh_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_criteria_3.h @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include #include @@ -45,8 +45,8 @@ namespace parameters { // see CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS +// see +CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS BOOST_PARAMETER_NAME( (edge_size, tag) edge_size_ ) BOOST_PARAMETER_NAME( (edge_sizing_field, tag) edge_sizing_field_ ) diff --git a/Mesh_3/include/CGAL/Polyhedral_complex_mesh_domain_3.h b/Mesh_3/include/CGAL/Polyhedral_complex_mesh_domain_3.h index 13464bb3317..52e5996cde2 100644 --- a/Mesh_3/include/CGAL/Polyhedral_complex_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_complex_mesh_domain_3.h @@ -47,7 +47,7 @@ #include #include #include - +#include #include #include @@ -57,156 +57,6 @@ namespace CGAL { -/// @cond DEVELOPERS -namespace internal { -namespace Mesh_3 { - -template -void dump_graph_edges(std::ostream& out, const Graph& g) -{ - typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - typedef typename boost::graph_traits::edge_descriptor edge_descriptor; - - out.precision(17); - BOOST_FOREACH(edge_descriptor e, edges(g)) - { - vertex_descriptor s = source(e, g); - vertex_descriptor t = target(e, g); - out << "2 " << g[s] << " " << g[t] << "\n"; - } -} - -template -void dump_graph_edges(const char* filename, const Graph& g) -{ - std::ofstream out(filename); - dump_graph_edges(out, g); -} - -template -struct Angle_tester -{ - template - bool operator()(vertex_descriptor& v, const Graph& g) const - { - typedef typename boost::graph_traits::out_edge_iterator out_edge_iterator; - if (out_degree(v, g) != 2) - return true; - else - { - out_edge_iterator out_edge_it, out_edges_end; - boost::tie(out_edge_it, out_edges_end) = out_edges(v, g); - - vertex_descriptor v1 = target(*out_edge_it++, g); - vertex_descriptor v2 = target(*out_edge_it++, g); - CGAL_assertion(out_edge_it == out_edges_end); - - const typename Kernel::Point_3& p = g[v]; - const typename Kernel::Point_3& p1 = g[v1]; - const typename Kernel::Point_3& p2 = g[v2]; - - return (CGAL::angle(p1, p, p2) == CGAL::ACUTE); - } - } -}; - -template -struct Is_featured_edge { - const Polyhedron* polyhedron; - typename boost::property_map::type eifm; - Is_featured_edge() - : polyhedron(0) - {} // required by boost::filtered_graph - - Is_featured_edge(const Polyhedron& polyhedron) - : polyhedron(&polyhedron), eifm(get(edge_is_feature,polyhedron)) - {} - - bool operator()(typename boost::graph_traits::edge_descriptor e) const { - return get(eifm, e); - } -}; // end Is_featured_edge - -template -struct Is_border_edge { - const Polyhedron* polyhedron; - Is_border_edge() : polyhedron(0) {} // required by boost::filtered_graph - Is_border_edge(const Polyhedron& polyhedron) : polyhedron(&polyhedron) {} - - bool operator()(typename boost::graph_traits::edge_descriptor e) const { - return is_border(halfedge(e, *polyhedron), *polyhedron) || - is_border(opposite(halfedge(e, *polyhedron), *polyhedron), *polyhedron); - } -}; // end Is_featured_edge - -template -struct Extract_polyline_with_context_visitor -{ - typedef typename Polyhedral_mesh_domain::Polyhedron_type Polyhedron; - std::vector& polylines; - const Graph& graph; - - Extract_polyline_with_context_visitor - (const Graph& graph, - typename std::vector& polylines) - : polylines(polylines), graph(graph) - {} - - void start_new_polyline() - { - polylines.push_back(Polyline_with_context()); - } - - void add_node(typename boost::graph_traits::vertex_descriptor vd) - { - if(polylines.back().polyline_content.empty()) { - polylines.back().polyline_content.push_back(graph[vd]); - } - } - - void add_edge(typename boost::graph_traits::edge_descriptor ed) - { - typename boost::graph_traits::vertex_descriptor - s = source(ed, graph), - t = target(ed, graph); - Polyline_with_context& polyline = polylines.back(); - CGAL_assertion(!polyline.polyline_content.empty()); - if(polyline.polyline_content.back() != graph[s]) { - polyline.polyline_content.push_back(graph[s]); - } else if(polyline.polyline_content.back() != graph[t]) { - // if the edge is zero-length, it is ignored - polyline.polyline_content.push_back(graph[t]); - } - const typename boost::edge_bundle_type::type & - set_of_indices = graph[ed]; - polyline.context.adjacent_patches_ids.insert(set_of_indices.begin(), - set_of_indices.end()); - } - - void end_polyline() - { - // ignore degenerated polylines - if(polylines.back().polyline_content.size() < 2) - polylines.resize(polylines.size() - 1); - // else { - // std::cerr << "Polyline with " << polylines.back().polyline_content.size() - // << " vertices, incident to " - // << polylines.back().context.adjacent_patches_ids.size() - // << " patches:\n "; - // for(auto p: polylines.back().polyline_content) - // std::cerr << " " << p; - // std::cerr << "\n"; - // } - } -}; - - -} // end CGAL::internal::Mesh_3 -} // end CGAL::internal - -/// @endcond /*! \ingroup PkgMesh_3Domains diff --git a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h index 0650b628eef..755835811a3 100644 --- a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h @@ -32,7 +32,7 @@ #include -#include +#include #include #include diff --git a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h index ea04c0eb7e4..2240b0f1080 100644 --- a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -62,132 +63,6 @@ namespace CGAL { -namespace internal { -namespace Mesh_3 { - -template -struct Angle_tester -{ - template - bool operator()(vertex_descriptor& v, const Graph& g) const - { - typedef typename boost::graph_traits::out_edge_iterator out_edge_iterator; - if (out_degree(v, g) != 2) - return true; - else - { - out_edge_iterator out_edge_it, out_edges_end; - boost::tie(out_edge_it, out_edges_end) = out_edges(v, g); - - vertex_descriptor v1 = target(*out_edge_it++, g); - vertex_descriptor v2 = target(*out_edge_it++, g); - CGAL_assertion(out_edge_it == out_edges_end); - - const typename Kernel::Point_3& p = g[v]; - const typename Kernel::Point_3& p1 = g[v1]; - const typename Kernel::Point_3& p2 = g[v2]; - - return (CGAL::angle(p1, p, p2) == CGAL::ACUTE); - } - } -}; - -template -struct Is_featured_edge { - const Polyhedron* polyhedron; - typename boost::property_map::type eifm; - Is_featured_edge() - : polyhedron(0) - {} // required by boost::filtered_graph - - Is_featured_edge(const Polyhedron& polyhedron) - : polyhedron(&polyhedron), eifm(get(edge_is_feature,polyhedron)) - {} - - bool operator()(typename boost::graph_traits::edge_descriptor e) const { - return get(eifm, e); - } -}; // end Is_featured_edge - -template -struct Is_border_edge { - const Polyhedron* polyhedron; - Is_border_edge() : polyhedron(0) {} // required by boost::filtered_graph - Is_border_edge(const Polyhedron& polyhedron) : polyhedron(&polyhedron) {} - - bool operator()(typename boost::graph_traits::edge_descriptor e) const { - return is_border(halfedge(e, *polyhedron), *polyhedron) || - is_border(opposite(halfedge(e, *polyhedron), *polyhedron), *polyhedron); - } -}; // end Is_featured_edge - -template -struct Extract_polyline_with_context_visitor -{ - typedef typename Polyhedral_mesh_domain::Polyhedron Polyhedron; - std::vector& polylines; - const Graph& graph; - - Extract_polyline_with_context_visitor - (const Graph& graph, - typename std::vector& polylines) - : polylines(polylines), graph(graph) - {} - - void start_new_polyline() - { - polylines.push_back(Polyline_with_context()); - } - - void add_node(typename boost::graph_traits::vertex_descriptor vd) - { - if(polylines.back().polyline_content.empty()) { - polylines.back().polyline_content.push_back(graph[vd]); - } - } - - void add_edge(typename boost::graph_traits::edge_descriptor ed) - { - typename boost::graph_traits::vertex_descriptor - s = source(ed, graph), - t = target(ed, graph); - Polyline_with_context& polyline = polylines.back(); - CGAL_assertion(!polyline.polyline_content.empty()); - if(polyline.polyline_content.back() != graph[s]) { - polyline.polyline_content.push_back(graph[s]); - } else if(polyline.polyline_content.back() != graph[t]) { - // if the edge is zero-length, it is ignored - polyline.polyline_content.push_back(graph[t]); - } - const typename boost::edge_bundle_type::type & - set_of_indices = graph[ed]; - polyline.context.adjacent_patches_ids.insert(set_of_indices.begin(), - set_of_indices.end()); - } - - void end_polyline() - { - // ignore degenerated polylines - if(polylines.back().polyline_content.size() < 2) - polylines.resize(polylines.size() - 1); - // else { - // std::cerr << "Polyline with " << polylines.back().polyline_content.size() - // << " vertices, incident to " - // << polylines.back().context.adjacent_patches_ids.size() - // << " patches:\n "; - // for(auto p: polylines.back().polyline_content) - // std::cerr << " " << p; - // std::cerr << "\n"; - // } - } -}; - - -} // end CGAL::internal::Mesh_3 -} // end CGAL::internal - /** * @class Polyhedral_mesh_domain_with_features_3 * @@ -219,6 +94,7 @@ class Polyhedral_mesh_domain_with_features_3 std::set > Featured_edges_copy_graph; public: typedef Polyhedron_ Polyhedron; + typedef Polyhedron Polyhedron_type; // Index types typedef typename Base::Index Index; diff --git a/Mesh_3/include/CGAL/exude_mesh_3.h b/Mesh_3/include/CGAL/exude_mesh_3.h index ba74aa72111..04dad363b92 100644 --- a/Mesh_3/include/CGAL/exude_mesh_3.h +++ b/Mesh_3/include/CGAL/exude_mesh_3.h @@ -34,8 +34,7 @@ #include #include #include -#include -#include +#include namespace CGAL { @@ -46,8 +45,8 @@ namespace CGAL { // see CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS +// see +CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS BOOST_PARAMETER_FUNCTION( (Mesh_optimization_return_code), diff --git a/Mesh_3/include/CGAL/internal/Mesh_3/helpers.h b/Mesh_3/include/CGAL/internal/Mesh_3/helpers.h new file mode 100644 index 00000000000..6baa4ed6dd8 --- /dev/null +++ b/Mesh_3/include/CGAL/internal/Mesh_3/helpers.h @@ -0,0 +1,195 @@ +// Copyright (c) 2009-2010 INRIA Sophia-Antipolis (France). +// Copyright (c) 2014-2017 GeometryFactory Sarl (France) +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0+ +// +// +// Author(s) : Laurent Rineau, Stéphane Tayeb +// +//****************************************************************************** +// File Description : +// +//****************************************************************************** + +#ifndef CGAL_MESH_3_INTERNAL_MESH_3_HELPERS_H +#define CGAL_MESH_3_INTERNAL_MESH_3_HELPERS_H + +#include + +#include +#include +#include +#include + +namespace CGAL { + +/// @cond DEVELOPERS +namespace internal { +namespace Mesh_3 { + +template +void dump_graph_edges(std::ostream& out, const Graph& g) +{ + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + typedef typename boost::graph_traits::edge_descriptor edge_descriptor; + + out.precision(17); + BOOST_FOREACH(edge_descriptor e, edges(g)) + { + vertex_descriptor s = source(e, g); + vertex_descriptor t = target(e, g); + out << "2 " << g[s] << " " << g[t] << "\n"; + } +} + +template +void dump_graph_edges(const char* filename, const Graph& g) +{ + std::ofstream out(filename); + dump_graph_edges(out, g); +} + +template +struct Angle_tester +{ + template + bool operator()(vertex_descriptor& v, const Graph& g) const + { + typedef typename boost::graph_traits::out_edge_iterator out_edge_iterator; + if (out_degree(v, g) != 2) + return true; + else + { + out_edge_iterator out_edge_it, out_edges_end; + boost::tie(out_edge_it, out_edges_end) = out_edges(v, g); + + vertex_descriptor v1 = target(*out_edge_it++, g); + vertex_descriptor v2 = target(*out_edge_it++, g); + CGAL_assertion(out_edge_it == out_edges_end); + + const typename Kernel::Point_3& p = g[v]; + const typename Kernel::Point_3& p1 = g[v1]; + const typename Kernel::Point_3& p2 = g[v2]; + + return (CGAL::angle(p1, p, p2) == CGAL::ACUTE); + } + } +}; + +template +struct Is_featured_edge { + const Polyhedron* polyhedron; + typename boost::property_map::type eifm; + Is_featured_edge() + : polyhedron(0) + {} // required by boost::filtered_graph + + Is_featured_edge(const Polyhedron& polyhedron) + : polyhedron(&polyhedron), eifm(get(edge_is_feature,polyhedron)) + {} + + bool operator()(typename boost::graph_traits::edge_descriptor e) const { + return get(eifm, e); + } +}; // end Is_featured_edge + +template +struct Is_border_edge { + const Polyhedron* polyhedron; + Is_border_edge() : polyhedron(0) {} // required by boost::filtered_graph + Is_border_edge(const Polyhedron& polyhedron) : polyhedron(&polyhedron) {} + + bool operator()(typename boost::graph_traits::edge_descriptor e) const { + return is_border(halfedge(e, *polyhedron), *polyhedron) || + is_border(opposite(halfedge(e, *polyhedron), *polyhedron), *polyhedron); + } +}; // end Is_featured_edge + +template +struct Extract_polyline_with_context_visitor +{ + typedef typename Polyhedral_mesh_domain::Polyhedron_type Polyhedron; + std::vector& polylines; + const Graph& graph; + + Extract_polyline_with_context_visitor + (const Graph& graph, + typename std::vector& polylines) + : polylines(polylines), graph(graph) + {} + + void start_new_polyline() + { + polylines.push_back(Polyline_with_context()); + } + + void add_node(typename boost::graph_traits::vertex_descriptor vd) + { + if(polylines.back().polyline_content.empty()) { + polylines.back().polyline_content.push_back(graph[vd]); + } + } + + void add_edge(typename boost::graph_traits::edge_descriptor ed) + { + typename boost::graph_traits::vertex_descriptor + s = source(ed, graph), + t = target(ed, graph); + Polyline_with_context& polyline = polylines.back(); + CGAL_assertion(!polyline.polyline_content.empty()); + if(polyline.polyline_content.back() != graph[s]) { + polyline.polyline_content.push_back(graph[s]); + } else if(polyline.polyline_content.back() != graph[t]) { + // if the edge is zero-length, it is ignored + polyline.polyline_content.push_back(graph[t]); + } + const typename boost::edge_bundle_type::type & + set_of_indices = graph[ed]; + polyline.context.adjacent_patches_ids.insert(set_of_indices.begin(), + set_of_indices.end()); + } + + void end_polyline() + { + // ignore degenerated polylines + if(polylines.back().polyline_content.size() < 2) + polylines.resize(polylines.size() - 1); + // else { + // std::cerr << "Polyline with " << polylines.back().polyline_content.size() + // << " vertices, incident to " + // << polylines.back().context.adjacent_patches_ids.size() + // << " patches:\n "; + // for(auto p: polylines.back().polyline_content) + // std::cerr << " " << p; + // std::cerr << "\n"; + // } + } +}; + + +} // end CGAL::internal::Mesh_3 +} // end CGAL::internal + +/// @endcond + +} // end CGAL + +#include + +#endif // CGAL_MESH_3_INTERNAL_MESH_3_HELPERS_H diff --git a/Mesh_3/include/CGAL/lloyd_optimize_mesh_3.h b/Mesh_3/include/CGAL/lloyd_optimize_mesh_3.h index 63ed1d0a73e..3f2a3c051d8 100644 --- a/Mesh_3/include/CGAL/lloyd_optimize_mesh_3.h +++ b/Mesh_3/include/CGAL/lloyd_optimize_mesh_3.h @@ -30,7 +30,7 @@ #include -#include +#include #include #include #include @@ -47,8 +47,8 @@ namespace CGAL { // see CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS +// see +CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS BOOST_PARAMETER_FUNCTION( (Mesh_optimization_return_code), diff --git a/Mesh_3/include/CGAL/make_mesh_3.h b/Mesh_3/include/CGAL/make_mesh_3.h index 7c54c459f00..8d31b78da54 100644 --- a/Mesh_3/include/CGAL/make_mesh_3.h +++ b/Mesh_3/include/CGAL/make_mesh_3.h @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include #include @@ -123,8 +123,8 @@ namespace parameters { // see CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS +// see +CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS BOOST_PARAMETER_NAME( features_param ) @@ -404,8 +404,8 @@ C3T3 make_mesh_3(const MD& md, const MC& mc, const Arg1& a1, const Arg2& a2, // see CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS +// see +CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS BOOST_PARAMETER_FUNCTION( (void), diff --git a/Mesh_3/include/CGAL/odt_optimize_mesh_3.h b/Mesh_3/include/CGAL/odt_optimize_mesh_3.h index 57b7181c850..7627ab07510 100644 --- a/Mesh_3/include/CGAL/odt_optimize_mesh_3.h +++ b/Mesh_3/include/CGAL/odt_optimize_mesh_3.h @@ -30,7 +30,7 @@ #include -#include +#include #include #include #include @@ -47,8 +47,8 @@ namespace CGAL { // see CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS +// see +CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS BOOST_PARAMETER_FUNCTION( (Mesh_optimization_return_code), diff --git a/Mesh_3/include/CGAL/perturb_mesh_3.h b/Mesh_3/include/CGAL/perturb_mesh_3.h index 59291afe48e..74c68e397c5 100644 --- a/Mesh_3/include/CGAL/perturb_mesh_3.h +++ b/Mesh_3/include/CGAL/perturb_mesh_3.h @@ -30,7 +30,7 @@ #include -#include +#include #include #include #include @@ -48,8 +48,8 @@ namespace CGAL { // see CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS +// see +CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS BOOST_PARAMETER_FUNCTION( (Mesh_optimization_return_code), diff --git a/Mesh_3/include/CGAL/refine_mesh_3.h b/Mesh_3/include/CGAL/refine_mesh_3.h index fb3e4aee3d4..21547fc6ca6 100644 --- a/Mesh_3/include/CGAL/refine_mesh_3.h +++ b/Mesh_3/include/CGAL/refine_mesh_3.h @@ -31,9 +31,9 @@ #include #include +#include #include #include -#include #include #include #include @@ -236,8 +236,8 @@ namespace parameters { // see CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS +// see +CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS // ----------------------------------- @@ -412,14 +412,14 @@ CGAL_PRAGMA_DIAG_POP // ----------------------------------- // Reset_c3t3 (undocumented) // ----------------------------------- - CGAL_MESH_BOOLEAN_PARAMETER(Reset,reset_c3t3,no_reset_c3t3) - // CGAL_MESH_BOOLEAN_PARAMETER defined in + CGAL_BOOLEAN_PARAMETER(Reset,reset_c3t3,no_reset_c3t3) + // CGAL_BOOLEAN_PARAMETER defined in // see CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS +// see +CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS // ----------------------------------- // Parameters @@ -445,8 +445,8 @@ CGAL_PRAGMA_DIAG_POP // see CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_MESH_3_IGNORE_BOOST_PARAMETER_NAME_WARNINGS +// see +CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS BOOST_PARAMETER_FUNCTION( (void), diff --git a/Poisson_surface_reconstruction_3/include/CGAL/Mesh_3/Poisson_refine_cells_3.h b/Poisson_surface_reconstruction_3/include/CGAL/Mesh_3/Poisson_refine_cells_3.h index 6b5305564ed..936563a780e 100644 --- a/Poisson_surface_reconstruction_3/include/CGAL/Mesh_3/Poisson_refine_cells_3.h +++ b/Poisson_surface_reconstruction_3/include/CGAL/Mesh_3/Poisson_refine_cells_3.h @@ -281,7 +281,7 @@ template class Poisson_refine_tets : public BaseP, - public Mesher_level < + public CGAL::Mesher_level < // qualified with CGAL:: as CGAL::Mesh_3::Mesher_level also exists Tr, Poisson_refine_tets, typename Tr::Cell_handle, @@ -294,7 +294,7 @@ class Poisson_refine_tets : Facets_level& facets_level; public: typedef Poisson_refine_tets Self; - typedef Mesher_level < + typedef CGAL::Mesher_level < Tr, Poisson_refine_tets, typename Tr::Cell_handle, diff --git a/Poisson_surface_reconstruction_3/include/CGAL/Surface_mesher/Poisson_implicit_surface_oracle_3.h b/Poisson_surface_reconstruction_3/include/CGAL/Surface_mesher/Poisson_implicit_surface_oracle_3.h index 36c229aad36..d212d17c4fe 100644 --- a/Poisson_surface_reconstruction_3/include/CGAL/Surface_mesher/Poisson_implicit_surface_oracle_3.h +++ b/Poisson_surface_reconstruction_3/include/CGAL/Surface_mesher/Poisson_implicit_surface_oracle_3.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -52,12 +53,6 @@ // compute the value of the potential in any point of space namespace CGAL { -#ifdef BOOST_MPL_CFG_NO_HAS_XXX -# error "BOOST_MPL_HAS_XXX_TRAIT_DEF is needed!" -#else - BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_set_on_surface, Set_on_surface_tag, true) -#endif - namespace Surface_mesher { /** @@ -100,19 +95,7 @@ namespace CGAL { ) */ - namespace { - - template - struct Return_min : CGAL::binary_function - { - T operator()(const T& a, const T& b) const - { - return (std::min)(a, b); - } - }; - - } // end anonymous namespace - + template < class GT, class Surface, diff --git a/Polyhedron/demo/Polyhedron/C3t3_type.h b/Polyhedron/demo/Polyhedron/C3t3_type.h index d3e09ef5380..639242b908b 100644 --- a/Polyhedron/demo/Polyhedron/C3t3_type.h +++ b/Polyhedron/demo/Polyhedron/C3t3_type.h @@ -3,7 +3,7 @@ // include this to get #define BOOST_PARAMETER_MAX_ARITY 12 // as otherwise it gets set via inclusion of Polyhedron_3.h -#include +#include #include #include "Polyhedron_type.h" diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp index 527ec779993..acbfab9cdd5 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp @@ -2,7 +2,7 @@ // Needed for lloyd_optimize_mesh_2 which does it too late // (and we don't want to spend the time on finding out who // includes the header file that sets it too a value too low -#define BOOST_PARAMETER_MAX_ARITY 8 +#define BOOST_PARAMETER_MAX_ARITY 12 #include diff --git a/Polytope_distance_d/include/CGAL/width_assertions.h b/Polytope_distance_d/include/CGAL/width_assertions.h index 011de69d956..5df80c2ce3e 100644 --- a/Polytope_distance_d/include/CGAL/width_assertions.h +++ b/Polytope_distance_d/include/CGAL/width_assertions.h @@ -95,7 +95,7 @@ #define VISITED_CHECK 0 #define IMPASSABLE_CHECK 0 - #include + #include #define DEBUGENDL(doit,msg,var)\ if(doit!=0) std::cout << msg << " " << var << endl; diff --git a/Surface_mesher/include/CGAL/Surface_mesher/Implicit_surface_oracle_3.h b/Surface_mesher/include/CGAL/Surface_mesher/Implicit_surface_oracle_3.h index 2ed6a32971e..f57c6df8943 100644 --- a/Surface_mesher/include/CGAL/Surface_mesher/Implicit_surface_oracle_3.h +++ b/Surface_mesher/include/CGAL/Surface_mesher/Implicit_surface_oracle_3.h @@ -496,11 +496,6 @@ namespace CGAL { }; // end Implicit_surface_oracle_3 -template -FT approximate_sqrt(const FT x) { - return FT (CGAL_NTS sqrt(CGAL_NTS to_double(x))); -} - } // namespace Surface_mesher } // namespace CGAL diff --git a/Triangulation_2/include/CGAL/boost/graph/graph_traits_Triangulation_2.h b/Triangulation_2/include/CGAL/boost/graph/graph_traits_Triangulation_2.h index 668dca027a3..0a901850a6d 100644 --- a/Triangulation_2/include/CGAL/boost/graph/graph_traits_Triangulation_2.h +++ b/Triangulation_2/include/CGAL/boost/graph/graph_traits_Triangulation_2.h @@ -25,7 +25,7 @@ // include this to avoid a VC15 warning #include - +#include #include #include #include @@ -45,114 +45,6 @@ namespace CGAL { namespace detail { -template < class T, class EdgeBase > -class Edge : public EdgeBase { - -public: - typedef typename T::Face_handle Face_handle ; - - Edge() - {} - - Edge(Face_handle fh, int i) - : EdgeBase(fh,i) - {} - - Edge(const EdgeBase& e) - : EdgeBase(e) - {} - - Edge(const Edge& e) - : EdgeBase(e) - {} - - Edge& - operator=(const Edge& e) - { - this->first = e.first; - this->second = e.second; - return *this; - } - - friend std::size_t hash_value(const Edge& e) - { - if (e.first==Face_handle()) return 0; - return hash_value(e.firstneighbor(e.second)? - e.first:e.first->neighbor(e.second)); - } - - bool operator==(const Edge& other) const - { - if((this->first == other.first)&&(this->second == other.second)) return true; - Face_handle fh = this->first->neighbor(this->second); - if(other.first != fh) return false; - int i = fh->index(this->first); - return (other.second == i); - } - - bool operator!=(Edge& other) const - { - return ! (*this == other); - } -}; - -template -class Out_edge_circulator : public Circ -{ -private: - mutable E e; - -public: - - typedef E value_type; - typedef E* pointer; - typedef E& reference; - - Out_edge_circulator() - : Circ() - {} - - Out_edge_circulator(Circ c) - : Circ(c) - {} - - const E& operator*() const - { - E ed = static_cast(this)->operator*(); - e = E(ed.first->neighbor(ed.second), ed.first->neighbor(ed.second)->index(ed.first)); - return e; - } -}; - -template -class In_edge_circulator : public Circ -{ -private: - mutable E e; - -public: - - typedef E value_type; - typedef E* pointer; - typedef E& reference; - - In_edge_circulator() - : Circ() - {} - - In_edge_circulator(Circ c) - : Circ(c) - {} - - const E& operator*() const -{ - typename Circ::value_type ed = static_cast(this)->operator*(); - e = E(ed); - return e; - } -}; - - template struct T2_halfedge_descriptor { @@ -784,14 +676,6 @@ namespace std { #ifndef CGAL_CFG_NO_STD_HASH - template < class T, class EdgeBase> - struct hash > { - std::size_t operator()(const CGAL::detail::Edge& e) const - { - return hash_value(e); - } - }; - template < class Tr> struct hash > { std::size_t operator()(const CGAL::detail::T2_halfedge_descriptor& e) const