diff --git a/.github/install.sh b/.github/install.sh index e06328da401..32b8552aa8f 100755 --- a/.github/install.sh +++ b/.github/install.sh @@ -1,5 +1,4 @@ #!/bin/bash -sudo add-apt-repository ppa:mikhailnov/pulseeffects -y sudo apt-get update sudo apt-get install -y libmpfr-dev \ libeigen3-dev qtbase5-dev libqt5sql5-sqlite libqt5opengl5-dev qtscript5-dev \ diff --git a/.github/workflows/Remove_labels.yml b/.github/workflows/Remove_labels.yml new file mode 100644 index 00000000000..8e9ed55f6bd --- /dev/null +++ b/.github/workflows/Remove_labels.yml @@ -0,0 +1,32 @@ +name: remove_labels +on: + pull_request_target: + types: [synchronize] +jobs: + remove_label: + runs-on: ubuntu-latest + if: contains(github.event.pull_request.labels.*.name, 'Tested') + name: remove label + steps: + - name: removelabel + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + github.rest.issues.removeLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + name: "Tested", + }); + - name: Post address + uses: actions/github-script@v6 + if: ${{ success() }} + with: + script: | + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: "This pull-request was previously marked with the label `Tested`, but has been modified with new commits. That label has been removed." + }) diff --git a/.github/workflows/build_doc.yml b/.github/workflows/build_doc.yml index 208ed4b1d5c..b15b2658b6c 100644 --- a/.github/workflows/build_doc.yml +++ b/.github/workflows/build_doc.yml @@ -51,12 +51,22 @@ jobs: name: "checkout branch" if: steps.get_round.outputs.result != 'stop' with: - repository: ${{ github.repository }} - ref: refs/pull/${{ steps.get_pr_number.outputs.result }}/merge - token: ${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }} - fetch-depth: 2 - + repository: ${{ github.repository }} + ref: refs/pull/${{ steps.get_pr_number.outputs.result }}/merge + token: ${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }} + fetch-depth: 2 + - name: Emoji-comment + uses: actions/github-script@v6 + if: steps.get_round.outputs.result != 'stop' + with: + script: | + github.rest.reactions.createForIssueComment({ + comment_id: ${{ github.event.comment.id }}, + owner: context.repo.owner, + repo: context.repo.repo, + content: 'rocket' + }) - name: install dependencies if: steps.get_round.outputs.result != 'stop' run: | @@ -90,14 +100,17 @@ jobs: #list impacted packages LIST_OF_PKGS=$(git diff --name-only HEAD^1 HEAD |cut -s -d/ -f1 |sort -u | xargs -I {} echo {} && ls -d {}/package_info 2>/dev/null |cut -d/ -f1 |egrep -v Installation||true) if [ "$LIST_OF_PKGS" = "" ]; then - echo "::set-output name=DoxygenError::No package affected." + echo "DoxygenError=No package affected." >> $GITHUB_OUTPUT exit 1 fi cd build_doc && make -j2 doc make -j2 doc_with_postprocessing 2>tmp.log if [ -s tmp.log ]; then content=`cat ./tmp.log` - echo "::set-output name=DoxygenError::$(cat tmp.log)" + delimiter="$(openssl rand -hex 8)" + echo "DoxygenError<<${delimiter}" >> "${GITHUB_OUTPUT}" + cat tmp.log >> "${GITHUB_OUTPUT}" + echo "${delimiter}" >> "${GITHUB_OUTPUT}" exit 1 fi cd .. @@ -117,7 +130,7 @@ jobs: mv tmp.html index.html git add ${PR_NUMBER}/$ROUND index.html && git commit -q --amend -m "base commit" && git push -q -f -u origin master else - echo "::set-output name=DoxygenError::This round already exists. Overwrite it with /force-build." + echo "DoxygenError=This round already exists. Overwrite it with /force-build." >> $GITHUB_OUTPUT exit 1 fi diff --git a/AABB_tree/test/AABB_tree/AABB_test_util.h b/AABB_tree/test/AABB_tree/AABB_test_util.h index 65be2e8a7c5..5b73a20f9f2 100644 --- a/AABB_tree/test/AABB_tree/AABB_test_util.h +++ b/AABB_tree/test/AABB_tree/AABB_test_util.h @@ -527,7 +527,6 @@ private: { CGAL::Timer timer; timer.start(); - int nb_test = 0; while ( timer.time() < duration ) { Point a = random_point_in(m_tree.bbox()); @@ -539,8 +538,6 @@ private: test(segment, m_polyhedron, m_tree, m_naive); test(ray, m_polyhedron, m_tree, m_naive); test(line, m_polyhedron, m_tree, m_naive); - - ++nb_test; } timer.stop(); diff --git a/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h b/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h index d54f28b21a3..373dc515573 100644 --- a/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h +++ b/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h @@ -23,7 +23,6 @@ #include #include -#include #include #include @@ -849,7 +848,7 @@ Alpha_shape_2::initialize_interval_edge_map() { // both faces are infinite by definition unattached // the edge is finite by construction - CGAL_triangulation_precondition((is_infinite(pNeighbor) + CGAL_precondition((is_infinite(pNeighbor) && is_infinite(pFace))); interval = make_triple(squared_radius(pFace, i), Infinity, @@ -859,7 +858,7 @@ Alpha_shape_2::initialize_interval_edge_map() else { // is_infinite(pNeighbor) - CGAL_triangulation_precondition((is_infinite(pNeighbor) + CGAL_precondition((is_infinite(pNeighbor) && !is_infinite(pFace))); if (is_attached(pFace, i)) interval = make_triple(UNDEFINED, @@ -1109,7 +1108,7 @@ Alpha_shape_2::update_alpha_shape_vertex_list()const { // which might be infinity // write the vertex v = (*vertex_alpha_it).second; - CGAL_triangulation_assertion((classify(v) == REGULAR)); + CGAL_assertion((classify(v) == REGULAR)); Alpha_shape_vertices_list.push_back(v); } } @@ -1122,7 +1121,7 @@ Alpha_shape_2::update_alpha_shape_vertex_list()const { ++vertex_alpha_it) { v = (*vertex_alpha_it).second; - CGAL_triangulation_assertion((classify(v) == SINGULAR)); + CGAL_assertion((classify(v) == SINGULAR)); Alpha_shape_vertices_list.push_back(v); } @@ -1159,7 +1158,7 @@ Alpha_shape_2::update_alpha_shape_edges_list() const { pInterval = &(*edge_alpha_it).first; - CGAL_triangulation_assertion(pInterval->second != Infinity); + CGAL_assertion(pInterval->second != Infinity); // since this happens only for convex hull of dimension 2 // thus singular @@ -1171,9 +1170,9 @@ Alpha_shape_2::update_alpha_shape_edges_list() const // and alpha is smaller than the upper boundary // which might be infinity // visualize the boundary - CGAL_triangulation_assertion((classify((*edge_alpha_it).second.first, - (*edge_alpha_it).second.second) - == REGULAR)); + CGAL_assertion((classify((*edge_alpha_it).second.first, + (*edge_alpha_it).second.second) + == REGULAR)); Alpha_shape_edges_list.push_back(Edge((*edge_alpha_it).second.first, (*edge_alpha_it).second.second)); } @@ -1191,7 +1190,7 @@ Alpha_shape_2::update_alpha_shape_edges_list() const if (pInterval->first == UNDEFINED) { - CGAL_triangulation_assertion(pInterval->second != Infinity); + CGAL_assertion(pInterval->second != Infinity); // since this happens only for convex hull of dimension 2 // thus singular @@ -1203,9 +1202,9 @@ Alpha_shape_2::update_alpha_shape_edges_list() const // and alpha is smaller than the upper boundary // which might be infinity // visualize the boundary - CGAL_triangulation_assertion((classify((*edge_alpha_it).second.first, - (*edge_alpha_it).second.second) - == REGULAR)); + CGAL_assertion((classify((*edge_alpha_it).second.first, + (*edge_alpha_it).second.second) + == REGULAR)); Alpha_shape_edges_list.push_back(Edge((*edge_alpha_it).second.first, (*edge_alpha_it).second.second)); } @@ -1219,12 +1218,12 @@ Alpha_shape_2::update_alpha_shape_edges_list() const // if alpha is smaller than the upper boundary // which might be infinity // visualize the boundary - CGAL_triangulation_assertion(((classify((*edge_alpha_it).second.first, - (*edge_alpha_it).second.second) - == REGULAR) - || (classify((*edge_alpha_it).second.first, + CGAL_assertion(((classify((*edge_alpha_it).second.first, (*edge_alpha_it).second.second) - == SINGULAR))); + == REGULAR) + || (classify((*edge_alpha_it).second.first, + (*edge_alpha_it).second.second) + == SINGULAR))); Alpha_shape_edges_list.push_back(Edge((*edge_alpha_it).second.first, (*edge_alpha_it).second.second)); } @@ -1324,7 +1323,7 @@ Alpha_shape_2::number_of_solid_components(const Type_of_alpha& alpha) c ++face_it) { Face_handle pFace = face_it; - CGAL_triangulation_postcondition( pFace != nullptr); + CGAL_postcondition( pFace != nullptr); if (classify(pFace, alpha) == INTERIOR){ Data& data = marked_face_set[pFace]; @@ -1358,7 +1357,7 @@ Alpha_shape_2::traverse(const Face_handle& pFace, for (int i=0; i<3; i++) { pNeighbor = fh->neighbor(i); - CGAL_triangulation_assertion(pNeighbor != nullptr); + CGAL_assertion(pNeighbor != nullptr); if (classify(pNeighbor, alpha) == INTERIOR){ Data& data = marked_face_set[pNeighbor]; if(data == false){ @@ -1514,7 +1513,7 @@ Alpha_shape_2::op_ostream(std::ostream& os) const // write the vertex v = (*vertex_alpha_it).second; - CGAL_triangulation_assertion((classify(v) == + CGAL_assertion((classify(v) == Alpha_shape_2::REGULAR)); // if we used Edelsbrunner and Muecke's definition // regular means incident to a higher-dimensional face @@ -1536,7 +1535,7 @@ Alpha_shape_2::op_ostream(std::ostream& os) const { pInterval = &(*edge_alpha_it).first; - CGAL_triangulation_assertion(pInterval->second != Infinity); + CGAL_assertion(pInterval->second != Infinity); // since this happens only for convex hull of dimension 1 // thus singular @@ -1563,11 +1562,11 @@ Alpha_shape_2::op_ostream(std::ostream& os) const f = pNeighbor; } - CGAL_triangulation_assertion((classify(f) == - Alpha_shape_2::INTERIOR)); + CGAL_assertion((classify(f) == + Alpha_shape_2::INTERIOR)); - CGAL_triangulation_assertion((classify(f, i) == - Alpha_shape_2::REGULAR)); + CGAL_assertion((classify(f, i) == + Alpha_shape_2::REGULAR)); os << V[f->vertex(f->ccw(i))] << ' ' << V[f->vertex(f->cw(i))] << std::endl; @@ -1595,8 +1594,7 @@ Alpha_shape_2::op_ostream(std::ostream& os) const // write the vertex v = (*vertex_alpha_it).second; - CGAL_triangulation_assertion((classify(v) == - Alpha_shape_2::REGULAR)); + CGAL_assertion((classify(v) == Alpha_shape_2::REGULAR)); V[v] = number_of_vertices++; os << v->point() << std::endl; } @@ -1608,8 +1606,7 @@ Alpha_shape_2::op_ostream(std::ostream& os) const ++vertex_alpha_it) { v = (*vertex_alpha_it).second; - CGAL_triangulation_assertion((classify(v) == - Alpha_shape_2::SINGULAR)); + CGAL_assertion((classify(v) == Alpha_shape_2::SINGULAR)); V[v] = number_of_vertices++; os << v->point() << std::endl; @@ -1652,7 +1649,7 @@ Alpha_shape_2::op_ostream(std::ostream& os) const if (pInterval->second != Infinity && pInterval->second <= get_alpha()) { - CGAL_triangulation_assertion((classify(f, i) == + CGAL_assertion((classify(f, i) == Alpha_shape_2::REGULAR)); // assure that all vertices are in ccw order if (classify(f) == Alpha_shape_2::EXTERIOR) @@ -1665,7 +1662,7 @@ Alpha_shape_2::op_ostream(std::ostream& os) const f = pNeighbor; } - CGAL_triangulation_assertion((classify(f) == + CGAL_assertion((classify(f) == Alpha_shape_2::INTERIOR)); os << V[f->vertex(f->ccw(i))] << ' ' @@ -1680,7 +1677,7 @@ Alpha_shape_2::op_ostream(std::ostream& os) const // write the singular edges if (pInterval->first != UNDEFINED) { - CGAL_triangulation_assertion((classify(f, i) == + CGAL_assertion((classify(f, i) == Alpha_shape_2::SINGULAR)); os << V[f->vertex(f->ccw(i))] << ' ' << V[f->vertex(f->cw(i))] << std::endl; @@ -1739,7 +1736,7 @@ Alpha_shape_2::Output () // which might be infinity // visualize the boundary - CGAL_triangulation_assertion((classify((*edge_alpha_it).second.first, + CGAL_assertion((classify((*edge_alpha_it).second.first, (*edge_alpha_it).second.second) == REGULAR)); @@ -1769,7 +1766,7 @@ Alpha_shape_2::Output () if (pInterval->first == UNDEFINED) { - CGAL_triangulation_assertion(pInterval->second != Infinity); + CGAL_assertion(pInterval->second != Infinity); // since this happens only for convex hull of dimension 1 // thus singular @@ -1782,9 +1779,9 @@ Alpha_shape_2::Output () // which might be infinity // visualize the boundary - CGAL_triangulation_assertion((classify((*edge_alpha_it).second.first, - (*edge_alpha_it).second.second) == - REGULAR)); + CGAL_assertion((classify((*edge_alpha_it).second.first, + (*edge_alpha_it).second.second) == + REGULAR)); L.push_back((this->segment((*edge_alpha_it).second.first, (*edge_alpha_it).second.second)) .source()); @@ -1802,12 +1799,12 @@ Alpha_shape_2::Output () // which might be infinity // visualize the boundary - CGAL_triangulation_assertion(((classify((*edge_alpha_it).second.first, - (*edge_alpha_it).second.second) == - REGULAR) || - (classify((*edge_alpha_it).second.first, - (*edge_alpha_it).second.second) == - SINGULAR))); + CGAL_assertion(((classify((*edge_alpha_it).second.first, + (*edge_alpha_it).second.second) == + REGULAR) || + (classify((*edge_alpha_it).second.first, + (*edge_alpha_it).second.second) == + SINGULAR))); L.push_back((this->segment((*edge_alpha_it).second.first, (*edge_alpha_it).second.second)) .source()); diff --git a/Alpha_shapes_3/include/CGAL/Alpha_shape_3.h b/Alpha_shapes_3/include/CGAL/Alpha_shape_3.h index a0a30b5a113..b7b8c2e18ba 100644 --- a/Alpha_shapes_3/include/CGAL/Alpha_shape_3.h +++ b/Alpha_shapes_3/include/CGAL/Alpha_shape_3.h @@ -401,7 +401,7 @@ public: // Returns the n-th alpha-value. // n < size() { - CGAL_triangulation_assertion( n > 0 && + CGAL_assertion( n > 0 && n <= static_cast(alpha_spectrum.size()) ); return alpha_spectrum[n-1]; } @@ -1713,7 +1713,7 @@ Alpha_shape_3::number_of_solid_components(const NT& alpha) const for( cell_it = finite_cells_begin(); cell_it != done; ++cell_it) { Cell_handle pCell = cell_it; - CGAL_triangulation_assertion(pCell != nullptr); + CGAL_assertion(pCell != nullptr); if (classify(pCell, alpha) == INTERIOR){ Data& data = marked_cell_set[pCell]; @@ -1745,7 +1745,7 @@ void Alpha_shape_3::traverse(Cell_handle pCell, for (int i=0; i<=3; i++) { pNeighbor = pCell->neighbor(i); - CGAL_triangulation_assertion(pNeighbor != nullptr); + CGAL_assertion(pNeighbor != nullptr); if (classify(pNeighbor, alpha) == INTERIOR){ Data& data = marked_cell_set[pNeighbor]; if(data == false){ diff --git a/Alpha_wrap_3/examples/Alpha_wrap_3/wrap_from_cavity.cpp b/Alpha_wrap_3/examples/Alpha_wrap_3/wrap_from_cavity.cpp index 91b95584f8c..2eb3f9c4155 100644 --- a/Alpha_wrap_3/examples/Alpha_wrap_3/wrap_from_cavity.cpp +++ b/Alpha_wrap_3/examples/Alpha_wrap_3/wrap_from_cavity.cpp @@ -47,16 +47,9 @@ int main(int argc, char** argv) const double offset = diag_length / relative_offset; // Construct the wrap - using Oracle = CGAL::Alpha_wraps_3::internal::Triangle_mesh_oracle; - Oracle oracle; - oracle.add_triangle_mesh(input); - CGAL::Real_timer t; t.start(); - Mesh wrap; - CGAL::Alpha_wraps_3::internal::Alpha_wrap_3 aw3(oracle); - // There is no limit on how many seeds can be used. // However, the algorithm automatically determines whether a seed can be used // to initialize the refinement based on a few conditions (distance to the offset, value of alpha, etc.) @@ -66,7 +59,8 @@ int main(int argc, char** argv) Point_3(0, 50, 0) // a point within the armadillo surface }; - aw3(alpha, offset, wrap, CGAL::parameters::seed_points(std::ref(seeds))); + Mesh wrap; + alpha_wrap_3(input, alpha, offset, wrap, CGAL::parameters::seed_points(std::ref(seeds))); t.stop(); std::cout << "Result: " << num_vertices(wrap) << " vertices, " << num_faces(wrap) << " faces" << std::endl; diff --git a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_3.h b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_3.h index e88e00fafe0..8e05d6929cf 100644 --- a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_3.h +++ b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_3.h @@ -29,7 +29,7 @@ #include -#include +#include #include #include #include @@ -229,11 +229,14 @@ private: } public: - template + template void operator()(const double alpha, // = default_alpha() const double offset, // = alpha / 30. OutputMesh& output_mesh, - const NamedParameters& np) + const InputNamedParameters& in_np = parameters::default_values(), + const OutputNamedParameters& out_np = parameters::default_values()) { namespace PMP = Polygon_mesh_processing; @@ -241,25 +244,25 @@ public: using parameters::get_parameter_reference; using parameters::choose_parameter; - using OVPM = typename CGAL::GetVertexPointMap::type; - OVPM ovpm = choose_parameter(get_parameter(np, internal_np::vertex_point), + using OVPM = typename CGAL::GetVertexPointMap::type; + OVPM ovpm = choose_parameter(get_parameter(out_np, internal_np::vertex_point), get_property_map(vertex_point, output_mesh)); typedef typename internal_np::Lookup_named_param_def < internal_np::visitor_t, - NamedParameters, + InputNamedParameters, Wrapping_default_visitor // default >::reference Visitor; Wrapping_default_visitor default_visitor; - Visitor visitor = choose_parameter(get_parameter_reference(np, internal_np::visitor), default_visitor); + Visitor visitor = choose_parameter(get_parameter_reference(in_np, internal_np::visitor), default_visitor); std::vector no_seeds; using Seeds = typename internal_np::Lookup_named_param_def< - internal_np::seed_points_t, NamedParameters, std::vector >::reference; - Seeds seeds = choose_parameter(get_parameter_reference(np, internal_np::seed_points), no_seeds); + internal_np::seed_points_t, InputNamedParameters, std::vector >::reference; + Seeds seeds = choose_parameter(get_parameter_reference(in_np, internal_np::seed_points), no_seeds); - const bool do_enforce_manifoldness = choose_parameter(get_parameter(np, internal_np::do_enforce_manifoldness), true); + const bool do_enforce_manifoldness = choose_parameter(get_parameter(in_np, internal_np::do_enforce_manifoldness), true); #ifdef CGAL_AW3_TIMER CGAL::Real_timer t; @@ -360,14 +363,6 @@ public: } // Convenience overloads - template - void operator()(const double alpha, - const double offset, - OutputMesh& output_mesh) - { - return operator()(alpha, offset, output_mesh, parameters::default_values()); - } - template void operator()(const double alpha, OutputMesh& output_mesh) diff --git a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_AABB_traits.h b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_AABB_geom_traits.h similarity index 96% rename from Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_AABB_traits.h rename to Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_AABB_geom_traits.h index 1a3fa7d8183..22c64e9b5e2 100644 --- a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_AABB_traits.h +++ b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Alpha_wrap_AABB_geom_traits.h @@ -13,8 +13,8 @@ // Andreas Fabri // Michael Hemmer // -#ifndef CGAL_ALPHA_WRAP_3_INTERNAL_ALPHA_WRAP_AABB_TRAITS_H -#define CGAL_ALPHA_WRAP_3_INTERNAL_ALPHA_WRAP_AABB_TRAITS_H +#ifndef CGAL_ALPHA_WRAP_3_INTERNAL_ALPHA_WRAP_AABB_GEOM_TRAITS_H +#define CGAL_ALPHA_WRAP_3_INTERNAL_ALPHA_WRAP_AABB_GEOM_TRAITS_H #include @@ -89,14 +89,14 @@ public: }; template -class Alpha_wrap_AABB_traits +class Alpha_wrap_AABB_geom_traits : public GT { public: using Ball_3 = internal::Ball_3; public: - Alpha_wrap_AABB_traits(const GT& gt = GT()) : GT(gt) { } + Alpha_wrap_AABB_geom_traits(const GT& gt = GT()) : GT(gt) { } public: class Construct_ball_3 @@ -295,4 +295,4 @@ public: } // namespace Alpha_wraps_3 } // namespace CGAL -#endif // CGAL_ALPHA_WRAP_3_INTERNAL_ALPHA_WRAP_AABB_TRAITS_H +#endif // CGAL_ALPHA_WRAP_3_INTERNAL_ALPHA_WRAP_AABB_GEOM_TRAITS_H diff --git a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Point_set_oracle.h b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Point_set_oracle.h index b27ffa0525a..7bad2ff313d 100644 --- a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Point_set_oracle.h +++ b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Point_set_oracle.h @@ -14,7 +14,7 @@ #include -#include +#include #include #include @@ -38,7 +38,7 @@ namespace internal { template struct PS_oracle_traits { - using Geom_traits = Alpha_wrap_AABB_traits; // Wrap the kernel to add Ball_3 + custom Do_intersect_3 + using Geom_traits = Alpha_wrap_AABB_geom_traits; // Wrap the kernel to add Ball_3 + custom Do_intersect_3 using Points = std::vector; using PR_iterator = typename Points::const_iterator; diff --git a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Segment_soup_oracle.h b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Segment_soup_oracle.h index a6a87f000ab..d02a9f9faaf 100644 --- a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Segment_soup_oracle.h +++ b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Segment_soup_oracle.h @@ -14,7 +14,7 @@ #include -#include +#include #include #include @@ -38,7 +38,7 @@ namespace internal { template struct SS_oracle_traits { - using Geom_traits = Alpha_wrap_AABB_traits; // Wrap the kernel to add Ball_3 + custom Do_intersect_3 + using Geom_traits = Alpha_wrap_AABB_geom_traits; // Wrap the kernel to add Ball_3 + custom Do_intersect_3 using Segments = std::vector; using SR_iterator = typename Segments::const_iterator; diff --git a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Triangle_mesh_oracle.h b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Triangle_mesh_oracle.h index f4e74da51e9..6d0f65142f6 100644 --- a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Triangle_mesh_oracle.h +++ b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Triangle_mesh_oracle.h @@ -14,7 +14,7 @@ #include -#include +#include #include #include @@ -37,7 +37,7 @@ namespace internal { template struct TM_oracle_traits { - using Geom_traits = Alpha_wrap_AABB_traits; // Wrap the kernel to add Ball_3 + custom Do_intersect_3 + using Geom_traits = Alpha_wrap_AABB_geom_traits; // Wrap the kernel to add Ball_3 + custom Do_intersect_3 using Point_3 = typename Geom_traits::Point_3; using AABB_traits = typename AABB_tree_splitter_traits::AABB_traits; diff --git a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Triangle_soup_oracle.h b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Triangle_soup_oracle.h index 81fed3d58df..57f936306da 100644 --- a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Triangle_soup_oracle.h +++ b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/Triangle_soup_oracle.h @@ -14,7 +14,7 @@ #include -#include +#include #include #include @@ -38,7 +38,7 @@ namespace internal { template struct TS_oracle_traits { - using Geom_traits = Alpha_wrap_AABB_traits; // Wrap the kernel to add Ball_3 + custom Do_intersect_3 + using Geom_traits = Alpha_wrap_AABB_geom_traits; // Wrap the kernel to add Ball_3 + custom Do_intersect_3 using Point_3 = typename Geom_traits::Point_3; using AABB_traits = typename AABB_tree_splitter_traits::AABB_traits; using AABB_tree = typename AABB_tree_splitter_traits::AABB_tree; diff --git a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/oracles.h b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/oracles.h index 77a4ca313c0..509a9efe7e2 100644 --- a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/oracles.h +++ b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/oracles.h @@ -14,7 +14,7 @@ #include -#include +#include #include #include diff --git a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/splitting_helper.h b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/splitting_helper.h index 1e06b7ff30e..4b146e95d8f 100644 --- a/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/splitting_helper.h +++ b/Alpha_wrap_3/include/CGAL/Alpha_wrap_3/internal/splitting_helper.h @@ -14,7 +14,7 @@ #include -#include +#include #include #include diff --git a/Alpha_wrap_3/include/CGAL/alpha_wrap_3.h b/Alpha_wrap_3/include/CGAL/alpha_wrap_3.h index 13cf90f2df8..638c5fb9fa1 100644 --- a/Alpha_wrap_3/include/CGAL/alpha_wrap_3.h +++ b/Alpha_wrap_3/include/CGAL/alpha_wrap_3.h @@ -112,7 +112,7 @@ void alpha_wrap_3(const PointRange& points, Oracle oracle(alpha, gt); oracle.add_triangle_soup(points, faces, in_np); AW3 alpha_wrap_builder(oracle); - alpha_wrap_builder(alpha, offset, alpha_wrap, out_np); + alpha_wrap_builder(alpha, offset, alpha_wrap, in_np, out_np); } // Convenience overloads @@ -261,7 +261,7 @@ void alpha_wrap_3(const TriangleMesh& tmesh, Oracle oracle(alpha, gt); oracle.add_triangle_mesh(tmesh, in_np); AW3 alpha_wrap_builder(oracle); - alpha_wrap_builder(alpha, offset, alpha_wrap, out_np); + alpha_wrap_builder(alpha, offset, alpha_wrap, in_np, out_np); } // The convenience overloads are the same for triangle mesh & point set @@ -357,7 +357,7 @@ void alpha_wrap_3(const PointRange& points, Oracle oracle(gt); oracle.add_point_set(points, in_np); AW3 alpha_wrap_builder(oracle); - alpha_wrap_builder(alpha, offset, alpha_wrap, out_np); + alpha_wrap_builder(alpha, offset, alpha_wrap, in_np, out_np); } // Convenience overloads, common to both mesh and point set diff --git a/Alpha_wrap_3/test/Alpha_wrap_3/test_AW3_manifoldness.cpp b/Alpha_wrap_3/test/Alpha_wrap_3/test_AW3_manifoldness.cpp index 928cade6495..638431e3056 100644 --- a/Alpha_wrap_3/test/Alpha_wrap_3/test_AW3_manifoldness.cpp +++ b/Alpha_wrap_3/test/Alpha_wrap_3/test_AW3_manifoldness.cpp @@ -45,7 +45,6 @@ void alpha_wrap_triangle_manifoldness(Mesh& input_mesh, Mesh nm_wrap; CGAL::alpha_wrap_3(input_mesh, alpha, offset, nm_wrap, - CGAL::parameters::default_values(), CGAL::parameters::do_enforce_manifoldness(false)); std::cout << "Result: " << vertices(nm_wrap).size() << " vertices, " << faces(nm_wrap).size() << " faces" << std::endl; @@ -67,7 +66,6 @@ void alpha_wrap_triangle_manifoldness(Mesh& input_mesh, Mesh m_wrap; CGAL::alpha_wrap_3(input_mesh, alpha, offset, m_wrap, - CGAL::parameters::default_values(), CGAL::parameters::do_enforce_manifoldness(true)); // CGAL::IO::write_polygon_mesh("last.off", wrap, CGAL::parameters::stream_precision(17)); diff --git a/Alpha_wrap_3/test/Alpha_wrap_3/test_alpha_wrap_3_mesh.cpp b/Alpha_wrap_3/test/Alpha_wrap_3/test_alpha_wrap_3_mesh.cpp index 5091934b62f..470d48e40d4 100644 --- a/Alpha_wrap_3/test/Alpha_wrap_3/test_alpha_wrap_3_mesh.cpp +++ b/Alpha_wrap_3/test/Alpha_wrap_3/test_alpha_wrap_3_mesh.cpp @@ -47,7 +47,6 @@ void alpha_wrap_triangle_mesh(Mesh& input_mesh, Mesh wrap; CGAL::alpha_wrap_3(input_mesh, alpha, offset, wrap, - CGAL::parameters::default_values(), CGAL::parameters::do_enforce_manifoldness(enforce_manifoldness)); std::cout << "Result: " << vertices(wrap).size() << " vertices, " << faces(wrap).size() << " faces" << std::endl; diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Apollonius_graph_2_impl.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Apollonius_graph_2_impl.h index e5988f9f77b..e9e6ee7d472 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Apollonius_graph_2_impl.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Apollonius_graph_2_impl.h @@ -53,7 +53,7 @@ is_valid(bool verbose, int level) const if (number_of_vertices() < 3) return true; - // CGAL_triangulation_assertion(result); + // CGAL_assertion(result); for (All_edges_iterator eit = all_edges_begin(); eit != all_edges_end(); ++eit) { @@ -64,7 +64,7 @@ is_valid(bool verbose, int level) const if ( !is_infinite(v) ) { result = result && ( incircle(f, v->site()) != NEGATIVE ); - // CGAL_triangulation_assertion(result); + // CGAL_assertion(result); } Edge sym_e = sym_edge(e); f = sym_e.first; @@ -72,7 +72,7 @@ is_valid(bool verbose, int level) const if ( !is_infinite(v) ) { result = result && ( incircle(f, v->site()) != NEGATIVE ); - // CGAL_triangulation_assertion(result); + // CGAL_assertion(result); } } @@ -83,7 +83,7 @@ is_valid(bool verbose, int level) const std::cerr << "Apollonius diagram is NOT valid..." << std::flush; } - // CGAL_triangulation_assertion(result); + // CGAL_assertion(result); return result; } @@ -100,7 +100,7 @@ typename Apollonius_graph_2::Point_2 Apollonius_graph_2:: circumcenter(const Face_handle& f) const { - CGAL_triangulation_precondition (dimension()==2 || !is_infinite(f)); + CGAL_precondition (dimension()==2 || !is_infinite(f)); return circumcenter(f->vertex(0)->site(), f->vertex(1)->site(), f->vertex(2)->site()); @@ -122,7 +122,7 @@ typename Apollonius_graph_2::Site_2 Apollonius_graph_2:: circumcircle(const Face_handle& f) const { - CGAL_triangulation_precondition (dimension()==2 || !is_infinite(f)); + CGAL_precondition (dimension()==2 || !is_infinite(f)); return circumcircle(f->vertex(0)->site(), f->vertex(1)->site(), f->vertex(2)->site()); @@ -178,7 +178,7 @@ typename Gt::Object_2 Apollonius_graph_2:: dual(const Edge e) const { - CGAL_triangulation_precondition( !is_infinite(e) ); + CGAL_precondition( !is_infinite(e) ); if ( dimension() == 1 ) { Site_2 p = (e.first)->vertex(cw(e.second))->site(); @@ -207,16 +207,16 @@ dual(const Edge e) const } // only one of the adjacent faces is infinite - CGAL_triangulation_assertion( is_infinite( e.first ) || + CGAL_assertion( is_infinite( e.first ) || is_infinite( e.first->neighbor(e.second) ) ); - CGAL_triangulation_assertion( !(is_infinite( e.first ) && + CGAL_assertion( !(is_infinite( e.first ) && is_infinite( e.first->neighbor(e.second) ) ) ); - CGAL_triangulation_assertion + CGAL_assertion ( is_infinite( e.first->vertex(e.second) ) || is_infinite( tds().mirror_vertex(e.first, e.second) ) ); @@ -246,7 +246,7 @@ primal(const Edge e) const // typedef typename Geom_traits::Hyperbola_segment_2 Hyperbola_segment; // typedef typename Geom_traits::Parabola_segment_2 Parabola_segment; - // CGAL_triangulation_precondition( !is_infinite(e) ); + // CGAL_precondition( !is_infinite(e) ); if ( number_of_vertices() != 2 ) { if ( is_infinite(e) ) { @@ -257,7 +257,7 @@ primal(const Edge e) const Site_2 s = tds().mirror_vertex( e.first, e.second )->site(); ray = construct_Apollonius_primal_ray_2_object()(p,r,s); } else { - CGAL_triangulation_assertion + CGAL_assertion ( is_infinite( e.first->vertex(ccw(e.second)) ) ); Site_2 q = e.first->vertex( cw(e.second) )->site(); Site_2 r = e.first->vertex( e.second )->site(); @@ -317,11 +317,11 @@ typename Apollonius_graph_2::Edge Apollonius_graph_2:: flip(Face_handle& f, int i) { - CGAL_triangulation_precondition ( f != Face_handle() ); - CGAL_triangulation_precondition (i == 0 || i == 1 || i == 2); - CGAL_triangulation_precondition( dimension()==2 ); + CGAL_precondition ( f != Face_handle() ); + CGAL_precondition (i == 0 || i == 1 || i == 2); + CGAL_precondition( dimension()==2 ); - CGAL_triangulation_precondition( f->vertex(i) != tds().mirror_vertex(f,i) ); + CGAL_precondition( f->vertex(i) != tds().mirror_vertex(f,i) ); this->_tds.flip(f, i); @@ -383,7 +383,7 @@ void Apollonius_graph_2:: remove_degree_2(Vertex_handle v) { - CGAL_triangulation_precondition( is_degree_2(v) ); + CGAL_precondition( is_degree_2(v) ); this->_tds.remove_degree_2( v ); } @@ -403,7 +403,7 @@ void Apollonius_graph_2:: remove_degree_3(Vertex_handle v, Face_handle f) { - CGAL_triangulation_precondition( degree(v) == 3 ); + CGAL_precondition( degree(v) == 3 ); this->_tds.remove_degree_3(v, f); } @@ -416,7 +416,7 @@ typename Apollonius_graph_2::Vertex_handle Apollonius_graph_2:: insert_first(const Site_2& p) { - CGAL_triangulation_precondition(number_of_vertices() == 0); + CGAL_precondition(number_of_vertices() == 0); Vertex_handle v = this->_tds.insert_second(); v->set_site(p); return v; @@ -428,7 +428,7 @@ typename Apollonius_graph_2::Vertex_handle Apollonius_graph_2:: insert_second(const Site_2& p) { - CGAL_triangulation_precondition( number_of_vertices() == 1 ); + CGAL_precondition( number_of_vertices() == 1 ); Vertex_handle vnew; Vertex_handle v(finite_vertices_begin()); if ( is_hidden(v->site(), p) ) { @@ -439,7 +439,7 @@ insert_second(const Site_2& p) v->set_site(p); vnew = v; } else { - CGAL_triangulation_precondition(number_of_vertices() == 1); + CGAL_precondition(number_of_vertices() == 1); vnew = this->_tds.insert_dim_up(infinite_vertex(), true); vnew->set_site(p); // vnew = Delaunay_graph::insert_second(p); @@ -453,7 +453,7 @@ typename Apollonius_graph_2::Vertex_handle Apollonius_graph_2:: insert_third(const Site_2& p) { - CGAL_triangulation_precondition( number_of_vertices() == 2 ); + CGAL_precondition( number_of_vertices() == 2 ); Face_handle f((*finite_edges_begin()).first); Vertex_handle v1(f->vertex(0)); @@ -592,7 +592,7 @@ insert_third(const Site_2& p) } } - // CGAL_triangulation_assertion( is_valid() ); + // CGAL_assertion( is_valid() ); return v; } @@ -1752,8 +1752,8 @@ void Apollonius_graph_2:: remove(Vertex_handle v) { - CGAL_triangulation_precondition( v != Vertex_handle() ); - CGAL_triangulation_precondition( !is_infinite(v) ); + CGAL_precondition( v != Vertex_handle() ); + CGAL_precondition( !is_infinite(v) ); // find a neighbor of v to use for point location of hidden sites to // be re-inserted @@ -1900,7 +1900,7 @@ remove_degree_d_vertex(Vertex_handle v) CGAL_assertion( found ); CGAL_USE(found); } - CGAL_triangulation_precondition( degree(v) == 3 ); + CGAL_precondition( degree(v) == 3 ); this->_tds.remove_degree_3( v, Face_handle() ); diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Apollonius_graph_hierarchy_2_impl.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Apollonius_graph_hierarchy_2_impl.h index ba13844eb0e..a5369929afe 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Apollonius_graph_hierarchy_2_impl.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Apollonius_graph_hierarchy_2_impl.h @@ -332,8 +332,8 @@ void Apollonius_graph_hierarchy_2:: remove(Vertex_handle v) { - CGAL_triangulation_precondition( v != Vertex_handle()); - CGAL_triangulation_precondition( !is_infinite(v)); + CGAL_precondition( v != Vertex_handle()); + CGAL_precondition( !is_infinite(v)); // get the hidden circles typename Apollonius_graph_base::Site_list wp_list; diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_vertex_base_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_vertex_base_2.h index c16c2f1903f..a1f6fc7158d 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_vertex_base_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_vertex_base_2.h @@ -19,7 +19,6 @@ #include #include -#include namespace CGAL { diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementPainterOstream.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementPainterOstream.cpp index bdc2c17f627..b470946cec0 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementPainterOstream.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementPainterOstream.cpp @@ -48,12 +48,10 @@ ArrangementPainterOstream>& ArrangementPainterOstream>:: operator<<(const X_monotone_curve_2& curve) { - int cnt = 0; for (typename X_monotone_curve_2::Subcurve_const_iterator it = curve.subcurves_begin(); it != curve.subcurves_end(); ++it) { - cnt++; this->painterOstream << *it; } @@ -200,7 +198,6 @@ ArrangementPainterOstreamfirst, p_curr->second); @@ -208,7 +205,6 @@ ArrangementPainterOstreamqp->drawLine(p1, p2); p_curr++; p_next++; - ++count; } while (p_next != end_pts); }; diff --git a/BGL/include/CGAL/boost/graph/Euler_operations.h b/BGL/include/CGAL/boost/graph/Euler_operations.h index ca9adb2d294..30d481f8cdf 100644 --- a/BGL/include/CGAL/boost/graph/Euler_operations.h +++ b/BGL/include/CGAL/boost/graph/Euler_operations.h @@ -38,11 +38,12 @@ typename boost::graph_traits::halfedge_descriptor join_face(typename boost::graph_traits::halfedge_descriptor h, Graph& g) { - typedef typename boost::graph_traits Traits; + typedef typename boost::graph_traits Traits; typedef typename Traits::halfedge_descriptor halfedge_descriptor; typedef typename Traits::face_descriptor face_descriptor; + CGAL_precondition(is_valid_halfedge_descriptor(h, g)); halfedge_descriptor hop = opposite(h,g); halfedge_descriptor hprev = prev(h, g), gprev = prev(hop, g); @@ -73,17 +74,17 @@ join_face(typename boost::graph_traits::halfedge_descriptor h, remove_edge(edge(h, g), g); return hprev; - } + } // namespace EulerImpl /// \endcond - namespace Euler { +namespace Euler { + /// \ingroup PkgBGLEulerOperations /// @{ - /** * joins the two vertices incident to `h`, (that is `source(h, g)` and * `target(h, g)`) and removes `source(h,g)`. Returns the predecessor @@ -117,6 +118,8 @@ join_vertex(typename boost::graph_traits::halfedge_descriptor h, typedef typename Traits::vertex_descriptor vertex_descriptor; typedef Halfedge_around_target_iterator halfedge_around_vertex_iterator; + CGAL_precondition(is_valid_halfedge_descriptor(h, g)); + halfedge_descriptor hop = opposite(h, g) , hprev = prev(hop, g) , gprev = prev(h, g) @@ -191,8 +194,9 @@ split_vertex(typename boost::graph_traits::halfedge_descriptor h1, typename boost::graph_traits::halfedge_descriptor h2, Graph& g) { - CGAL_assertion(h1 != h2); - CGAL_assertion(target(h1, g) == target(h2, g)); + CGAL_precondition(is_valid_halfedge_descriptor(h1, g) && is_valid_halfedge_descriptor(h2, g)); + CGAL_precondition(h1 != h2); + CGAL_precondition(target(h1, g) == target(h2, g)); typename boost::graph_traits::halfedge_descriptor hnew = halfedge(add_edge(g), g), @@ -226,8 +230,11 @@ split_vertex(typename boost::graph_traits::halfedge_descriptor h1, template typename boost::graph_traits::halfedge_descriptor split_edge(typename boost::graph_traits::halfedge_descriptor h, Graph& g) -{ return opposite(split_vertex(prev(h,g), opposite(h,g),g), g); } +{ + CGAL_precondition(is_valid_halfedge_descriptor(h, g)); + return opposite(split_vertex(prev(h,g), opposite(h,g),g), g); +} /** * joins the two faces incident to `h` and `opposite(h,g)`. @@ -260,8 +267,6 @@ join_face(typename boost::graph_traits::halfedge_descriptor h, return EulerImpl::join_face(h,g); } - - /** * splits the face incident to `h1` and `h2`. Creates the opposite * halfedges `h3` and `h4`, such that `next(h1,g) == h3` and `next(h2,g) == h4`. @@ -290,6 +295,12 @@ split_face(typename boost::graph_traits::halfedge_descriptor h1, typedef typename boost::graph_traits Traits; typedef typename Traits::halfedge_descriptor halfedge_descriptor; typedef typename Traits::face_descriptor face_descriptor; + + CGAL_precondition(is_valid_halfedge_descriptor(h1, g) && is_valid_halfedge_descriptor(h2, g)); + CGAL_precondition(h1 != h2); + CGAL_precondition(face(h1, g) == face(h2, g)); + CGAL_precondition(next(h1, g) != h2 && next(h2, g) != h1); + halfedge_descriptor hnew = halfedge(add_edge(g), g); face_descriptor fnew = add_face(g); internal::insert_tip( hnew, h2, g); @@ -298,6 +309,7 @@ split_face(typename boost::graph_traits::halfedge_descriptor h1, internal::set_face_in_face_loop(opposite(hnew,g), fnew, g); set_halfedge(face(hnew,g), hnew, g); set_halfedge(face(opposite(hnew,g),g), opposite(hnew,g), g); + return hnew; } @@ -327,7 +339,9 @@ join_loop(typename boost::graph_traits::halfedge_descriptor h1, typedef typename boost::graph_traits Traits; typedef typename Traits::halfedge_descriptor halfedge_descriptor; + CGAL_precondition(is_valid_halfedge_descriptor(h1, g) && is_valid_halfedge_descriptor(h2, g)); CGAL_precondition( is_border(h1,g) || face(h1, g) != face(h2, g)); + if (! is_border(h1,g)) remove_face(face(h1, g), g); if (! is_border(h2,g)) @@ -401,13 +415,18 @@ split_loop(typename boost::graph_traits::halfedge_descriptor h1, typedef typename Traits::halfedge_descriptor halfedge_descriptor; typedef typename Traits::face_descriptor face_descriptor; + CGAL_precondition(is_valid_halfedge_descriptor(h1, g) && + is_valid_halfedge_descriptor(h2, g) && + is_valid_halfedge_descriptor(h3, g)); + halfedge_descriptor h = h1, i = h2, j = h3; - CGAL_precondition( h != i); - CGAL_precondition( h != j); - CGAL_precondition( i != j); - CGAL_precondition( target(h,g) == target(opposite(i,g),g)); - CGAL_precondition( target(i,g) == target(opposite(j,g),g)); - CGAL_precondition( target(j,g) == target(opposite(h,g),g)); + CGAL_precondition(h != i); + CGAL_precondition(h != j); + CGAL_precondition(i != j); + CGAL_precondition(target(h,g) == target(opposite(i,g),g)); + CGAL_precondition(target(i,g) == target(opposite(j,g),g)); + CGAL_precondition(target(j,g) == target(opposite(h,g),g)); + // Create a copy of the triangle. halfedge_descriptor hnew = internal::copy(h,g); halfedge_descriptor inew = internal::copy(i,g); @@ -505,7 +524,9 @@ void remove_face(typename boost::graph_traits::halfedge_descriptor h, typedef typename Traits::halfedge_descriptor halfedge_descriptor; typedef typename Traits::face_descriptor face_descriptor; + CGAL_precondition(is_valid_halfedge_descriptor(h, g)); CGAL_precondition(! is_border(h,g)); + face_descriptor f = face(h, g); halfedge_descriptor end = h; @@ -551,13 +572,15 @@ add_edge(typename boost::graph_traits::vertex_descriptor s, typename boost::graph_traits::vertex_descriptor t, Graph& g) { + CGAL_precondition(is_valid_vertex_descriptor(s, g) && is_valid_vertex_descriptor(t, g)); + typename boost::graph_traits::edge_descriptor e = add_edge(g); set_target(halfedge(e, g), t, g); set_target(opposite(halfedge(e, g), g), s, g); + return e; } - /** * checks whether a new face defined by a range of vertices (identified by their descriptors, * `boost::graph_traits::%vertex_descriptor`) can be added. @@ -568,6 +591,9 @@ bool can_add_face(const VertexRange& vrange, const PMesh& sm) typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + CGAL_precondition_code(for(vertex_descriptor v : vrange)) + CGAL_precondition(is_valid_vertex_descriptor(v, sm)); + std::vector::vertex_descriptor> face(vrange.begin(), vrange.end()); std::size_t N = face.size(); @@ -697,6 +723,9 @@ add_face(const VertexRange& vr, Graph& g) typedef typename boost::graph_traits::face_descriptor face_descriptor; typedef typename boost::graph_traits::edge_descriptor edge_descriptor; + CGAL_precondition_code(for(vertex_descriptor v : vr)) + CGAL_precondition(is_valid_vertex_descriptor(v, g)); + std::vector vertices(vr.begin(), vr.end()); // quick and dirty copy unsigned int n = (unsigned int)vertices.size(); //check that every vertex is unique @@ -1115,7 +1144,9 @@ void make_hole(typename boost::graph_traits::halfedge_descriptor h, typedef typename Traits::face_descriptor face_descriptor; typedef Halfedge_around_face_iterator halfedge_around_face_iterator; - CGAL_precondition(! is_border(h,g)); + CGAL_precondition(is_valid_halfedge_descriptor(h, g)); + CGAL_precondition(!is_border(h, g)); + face_descriptor fd = face(h, g); halfedge_around_face_iterator hafib, hafie; for(boost::tie(hafib, hafie) = halfedges_around_face(h, g); @@ -1139,6 +1170,9 @@ void fill_hole(typename boost::graph_traits::halfedge_descriptor h, typedef typename Traits::face_descriptor face_descriptor; typedef typename Traits::halfedge_descriptor halfedge_descriptor; + CGAL_precondition(is_valid_halfedge_descriptor(h, g)); + CGAL_precondition(is_border(h, g)); + face_descriptor f = add_face(g); for(halfedge_descriptor hd : halfedges_around_face(h,g)){ set_face(hd, f,g); @@ -1179,6 +1213,9 @@ add_center_vertex(typename boost::graph_traits::halfedge_descriptor h, typedef typename Traits::halfedge_descriptor halfedge_descriptor; typedef typename Traits::face_descriptor face_descriptor; + CGAL_precondition(is_valid_halfedge_descriptor(h, g)); + CGAL_precondition(!is_border(h, g)); + halfedge_descriptor hnew = halfedge(add_edge(g),g); vertex_descriptor vnew = add_vertex(g); internal::close_tip(hnew, vnew, g); @@ -1236,6 +1273,8 @@ remove_center_vertex(typename boost::graph_traits::halfedge_descriptor h, typedef typename boost::graph_traits Traits; typedef typename Traits::halfedge_descriptor halfedge_descriptor; + CGAL_precondition(is_valid_halfedge_descriptor(h, g)); + // h points to the vertex that gets removed halfedge_descriptor h2 = opposite(next(h, g), g); halfedge_descriptor hret = prev(h, g); @@ -1283,14 +1322,28 @@ add_vertex_and_face_to_border(typename boost::graph_traits::halfedge_desc typename boost::graph_traits::halfedge_descriptor h2, Graph& g) { - typename boost::graph_traits::vertex_descriptor v = add_vertex(g); - typename boost::graph_traits::face_descriptor f = add_face(g); - typename boost::graph_traits::edge_descriptor e1 = add_edge(g); - typename boost::graph_traits::edge_descriptor e2 = add_edge(g); - typename boost::graph_traits::halfedge_descriptor he1= halfedge(e1, g); - typename boost::graph_traits::halfedge_descriptor he2= halfedge(e2, g); - typename boost::graph_traits::halfedge_descriptor ohe1= opposite(he1, g); - typename boost::graph_traits::halfedge_descriptor ohe2= opposite(he2, g); + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + typedef typename boost::graph_traits::edge_descriptor edge_descriptor; + typedef typename boost::graph_traits::face_descriptor face_descriptor; + + CGAL_precondition(is_valid_halfedge_descriptor(h1, g) && is_valid_halfedge_descriptor(h2, g)); + CGAL_precondition(is_border(h1, g) && is_border(h2, g)); + CGAL_precondition(h1 != h2); + + CGAL_precondition_code(halfedge_descriptor h = h1;) + CGAL_precondition_code(const halfedge_descriptor done = h1;) + CGAL_precondition_code(do { if(h == h2) break; h = next(h, g); } while(h != done);) + CGAL_precondition(h != done); + + vertex_descriptor v = add_vertex(g); + face_descriptor f = add_face(g); + edge_descriptor e1 = add_edge(g); + edge_descriptor e2 = add_edge(g); + halfedge_descriptor he1 = halfedge(e1, g); + halfedge_descriptor he2 = halfedge(e2, g); + halfedge_descriptor ohe1= opposite(he1, g); + halfedge_descriptor ohe2= opposite(he2, g); set_next(ohe1, next(h1,g),g); set_next(h1,he1,g); @@ -1340,6 +1393,7 @@ add_face_to_border(typename boost::graph_traits::halfedge_descriptor h1, typename boost::graph_traits::halfedge_descriptor h2, Graph& g) { + CGAL_precondition(is_valid_halfedge_descriptor(h1, g) && is_valid_halfedge_descriptor(h2, g)); CGAL_precondition(is_border(h1,g) == true); CGAL_precondition(is_border(h2,g) == true); CGAL_precondition(h1 != h2); @@ -1409,6 +1463,8 @@ collapse_edge(typename boost::graph_traits::edge_descriptor e, typedef typename Traits::vertex_descriptor vertex_descriptor; typedef typename Traits::halfedge_descriptor halfedge_descriptor; + CGAL_precondition(is_valid_edge_descriptor(e, g)); + halfedge_descriptor pq = halfedge(e,g); halfedge_descriptor qp = opposite(pq, g); halfedge_descriptor pt = opposite(prev(pq, g), g); @@ -1520,15 +1576,17 @@ collapse_edge(typename boost::graph_traits::edge_descriptor e, template typename boost::graph_traits::vertex_descriptor collapse_edge(typename boost::graph_traits::edge_descriptor v0v1, - Graph& g - , EdgeIsConstrainedMap Edge_is_constrained_map) + Graph& g, + EdgeIsConstrainedMap Edge_is_constrained_map) { typedef boost::graph_traits< Graph > Traits; typedef typename Traits::vertex_descriptor vertex_descriptor; typedef typename Traits::halfedge_descriptor halfedge_descriptor; + CGAL_precondition(is_valid_edge_descriptor(v0v1, g)); + CGAL_precondition(!get(Edge_is_constrained_map, v0v1)); + halfedge_descriptor pq = halfedge(v0v1,g); - CGAL_assertion( !get(Edge_is_constrained_map,v0v1) ); halfedge_descriptor qp = opposite(pq,g); halfedge_descriptor pt = opposite(prev(pq,g),g); @@ -1666,6 +1724,8 @@ flip_edge(typename boost::graph_traits::halfedge_descriptor h, typedef typename Traits::halfedge_descriptor halfedge_descriptor; typedef typename Traits::face_descriptor face_descriptor; + CGAL_precondition(is_valid_halfedge_descriptor(h, g)); + vertex_descriptor s = source(h,g); vertex_descriptor t = target(h,g); halfedge_descriptor nh = next(h,g), nnh = next(nh,g), oh = opposite(h,g), noh = next(oh,g), nnoh = next(noh,g); @@ -1706,6 +1766,8 @@ does_satisfy_link_condition(typename boost::graph_traits::edge_descriptor typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef CGAL::Halfedge_around_source_iterator out_edge_iterator; + CGAL_precondition(is_valid_edge_descriptor(e, g)); + halfedge_descriptor v0_v1 = halfedge(e,g); halfedge_descriptor v1_v0 = opposite(v0_v1,g); @@ -1798,9 +1860,8 @@ does_satisfy_link_condition(typename boost::graph_traits::edge_descriptor #ifndef CGAL_NO_DEPRECATED_CODE /// \cond SKIP_IN_MANUAL template -bool - satisfies_link_condition(typename boost::graph_traits::edge_descriptor e, - const Graph& g) +bool satisfies_link_condition(typename boost::graph_traits::edge_descriptor e, + const Graph& g) { return does_satisfy_link_condition(e, g); } @@ -1808,9 +1869,8 @@ bool #endif /// @} -} // CGAL - -} // CGAL +} // namespace Euler +} // namespace CGAL #endif /* CGAL_EULER_OPERATIONS_H */ diff --git a/BGL/include/CGAL/boost/graph/IO/Tds_2_off.h b/BGL/include/CGAL/boost/graph/IO/Tds_2_off.h index 7f7d663daa4..1f893ffb43c 100644 --- a/BGL/include/CGAL/boost/graph/IO/Tds_2_off.h +++ b/BGL/include/CGAL/boost/graph/IO/Tds_2_off.h @@ -109,7 +109,7 @@ off_file_input( std::istream& is, Triangulation_data_structure_2& tds, bo tds.set_adjacency(fn, 2, inf_edge_map); edge_map.erase(edge_map.begin()); } - CGAL_triangulation_assertion(inf_edge_map.empty()); + CGAL_assertion(inf_edge_map.empty()); } diff --git a/BGL/include/CGAL/boost/graph/generators.h b/BGL/include/CGAL/boost/graph/generators.h index d49a53fd814..a4e91f177fb 100644 --- a/BGL/include/CGAL/boost/graph/generators.h +++ b/BGL/include/CGAL/boost/graph/generators.h @@ -195,6 +195,11 @@ make_quad(typename boost::graph_traits::vertex_descriptor v0, typename boost::graph_traits::vertex_descriptor v3, Graph& g) { + CGAL_precondition(is_valid_vertex_descriptor(v0, g) && + is_valid_vertex_descriptor(v1, g) && + is_valid_vertex_descriptor(v2, g) && + is_valid_vertex_descriptor(v3, g)); + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::face_descriptor face_descriptor; halfedge_descriptor h0 = halfedge(add_edge(g), g); diff --git a/BGL/include/CGAL/boost/graph/helpers.h b/BGL/include/CGAL/boost/graph/helpers.h index 0448870f6ed..21644ebf18f 100644 --- a/BGL/include/CGAL/boost/graph/helpers.h +++ b/BGL/include/CGAL/boost/graph/helpers.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -22,7 +23,6 @@ #include - namespace CGAL { /*! @@ -75,277 +75,244 @@ is_border(typename boost::graph_traits::vertex_descriptor vd, return boost::optional::halfedge_descriptor>(); } +namespace BGL { - /*! - \ingroup PkgBGLHelperFct - returns `true` if there are no border edges. - */ -template -bool is_closed(const FaceGraph& g) +template +bool is_valid_vertex_descriptor(typename boost::graph_traits::vertex_descriptor v, + const Graph& g, + const bool verb = false) { - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - for(halfedge_descriptor hd : halfedges(g)){ - if(is_border(hd,g)){ - return false; - } - } - return true; -} + Verbose_ostream verr(verb); + bool valid = true; - /*! - \ingroup PkgBGLHelperFct - returns `true` if the target of `hd` has exactly two incident edges. - */ -template -bool is_bivalent(typename boost::graph_traits::halfedge_descriptor hd, const FaceGraph& g) -{ - return hd == opposite(next(opposite(next(hd,g),g),g),g); -} - - /*! - \ingroup PkgBGLHelperFct - returns `true` if all vertices have exactly two incident edges. - */ -template - bool is_bivalent_mesh(const FaceGraph& g) -{ - typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - for(vertex_descriptor vd : vertices(g)){ - halfedge_descriptor hd = halfedge(vd,g); - if((hd == boost::graph_traits::null_halfedge()) || - (! is_bivalent(hd,g))){ - return false; - } - } - return true; -} - - /*! - \ingroup PkgBGLHelperFct - returns `true` if the target of `hd` has exactly three incident edges. - */ -template -bool is_trivalent(typename boost::graph_traits::halfedge_descriptor hd, const FaceGraph& g) -{ - return hd == opposite(next(opposite(next(opposite(next(hd,g),g),g),g),g),g); -} - - /*! - \ingroup PkgBGLHelperFct - returns `true` if all - vertices have exactly three incident edges. - */ -template - bool is_trivalent_mesh(const FaceGraph& g) -{ - typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - for(vertex_descriptor vd : vertices(g)){ - halfedge_descriptor hd = halfedge(vd,g); - if((hd == boost::graph_traits::null_halfedge()) || - (! is_trivalent(halfedge(hd,g),g))){ - return false; - } - } - return true; -} - - /*! - \ingroup PkgBGLHelperFct - returns `true` iff the connected component denoted by `hd` is a triangle. - \pre `g` must be valid. - */ -template - bool is_isolated_triangle(typename boost::graph_traits::halfedge_descriptor hd, const FaceGraph& g) -{ - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - halfedge_descriptor beg = hd; - if(is_border(hd,g)) return false; - for(int i=0; i<3;i++){ - if(! is_border(opposite(hd,g),g)) return false; - hd = next(hd,g); - } - return hd == beg; -} - - /*! - \ingroup PkgBGLHelperFct - returns `true` iff the face denoted by `hd` is a triangle, that is it has three incident halfedges. - */ -template -bool is_triangle(typename boost::graph_traits::halfedge_descriptor hd, const FaceGraph& g) -{ - return hd == next(next(next(hd,g),g),g); -} - - /*! - \ingroup PkgBGLHelperFct - returns `true` if all faces are triangles. - */ -template - bool is_triangle_mesh(const FaceGraph& g) -{ - typedef typename boost::graph_traits::face_descriptor face_descriptor; - for(face_descriptor fd : faces(g)){ - if(! is_triangle(halfedge(fd,g),g)){ - return false; - } - } - return true; -} - -/*! - \ingroup PkgBGLHelperFct - returns `true` iff the connected component denoted by `hd` is a quadrilateral. - */ -template -bool is_isolated_quad(typename boost::graph_traits::halfedge_descriptor hd, const FaceGraph& g) -{ - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - halfedge_descriptor beg = hd; - if(is_border(hd,g)) return false; - for(int i=0; i<4;i++){ - if(! is_border(opposite(hd,g),g)) return false; - hd = next(hd,g); - } - return hd == beg; -} - - - /*! - \ingroup PkgBGLHelperFct - returns `true` iff the face denoted by `hd` is a quad, that is it has four incident halfedges. - */ -template -bool is_quad(typename boost::graph_traits::halfedge_descriptor hd, const FaceGraph& g) -{ - return hd == next(next(next(next(hd,g),g),g),g); -} - - /*! - \ingroup PkgBGLHelperFct - returns `true` if all faces are quadrilaterals. - */ -template - bool is_quad_mesh(const FaceGraph& g) -{ - typedef typename boost::graph_traits::face_descriptor face_descriptor; - for(face_descriptor fd : faces(g)){ - if(! is_quad(halfedge(fd,g),g)){ - return false; - } - } - return true; -} - - /*! - \ingroup PkgBGLHelperFct - returns `true` iff the connected component denoted by `hd` is a tetrahedron. - */ -template -bool is_tetrahedron( typename boost::graph_traits::halfedge_descriptor hd, const FaceGraph& g) -{ - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - - halfedge_descriptor h1 = hd; - if(is_border(h1,g)) return false; - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - halfedge_descriptor h2 = next(h1,g); - halfedge_descriptor h3 = next(h2,g); - halfedge_descriptor h4 = next(opposite(h1,g),g ); - halfedge_descriptor h5 = next(opposite(h2,g),g ); - halfedge_descriptor h6 = next(opposite(h3,g),g ); - // check halfedge combinatorics. - // at least three edges at vertices 1, 2, 3. - if ( h4 == opposite(h3,g) ) return false; - if ( h5 == opposite(h1,g) ) return false; - if ( h6 == opposite(h2,g) ) return false; - // exact three edges at vertices 1, 2, 3. - if ( next(opposite(h4,g),g) != opposite(h3,g) ) return false; - if ( next(opposite(h5,g),g) != opposite(h1,g) ) return false; - if ( next(opposite(h6,g),g) != opposite(h2,g) ) return false; - // three edges at v4. - if ( opposite(next(h4,g),g) != h5 ) return false; - if ( opposite(next(h5,g),g) != h6 ) return false; - if ( opposite(next(h6,g),g) != h4 ) return false; - // All facets are triangles. - if ( next(next(next(h1,g),g),g) != h1 ) return false; - if ( next(next(next(h4,g),g),g) != h4 ) return false; - if ( next(next(next(h5,g),g),g) != h5 ) return false; - if ( next(next(next(h6,g),g),g) != h6 ) return false; - // all edges are non-border edges. - if ( is_border(h1,g) ) return false; // implies h2 and h3 - if ( is_border(h4,g) ) return false; - if ( is_border(h5,g) ) return false; - if ( is_border(h6,g) ) return false; - return true; - } - -template -bool is_valid_halfedge_descriptor( typename boost::graph_traits::halfedge_descriptor h, const FaceGraph& g) -{ - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - typedef typename boost::graph_traits::face_descriptor face_descriptor; - face_descriptor f = face(h,g); - halfedge_descriptor done(h); - do{ - if(face(h,g) != f){ - std::cerr << "halfedge " << h << " is invalid\n"; - return false; - } - halfedge_descriptor hn = h; - hn = next(h,g); - if(prev(hn,g) != h){ - std::cerr << "halfedge " << h << " is invalid\n"; - return false; - } - h = hn; - } while(h != done); - return true; -} - -template -bool is_valid_vertex_descriptor( typename boost::graph_traits::vertex_descriptor v, const FaceGraph& g) -{ - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - halfedge_descriptor h = halfedge(v,g), done(h); - if(h == boost::graph_traits::null_halfedge()){ - return true; - } - do{ - if(target(h,g) != v){ - std::cerr << "vertex " << v << " is invalid\n"; - return false; - } - h = opposite(next(h,g),g); - }while(h != done); - return true; -} - -template -bool is_valid_face_descriptor( typename boost::graph_traits::face_descriptor f, const FaceGraph& g) -{ - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - - halfedge_descriptor h = halfedge(f,g); - if(face(h,g) != f){ - std::cerr << "face " << f << " is invalid\n"; + // null vertex + valid = (v != boost::graph_traits::null_vertex()); + if(!valid) + { + verr << "vertex is null." << std::endl; return false; } + + if(!CGAL::internal::is_isolated(v, g)) + { + // Incident halfedge integrity + valid = (target(halfedge(v, g), g) == v); + if(!valid) + { + verr << "vertex has invalid halfedge()." << std::endl; + return false; + } + } + return true; } +template +bool is_valid_halfedge_descriptor(typename boost::graph_traits::halfedge_descriptor h, + const Graph& g, + const bool verb = false) +{ + Verbose_ostream verr(verb); + bool valid = true; + + // null halfedge + valid = (h != boost::graph_traits::null_halfedge()); + if(!valid) + { + verr << "halfedge is null." << std::endl; + return false; + } + + // Pointer integrity. + valid = (prev(h, g) != boost::graph_traits::null_halfedge()); + valid = valid && (next(h, g) != boost::graph_traits::null_halfedge()); + valid = valid && (opposite(h, g) != boost::graph_traits::null_halfedge()); + if(!valid) + { + verr << "halfedge's prev / next / opposite halfedges are null." << std::endl; + return false; + } + + // degeneracies + valid = (next(h, g) != h); + valid = valid && (prev(h, g) != h); + valid = valid && (opposite(h, g) != h); + valid = valid && (target(h, g) != target(opposite(h, g), g)); + if(!valid) + { + verr << "combinatorial degeneracies." << std::endl; + return false; + } + + // edge integrity + valid = (halfedge(edge(h, g), g) == h); + if(!valid) + { + verr << "halfedge has an invalid edge." << std::endl; + return false; + } + + // opposite integrity. + valid = (opposite(h, g) != h); + valid = valid && (opposite(opposite(h, g), g) == h); + if(!valid) + { + verr << "halfedge has invalid opposite()." << std::endl; + return false; + } + + // previous integrity. + valid = (prev(next(h, g), g) == h); + valid = valid && (next(prev(h, g), g) == h); + if(!valid) + { + verr << "prev(next(hd)) != hd OR next(prev(hd)) != hd" << std::endl; + return false; + } + + // vertex integrity. + valid = (target(h, g) != boost::graph_traits::null_vertex()); + if(!valid) + { + verr << "target of halfedge is the null vertex." << std::endl; + return false; + } + + valid = (target(h, g) == target(opposite(next(h, g), g), g)); + valid = valid && (target(opposite(h, g), g) == target(prev(h, g), g)); + if(!valid) + { + verr << "vertex inconsistencies with prev/next." << std::endl; + return false; + } + + return true; +} + +template +bool is_valid_edge_descriptor(typename boost::graph_traits::edge_descriptor e, + const FaceGraph& g, + const bool verb = false) +{ + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + + Verbose_ostream verr(verb); + bool valid = true; + + // there is no null_edge() in the Graph concepts + + // Pointer integrity. + const halfedge_descriptor h = halfedge(e, g); + valid = (h != boost::graph_traits::null_halfedge()); + if(!valid) + { + verr << "halfedge incident to edge is the null halfedge." << std::endl; + return false; + } + + // halfedge integrity + valid = (edge(h, g) == e); + if(!valid) + { + verr << "edge has an invalid halfedge()." << std::endl; + return false; + } + + return true; +} + +template +bool is_valid_face_descriptor(typename boost::graph_traits::face_descriptor f, + const FaceGraph& g, + const bool verb = false) +{ + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + + Verbose_ostream verr(verb); + bool valid = true; + + // null face + valid = (f != boost::graph_traits::null_face()); + if(!valid) + { + verr << "face is null." << std::endl; + return false; + } + + // Pointer integrity. + const halfedge_descriptor h = halfedge(f, g); + valid = (h != boost::graph_traits::null_halfedge()); + if(!valid) + { + verr << "halfedge incident to face is the null halfedge." << std::endl; + return false; + } + + valid = (face(h, g) == f); + if(!valid) + { + verr << "face has an invalid halfedge()." << std::endl; + return false; + } + + // face integrity. + valid = (face(h, g) == face(next(h, g), g)); + valid = valid && (face(h, g) == face(prev(h, g), g)); + if(!valid) + { + verr << "different face incident to face halfedges." << std::endl; + return false; + } + + return true; +} + +} // namespace BGL + +// These empty functions simply calling the BGL versions (just above) are done such that +// a specific graph type (e.g. Surface_mesh) can overload those and still call the BGL versions +// without duplicating code +template +bool is_valid_vertex_descriptor(typename boost::graph_traits::vertex_descriptor v, + const Graph& g, + const bool verb = false) +{ + return BGL::is_valid_vertex_descriptor(v, g, verb); +} + +template +bool is_valid_halfedge_descriptor(typename boost::graph_traits::halfedge_descriptor h, + const Graph& g, + const bool verb = false) +{ + return BGL::is_valid_halfedge_descriptor(h, g, verb); +} + +template +bool is_valid_edge_descriptor(typename boost::graph_traits::edge_descriptor e, + const Graph& g, + const bool verb = false) +{ + return BGL::is_valid_edge_descriptor(e, g, verb); +} + +template +bool is_valid_face_descriptor(typename boost::graph_traits::face_descriptor f, + const Graph& g, + const bool verb = false) +{ + return BGL::is_valid_face_descriptor(f, g, verb); +} + /*! \ingroup PkgBGLHelperFct - * \brief checks the integrity of `g`. + * \brief checks the integrity of the graph `g`. * - * `g` is valid if it follows the rules of the `HalfedgeListGraph` concept, - * and all of its associations are reciprocal. - * For example, `prev(next(h, g), g)` must be `h`, - * and `next(prev(h, g), g)` must be `h`. + * The graph `g` is valid if it follows the rules of the `HalfedgeListGraph` concept + * and all of its associations are reciprocal (for example, `prev(next(h, g), g)` must be `h`, + * and `next(prev(h, g), g)` must be `h`). * - * \param g the `Graph` to test. + * \param g the graph to test * \param verb if `true`, the details of the check will be written in the standard output. * * \tparam Graph a model of `HalfedgeListGraph` @@ -357,14 +324,13 @@ template bool is_valid_halfedge_graph(const Graph& g, bool verb = false) { typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - typedef typename boost::graph_traits::vertices_size_type vertex_size_type; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - typedef typename boost::graph_traits::halfedges_size_type halfedges_size_type; Verbose_ostream verr(verb); - std::size_t num_v(std::distance(boost::begin(vertices(g)), boost::end(vertices(g)))), - num_e(std::distance(boost::begin(edges(g)), boost::end(edges(g)))), - num_h(std::distance(boost::begin(halfedges(g)), boost::end(halfedges(g)))); + + std::size_t num_v = CGAL::internal::exact_num_vertices(g), + num_e = CGAL::internal::exact_num_edges(g), + num_h = CGAL::internal::exact_num_halfedges(g); bool valid = (1 != (num_h&1) && (2*num_e == num_h)); if(!valid) @@ -375,288 +341,185 @@ bool is_valid_halfedge_graph(const Graph& g, bool verb = false) } // All halfedges. - halfedges_size_type n = 0; - for(halfedge_descriptor begin : halfedges(g)) + std::size_t hc = 0; + for(halfedge_descriptor h : halfedges(g)) { - // Pointer integrity. - valid = (next(begin, g) != boost::graph_traits::null_halfedge()); - valid = valid && (opposite(begin, g) != boost::graph_traits::null_halfedge()); - if(!valid) + if(!is_valid_halfedge_descriptor(h, g, verb)) { - verr << "halfedge " << n << " next / opposite halfedges are null." << std::endl; + verr << "halfedge " << hc << " is invalid." << std::endl; verr << "Halfedge Graph Structure is NOT VALID." << std::endl; return false; } - // edge integrity - valid = (halfedge(edge(begin, g), g) == begin); - - // opposite integrity. - valid = valid && (opposite(begin, g) != begin); - valid = valid && (opposite(opposite(begin, g), g) == begin); - if(!valid) - { - verr << "halfedge " << n << " invalid halfedge opposite()." << std::endl; - verr << "Halfedge Graph Structure is NOT VALID." << std::endl; - return false; - } - - // previous integrity. - valid = (prev(next(begin, g), g) == begin); - valid = valid && (next(prev(begin, g), g) == begin); - if(!valid) - { - verr << "halfedge " << n << " prev(next(hd)) != hd OR next(prev(hd)) != hd" << std::endl; - verr << "Halfedge Graph Structure is NOT VALID." << std::endl; - return false; - } - - // vertex integrity. - valid = (target(begin, g) != boost::graph_traits::null_vertex()); - if(!valid) - { - verr << "halfedge " << n << " target of halfedge is the null vertex." << std::endl; - verr << "Halfedge Graph Structure is NOT VALID." << std::endl; - return false; - } - - valid = (target(begin, g) == target(opposite(next(begin, g), g), g)); - if(!valid) - { - verr << "halfedge " << n << " target(hd) != source(next(hd))." << std::endl; - verr << "Halfedge Graph Structure is NOT VALID." << std::endl; - return false; - } - - ++n; + ++hc; } - valid = (n == num_h); + valid = (hc == num_h); if(!valid) { - verr << "counting halfedges failed." << std::endl; + verr << "counting halfedges failed: " << hc << " vs " << num_h << std::endl; verr << "Halfedge Graph Structure is NOT VALID." << std::endl; return false; } // All vertices. - vertex_size_type v = 0; - n = 0; - for(vertex_descriptor vbegin : vertices(g)) + std::size_t vc = 0; + hc = 0; + for(vertex_descriptor v : vertices(g)) { - // Pointer integrity. - if(halfedge(vbegin, g) != boost::graph_traits::null_halfedge()) - valid = (target(halfedge(vbegin, g), g) == vbegin); - else - valid = false; - - if(!valid) + if(!is_valid_vertex_descriptor(v, g, verb)) { - verr << "vertex " << v << " halfedge incident to vertex is the null halfedge." << std::endl; + verr << "vertex " << vc << " is invalid." << std::endl; verr << "Halfedge Graph Structure is NOT VALID." << std::endl; return false; } // cycle-around-vertex test. - halfedge_descriptor h = halfedge(vbegin, g); - if(h != boost::graph_traits::null_halfedge()) + if(!CGAL::internal::is_isolated(v, g)) { - halfedge_descriptor ge = h; + halfedge_descriptor h = halfedge(v, g), done = h; do { - ++n; + ++hc; h = opposite(next(h, g), g); - valid = (n <= num_h && n != 0); + valid = (hc <= num_h); if(!valid) { - verr << "vertex " << v << " too many halfedges around vertex." << std::endl; + verr << "vertex " << vc << " too many halfedges around vertex." << std::endl; verr << "Halfedge Graph Structure is NOT VALID." << std::endl; return false; } } - while(h != ge); + while(h != done); } - ++v; + ++vc; } - valid = (v == num_v); + valid = (vc == num_v); if(!valid) { - verr << "counting vertices failed." << std::endl; + verr << "counting vertices failed: " << vc << " vs " << num_v << std::endl; verr << "Halfedge Graph Structure is NOT VALID." << std::endl; return false; } - valid = (n == num_h); + valid = (hc == num_h); if(!valid) { - verr << "counting halfedges via vertices failed." << std::endl; + verr << "counting halfedges via vertices failed: " << hc << " vs " << num_h << std::endl; verr << "Halfedge Graph Structure is NOT VALID." << std::endl; return false; } - // All halfedges. - n = 0; - for(halfedge_descriptor i : halfedges(g)) - { - // At least triangular facets and distinct geometry. - valid = (next(i, g) != i) && (target(i, g) != target(opposite(i, g), g)); - if(!valid) - { - verr << "halfedge " << n << " pointer validity corrupted." << std::endl; - verr << "Halfedge Graph Structure is NOT VALID." << std::endl; - return false; - } - - ++n; - } - - valid = (n == num_h); - if(!valid) - verr << "counting halfedges failed." << std::endl; - - verr << "Halfedge Graph Structure is " << (valid ? "valid." : "NOT VALID.") << std::endl; + verr << "Halfedge Graph Structure is valid" << std::endl; return valid; } /*! \ingroup PkgBGLHelperFct - * \brief checks the integrity of `g`. + * \brief checks the integrity of the graph `g`. * - * `g` is valid if it is a valid `HalfedgeListGraph`, if it follows the rules - * of the `FaceListGraph` concept, and all of its associations are reciprocal. - * For example, `face(halfedge(f,g),g)` must be `f`. - * calls `is_valid_halfedge_graph()` + * The graph `g` is a valid face graph if it is a valid halfedge graph, and if it follows the rules + * of the `FaceListGraph` concept and all of its associations are reciprocal (for example, + * `face(halfedge(f,g),g)` must be `f`). * - * \param g the `Graph` to test. - * \param verb if `true`, the details of the check will be written in the standard output. + * \param g the graph to test + * \param verb if `true`, the details of the check will be written in the standard output * - * \tparam Graph a model of `FaceListGraph` + * \tparam FaceGraph a model of `FaceListGraph` and `HalfedgeListGraph` * * \return `true` if `g` is valid, `false` otherwise. * * \see `is_valid_halfedge_graph()` */ -template -bool is_valid_face_graph(const Graph& g, bool verb = false) +template +bool is_valid_face_graph(const FaceGraph& g, bool verb = false) { - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - typedef typename boost::graph_traits::halfedges_size_type halfedges_size_type; - typedef typename boost::graph_traits::face_descriptor face_descriptor; - typedef typename boost::graph_traits::faces_size_type faces_size_type; + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + typedef typename boost::graph_traits::face_descriptor face_descriptor; Verbose_ostream verr(verb); - std::size_t num_f(std::distance(boost::begin(faces(g)), boost::end(faces(g)))), - num_h(std::distance(boost::begin(halfedges(g)), boost::end(halfedges(g)))); + std::size_t num_f = CGAL::internal::exact_num_faces(g), + num_h = CGAL::internal::exact_num_halfedges(g); - faces_size_type f = 0; - std::size_t n = 0; - std::size_t hn = 0; - halfedges_size_type nb = 0; + std::size_t fc = 0, hc = 0, nb = 0; - //is valid halfedge_graph ? bool valid = is_valid_halfedge_graph(g, verb); if(!valid) return false; // All faces. - for(face_descriptor fbegin : faces(g)) + for(face_descriptor f : faces(g)) { - // Pointer integrity. - if(halfedge(fbegin, g) != boost::graph_traits::null_halfedge()) - valid = (face(halfedge(fbegin, g), g) == fbegin); - else - valid = false; - - if(!valid) + if(!is_valid_face_descriptor(f, g, verb)) { - verr << "face " << f << " halfedge incident to face is the null halfedge." << std::endl; + verr << "face " << fc << " is invalid." << std::endl; verr << "Face Graph Structure is NOT VALID." << std::endl; return false; } // cycle-around-face test. - halfedge_descriptor h = halfedge( fbegin, g); - if(h != boost::graph_traits::null_halfedge()) + halfedge_descriptor h = halfedge(f, g), done(h); + do { - halfedge_descriptor ge = h; - do + ++hc; + valid = (hc <= num_h); + if(!valid) { - ++n; - h = next(h, g); - valid = (n <= num_h && n != 0); - if(!valid) - { - verr << "face " << f << " too many halfedges around face." << std::endl; - verr << "Face Graph Structure is NOT VALID." << std::endl; - return false; - } + verr << "face " << fc << " too many halfedges around face." << std::endl; + verr << "Face Graph Structure is NOT VALID." << std::endl; + return false; } - while(h != ge); + h = next(h, g); } + while(h != done); - ++f; + ++fc; } - valid = (f == num_f); + valid = (fc == num_f); if(!valid) { - verr << "counting faces failed." << std::endl; + verr << "counting faces failed: " << fc << " vs " << num_f << std::endl; verr << "Face Graph Structure is NOT VALID." << std::endl; return false; } - for(halfedge_descriptor i : halfedges(g)) + for(halfedge_descriptor h : halfedges(g)) { - ++hn; - //counting borders - if(is_border(i, g)) + if(is_border(h, g)) ++nb; - - // face integrity. - valid = (face(i, g) == face(next(i, g), g)); - if(!valid) - { - verr << "halfedge " << hn << " face(hd) != face(next(hd))." << std::endl; - verr << "Face Graph Structure is NOT VALID." << std::endl; - return false; - } } - valid = (n + nb == num_h); + valid = (hc + nb == num_h); if(!valid) { - verr << "sum border halfedges (2*nb) = " << 2 * nb << std::endl; verr << "counting halfedges via faces failed." << std::endl; + verr << "sum border halfedges (2*nb) = " << 2 * nb << " vs " << num_h << std::endl; verr << "Face Graph Structure is NOT VALID." << std::endl; return false; } - valid = (f == num_f); - if(!valid) - verr << "counting faces failed." << std::endl; - - verr << "Face Graph Structure is " << (valid ? "valid." : "NOT VALID.") << std::endl; + verr << "Face Graph Structure is valid" << std::endl; return valid; } /*! \ingroup PkgBGLHelperFct - * \brief checks the integrity of `g`. + * \brief checks the integrity of the mesh `g`. * - * `g` is valid if it is a valid `FaceListGraph` and it has distinct faces on each side of an edge. - * calls `is_valid_face_graph()`. + * The mesh `g` is a valid polygon mesh if it is a valid face graph and if it follows the rules + * defined in \ref PMPDef "PolygonMesh". * - * \param g the `Mesh` to test. - * \param verb : if `true`, the details of the check will be written in the standard output. + * \param g the `Mesh` to test + * \param verb if `true`, the details of the check will be written in the standard output * - * \tparam Mesh a model of `FaceListGraph` and `HalfedgeListGraph`, and follows - * the definition of a \ref PMPDef "PolygonMesh" + * \tparam Mesh a model of `FaceListGraph` and `HalfedgeListGraph` * \return `true` if `g` is valid, `false` otherwise. * * \see `is_valid_face_graph()` @@ -700,15 +563,246 @@ bool is_valid_polygon_mesh(const Mesh& g, bool verb = false) return true; } + /*! + \ingroup PkgBGLHelperFct + returns `true` if there are no border edges. + */ +template +bool is_closed(const FaceGraph& g) +{ + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + for(halfedge_descriptor hd : halfedges(g)){ + if(is_border(hd,g)){ + return false; + } + } + return true; +} + + /*! + \ingroup PkgBGLHelperFct + returns `true` if the target of `hd` has exactly two incident edges. + */ +template +bool is_bivalent(typename boost::graph_traits::halfedge_descriptor hd, const FaceGraph& g) +{ + CGAL_precondition(is_valid_halfedge_descriptor(hd, g)); + + return hd == opposite(next(opposite(next(hd,g),g),g),g); +} + + /*! + \ingroup PkgBGLHelperFct + returns `true` if all vertices have exactly two incident edges. + */ +template +bool is_bivalent_mesh(const FaceGraph& g) +{ + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + for(vertex_descriptor vd : vertices(g)){ + halfedge_descriptor hd = halfedge(vd,g); + if((hd == boost::graph_traits::null_halfedge()) || + (! is_bivalent(hd,g))){ + return false; + } + } + return true; +} + + /*! + \ingroup PkgBGLHelperFct + returns `true` if the target of `hd` has exactly three incident edges. + */ +template +bool is_trivalent(typename boost::graph_traits::halfedge_descriptor hd, const FaceGraph& g) +{ + CGAL_precondition(is_valid_halfedge_descriptor(hd, g)); + + return hd == opposite(next(opposite(next(opposite(next(hd,g),g),g),g),g),g); +} + + /*! + \ingroup PkgBGLHelperFct + returns `true` if all + vertices have exactly three incident edges. + */ +template +bool is_trivalent_mesh(const FaceGraph& g) +{ + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + for(vertex_descriptor vd : vertices(g)){ + halfedge_descriptor hd = halfedge(vd,g); + if((hd == boost::graph_traits::null_halfedge()) || + (! is_trivalent(halfedge(hd,g),g))){ + return false; + } + } + return true; +} + + /*! + \ingroup PkgBGLHelperFct + returns `true` iff the connected component denoted by `hd` is a triangle. + \pre `g` must be valid. + */ +template +bool is_isolated_triangle(typename boost::graph_traits::halfedge_descriptor hd, + const FaceGraph& g) +{ + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + + CGAL_precondition(is_valid_halfedge_descriptor(hd, g)); + + halfedge_descriptor beg = hd; + if(is_border(hd,g)) return false; + for(int i=0; i<3;i++){ + if(! is_border(opposite(hd,g),g)) return false; + hd = next(hd,g); + } + return hd == beg; +} + + /*! + \ingroup PkgBGLHelperFct + returns `true` iff the face denoted by `hd` is a triangle, that is it has three incident halfedges. + */ +template +bool is_triangle(typename boost::graph_traits::halfedge_descriptor hd, + const FaceGraph& g) +{ + CGAL_precondition(is_valid_halfedge_descriptor(hd, g)); + + return hd == next(next(next(hd,g),g),g); +} + + /*! + \ingroup PkgBGLHelperFct + returns `true` if all faces are triangles. + */ +template +bool is_triangle_mesh(const FaceGraph& g) +{ + typedef typename boost::graph_traits::face_descriptor face_descriptor; + for(face_descriptor fd : faces(g)){ + if(! is_triangle(halfedge(fd,g),g)){ + return false; + } + } + return true; +} + +/*! + \ingroup PkgBGLHelperFct + returns `true` iff the connected component denoted by `hd` is a quadrilateral. + */ +template +bool is_isolated_quad(typename boost::graph_traits::halfedge_descriptor hd, + const FaceGraph& g) +{ + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + + CGAL_precondition(is_valid_halfedge_descriptor(hd, g)); + + halfedge_descriptor beg = hd; + if(is_border(hd,g)) return false; + for(int i=0; i<4;i++){ + if(! is_border(opposite(hd,g),g)) return false; + hd = next(hd,g); + } + return hd == beg; +} + + + /*! + \ingroup PkgBGLHelperFct + returns `true` iff the face denoted by `hd` is a quad, that is it has four incident halfedges. + */ +template +bool is_quad(typename boost::graph_traits::halfedge_descriptor hd, + const FaceGraph& g) +{ + CGAL_precondition(is_valid_halfedge_descriptor(hd, g)); + + return hd == next(next(next(next(hd,g),g),g),g); +} + + /*! + \ingroup PkgBGLHelperFct + returns `true` if all faces are quadrilaterals. + */ +template +bool is_quad_mesh(const FaceGraph& g) +{ + typedef typename boost::graph_traits::face_descriptor face_descriptor; + + for(face_descriptor fd : faces(g)){ + if(! is_quad(halfedge(fd,g),g)){ + return false; + } + } + return true; +} + + /*! + \ingroup PkgBGLHelperFct + returns `true` iff the connected component denoted by `hd` is a tetrahedron. + */ +template +bool is_tetrahedron(typename boost::graph_traits::halfedge_descriptor hd, + const FaceGraph& g) +{ + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + + CGAL_precondition(is_valid_halfedge_descriptor(hd, g)); + + halfedge_descriptor h1 = hd; + if(is_border(h1,g)) return false; + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + halfedge_descriptor h2 = next(h1,g); + halfedge_descriptor h3 = next(h2,g); + halfedge_descriptor h4 = next(opposite(h1,g),g ); + halfedge_descriptor h5 = next(opposite(h2,g),g ); + halfedge_descriptor h6 = next(opposite(h3,g),g ); + // check halfedge combinatorics. + // at least three edges at vertices 1, 2, 3. + if ( h4 == opposite(h3,g) ) return false; + if ( h5 == opposite(h1,g) ) return false; + if ( h6 == opposite(h2,g) ) return false; + // exact three edges at vertices 1, 2, 3. + if ( next(opposite(h4,g),g) != opposite(h3,g) ) return false; + if ( next(opposite(h5,g),g) != opposite(h1,g) ) return false; + if ( next(opposite(h6,g),g) != opposite(h2,g) ) return false; + // three edges at v4. + if ( opposite(next(h4,g),g) != h5 ) return false; + if ( opposite(next(h5,g),g) != h6 ) return false; + if ( opposite(next(h6,g),g) != h4 ) return false; + // All facets are triangles. + if ( next(next(next(h1,g),g),g) != h1 ) return false; + if ( next(next(next(h4,g),g),g) != h4 ) return false; + if ( next(next(next(h5,g),g),g) != h5 ) return false; + if ( next(next(next(h6,g),g),g) != h6 ) return false; + // all edges are non-border edges. + if ( is_border(h1,g) ) return false; // implies h2 and h3 + if ( is_border(h4,g) ) return false; + if ( is_border(h5,g) ) return false; + if ( is_border(h6,g) ) return false; + return true; +} + /*! \ingroup PkgBGLHelperFct returns `true` iff the connected component denoted by `hd` is a hexahedron. */ template -bool is_hexahedron( typename boost::graph_traits::halfedge_descriptor hd, const FaceGraph& g) +bool is_hexahedron(typename boost::graph_traits::halfedge_descriptor hd, + const FaceGraph& g) { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + CGAL_precondition(is_valid_halfedge_descriptor(hd, g)); + halfedge_descriptor h1 = hd; if(is_border(h1,g)) return false; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; @@ -763,13 +857,14 @@ clear_impl(FaceGraph& g) } template -void swap_vertices( - typename boost::graph_traits::vertex_descriptor& p, - typename boost::graph_traits::vertex_descriptor& q, - FaceGraph& g) +void swap_vertices(typename boost::graph_traits::vertex_descriptor& p, + typename boost::graph_traits::vertex_descriptor& q, + FaceGraph& g) { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + CGAL_precondition(is_valid_vertex_descriptor(p, g) && is_valid_vertex_descriptor(q, g)); + halfedge_descriptor hq=halfedge(q, g); halfedge_descriptor hp=halfedge(p, g); for(halfedge_descriptor h : halfedges_around_target(hq, g)) @@ -781,14 +876,16 @@ void swap_vertices( } template -void swap_edges( - const typename boost::graph_traits::halfedge_descriptor& h1, - const typename boost::graph_traits::halfedge_descriptor& h2, - FaceGraph& g) +void swap_edges(const typename boost::graph_traits::halfedge_descriptor& h1, + const typename boost::graph_traits::halfedge_descriptor& h2, + FaceGraph& g) { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::face_descriptor face_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + + CGAL_precondition(is_valid_halfedge_descriptor(h1, g) && is_valid_halfedge_descriptor(h2, g)); + const halfedge_descriptor oh1 = opposite(h1, g), oh2 = opposite(h2, g); // backup vertex pointers @@ -918,6 +1015,8 @@ int vertex_index_in_face(const typename boost::graph_traits::vertex_descr { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + CGAL_precondition(is_valid_vertex_descriptor(vd, g) && is_valid_face_descriptor(fd, g)); + halfedge_descriptor start = halfedge(fd, g); halfedge_descriptor current = start; int counter = 0; @@ -958,7 +1057,7 @@ int halfedge_index_in_face(typename boost::graph_traits::halfedge_descrip typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::face_descriptor face_descriptor; - CGAL_precondition(he != boost::graph_traits::null_halfedge()); + CGAL_precondition(is_valid_halfedge_descriptor(he, g)); CGAL_precondition(!is_border(he, g)); face_descriptor f = face(he, g); diff --git a/BGL/include/CGAL/boost/graph/internal/helpers.h b/BGL/include/CGAL/boost/graph/internal/helpers.h index ec6b47baf83..4da0e59a63c 100644 --- a/BGL/include/CGAL/boost/graph/internal/helpers.h +++ b/BGL/include/CGAL/boost/graph/internal/helpers.h @@ -11,14 +11,15 @@ #ifndef CGAL_BOOST_GRAPH_INTERNAL_HELPERS_H #define CGAL_BOOST_GRAPH_INTERNAL_HELPERS_H -#include -#include #include #include #include #include + #include +#include + namespace CGAL { // breaks a dependency loop between @@ -133,7 +134,7 @@ std::size_t exact_num_vertices(const Graph& g) { typename boost::graph_traits::vertex_iterator beg, end; - boost::tie(beg,end) = vertices(g); + std::tie(beg,end) = vertices(g); return std::distance(beg,end); } @@ -142,7 +143,7 @@ std::size_t exact_num_halfedges(const Graph& g) { typename boost::graph_traits::halfedge_iterator beg, end; - boost::tie(beg,end) = halfedges(g); + std::tie(beg,end) = halfedges(g); return std::distance(beg,end); } @@ -151,7 +152,7 @@ std::size_t exact_num_edges(const Graph& g) { typename boost::graph_traits::edge_iterator beg, end; - boost::tie(beg,end) = edges(g); + std::tie(beg,end) = edges(g); return std::distance(beg,end); } @@ -160,14 +161,14 @@ std::size_t exact_num_faces(const Graph& g) { typename boost::graph_traits::face_iterator beg, end; - boost::tie(beg,end) = faces(g); + std::tie(beg,end) = faces(g); return std::distance(beg,end); } template bool is_isolated(typename boost::graph_traits::vertex_descriptor v, - Graph& g) + const Graph& g) { return halfedge(v, g) == boost::graph_traits::null_halfedge(); } diff --git a/BGL/include/CGAL/boost/graph/properties_OpenMesh.h b/BGL/include/CGAL/boost/graph/properties_OpenMesh.h index 35b49cf33eb..0740602e64f 100644 --- a/BGL/include/CGAL/boost/graph/properties_OpenMesh.h +++ b/BGL/include/CGAL/boost/graph/properties_OpenMesh.h @@ -202,7 +202,7 @@ public: : sm_(pm.sm_) {} - reference operator[](key_type v) + reference operator[](key_type v) const { #if defined(CGAL_USE_OM_POINTS) return sm_->point(v); diff --git a/BGL/include/CGAL/boost/graph/selection.h b/BGL/include/CGAL/boost/graph/selection.h index 2604e4cf223..b0ea97d89dd 100644 --- a/BGL/include/CGAL/boost/graph/selection.h +++ b/BGL/include/CGAL/boost/graph/selection.h @@ -207,13 +207,11 @@ struct Regularization_graph prevent_unselection (prevent_unselection) { labels.reserve(num_faces(fg)); - std::size_t nb_selected = 0; for (fg_face_descriptor fd : faces(fg)) { if (get(is_selected_map,fd)) { labels.push_back(1); - ++ nb_selected; } else labels.push_back(0); @@ -486,7 +484,7 @@ reduce_face_selection( \cgalParamNEnd \cgalParamNBegin{prevent_unselection} - \cgalParamDescription{Boolean used to indicate if selection can be only expanded or if it can also be shrinked.} + \cgalParamDescription{Boolean used to indicate if selection can be only expanded or if it can also be shrunk.} \cgalParamType{`bool`} \cgalParamDefault{`false`} \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} diff --git a/BGL/include/CGAL/boost/parameter.h b/BGL/include/CGAL/boost/parameter.h deleted file mode 100644 index 14ab09b0474..00000000000 --- a/BGL/include/CGAL/boost/parameter.h +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) 2014 GeometryFactory (France). All rights reserved. -// -// This file is part of CGAL (www.cgal.org) -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Andreas Fabri - -#ifndef CGAL_BOOST_PARAMETER_H -#define CGAL_BOOST_PARAMETER_H - -#include - - -#ifdef BOOST_PARAMETER_MAX_ARITY -# if (BOOST_PARAMETER_MAX_ARITY < 12) -# error "BOOST_PARAMETER_MAX_ARITY must be at least 12 for CGAL::Mesh_3" -# endif -#else -# define BOOST_PARAMETER_MAX_ARITY 12 -#endif - -#include - -#if defined(__clang__) || defined(BOOST_GCC) -# 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 - -#define CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS \ - CGAL_IGNORE_UNUSED_VARIABLES \ - CGAL_IGNORE_UNUSED_INTERNAL_DECLARATION - - -namespace CGAL -{ -namespace parameters -{ - -template -struct Base -{ - Base(T t) : t_(t) {} - T operator()() const { return t_; } -private: - T t_; -}; - -#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_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_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( (do_freeze, tag) do_freeze_) - -BOOST_PARAMETER_NAME( (mesh_topology, tag) mesh_topology_) - -BOOST_PARAMETER_NAME( (dump_after_init_prefix, tag ) dump_after_init_prefix_) -BOOST_PARAMETER_NAME( (dump_after_refine_surface_prefix, tag ) dump_after_refine_surface_prefix_) -BOOST_PARAMETER_NAME( (dump_after_refine_prefix, tag ) dump_after_refine_prefix_) -BOOST_PARAMETER_NAME( (dump_after_glob_opt_prefix, tag ) dump_after_glob_opt_prefix_) -BOOST_PARAMETER_NAME( (dump_after_perturb_prefix, tag ) dump_after_perturb_prefix_) -BOOST_PARAMETER_NAME( (dump_after_exude_prefix, tag ) dump_after_exude_prefix_) -BOOST_PARAMETER_NAME( (number_of_initial_points, tag) number_of_initial_points_) -BOOST_PARAMETER_NAME( (maximal_number_of_vertices, tag ) maximal_number_of_vertices_) -BOOST_PARAMETER_NAME( (nonlinear_growth_of_balls, tag ) nonlinear_growth_of_balls_) -BOOST_PARAMETER_NAME( (pointer_to_error_code, tag ) pointer_to_error_code_) -BOOST_PARAMETER_NAME( (pointer_to_stop_atomic_boolean, tag ) pointer_to_stop_atomic_boolean_) - -// First used in -BOOST_PARAMETER_NAME( (function, tag ) function_) -BOOST_PARAMETER_NAME( (bounding_object, tag ) bounding_object_) -BOOST_PARAMETER_NAME( (relative_error_bound, tag ) relative_error_bound_) -BOOST_PARAMETER_NAME( (weights, tag) weights_) -BOOST_PARAMETER_NAME( (p_rng, tag ) p_rng_) -BOOST_PARAMETER_NAME( (null_subdomain_index, tag ) null_subdomain_index_) -BOOST_PARAMETER_NAME( (construct_surface_patch_index, tag ) construct_surface_patch_index_) - -// First used in -BOOST_PARAMETER_NAME( (image, tag ) image_) -BOOST_PARAMETER_NAME( (iso_value, tag) iso_value_) -BOOST_PARAMETER_NAME( (value_outside, tag) value_outside_) -BOOST_PARAMETER_NAME( (image_values_to_subdomain_indices, tag ) image_values_to_subdomain_indices_) - -CGAL_PRAGMA_DIAG_POP -} // parameters -} // CGAL - - -#endif // CGAL_BOOST_PARAMETER_H diff --git a/BGL/test/BGL/test_test_face.cpp b/BGL/test/BGL/test_test_face.cpp index e69f7e3176e..aa4e0fa0879 100644 --- a/BGL/test/BGL/test_test_face.cpp +++ b/BGL/test/BGL/test_test_face.cpp @@ -23,9 +23,9 @@ int main() vertex_descriptor vs = CGAL::add_vertex(sm); std::array face0; assert( ! CGAL::Euler::can_add_face(face0,sm) ); - std::array face1; + std::array face1 = { vp }; assert( ! CGAL::Euler::can_add_face(face1,sm) ); - std::array face2; + std::array face2 = { vp, vq }; assert( ! CGAL::Euler::can_add_face(face2,sm) ); std::array face = { vp, vq, vr }; @@ -56,5 +56,7 @@ int main() assert( ! CGAL::Euler::can_add_face(face,sm) ); } + std::cout << "Done" << std::endl; + return 0; } diff --git a/Bounding_volumes/doc/Bounding_volumes/PackageDescription.txt b/Bounding_volumes/doc/Bounding_volumes/PackageDescription.txt index 6fa63e9c60d..7ec2b717b7b 100644 --- a/Bounding_volumes/doc/Bounding_volumes/PackageDescription.txt +++ b/Bounding_volumes/doc/Bounding_volumes/PackageDescription.txt @@ -20,12 +20,6 @@ \cgalPkgShortInfoEnd \cgalPkgDescriptionEnd -\cgalCRPSection{Assertions} - -The optimization code uses infix `OPTIMISATION` in the assertions, -e.g. defining the compiler flag -`CGAL_OPTIMISATION_NO_PRECONDITIONS` switches precondition -checking off, cf. Section \ref secchecks. \cgalClassifedRefPages @@ -62,4 +56,3 @@ checking off, cf. Section \ref secchecks. - `CGAL::Min_sphere_of_spheres_d` - `MinSphereOfSpheresTraits` */ - diff --git a/Bounding_volumes/include/CGAL/Min_annulus_d.h b/Bounding_volumes/include/CGAL/Min_annulus_d.h index 8dae7e73d26..eb7435ef1f8 100644 --- a/Bounding_volumes/include/CGAL/Min_annulus_d.h +++ b/Bounding_volumes/include/CGAL/Min_annulus_d.h @@ -325,7 +325,7 @@ public: Support_point_iterator support_points_begin() const { - CGAL_optimisation_assertion_msg(number_of_points() >= 2, + CGAL_assertion_msg(number_of_points() >= 2, "support_points_begin: not enough points"); return Support_point_iterator( solver->basic_original_variable_indices_begin(), @@ -334,7 +334,7 @@ public: Support_point_iterator support_points_end() const { - CGAL_optimisation_assertion_msg(number_of_points() >= 2, + CGAL_assertion_msg(number_of_points() >= 2, "support_points_begin: not enough points"); return Support_point_iterator( solver->basic_original_variable_indices_end(), @@ -401,27 +401,27 @@ public: // NOTE: an implicit conversion from ET to RT must be available! Point center( ) const - { CGAL_optimisation_precondition( ! is_empty()); + { CGAL_precondition( ! is_empty()); return tco.construct_point_d_object()( ambient_dimension(), center_coordinates_begin(), center_coordinates_end()); } FT squared_inner_radius( ) const - { CGAL_optimisation_precondition( ! is_empty()); + { CGAL_precondition( ! is_empty()); return FT( squared_inner_radius_numerator()) / FT( squared_radii_denominator()); } FT squared_outer_radius( ) const - { CGAL_optimisation_precondition( ! is_empty()); + { CGAL_precondition( ! is_empty()); return FT( squared_outer_radius_numerator()) / FT( squared_radii_denominator()); } // predicates CGAL::Bounded_side bounded_side( const Point& p) const - { CGAL_optimisation_precondition( + { CGAL_precondition( is_empty() || tco.access_dimension_d_object()( p) == d); ET sqr_d = sqr_dist( p); ET h_p_sqr = da_coord(p)[d] * da_coord(p)[d]; @@ -431,7 +431,7 @@ public: bool has_on_bounded_side( const Point& p) const - { CGAL_optimisation_precondition( + { CGAL_precondition( is_empty() || tco.access_dimension_d_object()( p) == d); ET sqr_d = sqr_dist( p); ET h_p_sqr = da_coord(p)[d] * da_coord(p)[d]; @@ -440,7 +440,7 @@ public: bool has_on_boundary( const Point& p) const - { CGAL_optimisation_precondition( + { CGAL_precondition( is_empty() || tco.access_dimension_d_object()( p) == d); ET sqr_d = sqr_dist( p); ET h_p_sqr = da_coord(p)[d] * da_coord(p)[d]; @@ -449,7 +449,7 @@ public: bool has_on_unbounded_side( const Point& p) const - { CGAL_optimisation_precondition( + { CGAL_precondition( is_empty() || tco.access_dimension_d_object()( p) == d); ET sqr_d = sqr_dist( p); ET h_p_sqr(da_coord(p)[d]); @@ -468,14 +468,14 @@ public: { if ( points.size() > 0) points.erase( points.begin(), points.end()); std::copy( first, last, std::back_inserter( points)); set_dimension(); - CGAL_optimisation_precondition_msg( check_dimension(), + CGAL_precondition_msg( check_dimension(), "Not all points have the same dimension."); compute_min_annulus(); } void insert( const Point& p) { if ( is_empty()) d = tco.access_dimension_d_object()( p); - CGAL_optimisation_precondition( + CGAL_precondition( tco.access_dimension_d_object()( p) == d); points.push_back( p); compute_min_annulus(); } @@ -483,10 +483,10 @@ public: template < class InputIterator > void insert( InputIterator first, InputIterator last) - { CGAL_optimisation_precondition_code( std::size_t old_n = points.size()); + { CGAL_precondition_code( std::size_t old_n = points.size()); points.insert( points.end(), first, last); set_dimension(); - CGAL_optimisation_precondition_msg( check_dimension( old_n), + CGAL_precondition_msg( check_dimension( old_n), "Not all points have the same dimension."); compute_min_annulus(); } @@ -645,7 +645,7 @@ private: options.set_pricing_strategy(pricing_strategy(NT())); delete solver; solver = new Solver(lp, options); - CGAL_optimisation_assertion(solver->status() == QP_OPTIMAL); + CGAL_assertion(solver->status() == QP_OPTIMAL); // compute center and squared radius ET sqr_sum = 0; @@ -829,7 +829,7 @@ operator << ( std::ostream& os, break; default: - CGAL_optimisation_assertion_msg( false, + CGAL_assertion_msg( false, "CGAL::IO::get_mode( os) invalid!"); break; } @@ -858,7 +858,7 @@ operator >> ( std::istream& is, CGAL::Min_annulus_d& min_annulus) break; default: - CGAL_optimisation_assertion_msg( false, "CGAL::IO::mode invalid!"); + CGAL_assertion_msg( false, "CGAL::IO::mode invalid!"); break; } return( is); diff --git a/Bounding_volumes/include/CGAL/Min_circle_2.h b/Bounding_volumes/include/CGAL/Min_circle_2.h index 759eb9195ef..ee36071ce21 100644 --- a/Bounding_volumes/include/CGAL/Min_circle_2.h +++ b/Bounding_volumes/include/CGAL/Min_circle_2.h @@ -191,7 +191,7 @@ class Min_circle_2 { const Point& support_point( std::size_t i) const { - CGAL_optimisation_precondition(i < number_of_support_points()); + CGAL_precondition(i < number_of_support_points()); return( support_points[ i]); } // circle @@ -256,7 +256,7 @@ class Min_circle_2 { tco.circle.set( ); break; default: - CGAL_optimisation_assertion( n_support_points <= 3 ); } + CGAL_assertion( n_support_points <= 3 ); } } void @@ -334,7 +334,7 @@ class Min_circle_2 { // initialize circle tco.circle.set(); - CGAL_optimisation_postcondition( is_empty()); + CGAL_postcondition( is_empty()); } // constructor for one point @@ -349,7 +349,7 @@ class Min_circle_2 { support_points[ 0] = p; tco.circle.set( p); - CGAL_optimisation_postcondition( is_degenerate()); + CGAL_postcondition( is_degenerate()); } // constructor for two points diff --git a/Bounding_volumes/include/CGAL/Min_circle_2/Min_circle_2_adapterC2.h b/Bounding_volumes/include/CGAL/Min_circle_2/Min_circle_2_adapterC2.h index 47d93bb8288..5121c02919c 100644 --- a/Bounding_volumes/include/CGAL/Min_circle_2/Min_circle_2_adapterC2.h +++ b/Bounding_volumes/include/CGAL/Min_circle_2/Min_circle_2_adapterC2.h @@ -293,7 +293,7 @@ operator << ( std::ostream& os, break; default: - CGAL_optimisation_assertion_msg( false, + CGAL_assertion_msg( false, "CGAL::IO::get_mode( os) invalid!"); break; } @@ -323,7 +323,7 @@ operator >> ( std::istream& is, break; default: - CGAL_optimisation_assertion_msg( false, + CGAL_assertion_msg( false, "CGAL::IO::mode invalid!"); break; } diff --git a/Bounding_volumes/include/CGAL/Min_circle_2/Min_circle_2_adapterH2.h b/Bounding_volumes/include/CGAL/Min_circle_2/Min_circle_2_adapterH2.h index 43b90b757d0..cc5bbbf4164 100644 --- a/Bounding_volumes/include/CGAL/Min_circle_2/Min_circle_2_adapterH2.h +++ b/Bounding_volumes/include/CGAL/Min_circle_2/Min_circle_2_adapterH2.h @@ -332,7 +332,7 @@ operator << ( std::ostream& os, break; default: - CGAL_optimisation_assertion_msg( false, + CGAL_assertion_msg( false, "CGAL::IO::get_mode( os) invalid!"); break; } @@ -363,7 +363,7 @@ operator >> ( std::istream& is, break; default: - CGAL_optimisation_assertion_msg( false, + CGAL_assertion_msg( false, "CGAL::IO::mode invalid!"); break; } diff --git a/Bounding_volumes/include/CGAL/Min_circle_2/Min_circle_2_impl.h b/Bounding_volumes/include/CGAL/Min_circle_2/Min_circle_2_impl.h index ccb2d79af91..114a59a297a 100644 --- a/Bounding_volumes/include/CGAL/Min_circle_2/Min_circle_2_impl.h +++ b/Bounding_volumes/include/CGAL/Min_circle_2/Min_circle_2_impl.h @@ -60,7 +60,7 @@ operator << ( std::ostream& os, break; default: - CGAL_optimisation_assertion_msg( false, + CGAL_assertion_msg( false, "CGAL::IO::get_mode( os) invalid!"); break; } @@ -89,7 +89,7 @@ operator >> ( std::istream& is, CGAL::Min_circle_2& min_circle) break; default: - CGAL_optimisation_assertion_msg( false, "CGAL::IO::mode invalid!"); + CGAL_assertion_msg( false, "CGAL::IO::mode invalid!"); break; } return( is); diff --git a/Bounding_volumes/include/CGAL/Min_circle_2/Optimisation_circle_2_impl.h b/Bounding_volumes/include/CGAL/Min_circle_2/Optimisation_circle_2_impl.h index 33cf439dd26..f2e94333b61 100644 --- a/Bounding_volumes/include/CGAL/Min_circle_2/Optimisation_circle_2_impl.h +++ b/Bounding_volumes/include/CGAL/Min_circle_2/Optimisation_circle_2_impl.h @@ -11,7 +11,7 @@ // Author(s) : Sven Schoenherr , Bernd Gaertner // includes -# include +# include namespace CGAL { @@ -42,7 +42,7 @@ operator << ( std::ostream& os, const CGAL::Optimisation_circle_2& c) break; default: - CGAL_optimisation_assertion_msg( false, + CGAL_assertion_msg( false, "CGAL::IO::get_mode( os) invalid!"); break; } @@ -79,7 +79,7 @@ operator >> ( std::istream& is, CGAL::Optimisation_circle_2& c) break; default: - CGAL_optimisation_assertion_msg( false, + CGAL_assertion_msg( false, "CGAL::IO::get_mode( is) invalid!"); break; } diff --git a/Bounding_volumes/include/CGAL/Min_ellipse_2.h b/Bounding_volumes/include/CGAL/Min_ellipse_2.h index 3421a2de847..b8b35130a50 100644 --- a/Bounding_volumes/include/CGAL/Min_ellipse_2.h +++ b/Bounding_volumes/include/CGAL/Min_ellipse_2.h @@ -203,7 +203,7 @@ class Min_ellipse_2 { const Point& support_point( std::size_t i) const { - CGAL_optimisation_precondition(i < number_of_support_points()); + CGAL_precondition(i < number_of_support_points()); return( support_points[ i]); } // ellipse @@ -281,7 +281,7 @@ class Min_ellipse_2 { tco.ellipse.set( ); break; default: - CGAL_optimisation_assertion( ( n_support_points >= 0) && + CGAL_assertion( ( n_support_points >= 0) && ( n_support_points <= 5) ); } } @@ -360,7 +360,7 @@ class Min_ellipse_2 { // initialize ellipse tco.ellipse.set(); - CGAL_optimisation_postcondition( is_empty()); + CGAL_postcondition( is_empty()); } inline @@ -373,7 +373,7 @@ class Min_ellipse_2 { // initialize ellipse tco.ellipse.set(); - CGAL_optimisation_postcondition( is_empty()); + CGAL_postcondition( is_empty()); } // constructor for one point @@ -388,7 +388,7 @@ class Min_ellipse_2 { support_points[ 0] = p; tco.ellipse.set( p); - CGAL_optimisation_postcondition( is_degenerate()); + CGAL_postcondition( is_degenerate()); } // constructor for two points @@ -409,7 +409,7 @@ class Min_ellipse_2 { // compute me me( points.end(), 0); - CGAL_optimisation_postcondition( is_degenerate()); + CGAL_postcondition( is_degenerate()); } // constructor for three points diff --git a/Bounding_volumes/include/CGAL/Min_ellipse_2/Min_ellipse_2_adapterC2.h b/Bounding_volumes/include/CGAL/Min_ellipse_2/Min_ellipse_2_adapterC2.h index e2fad6bc1bb..be22328dfb4 100644 --- a/Bounding_volumes/include/CGAL/Min_ellipse_2/Min_ellipse_2_adapterC2.h +++ b/Bounding_volumes/include/CGAL/Min_ellipse_2/Min_ellipse_2_adapterC2.h @@ -18,7 +18,7 @@ // includes # include -# include +# include namespace CGAL { @@ -235,7 +235,7 @@ class _Min_ellipse_2_adapterC2__Ellipse { int tau_star = c.vol_derivative( dr, ds, dt, du, dv, dw); return( CGAL::Bounded_side( CGAL_NTS sign( tau_star))); } } default: - CGAL_optimisation_assertion( ( n_boundary_points >= 0) && + CGAL_assertion( ( n_boundary_points >= 0) && ( n_boundary_points <= 5) ); } // keeps g++ happy return( CGAL::Bounded_side( 0)); @@ -298,7 +298,7 @@ class _Min_ellipse_2_adapterC2__Ellipse { || ( ( conic1 == e.conic2) && ( conic2 == e.conic1))); default: - CGAL_optimisation_assertion( ( n_boundary_points >= 0) + CGAL_assertion( ( n_boundary_points >= 0) && ( n_boundary_points <= 5)); } // keeps g++ happy return( false); @@ -341,7 +341,7 @@ operator << ( std::ostream& os, case CGAL::IO::BINARY: break; default: - CGAL_optimisation_assertion_msg( false, + CGAL_assertion_msg( false, "CGAL::IO::get_mode( os) invalid!"); break; } @@ -405,7 +405,7 @@ operator >> ( std::istream& is, break; default: - CGAL_optimisation_assertion_msg( false, + CGAL_assertion_msg( false, "CGAL::IO::mode invalid!"); break; } diff --git a/Bounding_volumes/include/CGAL/Min_ellipse_2/Min_ellipse_2_adapterH2.h b/Bounding_volumes/include/CGAL/Min_ellipse_2/Min_ellipse_2_adapterH2.h index f971e915fc4..22c12492b8d 100644 --- a/Bounding_volumes/include/CGAL/Min_ellipse_2/Min_ellipse_2_adapterH2.h +++ b/Bounding_volumes/include/CGAL/Min_ellipse_2/Min_ellipse_2_adapterH2.h @@ -18,7 +18,7 @@ // includes # include -# include +# include namespace CGAL { @@ -243,7 +243,7 @@ class _Min_ellipse_2_adapterH2__Ellipse { int tau_star = c.vol_derivative( dr, ds, dt, du, dv, dw); return( CGAL::Bounded_side( CGAL_NTS sign( tau_star))); } } default: - CGAL_optimisation_assertion( ( n_boundary_points >= 0) && + CGAL_assertion( ( n_boundary_points >= 0) && ( n_boundary_points <= 5) ); } // keeps g++ happy return( CGAL::Bounded_side( 0)); @@ -306,7 +306,7 @@ class _Min_ellipse_2_adapterH2__Ellipse { || ( ( conic1 == e.conic2) && ( conic2 == e.conic1))); default: - CGAL_optimisation_assertion( ( n_boundary_points >= 0) + CGAL_assertion( ( n_boundary_points >= 0) && ( n_boundary_points <= 5)); } // keeps g++ happy return( false); @@ -349,7 +349,7 @@ operator << ( std::ostream& os, case CGAL::IO::BINARY: break; default: - CGAL_optimisation_assertion_msg( false, + CGAL_assertion_msg( false, "CGAL::IO::get_mode( os) invalid!"); break; } @@ -413,7 +413,7 @@ operator >> ( std::istream& is, break; default: - CGAL_optimisation_assertion_msg( false, + CGAL_assertion_msg( false, "CGAL::IO::mode invalid!"); break; } diff --git a/Bounding_volumes/include/CGAL/Min_ellipse_2/Min_ellipse_2_impl.h b/Bounding_volumes/include/CGAL/Min_ellipse_2/Min_ellipse_2_impl.h index 708c6644d9c..d7bd821350e 100644 --- a/Bounding_volumes/include/CGAL/Min_ellipse_2/Min_ellipse_2_impl.h +++ b/Bounding_volumes/include/CGAL/Min_ellipse_2/Min_ellipse_2_impl.h @@ -60,7 +60,7 @@ operator << ( std::ostream& os, break; default: - CGAL_optimisation_assertion_msg( false, + CGAL_assertion_msg( false, "CGAL::IO::get_mode( os) invalid!"); break; } @@ -89,7 +89,7 @@ operator >> ( std::istream& is, CGAL::Min_ellipse_2& min_ellipse) break; default: - CGAL_optimisation_assertion_msg( false, "CGAL::IO::mode invalid!"); + CGAL_assertion_msg( false, "CGAL::IO::mode invalid!"); break; } return( is); diff --git a/Bounding_volumes/include/CGAL/Min_ellipse_2/Optimisation_ellipse_2.h b/Bounding_volumes/include/CGAL/Min_ellipse_2/Optimisation_ellipse_2.h index ef343d86c91..54c72de0678 100644 --- a/Bounding_volumes/include/CGAL/Min_ellipse_2/Optimisation_ellipse_2.h +++ b/Bounding_volumes/include/CGAL/Min_ellipse_2/Optimisation_ellipse_2.h @@ -17,7 +17,7 @@ #include -#include +#include #include @@ -131,7 +131,7 @@ class Optimisation_ellipse_2 { set( const Point& p, const Point& q) { n_boundary_points = 2; - CGAL_optimisation_precondition(boundary_point1 == p); CGAL_USE(p); + CGAL_precondition(boundary_point1 == p); CGAL_USE(p); boundary_point2 = q; } @@ -139,20 +139,20 @@ class Optimisation_ellipse_2 { set( const Point& p1, const Point& p2, const Point& p3) { n_boundary_points = 3; - CGAL_optimisation_precondition(boundary_point1 == p1); - CGAL_optimisation_precondition(boundary_point2 == p2); + CGAL_precondition(boundary_point1 == p1); + CGAL_precondition(boundary_point2 == p2); boundary_point3 = p3; helper_conic.set_ellipse( p1, p2, p3); - CGAL_optimisation_assertion(helper_conic.is_ellipse()); + CGAL_assertion(helper_conic.is_ellipse()); } void set( const Point& p1, const Point& p2, const Point& p3, const Point& p4) { n_boundary_points = 4; - CGAL_optimisation_precondition(boundary_point1 == p1); - CGAL_optimisation_precondition(boundary_point2 == p2); - CGAL_optimisation_precondition(boundary_point3 == p3); + CGAL_precondition(boundary_point1 == p1); + CGAL_precondition(boundary_point2 == p2); + CGAL_precondition(boundary_point3 == p3); boundary_point4 = p4; Conic::set_two_linepairs( p1, p2, p3, p4, conic1, conic2); @@ -195,7 +195,7 @@ class Optimisation_ellipse_2 { if (!helper_ellipse_set) { helper_ellipse.set_ellipse( conic1, conic2); helper_ellipse.analyse(); - CGAL_optimisation_assertion (helper_ellipse.is_ellipse()); + CGAL_assertion (helper_ellipse.is_ellipse()); helper_ellipse_set= true; } } @@ -211,14 +211,14 @@ class Optimisation_ellipse_2 { // In that case, helper_conic is already correct, // but in general, this optimization is NOT valid. n_boundary_points = 5; - CGAL_optimisation_assertion(helper_conic.is_ellipse()); + CGAL_assertion(helper_conic.is_ellipse()); // the following assertion is too strict if we run under // double (which is sometimes the case, e.g. in demos) - // CGAL_optimisation_assertion(helper_conic.has_on_boundary(p5)); - CGAL_optimisation_precondition(boundary_point1 == p1); - CGAL_optimisation_precondition(boundary_point2 == p2); - CGAL_optimisation_precondition(boundary_point3 == p3); - CGAL_optimisation_precondition(boundary_point4 == p4); + // CGAL_assertion(helper_conic.has_on_boundary(p5)); + CGAL_precondition(boundary_point1 == p1); + CGAL_precondition(boundary_point2 == p2); + CGAL_precondition(boundary_point3 == p3); + CGAL_precondition(boundary_point4 == p4); CGAL_USE(p1); CGAL_USE(p2); CGAL_USE(p3); CGAL_USE(p4); boundary_point5 = p5; } @@ -247,7 +247,7 @@ class Optimisation_ellipse_2 { double &u, double &v, double &w) const { // just like double_conic, but we only get the coefficients - CGAL_optimisation_precondition( ! is_degenerate()); + CGAL_precondition( ! is_degenerate()); if ( n_boundary_points == 4) { set_e_values(); @@ -297,7 +297,7 @@ class Optimisation_ellipse_2 { || ( ( conic1 == e.conic2) && ( conic2 == e.conic1))); default: - CGAL_optimisation_assertion( ( n_boundary_points >= 0) + CGAL_assertion( ( n_boundary_points >= 0) && ( n_boundary_points <= 5)); } // keeps g++ happy return( false); @@ -343,7 +343,7 @@ class Optimisation_ellipse_2 { helper_conic.vol_derivative( dr, ds, dt, du, dv, dw); return( CGAL::Bounded_side( CGAL_NTS sign( tau_star))); } } default: - CGAL_optimisation_assertion( ( n_boundary_points >= 0) && + CGAL_assertion( ( n_boundary_points >= 0) && ( n_boundary_points <= 5) ); } // keeps g++ happy return( CGAL::Bounded_side( 0)); @@ -416,7 +416,7 @@ class Optimisation_ellipse_2 { return (CGAL::ZERO == (c.vol_derivative(dr, ds, dt, du, dv, dw))); } default: - CGAL_optimisation_assertion( ( n_boundary_points >= 0) && + CGAL_assertion( ( n_boundary_points >= 0) && ( n_boundary_points <= 5) ); return false; } diff --git a/Bounding_volumes/include/CGAL/Min_ellipse_2/Optimisation_ellipse_2_impl.h b/Bounding_volumes/include/CGAL/Min_ellipse_2/Optimisation_ellipse_2_impl.h index f2b1d2e8e87..4f94bbe4047 100644 --- a/Bounding_volumes/include/CGAL/Min_ellipse_2/Optimisation_ellipse_2_impl.h +++ b/Bounding_volumes/include/CGAL/Min_ellipse_2/Optimisation_ellipse_2_impl.h @@ -43,7 +43,7 @@ operator << ( std::ostream& os, const CGAL::Optimisation_ellipse_2& e) case CGAL::IO::BINARY: break; default: - CGAL_optimisation_assertion_msg( false, + CGAL_assertion_msg( false, "CGAL::IO::get_mode( os) invalid!"); break; } @@ -106,7 +106,7 @@ operator >> ( std::istream& is, CGAL::Optimisation_ellipse_2& e) break; default: - CGAL_optimisation_assertion_msg( false, + CGAL_assertion_msg( false, "CGAL::IO::get_mode( is) invalid!"); break; } diff --git a/Bounding_volumes/include/CGAL/Min_quadrilateral_traits_2.h b/Bounding_volumes/include/CGAL/Min_quadrilateral_traits_2.h index 9fd4c66ec0b..d3ad2595068 100644 --- a/Bounding_volumes/include/CGAL/Min_quadrilateral_traits_2.h +++ b/Bounding_volumes/include/CGAL/Min_quadrilateral_traits_2.h @@ -18,7 +18,7 @@ #include -#include +#include #include #include #include @@ -303,36 +303,36 @@ public: if (assign(tmp, tmpo)) { *o++ = tmp; } else { - CGAL_optimisation_assertion_code(bool test1 =) + CGAL_assertion_code(bool test1 =) assign(tmpl, tmpo); - CGAL_optimisation_assertion(test1); + CGAL_assertion(test1); *o++ = r.p1; } tmpo = isec(line(r.p3, r.d1), line(r.p2, r.d2)); if (assign(tmp, tmpo)) { *o++ = tmp; } else { - CGAL_optimisation_assertion_code(bool test1 =) + CGAL_assertion_code(bool test1 =) assign(tmpl, tmpo); - CGAL_optimisation_assertion(test1); + CGAL_assertion(test1); *o++ = r.p2; } tmpo = isec(line(r.p3, r.d1), line(r.p4, r.d2)); if (assign(tmp, tmpo)) { *o++ = tmp; } else { - CGAL_optimisation_assertion_code(bool test1 =) + CGAL_assertion_code(bool test1 =) assign(tmpl, tmpo); - CGAL_optimisation_assertion(test1); + CGAL_assertion(test1); *o++ = r.p3; } tmpo = isec(line(r.p1, r.d1), line(r.p4, r.d2)); if (assign(tmp, tmpo)) { *o++ = tmp; } else { - CGAL_optimisation_assertion_code(bool test1 =) + CGAL_assertion_code(bool test1 =) assign(tmpl, tmpo); - CGAL_optimisation_assertion(test1); + CGAL_assertion(test1); *o++ = r.p3; } return o; diff --git a/Bounding_volumes/include/CGAL/Min_sphere_d.h b/Bounding_volumes/include/CGAL/Min_sphere_d.h index 96d11c86368..e76b989b39a 100644 --- a/Bounding_volumes/include/CGAL/Min_sphere_d.h +++ b/Bounding_volumes/include/CGAL/Min_sphere_d.h @@ -26,7 +26,7 @@ # include -# include +# include # include @@ -110,7 +110,7 @@ public: #endif if (points.size()>0) { d = tco.access_dimension_d_object() (points.front()); - CGAL_optimisation_precondition ((d>=0) && all_points_have_dim(d)); + CGAL_precondition ((d>=0) && all_points_have_dim(d)); ms_basis.get_sphere(Rep_tag()).set_size (d); pivot_ms(); } @@ -137,7 +137,7 @@ public: #endif if (points.size()>0) { d = tco.access_dimension_d_object() (points.front()); - CGAL_optimisation_precondition ((d>=0) && all_points_have_dim(d)); + CGAL_precondition ((d>=0) && all_points_have_dim(d)); ms_basis.get_sphere(Rep_tag()).set_size (d); pivot_ms(); } @@ -211,13 +211,13 @@ public: Point center () const { - CGAL_optimisation_precondition (!is_empty()); + CGAL_precondition (!is_empty()); return ms_basis.get_sphere(Rep_tag()).center(); } FT squared_radius () const { - CGAL_optimisation_precondition (!is_empty()); + CGAL_precondition (!is_empty()); return ms_basis.get_sphere(Rep_tag()).squared_radius(); } @@ -227,7 +227,7 @@ public: if (d == -1) return ON_UNBOUNDED_SIDE; else { - CGAL_optimisation_precondition + CGAL_precondition (d == tco.access_dimension_d_object()(p)); return (Bounded_side (-CGAL::sign (ms_basis.get_sphere(Rep_tag()).excess (p)))); @@ -239,7 +239,7 @@ public: if (d == -1) return false; else { - CGAL_optimisation_precondition + CGAL_precondition (d == tco.access_dimension_d_object()(p)); return (CGAL_NTS is_negative (ms_basis.get_sphere(Rep_tag()).excess (p))); } @@ -250,7 +250,7 @@ public: if (d == -1) return true; else { - CGAL_optimisation_precondition + CGAL_precondition (d == tco.access_dimension_d_object()(p)); return (CGAL_NTS is_positive (ms_basis.get_sphere(Rep_tag()).excess (p))); } @@ -261,7 +261,7 @@ public: if (d == -1) return false; else { - CGAL_optimisation_precondition + CGAL_precondition (d == tco.access_dimension_d_object()(p)); return (CGAL_NTS is_zero (ms_basis.get_sphere(Rep_tag()).excess (p))); } @@ -296,7 +296,7 @@ public: support_end = points.begin(); if (points.size()>0) { d = tco.access_dimension_d_object() (points.front()); - CGAL_optimisation_precondition ((d>=0) && all_points_have_dim (d)); + CGAL_precondition ((d>=0) && all_points_have_dim (d)); ms_basis.get_sphere(Rep_tag()).set_size (d); pivot_ms(); } else { @@ -310,7 +310,7 @@ public: if (has_on_unbounded_side (p)) { if (is_empty()) { d = tco.access_dimension_d_object() (p); - CGAL_optimisation_precondition (d>=0); + CGAL_precondition (d>=0); ms_basis.get_sphere(Rep_tag()).set_size (d); } // ensure precondition of pivot_ms diff --git a/Bounding_volumes/include/CGAL/Min_sphere_d/Min_sphere_d_impl.h b/Bounding_volumes/include/CGAL/Min_sphere_d/Min_sphere_d_impl.h index 0415adbf47f..17231e575e4 100644 --- a/Bounding_volumes/include/CGAL/Min_sphere_d/Min_sphere_d_impl.h +++ b/Bounding_volumes/include/CGAL/Min_sphere_d/Min_sphere_d_impl.h @@ -62,7 +62,7 @@ operator << ( std::ostream& os, const Min_sphere_d& min_sphere) break; default: - CGAL_optimisation_assertion_msg + CGAL_assertion_msg ( false, "IO::get_mode( os) invalid!"); break; } @@ -93,7 +93,7 @@ operator >> ( std::istream& is, Min_sphere_d& min_sphere) } break; default: - CGAL_optimisation_assertion_msg( false, "IO::mode invalid!"); + CGAL_assertion_msg( false, "IO::mode invalid!"); break; } diff --git a/Bounding_volumes/include/CGAL/Min_sphere_d/Optimisation_sphere_d.h b/Bounding_volumes/include/CGAL/Min_sphere_d/Optimisation_sphere_d.h index 02c554f9610..8e10f2b499c 100644 --- a/Bounding_volumes/include/CGAL/Min_sphere_d/Optimisation_sphere_d.h +++ b/Bounding_volumes/include/CGAL/Min_sphere_d/Optimisation_sphere_d.h @@ -42,7 +42,7 @@ class Optimisation_sphere_d; #include - #include + #include namespace CGAL { @@ -188,7 +188,7 @@ class Optimisation_sphere_d; // compute z FT z = FT_(2)*v_basis[m+1] - prod(v,x,m+1); - CGAL_optimisation_assertion (!CGAL_NTS is_zero (z)); + CGAL_assertion (!CGAL_NTS is_zero (z)); FT inv_z = FT_(1)/z; // set up A^{-1}_{B^m} @@ -461,7 +461,7 @@ class Optimisation_sphere_d; // compute \tilde{z} RT old_denom = denom[m-1]; RT z = old_denom*RT_(2)*sqr_q_m - prod(v,x,m+1); - CGAL_optimisation_assertion (!CGAL_NTS is_zero (z)); + CGAL_assertion (!CGAL_NTS is_zero (z)); // set up \tilde{A}^{-1}_{B^m} RT** M = inv[m-1]; // \tilde{A}^{-1}_B, old matrix @@ -503,7 +503,7 @@ class Optimisation_sphere_d; // get h_p RT h_p = *(i++); - CGAL_optimisation_precondition (!CGAL_NTS is_zero (h_p)); + CGAL_precondition (!CGAL_NTS is_zero (h_p)); // compute (h_p h D)^2 (c-p)^2 RT sqr_dist(RT(0)); diff --git a/Bounding_volumes/include/CGAL/Rectangular_p_center_traits_2.h b/Bounding_volumes/include/CGAL/Rectangular_p_center_traits_2.h index bc93c75bf74..d096b37c88f 100644 --- a/Bounding_volumes/include/CGAL/Rectangular_p_center_traits_2.h +++ b/Bounding_volumes/include/CGAL/Rectangular_p_center_traits_2.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include namespace CGAL { @@ -228,21 +228,21 @@ struct Rectangular_p_center_matrix_search_traits_2 { bool operator()(FT v) { - CGAL_optimisation_assertion(ld.size() == ld_size); + CGAL_assertion(ld.size() == ld_size); ld.r = v / FT(2); bool ok; pf(ld, Wastebasket< Point_2 >(), ok); - CGAL_optimisation_assertion(ld.size() == ld_size); + CGAL_assertion(ld.size() == ld_size); return ok; } template < class OutputIterator > OutputIterator operator()(FT v, OutputIterator o, bool& ok) { - CGAL_optimisation_assertion(ld.size() == ld_size); + CGAL_assertion(ld.size() == ld_size); ld.r = v / FT(2); OutputIterator n = pf(ld, o, ok); - CGAL_optimisation_assertion(ld.size() == ld_size); + CGAL_assertion(ld.size() == ld_size); return n; //pf(ld, o, ok); } @@ -250,7 +250,7 @@ protected: // data members: LD ld; PiercingFunction pf; - CGAL_optimisation_assertion_code(typename LD::size_type ld_size;) + CGAL_assertion_code(typename LD::size_type ld_size;) // copying this would be too inefficient Rectangular_p_center_matrix_search_traits_2( diff --git a/Bounding_volumes/include/CGAL/min_quadrilateral_2.h b/Bounding_volumes/include/CGAL/min_quadrilateral_2.h index dfa0eb1e30c..081520c0846 100644 --- a/Bounding_volumes/include/CGAL/min_quadrilateral_2.h +++ b/Bounding_volumes/include/CGAL/min_quadrilateral_2.h @@ -18,7 +18,7 @@ #include -#include +#include #include #include @@ -346,8 +346,8 @@ min_rectangle_2( { typedef Optimisation::Min_quadrilateral_traits_wrapper Traits; Traits t(bt); - CGAL_optimisation_expensive_precondition(is_convex_2(f, l, t)); - CGAL_optimisation_expensive_precondition( + CGAL_expensive_precondition(is_convex_2(f, l, t)); + CGAL_expensive_precondition( orientation_2(f, l, t) == COUNTERCLOCKWISE); // check for trivial cases @@ -395,7 +395,7 @@ min_rectangle_2( int yet_to_finish = 0; for (int i1 = 0; i1 < 4; ++i1) { - CGAL_optimisation_assertion(limit[i1] != l); + CGAL_assertion(limit[i1] != l); if (curr[i1] != limit[i1]) ++yet_to_finish; } @@ -448,7 +448,7 @@ min_parallelogram_2(ForwardIterator f, { typedef Optimisation::Min_quadrilateral_traits_wrapper Traits; Traits t(bt); - CGAL_optimisation_expensive_precondition(is_convex_2(f, l, t)); + CGAL_expensive_precondition(is_convex_2(f, l, t)); // types from the traits class typedef typename Traits::Direction_2 Direction_2; @@ -630,7 +630,7 @@ min_strip_2(ForwardIterator f, { typedef Optimisation::Min_quadrilateral_traits_wrapper Traits; Traits t(bt); - CGAL_optimisation_expensive_precondition(is_convex_2(f, l, t)); + CGAL_expensive_precondition(is_convex_2(f, l, t)); // types from the traits class typedef typename Traits::Direction_2 Direction_2; diff --git a/Bounding_volumes/include/CGAL/pierce_rectangles_2.h b/Bounding_volumes/include/CGAL/pierce_rectangles_2.h index ebaf8081e1c..8a7f3560a38 100644 --- a/Bounding_volumes/include/CGAL/pierce_rectangles_2.h +++ b/Bounding_volumes/include/CGAL/pierce_rectangles_2.h @@ -16,7 +16,7 @@ #include -#include +#include #include #include #include @@ -75,7 +75,7 @@ struct Loc_domain { void update(int j, Citerator i) { - CGAL_optimisation_precondition(j >= 0 && j < 4); + CGAL_precondition(j >= 0 && j < 4); if (j < 2) if (j == 0) { if (traits.less_x_2_object()(*i, minx)) minx = *i; @@ -106,9 +106,9 @@ struct Loc_domain { maxy(pts.front()), traits(t) { - CGAL_optimisation_precondition(b != e); + CGAL_precondition(b != e); Iterator i = pts.begin(); - CGAL_optimisation_assertion(i != pts.end()); + CGAL_assertion(i != pts.end()); while (++i != pts.end()) { if (traits.less_x_2_object()(*i, minx)) minx = *i; if (traits.less_x_2_object()(maxx, *i)) maxx = *i; @@ -124,7 +124,7 @@ struct Loc_domain { operator[](int i) const // return corner points (0 <-> bottom-left, 1 <-> bottom-right) { - CGAL_optimisation_precondition(i >= 0 && i < 4); + CGAL_precondition(i >= 0 && i < 4); if (i == 0) return traits.construct_point_2_above_right_implicit_point_2_object()( minx, miny, r); @@ -142,7 +142,7 @@ struct Loc_domain { extreme(int i) const // return extreme points (0 <-> left, 1 <-> bottom) { - CGAL_optimisation_precondition(i >= 0 && i < 4); + CGAL_precondition(i >= 0 && i < 4); if (i > 1) return i == 2 ? maxx : maxy; return i == 0 ? minx : miny; } @@ -151,7 +151,7 @@ struct Loc_domain { extreme(int i) // return extreme points (0 <-> left, 1 <-> bottom) { - CGAL_optimisation_precondition(i >= 0 && i < 4); + CGAL_precondition(i >= 0 && i < 4); if (i > 1) return i == 2 ? maxx : maxy; return i == 0 ? minx : miny; } @@ -177,13 +177,13 @@ struct Loc_domain { void check() const { - CGAL_optimisation_expensive_assertion_code( + CGAL_expensive_assertion_code( Iterator i = pts.begin(); do { - CGAL_optimisation_assertion(!traits.less_x_2_object()(*i, minx)); - CGAL_optimisation_assertion(!traits.less_x_2_object()(maxx, *i)); - CGAL_optimisation_assertion(!traits.less_y_2_object()(*i, miny)); - CGAL_optimisation_assertion(!traits.less_y_2_object()(maxy, *i)); + CGAL_assertion(!traits.less_x_2_object()(*i, minx)); + CGAL_assertion(!traits.less_x_2_object()(maxx, *i)); + CGAL_assertion(!traits.less_y_2_object()(*i, miny)); + CGAL_assertion(!traits.less_y_2_object()(maxy, *i)); } while (++i != end); ) } @@ -463,7 +463,7 @@ inline OutputIterator two_cover_points( InputIC f, InputIC l, OutputIterator o, bool& ok, const Traits& t) { - CGAL_optimisation_precondition(f != l); + CGAL_precondition(f != l); // compute location domain: Loc_domain< Traits > d(f, l, t); @@ -475,7 +475,7 @@ inline OutputIterator three_cover_points( InputIC f, InputIC l, OutputIterator o, bool& ok, const Traits& t) { - CGAL_optimisation_precondition(f != l); + CGAL_precondition(f != l); // compute location domain: Loc_domain< Traits > d(f, l, t); @@ -487,7 +487,7 @@ inline OutputIterator four_cover_points( InputIC f, InputIC l, OutputIterator o, bool& ok, const Traits& t) { - CGAL_optimisation_precondition(f != l); + CGAL_precondition(f != l); // compute location domain: Loc_domain< Traits > d(f, l, t); @@ -562,7 +562,7 @@ three_cover_points( using std::less; using std::iter_swap; - CGAL_optimisation_precondition(!d.empty()); + CGAL_precondition(!d.empty()); // typedefs: typedef typename Traits::Point_2 Point_2; @@ -583,7 +583,7 @@ three_cover_points( // are all points already covered? if (i == d.end()) { - CGAL_optimisation_assertion(k == 0); + CGAL_assertion(k == 0); *o++ = d[0]; ok = true; return o; @@ -620,11 +620,11 @@ three_cover_points( // check disjoint for two-pierceability: - CGAL_optimisation_expensive_assertion( + CGAL_expensive_assertion( save_end == find_if(d.end(), save_end, [&d, &dist, &corner](const Point_2& p) { return d.r < dist(corner, p); })); - CGAL_optimisation_expensive_assertion( + CGAL_expensive_assertion( d.end() == find_if(d.begin(), d.end(), [&d,&dist, &corner](const Point_2& p) { return d.r >= dist(corner, p); })); @@ -721,7 +721,7 @@ four_cover_points(Staircases< Traits >& d, OutputIterator o, bool& ok) // are all points already covered? if (i == d.end()) { - CGAL_optimisation_assertion(k == 0); + CGAL_assertion(k == 0); *o++ = d[0]; ok = true; return o; @@ -758,11 +758,11 @@ four_cover_points(Staircases< Traits >& d, OutputIterator o, bool& ok) // check disjoint for two-pierceability: - CGAL_optimisation_expensive_assertion( + CGAL_expensive_assertion( save_end == find_if(d.end(), save_end, [&d,&dist,&corner](const Point_2& p) { return d.r < dist(corner, p); })); - CGAL_optimisation_expensive_assertion( + CGAL_expensive_assertion( d.end() == find_if(d.begin(), d.end(), [&d,&dist,&corner](const Point_2& p) { return d.r >= dist(corner, p); })); diff --git a/Bounding_volumes/include/CGAL/rectangular_3_center_2.h b/Bounding_volumes/include/CGAL/rectangular_3_center_2.h index cd3a1f14bee..a75118764b7 100644 --- a/Bounding_volumes/include/CGAL/rectangular_3_center_2.h +++ b/Bounding_volumes/include/CGAL/rectangular_3_center_2.h @@ -17,7 +17,7 @@ #include -#include +#include #include #include #include @@ -965,7 +965,7 @@ rectangular_3_center_2_type2( (Q_r_empty || op.compute_y_distance(q_r, Q_r) <= op.delta()(*m))) { boost::function1 greater_delta_m = boost::bind(less< FT >(), op.delta()(*m)); - CGAL_optimisation_assertion_code(RandomAccessIterator iii =) + CGAL_assertion_code(RandomAccessIterator iii =) find_if(e, l, boost::bind(logical_and< bool >(), @@ -973,7 +973,7 @@ rectangular_3_center_2_type2( boost::bind(op.distance(), q_t, _1)), boost::bind(greater_delta_m, boost::bind(op.distance(), q_r, _1)))); - CGAL_optimisation_assertion(iii == l); + CGAL_assertion(iii == l); } // check whether the points in [f,s) are covered { @@ -985,7 +985,7 @@ rectangular_3_center_2_type2( boost::bind(le_delta_m, boost::bind(op.distance(), q_t, _1))); iii = partition(iii, s, boost::bind(le_delta_m, boost::bind(op.distance(), q_r, _1))); - CGAL_optimisation_assertion(iii == s); + CGAL_assertion(iii == s); } #endif // CGAL_3COVER_CHECK @@ -1052,7 +1052,7 @@ rectangular_3_center_2_type2( } // step (e) [not enough points in G] - CGAL_optimisation_assertion(b1 - (m + 1) >= 5 * cutoff); + CGAL_assertion(b1 - (m + 1) >= 5 * cutoff); // compute the four cutting lines for R std::nth_element(m + 1, m + 1 + cutoff, b1, less_x_2); @@ -1113,7 +1113,7 @@ rectangular_3_center_2_type2( // now s_b corresponds to the first moment in [s, m+1) // where q_t and q_r cover B - CGAL_optimisation_assertion_code(bool loopcheck = false;) + CGAL_assertion_code(bool loopcheck = false;) CGAL_3CENTER_REPEAT_CHECK: // place q_t and q_r q_t = op.place_x_square(q_t_afap, r, op.delta()(*s_b)); @@ -1142,9 +1142,9 @@ CGAL_3CENTER_REPEAT_CHECK: // in degenerate situations it can happen that the number of // points in R is too small => decrease radius and check again --s_b; - CGAL_optimisation_assertion(!loopcheck); - CGAL_optimisation_assertion(s != s_b); - CGAL_optimisation_assertion_code(loopcheck = true;) + CGAL_assertion(!loopcheck); + CGAL_assertion(s != s_b); + CGAL_assertion_code(loopcheck = true;) goto CGAL_3CENTER_REPEAT_CHECK; } s = b1; @@ -1166,7 +1166,7 @@ CGAL_3CENTER_REPEAT_CHECK: // we still have a covering if (s_b == s) { - CGAL_optimisation_expensive_assertion_code( + CGAL_expensive_assertion_code( std::vector< Point > tmppts(f, l); RandomAccessIterator ii = partition(tmppts.begin(), tmppts.end(), @@ -1174,9 +1174,9 @@ CGAL_3CENTER_REPEAT_CHECK: IP tmppos = min_max_element(ii, tmppts.end(), op.compare_x(), op.compare_y()); ) - CGAL_optimisation_expensive_assertion( + CGAL_expensive_assertion( !op.compare_x()(*tmppos.first, q_t)); - CGAL_optimisation_expensive_assertion( + CGAL_expensive_assertion( !op.compare_y()(q_r, *tmppos.second)); // we are done @@ -1219,7 +1219,7 @@ CGAL_3CENTER_REPEAT_CHECK: [&op, s_b](const Point& p){ return op.delta()(*s_b) != op.delta()(p); }); rho_max = op.delta()(*s_b); q_t_at_rho_max = q_t, q_r_at_rho_max = q_r; - CGAL_optimisation_assertion(op.delta()(*next) < op.delta()(*s_b)); + CGAL_assertion(op.delta()(*next) < op.delta()(*s_b)); q_t_afap = op.update_x_square(q_t_afap, *s_b); q_r_afap = op.update_y_square(q_r_afap, *s_b); q_t = op.place_x_square(q_t_afap, r, op.delta()(*next)); @@ -1255,7 +1255,7 @@ CGAL_3CENTER_REPEAT_CHECK: } - CGAL_optimisation_assertion(b3 - b1 >= cutoff); + CGAL_assertion(b3 - b1 >= cutoff); e = b1; // adjust Q_t if (b1 != b2) { @@ -1299,7 +1299,7 @@ CGAL_3CENTER_REPEAT_CHECK: rho_max = max BOOST_PREVENT_MACRO_SUBSTITUTION (op.compute_x_distance(q_t, Q_t), op.compute_y_distance(q_r, Q_r)); #ifndef CGAL_3COVER_NO_CHECK_OPTIMUM_FIRST - CGAL_optimisation_assertion(rho_max <= rad); + CGAL_assertion(rho_max <= rad); #endif // ! CGAL_3COVER_NO_CHECK_OPTIMUM_FIRST rad = rho_max; *o++ = op.construct_corner_square(r, rad / FT(2)); @@ -1307,7 +1307,7 @@ CGAL_3CENTER_REPEAT_CHECK: *o++ = op.construct_y_square(q_r, rad / FT(2)); return o; } - CGAL_optimisation_assertion(s != e); + CGAL_assertion(s != e); // find the first diameter where covering is possible for (;;) { @@ -1324,7 +1324,7 @@ CGAL_3CENTER_REPEAT_CHECK: // try the next possible diameter value FT try_rho = op.delta()(*t); - CGAL_optimisation_assertion(t == s || try_rho < rho_max); + CGAL_assertion(t == s || try_rho < rho_max); q_t = op.place_x_square(q_t_afap, r, try_rho); q_r = op.place_y_square(q_r_afap, r, try_rho); @@ -1370,8 +1370,8 @@ CGAL_3CENTER_REPEAT_CHECK: // - q_r_at_rho_max is the corr. position of q_r. // try rho_min - CGAL_optimisation_assertion(rho_min <= rho_max); - CGAL_optimisation_assertion(rho_min >= 0); + CGAL_assertion(rho_min <= rho_max); + CGAL_assertion(rho_min >= 0); FT rad_2 = q_t_q_r_cover_at_rho_min; if (s_at_rho_min != e_at_rho_min) { auto mydist = [&q_t_at_rho_min, &q_r_at_rho_min, &op](const Point& p) @@ -1384,7 +1384,7 @@ CGAL_3CENTER_REPEAT_CHECK: [&mydist](const Point& p1, const Point& p2) { return mydist(p1) < mydist(p2); }))); } - CGAL_optimisation_assertion(rad_2 == 0 || rad_2 > rho_min); + CGAL_assertion(rad_2 == 0 || rad_2 > rho_min); // if a covering with rho == 0 is possible, // it will be catched in the type1 functions @@ -1397,7 +1397,7 @@ CGAL_3CENTER_REPEAT_CHECK: q_t = q_t_at_rho_min, q_r = q_r_at_rho_min; #ifndef CGAL_3COVER_NO_CHECK_OPTIMUM_FIRST - CGAL_optimisation_assertion(rad_2 <= rad); + CGAL_assertion(rad_2 <= rad); #endif // ! CGAL_3COVER_NO_CHECK_OPTIMUM_FIRST rad = rad_2; *o++ = op.construct_corner_square(r, rad / FT(2)); @@ -1414,7 +1414,7 @@ rectangular_3_center_2( typename Traits::FT& r, Traits& t) { - CGAL_optimisation_precondition(f != l); + CGAL_precondition(f != l); typedef typename Traits::FT FT; typedef typename Traits::Point_2 Point; typedef typename Traits::Iso_rectangle_2 Rectangle; diff --git a/Bounding_volumes/include/CGAL/rectangular_p_center_2.h b/Bounding_volumes/include/CGAL/rectangular_p_center_2.h index 1d680e9572f..78ec4b6e9cb 100644 --- a/Bounding_volumes/include/CGAL/rectangular_p_center_2.h +++ b/Bounding_volumes/include/CGAL/rectangular_p_center_2.h @@ -72,8 +72,8 @@ public: Value operator()( int r, int c) const { - CGAL_optimisation_precondition( r >= 0 && r < number_of_rows()); - CGAL_optimisation_precondition( c >= 0 && c < number_of_columns()); + CGAL_precondition( r >= 0 && r < number_of_rows()); + CGAL_precondition( c >= 0 && c < number_of_columns()); return Base::operator()( r, number_of_columns() - 1 - c); } }; @@ -145,7 +145,7 @@ rectangular_p_center_2_binary_search( // -------------- // { - CGAL_optimisation_precondition( f != l); + CGAL_precondition( f != l); // typedefs: typedef typename Traits::FT FT; @@ -171,7 +171,7 @@ rectangular_p_center_2_binary_search( c_diffs.push_back( CGAL_NTS abs( i->x() - j->x())); c_diffs.push_back( CGAL_NTS abs( i->y() - j->y())); } - CGAL_optimisation_assertion( + CGAL_assertion( c_diffs.size() == pierce_it.number_of_points() * (pierce_it.number_of_points() - 1)); @@ -195,12 +195,12 @@ rectangular_p_center_2_binary_search( b = c + 1; } } // while ( e > b) - CGAL_optimisation_assertion( e == b); + CGAL_assertion( e == b); // return the result: r = c_diffs[e]; OutputIterator o_return( pierce_it( r, o, ok)); - CGAL_optimisation_assertion( ok); + CGAL_assertion( ok); return o_return; } // rectangular_p_center_2_binary_search( ... ) @@ -221,7 +221,7 @@ rectangular_p_center_2_matrix_search( const MatrixOperator& mop) { std::size_t number_of_points( iterator_distance( f, l)); - CGAL_optimisation_precondition( number_of_points > 0); + CGAL_precondition( number_of_points > 0); using std::minus; using std::sort; @@ -296,7 +296,7 @@ rectangular_p_center_2_matrix_search( // return result: OutputIterator o_return(pierce_it(r, o, ok)); - CGAL_optimisation_assertion(ok); + CGAL_assertion(ok); return o_return; } // P_center_matrix_search @@ -341,7 +341,7 @@ rectangular_p_center_matrix_search_2( FT& r, int p) { - CGAL_optimisation_precondition(p >= 2 && p < 5); + CGAL_precondition(p >= 2 && p < 5); typename std::iterator_traits::value_type::R t; if (p == 2) return rectangular_p_center_2_matrix_search( @@ -401,7 +401,7 @@ rectangular_p_center_2(ForwardIterator f, int p, Traits& t) { - CGAL_optimisation_precondition(p >= 2 && p < 5); + CGAL_precondition(p >= 2 && p < 5); r=0; if ( !internal::is_distance_greater_than_p(f,l,p) ) return std::copy(f,l,o); @@ -422,7 +422,7 @@ rectangular_p_center_2(ForwardIterator f, FT& r, int p) { - CGAL_optimisation_precondition(p >= 2 && p < 5); + CGAL_precondition(p >= 2 && p < 5); typedef typename std::iterator_traits< ForwardIterator >::value_type::R R; Rectangular_p_center_default_traits_2< R > t; diff --git a/Convex_hull_2/doc/Convex_hull_2/PackageDescription.txt b/Convex_hull_2/doc/Convex_hull_2/PackageDescription.txt index fd1c27ca210..7fa7625b04f 100644 --- a/Convex_hull_2/doc/Convex_hull_2/PackageDescription.txt +++ b/Convex_hull_2/doc/Convex_hull_2/PackageDescription.txt @@ -53,13 +53,11 @@ upper hull of a set of points. \cgalCRPSection{Assertions} -The assertion flags for the convex hull and extreme point algorithms -use `CH` in their names (e.g., `CGAL_CH_NO_POSTCONDITIONS`). For the convex hull algorithms, the postcondition check tests only convexity (if not disabled), but not containment of the input points in the polygon or polyhedron defined by the output points. The latter is considered an expensive checking and can be enabled by -defining `CGAL_CH_CHECK_EXPENSIVE`. +defining `CGAL_CHECK_EXPENSIVE`. \cgalCRPSection{Concepts} @@ -105,4 +103,3 @@ defining `CGAL_CH_CHECK_EXPENSIVE`. */ - diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_akl_toussaint_impl.h b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_akl_toussaint_impl.h index ae896d3e374..455c2ce3fcf 100644 --- a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_akl_toussaint_impl.h +++ b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_akl_toussaint_impl.h @@ -20,7 +20,7 @@ #include #endif // CGAL_CH_NO_POSTCONDITIONS -#include +#include #include #include #include @@ -252,7 +252,7 @@ ch_akl_toussaint(ForwardIterator first, ForwardIterator last, region3.push_back( *e); region4.push_back( *n); - CGAL_ch_postcondition_code( ForwardIterator save_first = first; ) + CGAL_postcondition_code( ForwardIterator save_first = first; ) int duplicated_exteme_points = (std::get<0>(ranges)==std::get<1>(ranges)?1:0) + (std::get<1>(ranges)==std::get<2>(ranges)?1:0) + @@ -323,12 +323,12 @@ ch_akl_toussaint(ForwardIterator first, ForwardIterator last, res, ch_traits); } - CGAL_ch_postcondition_code( first = save_first; ) - CGAL_ch_postcondition( \ + CGAL_postcondition_code( first = save_first; ) + CGAL_postcondition( \ is_ccw_strongly_convex_2( res.output_so_far_begin(), \ res.output_so_far_end(), \ ch_traits)); - CGAL_ch_expensive_postcondition( \ + CGAL_expensive_postcondition( \ ch_brute_force_check_2( \ first, last, \ res.output_so_far_begin(), res.output_so_far_end(), \ diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_assertions.h b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_assertions.h deleted file mode 100644 index 1706f796e9f..00000000000 --- a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_assertions.h +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) 1999 Max-Planck-Institute Saarbruecken (Germany). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Geert-Jan Giezeman, Sven Schoenherr -// -// Generated from script create_assertions.sh - - -// Note that this header file is intentionnaly not protected with a -// macro (as ). Calling it a second time with another value -// for CGAL_NO_ASSERTIONS for example must make a difference. - -#include - -// macro definitions -// ================= -// assertions -// ---------- - -#undef CGAL_ch_assertion -#undef CGAL_ch_assertion_msg -#undef CGAL_ch_assertion_code - -#if defined(CGAL_CH_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) -# define CGAL_ch_assertion(EX) (static_cast(0)) - -#include - -# define CGAL_ch_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_ch_assertion_code(CODE) -#else -# define CGAL_ch_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_ch_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_ch_assertion_code(CODE) CODE -# define CGAL_ch_assertions 1 -#endif // CGAL_CH_NO_ASSERTIONS - - -#undef CGAL_ch_exactness_assertion -#undef CGAL_ch_exactness_assertion_msg -#undef CGAL_ch_exactness_assertion_code - -#if defined(CGAL_CH_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_ch_exactness_assertion(EX) (static_cast(0)) -# define CGAL_ch_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_ch_exactness_assertion_code(CODE) -#else -# define CGAL_ch_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_ch_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_ch_exactness_assertion_code(CODE) CODE -# define CGAL_ch_exactness_assertions 1 -#endif // CGAL_CH_NO_ASSERTIONS - - -#undef CGAL_ch_expensive_assertion -#undef CGAL_ch_expensive_assertion_msg -#undef CGAL_ch_expensive_assertion_code - -#if defined(CGAL_CH_NO_ASSERTIONS) \ - || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_ch_expensive_assertion(EX) (static_cast(0)) -# define CGAL_ch_expensive_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_ch_expensive_assertion_code(CODE) -#else -# define CGAL_ch_expensive_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_ch_expensive_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_ch_expensive_assertion_code(CODE) CODE -# define CGAL_ch_expensive_assertions 1 -#endif // CGAL_CH_NO_ASSERTIONS - - -#undef CGAL_ch_expensive_exactness_assertion -#undef CGAL_ch_expensive_exactness_assertion_msg -#undef CGAL_ch_expensive_exactness_assertion_code - -#if defined(CGAL_CH_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_ch_expensive_exactness_assertion(EX) (static_cast(0)) -# define CGAL_ch_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_ch_expensive_exactness_assertion_code(CODE) -#else -# define CGAL_ch_expensive_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_ch_expensive_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_ch_expensive_exactness_assertion_code(CODE) CODE -# define CGAL_ch_expensive_exactness_assertions 1 -#endif // CGAL_CH_NO_ASSERTIONS - - -// preconditions -// ------------- - -#undef CGAL_ch_precondition -#undef CGAL_ch_precondition_msg -#undef CGAL_ch_precondition_code - -#if defined(CGAL_CH_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) -# define CGAL_ch_precondition(EX) (static_cast(0)) -# define CGAL_ch_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_ch_precondition_code(CODE) -#else -# define CGAL_ch_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_ch_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_ch_precondition_code(CODE) CODE -# define CGAL_ch_preconditions 1 -#endif // CGAL_CH_NO_PRECONDITIONS - - -#undef CGAL_ch_exactness_precondition -#undef CGAL_ch_exactness_precondition_msg -#undef CGAL_ch_exactness_precondition_code - -#if defined(CGAL_CH_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_ch_exactness_precondition(EX) (static_cast(0)) -# define CGAL_ch_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_ch_exactness_precondition_code(CODE) -#else -# define CGAL_ch_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_ch_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_ch_exactness_precondition_code(CODE) CODE -# define CGAL_ch_exactness_preconditions 1 -#endif // CGAL_CH_NO_PRECONDITIONS - - -#undef CGAL_ch_expensive_precondition -#undef CGAL_ch_expensive_precondition_msg -#undef CGAL_ch_expensive_precondition_code - -#if defined(CGAL_CH_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_ch_expensive_precondition(EX) (static_cast(0)) -# define CGAL_ch_expensive_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_ch_expensive_precondition_code(CODE) -#else -# define CGAL_ch_expensive_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_ch_expensive_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_ch_expensive_precondition_code(CODE) CODE -# define CGAL_ch_expensive_preconditions 1 -#endif // CGAL_CH_NO_PRECONDITIONS - - -#undef CGAL_ch_expensive_exactness_precondition -#undef CGAL_ch_expensive_exactness_precondition_msg -#undef CGAL_ch_expensive_exactness_precondition_code - -#if defined(CGAL_CH_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_ch_expensive_exactness_precondition(EX) (static_cast(0)) -# define CGAL_ch_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_ch_expensive_exactness_precondition_code(CODE) -#else -# define CGAL_ch_expensive_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_ch_expensive_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_ch_expensive_exactness_precondition_code(CODE) CODE -# define CGAL_ch_expensive_exactness_preconditions 1 -#endif // CGAL_CH_NO_PRECONDITIONS - - -// postconditions -// -------------- - -#undef CGAL_ch_postcondition -#undef CGAL_ch_postcondition_msg -#undef CGAL_ch_postcondition_code - -#if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) -# define CGAL_ch_postcondition(EX) (static_cast(0)) -# define CGAL_ch_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_ch_postcondition_code(CODE) -#else -# define CGAL_ch_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_ch_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_ch_postcondition_code(CODE) CODE -# define CGAL_ch_postconditions 1 -#endif // CGAL_CH_NO_POSTCONDITIONS - - -#undef CGAL_ch_exactness_postcondition -#undef CGAL_ch_exactness_postcondition_msg -#undef CGAL_ch_exactness_postcondition_code - -#if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_ch_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_ch_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_ch_exactness_postcondition_code(CODE) -#else -# define CGAL_ch_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_ch_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_ch_exactness_postcondition_code(CODE) CODE -# define CGAL_ch_exactness_postconditions 1 -#endif // CGAL_CH_NO_POSTCONDITIONS - - -#undef CGAL_ch_expensive_postcondition -#undef CGAL_ch_expensive_postcondition_msg -#undef CGAL_ch_expensive_postcondition_code - -#if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_ch_expensive_postcondition(EX) (static_cast(0)) -# define CGAL_ch_expensive_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_ch_expensive_postcondition_code(CODE) -#else -# define CGAL_ch_expensive_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_ch_expensive_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_ch_expensive_postcondition_code(CODE) CODE -# define CGAL_ch_expensive_postconditions 1 -#endif // CGAL_CH_NO_POSTCONDITIONS - - -#undef CGAL_ch_expensive_exactness_postcondition -#undef CGAL_ch_expensive_exactness_postcondition_msg -#undef CGAL_ch_expensive_exactness_postcondition_code - -#if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_ch_expensive_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_ch_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_ch_expensive_exactness_postcondition_code(CODE) -#else -# define CGAL_ch_expensive_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_ch_expensive_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_ch_expensive_exactness_postcondition_code(CODE) CODE -# define CGAL_ch_expensive_exactness_postconditions 1 -#endif // CGAL_CH_NO_POSTCONDITIONS - - -// warnings -// -------- - -#undef CGAL_ch_warning -#undef CGAL_ch_warning_msg -#undef CGAL_ch_warning_code - -#if defined(CGAL_CH_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) -# define CGAL_ch_warning(EX) (static_cast(0)) -# define CGAL_ch_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_ch_warning_code(CODE) -#else -# define CGAL_ch_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_ch_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_ch_warning_code(CODE) CODE -# define CGAL_ch_warnings 1 -#endif // CGAL_CH_NO_WARNINGS - - -#undef CGAL_ch_exactness_warning -#undef CGAL_ch_exactness_warning_msg -#undef CGAL_ch_exactness_warning_code - -#if defined(CGAL_CH_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_ch_exactness_warning(EX) (static_cast(0)) -# define CGAL_ch_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_ch_exactness_warning_code(CODE) -#else -# define CGAL_ch_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_ch_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_ch_exactness_warning_code(CODE) CODE -# define CGAL_ch_exactness_warnings 1 -#endif // CGAL_CH_NO_WARNINGS - - -#undef CGAL_ch_expensive_warning -#undef CGAL_ch_expensive_warning_msg -#undef CGAL_ch_expensive_warning_code - -#if defined(CGAL_CH_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_ch_expensive_warning(EX) (static_cast(0)) -# define CGAL_ch_expensive_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_ch_expensive_warning_code(CODE) -#else -# define CGAL_ch_expensive_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_ch_expensive_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_ch_expensive_warning_code(CODE) CODE -# define CGAL_ch_expensive_warnings 1 -#endif // CGAL_CH_NO_WARNINGS - - -#undef CGAL_ch_expensive_exactness_warning -#undef CGAL_ch_expensive_exactness_warning_msg -#undef CGAL_ch_expensive_exactness_warning_code - -#if defined(CGAL_CH_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_ch_expensive_exactness_warning(EX) (static_cast(0)) -# define CGAL_ch_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_ch_expensive_exactness_warning_code(CODE) -#else -# define CGAL_ch_expensive_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_ch_expensive_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_ch_expensive_exactness_warning_code(CODE) CODE -# define CGAL_ch_expensive_exactness_warnings 1 -#endif // CGAL_CH_NO_WARNINGS diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_bykat_impl.h b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_bykat_impl.h index cd48b9b9e67..180f44f7e7d 100644 --- a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_bykat_impl.h +++ b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_bykat_impl.h @@ -20,7 +20,7 @@ #include #endif // CGAL_CH_NO_POSTCONDITIONS -#include +#include #include #include #include @@ -116,11 +116,11 @@ ch_bykat(InputIterator first, InputIterator last, r = R.back(); R.pop_back(); } } - CGAL_ch_postcondition( \ + CGAL_postcondition( \ is_ccw_strongly_convex_2( res.output_so_far_begin(), \ res.output_so_far_end(), \ ch_traits)); - CGAL_ch_expensive_postcondition( \ + CGAL_expensive_postcondition( \ ch_brute_force_check_2( \ P.begin(), P.end(), \ res.output_so_far_begin(), res.output_so_far_end(), \ @@ -255,11 +255,11 @@ ch_bykat_with_threshold(InputIterator first, InputIterator last, r = R.back(); R.pop_back(); } } - CGAL_ch_postcondition( \ + CGAL_postcondition( \ is_ccw_strongly_convex_2( res.output_so_far_begin(), \ res.output_so_far_end(), \ ch_traits)); - CGAL_ch_expensive_postcondition( \ + CGAL_expensive_postcondition( \ ch_brute_force_check_2( \ Pbegin, Pend, \ res.output_so_far_begin(), res.output_so_far_end(), \ diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_eddy_impl.h b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_eddy_impl.h index c72f79f4c90..0f484f2b72b 100644 --- a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_eddy_impl.h +++ b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_eddy_impl.h @@ -20,7 +20,7 @@ #include #endif // CGAL_CH_NO_POSTCONDITIONS -#include +#include #include #include #include @@ -44,7 +44,7 @@ ch__recursive_eddy(List& L, Left_turn_2 left_turn = ch_traits.left_turn_2_object(); Less_xy_2 less_xy = ch_traits.less_xy_2_object(); - CGAL_ch_precondition( \ + CGAL_precondition( \ std::find_if(a_it, b_it, \ [&left_turn, a_it, b_it](const Point_2& p) { return left_turn(*b_it, *a_it, p); }) \ @@ -137,9 +137,9 @@ ch_eddy(InputIterator first, InputIterator last, ch__recursive_eddy( L, e, w, ch_traits); - CGAL_ch_postcondition( \ + CGAL_postcondition( \ is_ccw_strongly_convex_2( L.begin(), w, ch_traits) ); - CGAL_ch_expensive_postcondition( \ + CGAL_expensive_postcondition( \ ch_brute_force_check_2( first, last, \ L.begin(), w, ch_traits ) ); diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_graham_andrew_impl.h b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_graham_andrew_impl.h index d30fccdc8e3..1fdef8d9d0c 100644 --- a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_graham_andrew_impl.h +++ b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_graham_andrew_impl.h @@ -21,7 +21,7 @@ #include #endif // CGAL_CH_NO_POSTCONDITIONS -#include +#include #include #include #include @@ -42,11 +42,11 @@ ch_graham_andrew_scan( BidirectionalIterator first, BidirectionalIterator alpha; BidirectionalIterator beta; BidirectionalIterator iter; - CGAL_ch_precondition( first != last ); - CGAL_ch_precondition( std::next(first) != last ); + CGAL_precondition( first != last ); + CGAL_precondition( std::next(first) != last ); --last; - CGAL_ch_precondition( *first != *last ); + CGAL_precondition( *first != *last ); S.push_back( last ); S.push_back( first ); Left_turn left_turn = ch_traits.left_turn_2_object(); @@ -78,7 +78,7 @@ ch_graham_andrew_scan( BidirectionalIterator first, alpha = beta; stack_rev_iter = S.rbegin(); beta = *++stack_rev_iter; - CGAL_ch_assertion(S.size() >= 2); + CGAL_assertion(S.size() >= 2); } S.push_back( iter ); beta = alpha; @@ -98,11 +98,11 @@ ch_graham_andrew_scan( BidirectionalIterator first, #endif // no postconditions ... for ( ++stack_iter; stack_iter != S.end(); ++stack_iter) { *res = **stack_iter; ++res; } - CGAL_ch_postcondition( \ + CGAL_postcondition( \ is_ccw_strongly_convex_2( res.output_so_far_begin(), \ res.output_so_far_end(), \ ch_traits)); - CGAL_ch_expensive_postcondition( \ + CGAL_expensive_postcondition( \ ch_brute_force_chain_check_2( \ first, last, \ res.output_so_far_begin(), res.output_so_far_end(), \ @@ -123,7 +123,7 @@ ch__ref_graham_andrew_scan( BidirectionalIterator first, { typedef typename Traits::Left_turn_2 Left_turn; - CGAL_ch_precondition_code( + CGAL_precondition_code( typedef typename Traits::Equal_2 Equal_2; Equal_2 equal_points = ch_traits.equal_2_object(); ) @@ -134,11 +134,11 @@ ch__ref_graham_andrew_scan( BidirectionalIterator first, BidirectionalIterator alpha; BidirectionalIterator beta; BidirectionalIterator iter; - CGAL_ch_precondition( first != last ); - CGAL_ch_precondition( std::next(first) != last ); + CGAL_precondition( first != last ); + CGAL_precondition( std::next(first) != last ); --last; - CGAL_ch_precondition(! equal_points(*first,*last) ); + CGAL_precondition(! equal_points(*first,*last) ); S.push_back( last ); S.push_back( first ); @@ -168,7 +168,7 @@ ch__ref_graham_andrew_scan( BidirectionalIterator first, alpha = beta; stack_rev_iter = S.rbegin(); beta = *++stack_rev_iter; - CGAL_ch_assertion(S.size() >= 2); + CGAL_assertion(S.size() >= 2); } S.push_back( iter ); beta = alpha; @@ -213,11 +213,11 @@ ch_graham_andrew( InputIterator first, #endif // no postconditions ... ch__ref_graham_andrew_scan( V.begin(), V.end(), res, ch_traits); ch__ref_graham_andrew_scan( V.rbegin(), V.rend(), res, ch_traits); - CGAL_ch_postcondition( \ + CGAL_postcondition( \ is_ccw_strongly_convex_2( res.output_so_far_begin(), \ res.output_so_far_end(), \ ch_traits)); - CGAL_ch_expensive_postcondition( \ + CGAL_expensive_postcondition( \ ch_brute_force_check_2( \ V.begin(), V.end(), \ res.output_so_far_begin(), res.output_so_far_end(), \ diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_jarvis_impl.h b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_jarvis_impl.h index 1ecdd0b7ea8..8710ea0a030 100644 --- a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_jarvis_impl.h +++ b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_jarvis_impl.h @@ -21,7 +21,7 @@ #endif // CGAL_CH_NO_POSTCONDITIONS #include -#include +#include #include #include @@ -48,16 +48,16 @@ ch_jarvis_march(ForwardIterator first, ForwardIterator last, typedef typename Traits::Point_2 Point_2; Tee_for_output_iterator res(result); #endif // no postconditions ... - CGAL_ch_assertion_code( \ + CGAL_assertion_code( \ int count_points = 0; ) - CGAL_ch_assertion_code( \ + CGAL_assertion_code( \ for (ForwardIterator fit = first; fit!= last; ++fit) ++count_points; ) Less_rotate_ccw rotation_predicate = ch_traits.less_rotate_ccw_2_object( ); *res = start_p; ++res; - CGAL_ch_assertion_code( \ + CGAL_assertion_code( \ int constructed_points = 1; ) - CGAL_ch_exactness_assertion_code( \ + CGAL_exactness_assertion_code( \ Point previous_point = start_p; ) ForwardIterator it = std::min_element( first, last, @@ -65,26 +65,26 @@ ch_jarvis_march(ForwardIterator first, ForwardIterator last, {return rotation_predicate(start_p, p1, p2);} ); while (! equal_points(*it, stop_p) ) { - CGAL_ch_exactness_assertion( \ + CGAL_exactness_assertion( \ *it != previous_point ); - CGAL_ch_exactness_assertion_code( \ + CGAL_exactness_assertion_code( \ previous_point = *it; ) *res = *it; ++res; - CGAL_ch_assertion_code( \ + CGAL_assertion_code( \ ++constructed_points;) - CGAL_ch_assertion( \ + CGAL_assertion( \ constructed_points <= count_points + 1 ); it = std::min_element( first, last, [it, &rotation_predicate](const Point& p1, const Point& p2) {return rotation_predicate(*it, p1, p2);} ); } - CGAL_ch_postcondition( \ + CGAL_postcondition( \ is_ccw_strongly_convex_2( res.output_so_far_begin(), \ res.output_so_far_end(), \ ch_traits)); - CGAL_ch_expensive_postcondition( \ + CGAL_expensive_postcondition( \ ch_brute_force_check_2( first, last, \ res.output_so_far_begin(), res.output_so_far_end(), \ diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_melkman_impl.h b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_melkman_impl.h index 4af027e992d..04e1e931f66 100644 --- a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_melkman_impl.h +++ b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_melkman_impl.h @@ -19,7 +19,7 @@ #include #endif // CGAL_CH_NO_POSTCONDITIONS -#include +#include #include #include @@ -37,19 +37,19 @@ ch_melkman( InputIterator first, InputIterator last, typename Traits::Left_turn_2 left_turn = ch_traits.left_turn_2_object(); Equal_2 equal_points = ch_traits.equal_2_object(); - CGAL_ch_assertion_code( \ + CGAL_assertion_code( \ typename Traits::Less_xy_2 less = ch_traits.less_xy_2_object(); ) std::deque< Point> Q; - CGAL_ch_expensive_postcondition_code( std::deque< Point> IN; ) + CGAL_expensive_postcondition_code( std::deque< Point> IN; ) if (first == last) return result; // 0 elements Point p = *first; - CGAL_ch_expensive_postcondition_code( IN.push_back(p); ) + CGAL_expensive_postcondition_code( IN.push_back(p); ) if (++first == last) { *result = p; ++result; return result; } // 1 element Point q = *first; - CGAL_ch_expensive_postcondition_code( IN.push_back(q); ) + CGAL_expensive_postcondition_code( IN.push_back(q); ) if (++first == last) // 2 elements { *result = p; ++result; @@ -63,11 +63,11 @@ ch_melkman( InputIterator first, InputIterator last, while (first != last) { r = *first; - CGAL_ch_expensive_postcondition_code( IN.push_back(r); ) + CGAL_expensive_postcondition_code( IN.push_back(r); ) // visited input sequence = p,..., q, r if ( left_turn(p,q,r)) { Q.push_back( q); break; } if ( left_turn(q,p,r)) { Q.push_front( q); break; } - CGAL_ch_assertion( less( p, q) ? less (p, r) : less( r, p)); + CGAL_assertion( less( p, q) ? less (p, r) : less( r, p)); q = r; ++first; } @@ -84,7 +84,7 @@ ch_melkman( InputIterator first, InputIterator last, while ( ++first != last) { r = *first; - CGAL_ch_expensive_postcondition_code( IN.push_back(r); ) + CGAL_expensive_postcondition_code( IN.push_back(r); ) if (left_turn( current, r, Q.front()) || left_turn( Q.back(), r, current)) // r outside cone Q.front(), current, Q.back() <=> @@ -110,9 +110,9 @@ ch_melkman( InputIterator first, InputIterator last, Q.push_back( current); // add last point to Q - CGAL_ch_postcondition( \ + CGAL_postcondition( \ is_ccw_strongly_convex_2( Q.begin(), Q.end(), ch_traits)); - CGAL_ch_expensive_postcondition( \ + CGAL_expensive_postcondition( \ ch_brute_force_check_2( IN.begin(),IN.end(), Q.begin(),Q.end(), ch_traits)); std::copy( Q.begin(), Q.end(), result); return result; diff --git a/Convex_hull_3/doc/Convex_hull_3/PackageDescription.txt b/Convex_hull_3/doc/Convex_hull_3/PackageDescription.txt index cfe86e65064..acadb02ed7e 100644 --- a/Convex_hull_3/doc/Convex_hull_3/PackageDescription.txt +++ b/Convex_hull_3/doc/Convex_hull_3/PackageDescription.txt @@ -52,13 +52,11 @@ points in is strongly convex or not. This chapter describes the functions available for three dimensions. \cgalCRPSection{Assertions} -The assertion flags for the convex hull and extreme point algorithms -use `CH` in their names (e.g., `CGAL_CH_NO_POSTCONDITIONS`). For the convex hull algorithms, the postcondition check tests only convexity (if not disabled), but not containment of the input points in the polygon or polyhedron defined by the output points. The latter is considered an expensive checking and can be enabled by -defining `CGAL_CH_CHECK_EXPENSIVE`. +defining `CGAL_CHECK_EXPENSIVE`. \cgalClassifedRefPages diff --git a/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h b/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h index 2edd7244422..a1311e87c5f 100644 --- a/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h +++ b/Convex_hull_3/include/CGAL/Convex_hull_3/dual/halfspace_intersection_3.h @@ -73,7 +73,6 @@ namespace CGAL std::unordered_map primal_vertices; - size_t n = 0; // First, computing the primal vertices for(Facet_const_handle fd : faces(_dual)){ @@ -111,7 +110,6 @@ namespace CGAL vertex_descriptor vd = add_vertex(primal); primal_vertices[fd] = vd; put(vpm, vd, ppp); - ++n; } // Then, add facets to the primal polyhedron @@ -283,4 +281,3 @@ namespace CGAL #include #endif // CGAL_HALFSPACE_INTERSECTION_3_H - diff --git a/Convex_hull_3/include/CGAL/convex_hull_3.h b/Convex_hull_3/include/CGAL/convex_hull_3.h index 46d2082ab0b..18a11329308 100644 --- a/Convex_hull_3/include/CGAL/convex_hull_3.h +++ b/Convex_hull_3/include/CGAL/convex_hull_3.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -565,7 +565,7 @@ farthest_outside_point(Face_handle f, std::list& outside_set, { typedef typename std::list::iterator Outside_set_iterator; - CGAL_ch_assertion(!outside_set.empty()); + CGAL_assertion(!outside_set.empty()); typename Traits::Plane_3 plane = traits.construct_plane_3_object()(f->vertex(0)->point(), @@ -682,7 +682,7 @@ ch_quickhull_3_scan(TDS_2& tds, border.erase(it); while(! border.empty()){ it = border.find(e.first->vertex(TDS_2::ccw(e.second))); - CGAL_ch_assertion(it != border.end()); + CGAL_assertion(it != border.end()); e = it->second; e.first->info() = 0; edges.push_back(e); @@ -758,9 +758,9 @@ void non_coplanar_quickhull_3(std::list& points, ch_quickhull_3_scan(tds, pending_facets, traits); //std::cout << "|V(tds)| = " << tds.number_of_vertices() << std::endl; -// CGAL_ch_expensive_postcondition(all_points_inside(points.begin(), +// CGAL_expensive_postcondition(all_points_inside(points.begin(), // points.end(),P,traits)); -// CGAL_ch_postcondition(is_strongly_convex_3(P, traits)); +// CGAL_postcondition(is_strongly_convex_3(P, traits)); } template diff --git a/Convex_hull_3/test/Convex_hull_3/degeneracy_test.cpp b/Convex_hull_3/test/Convex_hull_3/degeneracy_test.cpp index 55b29cf4435..3638c7b9ef0 100644 --- a/Convex_hull_3/test/Convex_hull_3/degeneracy_test.cpp +++ b/Convex_hull_3/test/Convex_hull_3/degeneracy_test.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/Documentation/doc/Documentation/Developer_manual/Chapter_checks.txt b/Documentation/doc/Documentation/Developer_manual/Chapter_checks.txt index 1a6fb78e4cb..73cd228cf95 100644 --- a/Documentation/doc/Documentation/Developer_manual/Chapter_checks.txt +++ b/Documentation/doc/Documentation/Developer_manual/Chapter_checks.txt @@ -145,64 +145,19 @@ To disable all checks in the library, the flag `CGAL_NDEBUG` can be set. Note that the standard flag `NDEBUG` sets `CGAL_NDEBUG`, but it also affects the `assert` macro. -To enable expensive and exactness checks, respectively, the compile-time -flags `CGAL_CHECK_EXPENSIVE` - -and `CGAL_CHECK_EXACTNESS` - -have to be supplied. However, exactness checks should only be turned on if +To enable expensive and exactness checks, respectively, the preprocessor macros +`CGAL_CHECK_EXPENSIVE` and `CGAL_CHECK_EXACTNESS` +have to be defined. However, exactness checks should only be turned on if the computation is done with some exact number type. \section secchecks_controlling Controlling checks at a finer granularity The macros and related compile-time flags described so far all operate -on the whole library. Sometimes the user may want to have a more -selective control. \cgal offers the possibility to turn checks on -and off on a per-package basis. Therefore a package-specific term is -inserted in the macro names directly after the \cgal prefix, -e.g., `CGAL_kernel_assertion()`. Similarly, the uppercase -term is used for the compile-time flags; -e.g., `CGAL_KERNEL_NO_WARNINGS` switches off the warnings -in only the kernel. Other packages have their own specific -terms as documented in the corresponding chapters of the -reference manual. - -For a new package you will first have to create a suitable header file -with all macro definitions. This is done with the shell script -cgal_create_assertions.sh, to be found in the -scripts directory. - -The following command will create a file optimisation_assertions.h: - -
- sh cgal_create_assertions.sh optimisation - -
- -You should place the generated file in the proper directory (and possibly -rename it). Then you can use the checks in the following fashion. - -\code{.cpp} - #include - - void optimisation_foo( int i) - { - CGAL_optimisation_precondition_msg( i == 42, "Only 42 allowed!"); - // ... - } -\endcode - -The documentation of your new package has to name the term chosen to be -part of the package-specific macros in -order to enable the user to selectively turn off and on the checks of -your package. For example, in the documentation of the optimisation -package you can find a sentence similar to the following. -
- The optimisation code uses the term OPTIMISATION for the checks; - e.g., setting the compile time flag - `CGAL_OPTIMISATION_NO_PRECONDITIONS` switches off precondition - checking in the optimisation code. -
+on the whole library. \cgal offers the possibility to turn checks on +and off just for the kernel. Kernel assertions are stated using the +macro `CGAL_kernel_assertion()`, and they can be disabled by defining +the macros `CGAL_KERNEL_NO_ASSERTIONS` or `CGAL_NO_ASSERTIONS`. +See \ref secchecks "the section Checks in STL Extensions", for details. \section secchecks_cgal_assume Suppress warnings using CGAL_assume. diff --git a/Documentation/doc/resources/1.8.13/BaseDoxyfile.in b/Documentation/doc/resources/1.8.13/BaseDoxyfile.in index 2c1a87d69a6..7d6685977cf 100644 --- a/Documentation/doc/resources/1.8.13/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.13/BaseDoxyfile.in @@ -349,7 +349,10 @@ ALIASES = "cgal=%CGAL" \ "cgalParamType{1}=
  • Type: \1
  • " \ "cgalParamDefault{1}=
  • %Default: \1
  • " \ "cgalParamExtra{1}=
  • Extra: \1
  • " \ - "cgalParamNEnd= \htmlonly[block] \endhtmlonly " + "cgalParamNEnd= \htmlonly[block] \endhtmlonly " \ + "cgalParamSectionBegin{1}=\cgalParamNBegin{\1}" \ + "cgalParamSectionEnd=\cgalParamNEnd" \ + "cgalParamPrecondition{1}=
  • Precondition: \1
  • " # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding "class=itcl::class" diff --git a/Documentation/doc/resources/1.8.14/BaseDoxyfile.in b/Documentation/doc/resources/1.8.14/BaseDoxyfile.in index f436e62be4c..44a6b9f72b3 100644 --- a/Documentation/doc/resources/1.8.14/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.14/BaseDoxyfile.in @@ -350,7 +350,10 @@ ALIASES = "cgal=%CGAL" \ "cgalParamType{1}=
  • Type: \1
  • " \ "cgalParamDefault{1}=
  • %Default: \1
  • " \ "cgalParamExtra{1}=
  • Extra: \1
  • " \ - "cgalParamNEnd= \htmlonly[block] \endhtmlonly " + "cgalParamNEnd= \htmlonly[block] \endhtmlonly " \ + "cgalParamSectionBegin{1}=\cgalParamNBegin{\1}" \ + "cgalParamSectionEnd=\cgalParamNEnd" \ + "cgalParamPrecondition{1}=
  • Precondition: \1
  • " # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For diff --git a/Documentation/doc/resources/1.8.20/BaseDoxyfile.in b/Documentation/doc/resources/1.8.20/BaseDoxyfile.in index dfffc15a705..7f258d33a4b 100644 --- a/Documentation/doc/resources/1.8.20/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.20/BaseDoxyfile.in @@ -372,7 +372,11 @@ ALIASES = "cgal=%CGAL" \ "cgalParamType{1}=
  • Type: \1
  • " \ "cgalParamDefault{1}=
  • %Default: \1
  • " \ "cgalParamExtra{1}=
  • Extra: \1
  • " \ - "cgalParamNEnd= \htmlonly[block] \endhtmlonly " + "cgalParamNEnd= \htmlonly[block] \endhtmlonly " \ + "cgalParamSectionBegin{1}=\cgalParamNBegin{\1}" \ + "cgalParamSectionEnd=\cgalParamNEnd" \ + "cgalParamPrecondition{1}=
  • Precondition: \1
  • " + # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For diff --git a/Documentation/doc/resources/1.8.4/BaseDoxyfile.in b/Documentation/doc/resources/1.8.4/BaseDoxyfile.in index 2aa14b65920..45d422384df 100644 --- a/Documentation/doc/resources/1.8.4/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.4/BaseDoxyfile.in @@ -356,6 +356,10 @@ ALIASES+= "cgalParamType{1}=
  • Type: \1
  • " ALIASES+= "cgalParamDefault{1}=
  • %Default: \1
  • " ALIASES+= "cgalParamExtra{1}=
  • Extra: \1
  • " ALIASES+= "cgalParamNEnd= \htmlonly[block] \endhtmlonly " +ALIASES+= "cgalParamSectionBegin{1}=\cgalParamNBegin{\1}" +ALIASES+= "cgalParamSectionEnd=\cgalParamNEnd" +ALIASES+= "cgalParamPrecondition{1}=
  • Precondition: \1
  • " + # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding diff --git a/Documentation/doc/resources/1.9.3/BaseDoxyfile.in b/Documentation/doc/resources/1.9.3/BaseDoxyfile.in index 7293184c812..d95cfc9dd5a 100644 --- a/Documentation/doc/resources/1.9.3/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.9.3/BaseDoxyfile.in @@ -372,7 +372,10 @@ ALIASES = "cgal=%CGAL" \ "cgalParamType{1}=
  • Type: \1
  • " \ "cgalParamDefault{1}=
  • %Default: \1
  • " \ "cgalParamExtra{1}=
  • Extra: \1
  • " \ - "cgalParamNEnd= \htmlonly[block] \endhtmlonly " + "cgalParamNEnd= \htmlonly[block] \endhtmlonly " \ + "cgalParamSectionBegin{1}=\cgalParamNBegin{\1}" \ + "cgalParamSectionEnd=\cgalParamNEnd" \ + "cgalParamPrecondition{1}=
  • Precondition: \1
  • " # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For diff --git a/Generator/doc/Generator/Generator.txt b/Generator/doc/Generator/Generator.txt index fe9e9acc0c7..3e2e4e3c856 100644 --- a/Generator/doc/Generator/Generator.txt +++ b/Generator/doc/Generator/Generator.txt @@ -18,7 +18,7 @@ Two kinds of point generators are provided: first, random point generators and second deterministic point generators. Most random point generators and a few deterministic point generators are provided as input iterators. The input iterators model an infinite sequence of -points. The function `CGAL::copy_n()` can be used to copy a +points. The algorithm `std::copy_n` can be used to copy a finite sequence. The iterator adaptor `Counting_iterator` can be used to create finite iterator ranges. diff --git a/Generator/include/CGAL/Random_polygon_2_sweep.h b/Generator/include/CGAL/Random_polygon_2_sweep.h index 2aa4102bbb1..84cb7ad5818 100644 --- a/Generator/include/CGAL/Random_polygon_2_sweep.h +++ b/Generator/include/CGAL/Random_polygon_2_sweep.h @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include @@ -156,9 +156,9 @@ less_than_in_tree(Vertex_index new_edge, Vertex_index tree_edge) const #if defined(CGAL_POLY_GENERATOR_DEBUG) std::cout << "less_than_in_tree; new: " << new_edge.as_int() << " tree edge: " << tree_edge.as_int() << std::endl; #endif - CGAL_polygon_precondition( + CGAL_precondition( m_vertex_data->edges[tree_edge.as_int()].is_in_tree); - CGAL_polygon_precondition( + CGAL_precondition( !m_vertex_data->edges[new_edge.as_int()].is_in_tree); Vertex_index left, mid, right; m_vertex_data->left_and_right_index(left, right, tree_edge); @@ -172,10 +172,10 @@ less_than_in_tree(Vertex_index new_edge, Vertex_index tree_edge) const case RIGHT_TURN: return false; case COLLINEAR: break; } - CGAL_polygon_assertion(m_vertex_data->less_xy_2( + CGAL_assertion(m_vertex_data->less_xy_2( m_vertex_data->point(left), m_vertex_data->point(mid))); - CGAL_polygon_assertion( m_vertex_data->less_xy_2( + CGAL_assertion( m_vertex_data->less_xy_2( m_vertex_data->point(mid), m_vertex_data->point(right))); m_vertex_data->is_simple_result = false; @@ -321,23 +321,23 @@ insertion_event(Tree *tree, Vertex_index prev_vt, std::pair result; if (left_turn) { result = tree->insert(prev_vt); - // CGAL_polygon_assertion(result.second) + // CGAL_assertion(result.second) td_prev.tree_it = result.first; td_prev.is_in_tree = true; if (!this->is_simple_result) return false; result = tree->insert(mid_vt); - // CGAL_polygon_assertion(result.second) + // CGAL_assertion(result.second) td_mid.tree_it = result.first; td_mid.is_in_tree = true; if (!this->is_simple_result) return false; } else { result = tree->insert(mid_vt); - // CGAL_polygon_assertion(result.second) + // CGAL_assertion(result.second) td_mid.tree_it = result.first; td_mid.is_in_tree = true; if (!this->is_simple_result) return false; result = tree->insert(prev_vt); - // CGAL_polygon_assertion(result.second) + // CGAL_assertion(result.second) td_prev.tree_it = result.first; td_prev.is_in_tree = true; if (!this->is_simple_result) return false; @@ -374,7 +374,7 @@ replacement_event(Tree *tree, Vertex_index cur_edge, Vertex_index next_edge) // check if continuation point is on the right side of neighbor segments typedef typename Tree::iterator It; Edge_data &td = edges[cur_edge.as_int()]; - CGAL_polygon_assertion(td.is_in_tree); + CGAL_assertion(td.is_in_tree); It cur_seg = td.tree_it; Vertex_index cur_vt = (td.is_left_to_right) ? next_edge : cur_edge; if (cur_seg != tree->begin()) { @@ -613,7 +613,7 @@ void make_simple_polygon(Iterator points_begin, Iterator points_end, #if defined(CGAL_POLY_GENERATOR_DEBUG) std::cout << "To swap: " << swap_interval.first << " " << swap_interval.second << std::endl; - CGAL_polygon_assertion(swap_interval.first >= -1 && + CGAL_assertion(swap_interval.first >= -1 && swap_interval.second >= -1 && swap_interval.first < size && swap_interval.second < size); diff --git a/GraphicsView/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp b/GraphicsView/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp index e24b3e21d42..c18f2566d36 100644 --- a/GraphicsView/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp +++ b/GraphicsView/demo/Triangulation_2/Constrained_Delaunay_triangulation_2.cpp @@ -961,9 +961,7 @@ MainWindow::on_actionLloyd_optimization_triggered() } CGAL::lloyd_optimize_mesh_2(cdt, - max_iteration_number = nb, - seeds_begin = m_seeds.begin(), - seeds_end = m_seeds.end()); + CGAL::parameters::number_of_iterations(nb).seeds(m_seeds)); // default cursor QApplication::restoreOverrideCursor(); diff --git a/HalfedgeDS/include/CGAL/HalfedgeDS_decorator.h b/HalfedgeDS/include/CGAL/HalfedgeDS_decorator.h index 92afeab7ae1..e65eb447e2e 100644 --- a/HalfedgeDS/include/CGAL/HalfedgeDS_decorator.h +++ b/HalfedgeDS/include/CGAL/HalfedgeDS_decorator.h @@ -795,8 +795,7 @@ public: Assert_compile_time_tag(Supports_vertex_halfedge(), Tag_true()); Assert_compile_time_tag(Supports_halfedge_vertex(), Tag_true()); - unsigned int nb_erased_components = 0, - nb_isolated_vertices = 0; + unsigned int nb_erased_components = 0; // Gets list of connected components, ordered by size (i.e. number of vertices) std::vector components; @@ -818,13 +817,9 @@ public: else // if isolated vertex { vertices_erase(vertex); - nb_isolated_vertices++; } } -// if (nb_isolated_vertices > 0) -// std::cerr << " Erased " << nb_isolated_vertices << " isolated vertices\n"; - return nb_erased_components; } diff --git a/Heat_method_3/doc/Heat_method_3/PackageDescription.txt b/Heat_method_3/doc/Heat_method_3/PackageDescription.txt index f562ab1ce22..c13822436f1 100644 --- a/Heat_method_3/doc/Heat_method_3/PackageDescription.txt +++ b/Heat_method_3/doc/Heat_method_3/PackageDescription.txt @@ -1,13 +1,12 @@ // The Heat Method -/// \defgroup PkgHeatMethod Heat Method Reference +/// \defgroup PkgHeatMethodRef Heat Method Reference /// \defgroup PkgHeatMethodConcepts Concepts -/// \ingroup PkgHeatMethod - +/// \ingroup PkgHeatMethodRef /*! -\addtogroup PkgHeatMethod +\addtogroup PkgHeatMethodRef \cgalPkgDescriptionBegin{The Heat Method,PkgHeatMethod} \cgalPkgPicture{heat-method-small.png} @@ -17,8 +16,8 @@ \cgalPkgDesc{The package provides an algorithm that solves the single- or multiple-source shortest path problem by returning an approximation of the geodesic distance for all vertices of a triangle mesh to the closest vertex in a given set of -source vertices. } -\cgalPkgManuals{Chapter_HeatMethod,PkgHeatMethod} +source vertices.} +\cgalPkgManuals{Chapter_HeatMethod,PkgHeatMethodRef} \cgalPkgSummaryEnd \cgalPkgShortInfoBegin \cgalPkgSince{4.14} diff --git a/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h b/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h index 73d369695b1..b257c53843d 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h @@ -21,9 +21,9 @@ #include #include #include +#include #include #include -#include #include #ifdef CGAL_EIGEN3_ENABLED #include @@ -90,58 +90,56 @@ protected: Face_id_map face_id_map; public: + /*! + \brief Constructor + */ + Surface_mesh_geodesic_distances_3(const TriangleMesh& tm, + VertexPointMap vpm) + : vertex_id_map(get(Vertex_property_tag(), tm)), + face_id_map(get(Face_property_tag(), tm)), + v2v(tm), + tm(tm), + vpm(vpm) + { + build(); + } /*! \brief Constructor */ Surface_mesh_geodesic_distances_3(const TriangleMesh& tm) - : vertex_id_map(get(Vertex_property_tag(),tm)), face_id_map(get(Face_property_tag(),tm)), v2v(tm), tm(tm), vpm(get(vertex_point,tm)) + : Surface_mesh_geodesic_distances_3(tm, get(vertex_point, tm)) { build(); } - - /*! - \brief Constructor - */ - Surface_mesh_geodesic_distances_3(const TriangleMesh& tm, VertexPointMap vpm) - : vertex_id_map(get(Vertex_property_tag(),tm)), face_id_map(get(Face_property_tag(),tm)), v2v(tm), tm(tm), vpm(vpm) - { - build(); - } - - /** * returns the triangle mesh the algorithm is running on. */ - const TriangleMesh& triangle_mesh() const{ + const TriangleMesh& triangle_mesh() const + { return tm; } - private: - const Matrix& mass_matrix() const { return m_mass_matrix; } - const Matrix& cotan_matrix() const { return m_cotan_matrix; } - const VertexPointMap& vertex_point_map() const { return vpm; } - const Vertex_id_map& get_vertex_id_map() const { @@ -149,7 +147,6 @@ private: } public: - /** * adds `vd` to the source set, returning `false` iff `vd` is already in the set. */ @@ -176,7 +173,6 @@ public: } } - /** * removes `vd` from the source set, returning `true` iff `vd` was in the set. */ @@ -188,7 +184,6 @@ public: return (m_sources.erase(v2v(vd)) == 1); } - /** * clears the current source set. */ @@ -203,7 +198,6 @@ public: /** * returns the set of source vertices. */ - const Vertex_const_range& sources() const { @@ -211,7 +205,6 @@ public: } private: - double summation_of_edges() const { @@ -237,14 +230,12 @@ private: return edge_sum; } - double time_step() const { return m_time_step; } - void update_kronecker_delta() { @@ -263,14 +254,12 @@ private: m_kronecker.swap(K); } - const Matrix& kronecker_delta() const { return m_kronecker; } - void factor_cotan_laplace() { Matrix A, A0; @@ -293,7 +282,6 @@ private: } } - void compute_unit_gradient() { @@ -352,7 +340,6 @@ private: } } - void compute_divergence() { @@ -400,7 +387,6 @@ private: indexD.swap(m_index_divergence); } - // modifies m_solved_phi void value_at_source_set(const Vector& phi) @@ -432,7 +418,6 @@ private: m_solved_phi.swap(source_set_val); } - void factor_phi() { @@ -443,7 +428,6 @@ private: } } - void solve_phi() { @@ -456,7 +440,6 @@ private: value_at_source_set(phi); } - // this function returns a (number of vertices)x1 vector where // the ith index has the distance from the first vertex to the ith vertex const Vector& @@ -466,7 +449,6 @@ private: } public: - /** * Updates the distance property map after changes in the source set. **/ @@ -494,7 +476,6 @@ public: } private: - void build() { @@ -507,13 +488,16 @@ private: } m_source_change_flag = false; - CGAL_precondition(is_triangle_mesh(tm)); Index i = 0; for(vertex_descriptor vd : vertices(tm)){ put(vertex_id_map, vd, i++); } Index face_i = 0; for(face_descriptor fd : faces(tm)){ + // Do not use BGL's version because `tm` is not a valid halfedge graph due to its weird vertex descriptor: + // it fails checks such as halfedge(target(h, g), g) == h + CGAL_assertion_code(halfedge_descriptor hd = halfedge(fd, tm);) + CGAL_assertion(hd == next(next(next(hd,tm),tm),tm)); put(face_id_map, fd, face_i++); } dimension = static_cast(num_vertices(tm)); @@ -714,7 +698,7 @@ struct Base_helper /** - * \ingroup PkgHeatMethod + * \ingroup PkgHeatMethodRef * * Class `Surface_mesh_geodesic_distances_3` computes estimated geodesic distances for a set of source vertices where sources can be added and removed. * The class performs a preprocessing step that only depends on the mesh, so that the distance computation takes less @@ -788,6 +772,7 @@ class Surface_mesh_geodesic_distances_3 typedef typename Default::Get< VertexPointMap, typename boost::property_map< TriangleMesh, vertex_point_t>::const_type>::type Vertex_point_map; + typedef typename Default::Get::vertex_descriptor vertex_descriptor; #ifndef DOXYGEN_RUNNING @@ -906,7 +890,7 @@ public: }; #if defined(DOXYGEN_RUNNING) || defined(CGAL_EIGEN3_ENABLED) -/// \ingroup PkgHeatMethod +/// \ingroup PkgHeatMethodRef /// computes for each vertex of the triangle mesh `tm` the estimated geodesic distance to a given source vertex. /// This function is provided only if \ref thirdpartyEigen "Eigen" 3.3 (or greater) is available and `CGAL_EIGEN3_ENABLED` is defined. /// \tparam TriangleMesh a triangulated surface mesh, model of `FaceListGraph` and `HalfedgeListGraph`. @@ -947,7 +931,7 @@ estimate_geodesic_distances(const TriangleMesh& tm, #endif -/// \ingroup PkgHeatMethod +/// \ingroup PkgHeatMethodRef /// computes for each vertex of the triangle mesh `tm` the estimated geodesic distance to a given set of source vertices. /// This function is provided only if \ref thirdpartyEigen "Eigen" 3.3 (or greater) is available and `CGAL_EIGEN3_ENABLED` is defined. /// \tparam TriangleMesh a triangulated surface mesh, model of `FaceListGraph` and `HalfedgeListGraph` diff --git a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h index 4006dc23be3..cff7968bd7e 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h @@ -57,7 +57,6 @@ namespace internal { template bool has_degenerate_faces(const TriangleMesh& tm, const Traits& traits) { - typedef typename Traits::Point_3 Point; typedef typename Traits::Vector_3 Vector_3; typename Traits::Construct_vector_3 construct_vector = traits.construct_vector_3_object(); @@ -66,13 +65,16 @@ bool has_degenerate_faces(const TriangleMesh& tm, const Traits& traits) typename Traits::Construct_cross_product_vector_3 cross_product = traits.construct_cross_product_vector_3_object(); - typename boost::property_map< TriangleMesh, boost::vertex_point_t>::const_type - vpm = get(boost::vertex_point, tm); + typedef typename boost::property_map< TriangleMesh, boost::vertex_point_t>::const_type VPM; + typedef typename boost::property_traits::reference Point_ref; + + VPM vpm = get(boost::vertex_point, tm); + for (typename boost::graph_traits::face_descriptor f : faces(tm)) { - const Point p1 = get(vpm, target(halfedge(f, tm), tm)); - const Point p2 = get(vpm, target(next(halfedge(f, tm), tm), tm)); - const Point p3 = get(vpm, target(next(next(halfedge(f, tm), tm), tm), tm)); + const Point_ref p1 = get(vpm, target(halfedge(f, tm), tm)); + const Point_ref p2 = get(vpm, target(next(halfedge(f, tm), tm), tm)); + const Point_ref p3 = get(vpm, target(next(next(halfedge(f, tm), tm), tm), tm)); Vector_3 v = cross_product(construct_vector(p1, p2), construct_vector(p1, p3)); if(scalar_product(v, v) == 0.) return true; @@ -82,7 +84,8 @@ bool has_degenerate_faces(const TriangleMesh& tm, const Traits& traits) } template -struct Intrinsic_Delaunay_triangulation_3_vertex_descriptor { +struct Intrinsic_Delaunay_triangulation_3_vertex_descriptor +{ typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; halfedge_descriptor hd; @@ -99,6 +102,16 @@ struct Intrinsic_Delaunay_triangulation_3_vertex_descriptor { explicit Intrinsic_Delaunay_triangulation_3_vertex_descriptor(const vertex_descriptor vd, const TriangleMesh& tm) : hd(halfedge(vd,tm)) {} + + bool operator==(const Intrinsic_Delaunay_triangulation_3_vertex_descriptor& other) const + { + return hd == other.hd; + } + + bool operator!=(const Intrinsic_Delaunay_triangulation_3_vertex_descriptor& other) const + { + return ! (*this == other); + } }; template @@ -121,7 +134,7 @@ struct Intrinsic_Delaunay_triangulation_3_vertex_iterator_functor }; /** - * \ingroup PkgHeatMethod + * \ingroup PkgHeatMethodRef * * Class `Intrinsic_Delaunay_triangulation_3` is a remeshing algorithm to improve the approximation of the `Surface_mesh_geodesic_distances_3`. * It internally makes a copy of the triangle mesh, performs edge flips, and computes 2D vertex coordinates per face @@ -267,7 +280,7 @@ private: } - //returns true if edge is locally Delaunay (opposing angles are less than pi): + //returns `true` if edge is locally Delaunay (opposing angles are less than pi): //Two ways of doing this: taking angles directly (not good with virtual edges) //OR: taking edge length and using law of cosines, //The second way checks cotan weights @@ -340,7 +353,6 @@ private: void loop_over_edges(edge_stack stack, std::vector& marked_edges) { - int a = 0; while(!stack.empty()) { edge_descriptor ed = stack.top(); stack.pop(); @@ -351,7 +363,6 @@ private: //if the edge itself is not locally delaunay, go back if(!(is_edge_locally_delaunay(ed))) { if(!(is_border(ed,m_intrinsic_tm))) { - a++; change_edge_length(edge_i,ed); halfedge_descriptor hd = (halfedge(ed, m_intrinsic_tm)); CGAL::Euler::flip_edge(hd, m_intrinsic_tm); @@ -393,7 +404,8 @@ private: void build(VertexPointMap vpm) { - CGAL_precondition(is_triangle_mesh(m_intrinsic_tm)); + CGAL_precondition(is_empty(m_intrinsic_tm)); + CGAL_precondition(is_triangle_mesh(m_input_tm)); typename Traits::Compute_squared_distance_3 squared_distance = Traits().compute_squared_distance_3_object(); @@ -549,6 +561,8 @@ struct graph_traits::vertices_size_type vertices_size_type; + static vertex_descriptor null_vertex() { return vertex_descriptor(boost::graph_traits::null_halfedge()); } + static halfedge_descriptor null_halfedge() { return boost::graph_traits::null_halfedge(); } static face_descriptor null_face() { return boost::graph_traits::null_face(); } }; @@ -589,7 +603,7 @@ template Iterator_range >::vertex_iterator> vertices(const Intrinsic_Delaunay_triangulation_3& idt) - { +{ std::pair::vertex_iterator, typename boost::graph_traits::vertex_iterator> p = vertices(idt.triangle_mesh()); @@ -597,7 +611,7 @@ vertices(const Intrinsic_Delaunay_triangulation_3& idt) Fct fct(idt.triangle_mesh()); return make_range(boost::make_transform_iterator(p.first, fct), boost::make_transform_iterator(p.second,fct)); - } +} template Iterator_range::face_iterator> faces(const Intrinsic_Delaunay_triangulation_3& idt) - { - return make_range( faces(idt.triangle_mesh()) ); - } +{ + return make_range( faces(idt.triangle_mesh()) ); +} template @@ -659,7 +673,7 @@ template typename boost::graph_traits >::halfedge_descriptor halfedge(typename boost::graph_traits >::edge_descriptor ed, - const Intrinsic_Delaunay_triangulation_3& idt) + const Intrinsic_Delaunay_triangulation_3& idt) { return halfedge(ed, idt.triangle_mesh()); } @@ -684,6 +698,23 @@ next(typename boost::graph_traits >::ha return next(hd, idt.triangle_mesh()); } +template +typename boost::graph_traits >::halfedge_descriptor +prev(typename boost::graph_traits >::halfedge_descriptor hd, + const Intrinsic_Delaunay_triangulation_3& idt) +{ + return prev(hd, idt.triangle_mesh()); +} + +template +typename boost::graph_traits >::edge_descriptor +edge(typename boost::graph_traits >::halfedge_descriptor hd, + const Intrinsic_Delaunay_triangulation_3& idt) +{ + return edge(hd, idt.triangle_mesh()); +} template @@ -766,11 +797,11 @@ struct IDT_vertex_distance_property_map { friend void put(IDT_vertex_distance_property_map idtpm, key_type vd, - value_type v) + value_type val) { typename boost::graph_traits::vertex_descriptor tm_vd = target(vd.hd, idtpm.idt.triangle_mesh()); - put(idtpm.pm, idtpm.idt.v2v.at(tm_vd), v); + put(idtpm.pm, idtpm.idt.v2v.at(tm_vd), val); } }; diff --git a/Heat_method_3/package_info/Heat_method_3/dependencies b/Heat_method_3/package_info/Heat_method_3/dependencies index 50488d5544f..42f0881808e 100644 --- a/Heat_method_3/package_info/Heat_method_3/dependencies +++ b/Heat_method_3/package_info/Heat_method_3/dependencies @@ -4,14 +4,12 @@ Cartesian_kernel Circulator Distance_2 Distance_3 -Filtered_kernel Heat_method_3 Installation Interval_support Kernel_23 Modular_arithmetic Number_types -Polygon_mesh_processing Profiling_tools Property_map Random_numbers diff --git a/Hyperbolic_triangulation_2/TODO b/Hyperbolic_triangulation_2/TODO index 8f691736b3d..0bc3cc547d9 100644 --- a/Hyperbolic_triangulation_2/TODO +++ b/Hyperbolic_triangulation_2/TODO @@ -8,7 +8,7 @@ class Construct_hyperbolic_bisector_2 Hyperbolic_segment_2 operator()(Point_2 p, Point_2 q, Point_2 r) at the end the following lines are giving the wrong arc (wrong orientation), aren't they? - CGAL_triangulation_assertion(assign(pair,inters[1])); + CGAL_assertion(assign(pair,inters[1])); if ( Orientation_2()(approx_c,approx_a,approx_pinf) == POSITIVE ) return Circular_arc_2( *c_pq, pair.first, a); return Circular_arc_2( *c_pq, a, pair.first); diff --git a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_2.h b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_2.h index b5fb838c29c..2629ec1aff7 100644 --- a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_2.h +++ b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_2.h @@ -559,6 +559,8 @@ private: Oriented_side side_of_hyperbolic_triangle(const Point& p, const Point& q, const Point& r, const Point& query, Locate_type <, int& li) const { + + // The triangle (p,q,r) must be Delaunay hyperbolic CGAL_precondition(geom_traits().is_Delaunay_hyperbolic_2_object()(p, q, r)); CGAL_precondition(query != p && query != q && query != r); diff --git a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_CK_traits_2.h b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_CK_traits_2.h index ebf704c4ef3..da42c7429f9 100644 --- a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_CK_traits_2.h +++ b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_CK_traits_2.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include @@ -77,13 +77,13 @@ namespace internal { std::vector< Intersection_result > inters; intersection(*c_pq, *c_qr, std::back_inserter(inters)); - CGAL_triangulation_assertion(assign(pair, inters[0])); + CGAL_assertion(assign(pair, inters[0])); if(pair.second == 1) { if(_gt.has_on_bounded_side_2_object()(l_inf, pair.first)) return pair.first; - CGAL_triangulation_assertion(assign(pair, inters[1])); + CGAL_assertion(assign(pair, inters[1])); return pair.first; } return pair.first; @@ -104,13 +104,13 @@ namespace internal { std::vector< Intersection_result > inters; intersection(*l, *c, std::back_inserter(inters)); - CGAL_triangulation_assertion(assign(pair,inters[0])); + CGAL_assertion(assign(pair,inters[0])); if(pair.second == 1) { if(_gt.has_on_bounded_side_2_object()(l_inf, pair.first)) return pair.first; - CGAL_triangulation_assertion(assign(pair, inters[1])); + CGAL_assertion(assign(pair, inters[1])); return pair.first; } return pair.first; @@ -177,9 +177,9 @@ namespace internal { const Hyperbolic_point_2& r, const Hyperbolic_point_2& s) const { - CGAL_triangulation_precondition((_gt.orientation_2_object()(p, q, r) == ON_POSITIVE_SIDE) && + CGAL_precondition((_gt.orientation_2_object()(p, q, r) == ON_POSITIVE_SIDE) && (_gt.orientation_2_object()(p, s, q) == ON_POSITIVE_SIDE)); - CGAL_triangulation_precondition((_gt.side_of_oriented_circle_2_object()(p, q, r,s) == ON_NEGATIVE_SIDE) && + CGAL_precondition((_gt.side_of_oriented_circle_2_object()(p, q, r,s) == ON_NEGATIVE_SIDE) && (_gt.side_of_oriented_circle_2_object()(p, s, q, r) == ON_NEGATIVE_SIDE)); Construct_circle_or_line_supporting_bisector cclsb(_gt); @@ -218,7 +218,7 @@ namespace internal { const Hyperbolic_point_2& q, const Hyperbolic_point_2& r) const { - CGAL_triangulation_precondition(_gt.orientation_2_object()(p, q, r) == POSITIVE); + CGAL_precondition(_gt.orientation_2_object()(p, q, r) == POSITIVE); Construct_circle_or_line_supporting_bisector cclsb(_gt); Construct_hyperbolic_circumcenter_CK_2 chc(_gt); @@ -240,13 +240,13 @@ namespace internal { intersection(bis_pq, l_inf, std::back_inserter(inters)); std::pair pair; - CGAL_triangulation_assertion(assign(pair,inters[0])); - CGAL_triangulation_assertion(pair.second == 1); + CGAL_assertion(assign(pair,inters[0])); + CGAL_assertion(pair.second == 1); if(_gt.less_y_2_object()(p, q)) return Line_arc_2(bis_pq,a,pair.first); - CGAL_triangulation_assertion(assign(pair,inters[1])); - CGAL_triangulation_assertion(pair.second == 1); + CGAL_assertion(assign(pair,inters[1])); + CGAL_assertion(pair.second == 1); return Line_arc_2(bis_pq,a,pair.first); } @@ -261,8 +261,8 @@ namespace internal { intersection(*c_pq, l_inf, std::back_inserter(inters)); std::pair pair; - CGAL_triangulation_assertion(assign(pair,inters[0])); - CGAL_triangulation_assertion(pair.second == 1); + CGAL_assertion(assign(pair,inters[0])); + CGAL_assertion(pair.second == 1); Hyperbolic_point_2 approx_pinf(to_double(pair.first.x()), to_double(pair.first.y())); Hyperbolic_point_2 approx_c(to_double(c_pq->center().x()), @@ -275,7 +275,7 @@ namespace internal { return Circular_arc_2(*c_pq, pair.first, a); } - CGAL_triangulation_assertion(assign(pair,inters[1])); + CGAL_assertion(assign(pair,inters[1])); if(_gt.orientation_2_object()(approx_c,approx_a,approx_pinf) == POSITIVE) return Circular_arc_2(*c_pq, pair.first, a); diff --git a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_traits_2.h b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_traits_2.h index 2e7e8d268b2..801ee71d993 100644 --- a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_traits_2.h +++ b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_Delaunay_triangulation_traits_2.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include @@ -365,9 +365,9 @@ public: const Hyperbolic_point_2& r, const Hyperbolic_point_2& s) const { - CGAL_triangulation_precondition((_gt.orientation_2_object()(p, q, r) == ON_POSITIVE_SIDE) && + CGAL_precondition((_gt.orientation_2_object()(p, q, r) == ON_POSITIVE_SIDE) && (_gt.orientation_2_object()(p, s, q) == ON_POSITIVE_SIDE)); - CGAL_triangulation_precondition((_gt.side_of_oriented_circle_2_object()(p, q, r,s) == ON_NEGATIVE_SIDE) && + CGAL_precondition((_gt.side_of_oriented_circle_2_object()(p, q, r,s) == ON_NEGATIVE_SIDE) && (_gt.side_of_oriented_circle_2_object()(p, s, q, r) == ON_NEGATIVE_SIDE)); Construct_hyperbolic_circumcenter_2 chc(_gt); @@ -405,7 +405,7 @@ public: const Hyperbolic_point_2& q, const Hyperbolic_point_2& r) const { - CGAL_triangulation_precondition(_gt.orientation_2_object()(p, q, r) == POSITIVE); + CGAL_precondition(_gt.orientation_2_object()(p, q, r) == POSITIVE); Construct_circle_or_line_supporting_bisector cclsb(_gt); Construct_hyperbolic_circumcenter_2 chc(_gt); diff --git a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_triangulation_face_base_2.h b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_triangulation_face_base_2.h index 16781769cf9..32d730aab7c 100644 --- a/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_triangulation_face_base_2.h +++ b/Hyperbolic_triangulation_2/include/CGAL/Hyperbolic_triangulation_face_base_2.h @@ -16,7 +16,6 @@ #include #include -#include #include #include diff --git a/Inscribed_areas/doc/Inscribed_areas/PackageDescription.txt b/Inscribed_areas/doc/Inscribed_areas/PackageDescription.txt index 869cc842f1e..a15bb4b041c 100644 --- a/Inscribed_areas/doc/Inscribed_areas/PackageDescription.txt +++ b/Inscribed_areas/doc/Inscribed_areas/PackageDescription.txt @@ -22,18 +22,11 @@ \cgalPkgDescriptionEnd -\cgalCRPSection{Assertions} - -The optimization code uses infix `OPTIMISATION` in the assertions, -e.g. defining the compiler flag -`CGAL_OPTIMISATION_NO_PRECONDITIONS` switches precondition -checking off, cf. Section \ref secchecks. - \cgalClassifedRefPages -- `CGAL::maximum_area_inscribed_k_gon_2` -- `CGAL::maximum_perimeter_inscribed_k_gon_2` -- `CGAL::extremal_polygon_2` +- `CGAL::maximum_area_inscribed_k_gon_2()` +- `CGAL::maximum_perimeter_inscribed_k_gon_2()` +- `CGAL::extremal_polygon_2()` - `CGAL::Largest_empty_iso_rectangle_2` - `CGAL::Extremal_polygon_area_traits_2` - `CGAL::Extremal_polygon_perimeter_traits_2` @@ -41,4 +34,3 @@ checking off, cf. Section \ref secchecks. - `LargestEmptyIsoRectangleTraits_2` */ - diff --git a/Inscribed_areas/include/CGAL/Extremal_polygon_traits_2.h b/Inscribed_areas/include/CGAL/Extremal_polygon_traits_2.h index a85e9a76f47..9c4cb0a113f 100644 --- a/Inscribed_areas/include/CGAL/Extremal_polygon_traits_2.h +++ b/Inscribed_areas/include/CGAL/Extremal_polygon_traits_2.h @@ -16,7 +16,7 @@ #include -#include +#include #include #include #include @@ -83,7 +83,7 @@ struct Extremal_polygon_area_traits_2 { int number_of_points( static_cast(iterator_distance( points_begin, points_end))); - CGAL_optimisation_precondition( number_of_points > min_k()); + CGAL_precondition( number_of_points > min_k()); // this gives the area of the triangle of two points with // the root: @@ -136,7 +136,7 @@ protected: }; } //namespace CGAL -#include + #include #ifdef CGAL_USE_LEDA #include @@ -221,11 +221,11 @@ struct Extremal_polygon_perimeter_traits_2 { using std::less; using std::max_element; - CGAL_optimisation_precondition_code( + CGAL_precondition_code( int number_of_points( static_cast(iterator_distance( points_begin, points_end)));) - CGAL_optimisation_precondition( number_of_points > min_k()); + CGAL_precondition( number_of_points > min_k()); // kind of messy, but first we have to have something // like Distance (function object) ... diff --git a/Inscribed_areas/include/CGAL/extremal_polygon_2.h b/Inscribed_areas/include/CGAL/extremal_polygon_2.h index 2cd09fdd7c0..e1543637f53 100644 --- a/Inscribed_areas/include/CGAL/extremal_polygon_2.h +++ b/Inscribed_areas/include/CGAL/extremal_polygon_2.h @@ -16,7 +16,7 @@ #include -#include +#include #include #include #include @@ -76,7 +76,7 @@ public: RandomAccessIC_object begin_col, RandomAccessIC_object end_col, RandomAccessIC_value begin_value, - RandomAccessIC_value CGAL_optimisation_precondition_code(end_value), + RandomAccessIC_value CGAL_precondition_code(end_value), const Operation& o) // initialization with two ranges [begin_row, end_row) and // [begin_col, end_col) of Objects, a range [begin_value, end_value) @@ -92,9 +92,9 @@ public: n_rows( static_cast(iterator_distance( begin_row, end_row))), n_cols( static_cast(iterator_distance( begin_col, end_col))) { - CGAL_optimisation_precondition( + CGAL_precondition( iterator_distance( begin_value, end_value) == n_cols); - CGAL_optimisation_assertion( n_rows > 0 && n_cols > 0); + CGAL_assertion( n_rows > 0 && n_cols > 0); } int @@ -108,8 +108,8 @@ public: Value operator()( int r, int c) const { - CGAL_optimisation_precondition( r >= 0 && r < n_rows); - CGAL_optimisation_precondition( c >= 0 && c < n_cols); + CGAL_precondition( r >= 0 && r < n_rows); + CGAL_precondition( c >= 0 && c < n_cols); return begin_value_[c] + op( begin_row_[r], begin_col_[c]); } @@ -181,11 +181,11 @@ CGAL_maximum_inscribed_rooted_k_gon_2( // returns the past-the-end iterator of that sequence. { // check preconditions: - CGAL_optimisation_precondition( k >= t.min_k()); + CGAL_precondition( k >= t.min_k()); int number_of_points( static_cast(iterator_distance( points_begin, points_end))); - CGAL_optimisation_precondition( number_of_points > k); + CGAL_precondition( number_of_points > k); typedef std::vector< int > Index_cont; @@ -203,7 +203,7 @@ CGAL_maximum_inscribed_rooted_k_gon_2( points_begin, points_end, max_area, gon.rbegin() + k + 1 - i); for (;;) { - CGAL_optimisation_assertion( gon[0] == 0); + CGAL_assertion( gon[0] == 0); gon[i] = number_of_points - 1; if ( ++i >= k) break; @@ -243,7 +243,7 @@ CGAL_maximum_inscribed_rooted_k_gon_2( RandomAccessIC_point points_end, int root, RandomAccessIC_int left_c_begin, - RandomAccessIC_int CGAL_optimisation_precondition_code(left_c_end), + RandomAccessIC_int CGAL_precondition_code(left_c_end), RandomAccessIC_int right_c_begin, RandomAccessIC_int right_c_end, typename Traits::FT& max_area, @@ -294,26 +294,26 @@ CGAL_maximum_inscribed_rooted_k_gon_2( right_c_end)); // check preconditions: - CGAL_optimisation_precondition( number_of_points > t.min_k()); - CGAL_optimisation_precondition( size_of_gon >= t.min_k() - 1); - CGAL_optimisation_precondition( + CGAL_precondition( number_of_points > t.min_k()); + CGAL_precondition( size_of_gon >= t.min_k() - 1); + CGAL_precondition( iterator_distance( left_c_begin, left_c_end) == iterator_distance( right_c_begin, right_c_end)); - CGAL_optimisation_precondition( left_c_begin[0] >= 0); - CGAL_optimisation_precondition( right_c_begin[0] >= 0); - CGAL_optimisation_precondition( + CGAL_precondition( left_c_begin[0] >= 0); + CGAL_precondition( right_c_begin[0] >= 0); + CGAL_precondition( left_c_begin[size_of_gon-1] < number_of_points); - CGAL_optimisation_precondition( + CGAL_precondition( right_c_begin[size_of_gon-1] < number_of_points); - CGAL_optimisation_expensive_precondition_code( + CGAL_expensive_precondition_code( for ( i = 0; i < size_of_gon; ++i) { - CGAL_optimisation_expensive_precondition( left_c_begin[i] >= 0); - CGAL_optimisation_expensive_precondition( right_c_begin[i] >= 0); - CGAL_optimisation_expensive_precondition( + CGAL_expensive_precondition( left_c_begin[i] >= 0); + CGAL_expensive_precondition( right_c_begin[i] >= 0); + CGAL_expensive_precondition( left_c_begin[i] < number_of_points); - CGAL_optimisation_expensive_precondition( + CGAL_expensive_precondition( right_c_begin[i] < number_of_points); - CGAL_optimisation_expensive_precondition( + CGAL_expensive_precondition( left_c_begin[i] <= right_c_begin[i]); }) @@ -426,12 +426,12 @@ extremal_polygon_2( // returns the past-the-end iterator of that sequence. { // check preconditions: - CGAL_optimisation_precondition_code( + CGAL_precondition_code( int number_of_points( static_cast(iterator_distance( points_begin, points_end)));) - CGAL_optimisation_precondition( number_of_points >= t.min_k()); - CGAL_optimisation_expensive_precondition( + CGAL_precondition( number_of_points >= t.min_k()); + CGAL_expensive_precondition( is_convex_2( points_begin, points_end, t)); typedef typename Traits::Point_2 Point_2; @@ -491,11 +491,11 @@ CGAL_maximum_inscribed_k_gon_2( // returns the past-the-end iterator of that sequence. { // check preconditions: - CGAL_optimisation_precondition( k >= t.min_k()); + CGAL_precondition( k >= t.min_k()); int number_of_points( static_cast(iterator_distance( points_begin, points_end))); - CGAL_optimisation_precondition( number_of_points > 0); + CGAL_precondition( number_of_points > 0); using std::copy; @@ -518,7 +518,7 @@ CGAL_maximum_inscribed_k_gon_2( P_0.rbegin() + 1, t); P_0[k] = number_of_points - 1; - CGAL_optimisation_assertion( P_0[0] == 0); + CGAL_assertion( P_0[0] == 0); // compute k-gon rooted at points_begin[P_0[1]] Index_cont P_1( k); FT area_1; @@ -535,7 +535,7 @@ CGAL_maximum_inscribed_k_gon_2( P_1.rbegin(), t); - CGAL_optimisation_assertion( P_1[0] == P_0[1]); + CGAL_assertion( P_1[0] == P_0[1]); // start recursive computation: @@ -630,29 +630,29 @@ CGAL_maximum_inscribed_k_gon_2( using std::copy; // check preconditions: - CGAL_optimisation_precondition( k >= t.min_k()); - CGAL_optimisation_precondition( left_index <= right_index); - CGAL_optimisation_precondition( left_index >= 0); - CGAL_optimisation_precondition( right_index >= 0); - CGAL_optimisation_precondition_code( + CGAL_precondition( k >= t.min_k()); + CGAL_precondition( left_index <= right_index); + CGAL_precondition( left_index >= 0); + CGAL_precondition( right_index >= 0); + CGAL_precondition_code( int number_of_points( static_cast(iterator_distance( points_begin, points_end)));) - CGAL_optimisation_precondition( left_index < number_of_points); - CGAL_optimisation_precondition( right_index < number_of_points); - CGAL_optimisation_precondition( + CGAL_precondition( left_index < number_of_points); + CGAL_precondition( right_index < number_of_points); + CGAL_precondition( iterator_distance( left_c_begin, left_c_end) == k - 1); - CGAL_optimisation_precondition( + CGAL_precondition( iterator_distance( right_c_begin, right_c_end) == k - 1); - CGAL_optimisation_expensive_precondition_code( + CGAL_expensive_precondition_code( for ( int i( 0); i < k - 1; ++i) { - CGAL_optimisation_expensive_precondition( left_c_begin[i] >= 0); - CGAL_optimisation_expensive_precondition( right_c_begin[i] >= 0); - CGAL_optimisation_expensive_precondition( + CGAL_expensive_precondition( left_c_begin[i] >= 0); + CGAL_expensive_precondition( right_c_begin[i] >= 0); + CGAL_expensive_precondition( left_c_begin[i] < number_of_points); - CGAL_optimisation_expensive_precondition( + CGAL_expensive_precondition( right_c_begin[i] < number_of_points); - CGAL_optimisation_expensive_precondition( + CGAL_expensive_precondition( left_c_begin[i] <= right_c_begin[i]); }) @@ -671,7 +671,7 @@ CGAL_maximum_inscribed_k_gon_2( area_middle, P_m.rbegin(), t); - CGAL_optimisation_assertion( P_m[0] == middle_index); + CGAL_assertion( P_m[0] == middle_index); // left recursive branch: FT area_left( 0); Index_cont P_l( k); diff --git a/Inscribed_areas/package_info/Inscribed_areas/dependencies b/Inscribed_areas/package_info/Inscribed_areas/dependencies index da58f1b4f08..e380dc379d9 100644 --- a/Inscribed_areas/package_info/Inscribed_areas/dependencies +++ b/Inscribed_areas/package_info/Inscribed_areas/dependencies @@ -8,7 +8,6 @@ Kernel_23 Matrix_search Modular_arithmetic Number_types -Optimisation_basic Polygon Profiling_tools STL_Extension diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index 5ec9848fddb..6f0523005e2 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -4,7 +4,11 @@ Release History [Release 5.6](https://github.com/CGAL/cgal/releases/tag/v5.6) ----------- -Release date: December 2022 +Release date: June 2023 + +### General Changes + +- **Breaking change**: The per package assertions, pre- and postconditions are no longer supported. ### [Combinatorial Maps](https://doc.cgal.org/5.6/Manual/packages.html#PkgCombinatorialMaps) [Generalized Maps](https://doc.cgal.org/5.6/Manual/packages.html#PkgGeneralizedMaps) [Linear Cell Complex](https://doc.cgal.org/5.6/Manual/packages.html#PkgLinearCellComplex) @@ -38,8 +42,15 @@ CGAL tetrahedral Delaunay refinement algorithm. ### [2D Conforming Triangulations and Meshes](https://doc.cgal.org/5.6/Manual/packages.html#PkgMesh2) +- Deprecated usage of boost parameters in favor of function named parameters in `CGAL::lloyd_optimize_mesh_2()`. - Deprecated two overloads of Function `refine_Delaunay_mesh()` and replaced them with versions using function named parameters. -- Add overloads of function `write_VTU()` with property maps for specifying the domain. +- Add overloads of function `write_VTU()` with property maps for specifying the domain. + +### [3D Mesh Generation](https://doc.cgal.org/5.6/Manual/packages.html#PkgMesh3) +- Deprecated usage of boost parameters in favor of function named parameters. + +### [3D Periodic Mesh Generation](https://doc.cgal.org/5.6/Manual/packages.html#PkgPeriodic3Mesh3) +- Deprecated usage of boost parameters in favor of function named parameters. ### [2D Hyperbolic Triangulations](https://doc.cgal.org/5.6/Manual/packages.html#PkgHyperbolicTriangulation2) diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 28ee5079fdb..5f506634ba8 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -1200,8 +1200,6 @@ ${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include/${header}" endif() endforeach() # loop on packages #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 diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h index a2d01e9293a..7d7d435a302 100644 --- a/Installation/include/CGAL/config.h +++ b/Installation/include/CGAL/config.h @@ -112,17 +112,6 @@ #endif #endif -// Macro used by Boost Parameter. Mesh_3 needs at least 12, before the -// Boost Parameter headers are included: -// defines the value to 8, if it is not yet defined. -// The CGAL BGL properties mechanism includes -// , that includes -// , and maybe other Boost libraries may use -// Boost Parameter as well. -// That is why that is important to define that macro as early as possible, -// in -#define BOOST_PARAMETER_MAX_ARITY 12 - // The following header file defines among other things BOOST_PREVENT_MACRO_SUBSTITUTION #include #include diff --git a/Interpolation/include/CGAL/natural_neighbor_coordinates_3.h b/Interpolation/include/CGAL/natural_neighbor_coordinates_3.h index 4b26a1245ea..de50b9defa9 100644 --- a/Interpolation/include/CGAL/natural_neighbor_coordinates_3.h +++ b/Interpolation/include/CGAL/natural_neighbor_coordinates_3.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include @@ -79,7 +79,7 @@ laplace_natural_neighbor_coordinates_3(const Dt& dt, typedef typename Dt::Locate_type Locate_type; typedef typename Gt::FT Coord_type; - CGAL_triangulation_precondition (dt.dimension() == 3); + CGAL_precondition (dt.dimension() == 3); Locate_type lt; int li, lj; @@ -119,9 +119,9 @@ laplace_natural_neighbor_coordinates_3(const Dt& dt, if (dt.is_infinite(cc1)) return make_triple(nn_out, norm_coeff=Coord_type(1), false);//point outside the convex-hull - CGAL_triangulation_assertion_code(Cell_handle cc2 = cc1->neighbor(f1.second);) - CGAL_triangulation_assertion(std::find(cells.begin(),cells.end(),cc1) != cells.end());//TODO : Delete - CGAL_triangulation_assertion(std::find(cells.begin(),cells.end(),cc2) == cells.end());//TODO : Delete + CGAL_assertion_code(Cell_handle cc2 = cc1->neighbor(f1.second);) + CGAL_assertion(std::find(cells.begin(),cells.end(),cc1) != cells.end());//TODO : Delete + CGAL_assertion(std::find(cells.begin(),cells.end(),cc2) == cells.end());//TODO : Delete Point C_1 = construct_circumcenter
    (f1, Q, dt.geom_traits()); for(int j=1; j<4; j++) @@ -137,7 +137,7 @@ laplace_natural_neighbor_coordinates_3(const Dt& dt, Cell_handle next = cc3->neighbor(num_next); while (std::find(cells.begin(),cells.end(),next) != cells.end()) { - CGAL_triangulation_assertion( next != cc1 ); + CGAL_assertion( next != cc1 ); cc3 = next; num_next = dt.next_around_edge(cc3->index(vR),cc3->index(vP)); next = cc3->neighbor(num_next); @@ -181,7 +181,7 @@ sibson_natural_neighbor_coordinates_3(const Dt& dt, typedef typename Dt::Locate_type Locate_type; typedef typename Gt::FT Coord_type; - CGAL_triangulation_precondition (dt.dimension()== 3); + CGAL_precondition (dt.dimension()== 3); Locate_type lt; int li, lj; @@ -215,7 +215,7 @@ sibson_natural_neighbor_coordinates_3(const Dt& dt, { // for each cell cc1 in conflict Cell_handle cc1 = *cit; - CGAL_triangulation_assertion(std::find(cells.begin(),cells.end(),cc1)!=cells.end());//TODO : Delete + CGAL_assertion(std::find(cells.begin(),cells.end(),cc1)!=cells.end());//TODO : Delete if (dt.is_infinite(cc1)) return make_triple(nn_out,norm_coeff=Coord_type(1), false);//point outside the convex-hull @@ -245,7 +245,7 @@ sibson_natural_neighbor_coordinates_3(const Dt& dt, while (std::find(cells.begin(),cells.end(),next) != cells.end()) { //next is in conflict - CGAL_triangulation_assertion( next != cc1 ); + CGAL_assertion( next != cc1 ); cc3 = next; num_next = dt.next_around_edge(cc3->index(vR),cc3->index(vP)); next = cc3->neighbor(num_next); @@ -269,7 +269,7 @@ sibson_natural_neighbor_coordinates_3(const Dt& dt, } else // cc2 in the conflict cavity { - CGAL_triangulation_assertion(std::find(cells.begin(),cells.end(),cc2)!=cells.end());//TODO : Delete + CGAL_assertion(std::find(cells.begin(),cells.end(),cc2)!=cells.end());//TODO : Delete if (dt.is_infinite(cc2)) { //point outside the convex-hull @@ -352,12 +352,12 @@ construct_circumcenter(const typename DT::Facet& f, const typename DT::Geom_traits::Point_3& Q, const typename DT::Geom_traits& gt /* = typename DT::Geom_traits() */ ) { - CGAL_triangulation_precondition(//&3 in place of %4 - !gt.coplanar_3_object()( - f.first->vertex((f.second+1)&3)->point(), - f.first->vertex((f.second+2)&3)->point(), - f.first->vertex((f.second+3)&3)->point(), - Q)); + CGAL_precondition(//&3 in place of %4 + !gt.coplanar_3_object()( + f.first->vertex((f.second+1)&3)->point(), + f.first->vertex((f.second+2)&3)->point(), + f.first->vertex((f.second+3)&3)->point(), + Q)); // else the facet is not on the enveloppe of the conflict cavity associated to P return gt.construct_circumcenter_3_object()( f.first->vertex((f.second+1)&3)->point(), diff --git a/Kernel_23/include/CGAL/kernel_assertions.h b/Kernel_23/include/CGAL/kernel_assertions.h index 3bd9163f845..b34df95df1b 100644 --- a/Kernel_23/include/CGAL/kernel_assertions.h +++ b/Kernel_23/include/CGAL/kernel_assertions.h @@ -14,12 +14,9 @@ // // Author(s) : Geert-Jan Giezeman, Sven Schoenherr // -// Generated from script create_assertions.sh - -// Note that this header file is intentionnaly not protected with a -// macro (as ). Calling it a second time with another value -// for CGAL_NO_ASSERTIONS for example must make a difference. +#ifndef CGAL_KERNEL_ASSERTIONS_H +#define CGAL_KERNEL_ASSERTIONS_H #include @@ -28,9 +25,6 @@ // assertions // ---------- -#undef CGAL_kernel_assertion -#undef CGAL_kernel_assertion_msg -#undef CGAL_kernel_assertion_code #if defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) # define CGAL_kernel_assertion(EX) (static_cast(0)) @@ -46,9 +40,6 @@ #endif // CGAL_KERNEL_NO_ASSERTIONS -#undef CGAL_kernel_exactness_assertion -#undef CGAL_kernel_exactness_assertion_msg -#undef CGAL_kernel_exactness_assertion_code #if defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) @@ -65,9 +56,6 @@ #endif // CGAL_KERNEL_NO_ASSERTIONS -#undef CGAL_kernel_expensive_assertion -#undef CGAL_kernel_expensive_assertion_msg -#undef CGAL_kernel_expensive_assertion_code #if defined(CGAL_KERNEL_NO_ASSERTIONS) \ || defined(CGAL_NO_ASSERTIONS) \ @@ -85,9 +73,6 @@ #endif // CGAL_KERNEL_NO_ASSERTIONS -#undef CGAL_kernel_expensive_exactness_assertion -#undef CGAL_kernel_expensive_exactness_assertion_msg -#undef CGAL_kernel_expensive_exactness_assertion_code #if defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ @@ -108,9 +93,6 @@ // preconditions // ------------- -#undef CGAL_kernel_precondition -#undef CGAL_kernel_precondition_msg -#undef CGAL_kernel_precondition_code #if defined(CGAL_KERNEL_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) # define CGAL_kernel_precondition(EX) (static_cast(0)) @@ -126,9 +108,6 @@ #endif // CGAL_KERNEL_NO_PRECONDITIONS -#undef CGAL_kernel_exactness_precondition -#undef CGAL_kernel_exactness_precondition_msg -#undef CGAL_kernel_exactness_precondition_code #if defined(CGAL_KERNEL_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) @@ -145,9 +124,6 @@ #endif // CGAL_KERNEL_NO_PRECONDITIONS -#undef CGAL_kernel_expensive_precondition -#undef CGAL_kernel_expensive_precondition_msg -#undef CGAL_kernel_expensive_precondition_code #if defined(CGAL_KERNEL_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) @@ -164,9 +140,6 @@ #endif // CGAL_KERNEL_NO_PRECONDITIONS -#undef CGAL_kernel_expensive_exactness_precondition -#undef CGAL_kernel_expensive_exactness_precondition_msg -#undef CGAL_kernel_expensive_exactness_precondition_code #if defined(CGAL_KERNEL_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ @@ -187,9 +160,6 @@ // postconditions // -------------- -#undef CGAL_kernel_postcondition -#undef CGAL_kernel_postcondition_msg -#undef CGAL_kernel_postcondition_code #if defined(CGAL_KERNEL_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) # define CGAL_kernel_postcondition(EX) (static_cast(0)) @@ -205,9 +175,6 @@ #endif // CGAL_KERNEL_NO_POSTCONDITIONS -#undef CGAL_kernel_exactness_postcondition -#undef CGAL_kernel_exactness_postcondition_msg -#undef CGAL_kernel_exactness_postcondition_code #if defined(CGAL_KERNEL_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) @@ -224,9 +191,6 @@ #endif // CGAL_KERNEL_NO_POSTCONDITIONS -#undef CGAL_kernel_expensive_postcondition -#undef CGAL_kernel_expensive_postcondition_msg -#undef CGAL_kernel_expensive_postcondition_code #if defined(CGAL_KERNEL_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) @@ -243,9 +207,6 @@ #endif // CGAL_KERNEL_NO_POSTCONDITIONS -#undef CGAL_kernel_expensive_exactness_postcondition -#undef CGAL_kernel_expensive_exactness_postcondition_msg -#undef CGAL_kernel_expensive_exactness_postcondition_code #if defined(CGAL_KERNEL_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ @@ -266,9 +227,6 @@ // warnings // -------- -#undef CGAL_kernel_warning -#undef CGAL_kernel_warning_msg -#undef CGAL_kernel_warning_code #if defined(CGAL_KERNEL_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) # define CGAL_kernel_warning(EX) (static_cast(0)) @@ -284,9 +242,6 @@ #endif // CGAL_KERNEL_NO_WARNINGS -#undef CGAL_kernel_exactness_warning -#undef CGAL_kernel_exactness_warning_msg -#undef CGAL_kernel_exactness_warning_code #if defined(CGAL_KERNEL_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) @@ -303,9 +258,6 @@ #endif // CGAL_KERNEL_NO_WARNINGS -#undef CGAL_kernel_expensive_warning -#undef CGAL_kernel_expensive_warning_msg -#undef CGAL_kernel_expensive_warning_code #if defined(CGAL_KERNEL_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) @@ -322,9 +274,6 @@ #endif // CGAL_KERNEL_NO_WARNINGS -#undef CGAL_kernel_expensive_exactness_warning -#undef CGAL_kernel_expensive_exactness_warning_msg -#undef CGAL_kernel_expensive_exactness_warning_code #if defined(CGAL_KERNEL_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ @@ -340,3 +289,5 @@ # define CGAL_kernel_expensive_exactness_warning_code(CODE) CODE # define CGAL_kernel_expensive_exactness_warnings 1 #endif // CGAL_KERNEL_NO_WARNINGS + +#endif // CGAL_KERNEL_ASSERTIONS_H diff --git a/Kernel_d/include/CGAL/Kernel_d/Sphere_d.h b/Kernel_d/include/CGAL/Kernel_d/Sphere_d.h index 212480d843a..2c9a0e64955 100644 --- a/Kernel_d/include/CGAL/Kernel_d/Sphere_d.h +++ b/Kernel_d/include/CGAL/Kernel_d/Sphere_d.h @@ -47,6 +47,7 @@ class Sphere_d_rep { public: Sphere_d_rep() : cp(0) {} Sphere_d_rep(int d) : P(d), cp(0) {} + Sphere_d_rep(int d, Orientation orient) : P(d), orient(orient), cp(0) {} template Sphere_d_rep(int d, ForwardIterator first, ForwardIterator last) : @@ -109,14 +110,13 @@ typedef typename std::vector< Point_d >::const_iterator point_iterator; /*{\Mcreation 4}*/ -Sphere_d(int d = 0) : Base( Rep(d+1) ) + Sphere_d(int d = 0) : Base( Rep(d+1, ZERO) ) /*{\Mcreate introduces a variable |\Mvar| of type |\Mname|. |\Mvar| is initialized to the empty sphere centered at the origin of $d$-dimensional space. }*/ { Point_d p(d); for (int i = 0; i <= d; i++) ptr()->P[i] = p; - ptr()->orient = ZERO; ptr()->cp = new Point_d(p); } diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Linear_cell_complex_3_subdivision.cpp b/Linear_cell_complex/demo/Linear_cell_complex/Linear_cell_complex_3_subdivision.cpp index d157e9ba2e6..16b74ff6736 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Linear_cell_complex_3_subdivision.cpp +++ b/Linear_cell_complex/demo/Linear_cell_complex/Linear_cell_complex_3_subdivision.cpp @@ -134,11 +134,10 @@ subdivide_lcc_3 (LCC & m) // 2) We subdivide each facet. m.negate_mark (treated); // All the darts are marked in O(1). - unsigned int nb = 0; + for (LCC::Dart_range::iterator it (m.darts().begin ()); m.number_of_marked_darts (treated) > 0; ++it) { - ++nb; if (m.is_marked (it, treated)) { // We unmark the darts of the facet to process only once dart/facet. diff --git a/Matrix_search/doc/Matrix_search/PackageDescription.txt b/Matrix_search/doc/Matrix_search/PackageDescription.txt index 8ec5cfdffcb..202989f2da3 100644 --- a/Matrix_search/doc/Matrix_search/PackageDescription.txt +++ b/Matrix_search/doc/Matrix_search/PackageDescription.txt @@ -23,24 +23,17 @@ This chapter describes concepts, classes, and functions for monotone and sorted matrix search. -\cgalCRPSection{Assertions} - -The optimization code uses infix `OPTIMISATION` in the assertions, -e.g. defining the compiler flag -`CGAL_OPTIMISATION_NO_PRECONDITIONS` switches precondition -checking off, cf. Section \ref secchecks "Checks" in the chapter on STL extensions. \cgalClassifedRefPages -- `CGAL::monotone_matrix_search` +- `CGAL::monotone_matrix_search()` - `CGAL::Dynamic_matrix` - `MonotoneMatrixSearchTraits` - `BasicMatrix` -- `CGAL::sorted_matrix_search` +- `CGAL::sorted_matrix_search()` - `CGAL::Sorted_matrix_search_traits_adaptor` - `SortedMatrixSearchTraits` */ - diff --git a/Matrix_search/include/CGAL/Cartesian_matrix.h b/Matrix_search/include/CGAL/Cartesian_matrix.h index d3ad276a715..1aa192ab2c8 100644 --- a/Matrix_search/include/CGAL/Cartesian_matrix.h +++ b/Matrix_search/include/CGAL/Cartesian_matrix.h @@ -17,7 +17,7 @@ #include -#include +#include #include namespace CGAL { @@ -67,8 +67,8 @@ public: Value operator()(int r, int c) const { - CGAL_optimisation_precondition(r >= 0 && r < number_of_rows()); - CGAL_optimisation_precondition(c >= 0 && c < number_of_columns()); + CGAL_precondition(r >= 0 && r < number_of_rows()); + CGAL_precondition(c >= 0 && c < number_of_columns()); return op(row_vec[r], column_vec[c]); } diff --git a/Matrix_search/include/CGAL/Dynamic_matrix.h b/Matrix_search/include/CGAL/Dynamic_matrix.h index 83b9063cf3e..2ae86317ebb 100644 --- a/Matrix_search/include/CGAL/Dynamic_matrix.h +++ b/Matrix_search/include/CGAL/Dynamic_matrix.h @@ -18,7 +18,7 @@ #include #include -#include +#include namespace CGAL { @@ -56,8 +56,8 @@ public: Value operator()( int r, int c) const { - CGAL_optimisation_precondition( r >= 0 && r < number_of_rows()); - CGAL_optimisation_precondition( c >= 0 && c < number_of_columns()); + CGAL_precondition( r >= 0 && r < number_of_rows()); + CGAL_precondition( c >= 0 && c < number_of_columns()); return (*matrix)( r << row_power, column_indices[c]); } @@ -70,18 +70,18 @@ public: void replace_column( int o, int n) { - CGAL_optimisation_precondition( o >= 0 && o < number_of_columns()); - CGAL_optimisation_precondition( n >= 0 && n < number_of_columns()); + CGAL_precondition( o >= 0 && o < number_of_columns()); + CGAL_precondition( n >= 0 && n < number_of_columns()); column_indices[o] = column_indices[n]; } void shrink_to_quadratic_size() { - CGAL_optimisation_precondition( number_of_columns() >= number_of_rows()); + CGAL_precondition( number_of_columns() >= number_of_rows()); column_indices.erase( column_indices.begin() + number_of_rows(), column_indices.end()); - CGAL_optimisation_postcondition( number_of_columns() == number_of_rows()); + CGAL_postcondition( number_of_columns() == number_of_rows()); } private: diff --git a/Matrix_search/include/CGAL/Transform_iterator.h b/Matrix_search/include/CGAL/Transform_iterator.h index c3ab6e8c437..18d4f9986ab 100644 --- a/Matrix_search/include/CGAL/Transform_iterator.h +++ b/Matrix_search/include/CGAL/Transform_iterator.h @@ -16,7 +16,6 @@ #include -#include #include #include diff --git a/Matrix_search/include/CGAL/monotone_matrix_search.h b/Matrix_search/include/CGAL/monotone_matrix_search.h index 4f527634e70..ae1bd6f4ce9 100644 --- a/Matrix_search/include/CGAL/monotone_matrix_search.h +++ b/Matrix_search/include/CGAL/monotone_matrix_search.h @@ -16,7 +16,7 @@ #include -#include +#include #include #include @@ -57,9 +57,9 @@ monotone_matrix_search( // ------ // get even rows of M: Matrix* M_new = M.extract_all_even_rows(); - CGAL_optimisation_assertion( + CGAL_assertion( M_new->number_of_columns() == M.number_of_columns()); - CGAL_optimisation_assertion( + CGAL_assertion( M_new->number_of_rows() == 0 || M_new->number_of_rows() == ( M.number_of_rows() + 1) >> 1); @@ -75,7 +75,7 @@ monotone_matrix_search( reduction_table[M_new->number_of_rows()] = M.number_of_columns() - 1; _reduce_matrix( *M_new, reduction_table, compare_strictly); - CGAL_optimisation_assertion( + CGAL_assertion( M_new->number_of_columns() == M_new->number_of_rows()); } // if ( M_new->number_of_rows() < M_new->number_of_columns()) @@ -92,7 +92,7 @@ monotone_matrix_search( // recursion: - CGAL_optimisation_assertion( + CGAL_assertion( M_new->number_of_rows() >= M_new->number_of_columns()); // table to store the rmax values of M_new: @@ -160,7 +160,7 @@ _reduce_matrix( // and returns for each column of the resulting // matrix its column index in the original matrix { - CGAL_optimisation_precondition( + CGAL_precondition( M.number_of_columns() >= M.number_of_rows()); // active columns are 0, ..., j1, j2, ..., M.x_dim()-1 int j1( 0), j2( 1); @@ -191,7 +191,7 @@ _reduce_matrix( // have been deleted, now move columns // j2 .. M.number_of_columns()-1 to the first part while ( j1 < M.number_of_rows() - 1) { - CGAL_optimisation_assertion( j2 < M.number_of_columns()); + CGAL_assertion( j2 < M.number_of_columns()); M.replace_column( ++j1, j2); *(t+j1) = j2++; } diff --git a/Matrix_search/include/CGAL/sorted_matrix_search.h b/Matrix_search/include/CGAL/sorted_matrix_search.h index dd21234b4f5..d481ce8c07a 100644 --- a/Matrix_search/include/CGAL/sorted_matrix_search.h +++ b/Matrix_search/include/CGAL/sorted_matrix_search.h @@ -17,7 +17,7 @@ #include -#include +#include #include #include #include @@ -159,13 +159,13 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t) Cell_container active_cells; // set of input matrices must not be empty: - CGAL_optimisation_precondition( f != l); + CGAL_precondition( f != l); // for each input matrix insert a cell into active_cells: InputIterator i( f); int maxdim( -1); while ( i != l) { - CGAL_optimisation_expensive_precondition( + CGAL_expensive_precondition( PaddedMatrix( *i).is_sorted()); active_cells.push_back( Cell( PaddedMatrix( *i))); maxdim = max BOOST_PREVENT_MACRO_SUBSTITUTION ( max BOOST_PREVENT_MACRO_SUBSTITUTION ( (*i).number_of_columns(), @@ -173,7 +173,7 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t) maxdim); ++i; } - CGAL_optimisation_precondition( maxdim > 0); + CGAL_precondition( maxdim > 0); // current cell dimension: @@ -239,7 +239,7 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t) break; // there has to be at least one cell left: - CGAL_optimisation_assertion( active_cells.size() > 0); + CGAL_assertion( active_cells.size() > 0); // ------------------------------------------------------ // compute medians of smallest and largest elements: @@ -285,7 +285,7 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t) { return equal_to< Value >()(lower_median, Cell_min< Cell >()(c)); }); - CGAL_optimisation_assertion(lower_median_cell != active_cells.end()); + CGAL_assertion(lower_median_cell != active_cells.end()); // ------------------------------------------------------ // test feasibility of medians and remove cells accordingly: Cell_iterator new_end; @@ -385,8 +385,8 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t) } // for (;;) // there must be only one cell left: - CGAL_optimisation_assertion( active_cells.size() == 1); - CGAL_optimisation_assertion( ccd == 1); + CGAL_assertion( active_cells.size() == 1); + CGAL_assertion( ccd == 1); return ((*active_cells.begin()).min)(); } diff --git a/Matrix_search/package_info/Matrix_search/dependencies b/Matrix_search/package_info/Matrix_search/dependencies index 226536b676a..50ab94de3e7 100644 --- a/Matrix_search/package_info/Matrix_search/dependencies +++ b/Matrix_search/package_info/Matrix_search/dependencies @@ -5,7 +5,6 @@ Kernel_23 Matrix_search Modular_arithmetic Number_types -Optimisation_basic Profiling_tools STL_Extension Stream_support diff --git a/Mesh_2/doc/Mesh_2/CGAL/lloyd_optimize_mesh_2.h b/Mesh_2/doc/Mesh_2/CGAL/lloyd_optimize_mesh_2.h deleted file mode 100644 index 060cb8994e8..00000000000 --- a/Mesh_2/doc/Mesh_2/CGAL/lloyd_optimize_mesh_2.h +++ /dev/null @@ -1,119 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh2Functions - -The function `lloyd_optimize_mesh_2()` is a mesh optimization process -based on the minimization of a global energy function. - -In `lloyd_optimize_mesh_2()`, the minimized global energy may be interpreted -as the \f$ L^1\f$-norm of the error achieved -when the function \f$ x^2\f$ is interpolated on the mesh domain -using a piecewise linear function which is linear -in each cell of the Voronoi diagram of the mesh vertices. - -The optimizer `lloyd_optimize_mesh_2()` works in iterative steps. -At each iteration, mesh vertices are moved into -positions that bring to zero the energy gradient -and the Delaunay triangulation is updated. -Vertices on the mesh boundaries are not moved. - -\tparam CDT is required to be or derive from `CGAL::Constrained_Delaunay_triangulation_2`, -with vertex base and face base of its underlying `TriangulationDataStructure_2` -being models of `DelaunayMeshVertexBase_2` and `DelaunayMeshFaceBase_2`, respectively. -The argument `cdt`, passed by reference, provides the initial mesh -and is modified by the algorithm to represent the final optimized mesh. - -\tparam PointIterator must be an iterator with value type `Kernel::Point_2` - -The function has several optional parameters which are named parameters -(we use the Boost.Parameter library). -Therefore, when calling the function, the parameters can be provided in any order -provided that the names of the parameters are used -(see example at the bottom of this page). - -\cgalHeading{Named Parameters} - -- `parameters::time_limit` -is used to set up, in seconds, -a CPU time limit after which the optimization process is stopped. This time is -measured using `CGAL::Timer`. -The default value is 0 and means that there is no time limit. -\pre `time_limit` \f$ \geq\f$ 0 - -- `parameters::%max_iteration_number` sets a limit on the -number of performed iterations. The default value of 0 means that there is -no limit on the number of performed iterations. -\pre `max_iteration_number`\f$ \geq\f$ 0 - -- `parameters::%convergence` is a stopping criterion based on convergence: -the optimization process is stopped, when at the last iteration, -the displacement of any vertex is less than a given fraction of the -length of the shortest edge incident to that vertex. -The parameter `convergence` gives the threshold ratio. -\pre 0 \f$ \leq\f$ `convergence` \f$ \leq\f$ 1 - -- `parameters::freeze_bound` is designed to reduce running time of each -optimization iteration. Any vertex that has a displacement less than a given -fraction of the length of its shortest incident edge, is frozen (i.e.\ is -not relocated). The parameter `freeze_bound` gives the threshold ratio. -The default value is 0.001. If it is set to 0, freezing of vertices is disabled. -\pre 0 \f$ \leq\f$ `freeze_bound` \f$ \leq\f$ 1 - -- `parameters::seeds_begin` and `parameters::seeds_end` -are begin and end input iterators to iterate on seed points. -The sequence [`parameters::seeds_begin`, `parameters::seeds_end`) -defines the domain in which the mesh was generated, and should be optimized. - -- `parameters::mark`. If `mark` is set to true, the mesh domain -is the union of the bounded connected components including at least one seed. -If `mark` is false, the domain is the union of the bounded components including -no seed. Note that the unbounded component of the plane is never optimized. -The default value is false. - - - - -\return -The function `lloyd_optimize_mesh_2()` returns a value of type `CGAL::Mesh_optimization_return_code` -which is: -
      -
    • `CGAL::TIME_LIMIT_REACHED` when the time limit is reached. -
    • `CGAL::MAX_ITERATION_NUMBER_REACHED` when `lloyd_optimize_mesh_2()` stops because it has performed `max_iteration_number` iterations. -
    • `CGAL::CONVERGENCE_REACHED` when `lloyd_optimize_mesh_2()` stops because the convergence criterion -is met. -
    • `CGAL::ALL_VERTICES_FROZEN` when all vertices have been frozen, when the -`freeze_bound` parameter is set to a positive value. -
    • `CGAL::CANT_IMPROVE_ANYMORE` when `lloyd_optimize_mesh_2()` stops because -most vertices have been frozen, and no better convergence can be reached. -
    - -\cgalHeading{Example} - - -\code{.cpp} -// Lloyd-smoothing until convergence reaches 0.01, freezing vertices which -// move less than 0.001*shortest_incident_edge_length -lloyd_optimize_mesh_2(cdt, - parameters::convergence=0.01, - parameters::freeze_bound=0.001); - -\endcode - -\sa `CGAL::Mesh_optimization_return_code` -\sa `CGAL::refine_Delaunay_mesh_2()` - -*/ - -template -CGAL::Mesh_optimization_return_code -lloyd_optimize_mesh_2(CDT& cdt, - double parameters::time_limit=0, - std::size_t parameters::max_iteration_number=0, - double parameters::convergence=0.001, - double parameters::freeze_bound = 0.001, - PointIterator parameters::seeds_begin = PointIterator(), - PointIterator parameters::seeds_end = PointIterator(), - bool parameters::mark = false); - -} /* namespace CGAL */ diff --git a/Mesh_2/doc/Mesh_2/Doxyfile.in b/Mesh_2/doc/Mesh_2/Doxyfile.in index 06825acdea6..a277235f466 100644 --- a/Mesh_2/doc/Mesh_2/Doxyfile.in +++ b/Mesh_2/doc/Mesh_2/Doxyfile.in @@ -1,3 +1,4 @@ @INCLUDE = ${CGAL_DOC_PACKAGE_DEFAULTS} PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - 2D Conforming Triangulations and Meshes" +INPUT += ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/lloyd_optimize_mesh_2.h diff --git a/Mesh_2/doc/Mesh_2/Mesh_2.txt b/Mesh_2/doc/Mesh_2/Mesh_2.txt index 4ccab5bedb4..7d31bb1fc85 100644 --- a/Mesh_2/doc/Mesh_2/Mesh_2.txt +++ b/Mesh_2/doc/Mesh_2/Mesh_2.txt @@ -278,6 +278,7 @@ After Delaunay refinement, angles are in the interval [28.5; 121.9] degrees. After 10 iterations of Lloyd optimization, they are in [29.1; 110.8]. 100 iterations take them to [29.3; 109.9]. \cgalFigureEnd +As of \cgal 5.6, `lloyd_optimize_mesh_2()` uses \ref bgl_namedparameters to set parameters. More details are provided in \ref FromBoostNPtoCGALNP. \subsection Mesh_2Examples Examples diff --git a/Mesh_2/doc/Mesh_2/dependencies b/Mesh_2/doc/Mesh_2/dependencies index 0c0f7765312..5ef261da50f 100644 --- a/Mesh_2/doc/Mesh_2/dependencies +++ b/Mesh_2/doc/Mesh_2/dependencies @@ -4,5 +4,5 @@ STL_Extension Algebraic_foundations Circulator Stream_support -Triangulation_2 BGL +Triangulation_2 diff --git a/Mesh_2/examples/Mesh_2/mesh_optimization.cpp b/Mesh_2/examples/Mesh_2/mesh_optimization.cpp index 81fda66fe61..d52e882a065 100644 --- a/Mesh_2/examples/Mesh_2/mesh_optimization.cpp +++ b/Mesh_2/examples/Mesh_2/mesh_optimization.cpp @@ -52,8 +52,9 @@ int main() std::cout << "Run Lloyd optimization..."; CGAL::lloyd_optimize_mesh_2(cdt, - CGAL::parameters::max_iteration_number = 10); + CGAL::parameters::number_of_iterations(10)); std::cout << " done." << std::endl; + std::cout << "Number of vertices: " << cdt.number_of_vertices() << std::endl; } diff --git a/Mesh_2/include/CGAL/Constrained_Delaunay_triangulation_face_base_2.h b/Mesh_2/include/CGAL/Constrained_Delaunay_triangulation_face_base_2.h index 3a49d756a71..fe4d4fd9869 100644 --- a/Mesh_2/include/CGAL/Constrained_Delaunay_triangulation_face_base_2.h +++ b/Mesh_2/include/CGAL/Constrained_Delaunay_triangulation_face_base_2.h @@ -17,7 +17,7 @@ #include -#include +#include #include namespace CGAL { diff --git a/Mesh_2/include/CGAL/Constrained_voronoi_diagram_2.h b/Mesh_2/include/CGAL/Constrained_voronoi_diagram_2.h index b03ca56d811..eb61e4bf50a 100644 --- a/Mesh_2/include/CGAL/Constrained_voronoi_diagram_2.h +++ b/Mesh_2/include/CGAL/Constrained_voronoi_diagram_2.h @@ -21,6 +21,7 @@ #include #include #include +#include #include namespace CGAL { @@ -415,8 +416,8 @@ template Cvd_cell_2 dual(const Tr& tr, const typename Tr::Vertex_handle& v) { - CGAL_triangulation_precondition( v != typename Tr::Vertex_handle()); - CGAL_triangulation_precondition( !tr.is_infinite(v)); + CGAL_precondition( v != typename Tr::Vertex_handle()); + CGAL_precondition( !tr.is_infinite(v)); Constrained_voronoi_diagram_2 diagram(tr); return diagram.cvd_cell(v); @@ -436,8 +437,8 @@ Cvd_cell_2 dual(const Tr& tr, // typedef Tr::Geom_traits::Ray_2 Ray; // typedef Tr::Geom_traits::Vector_2 Vector_2; // -// CGAL_triangulation_precondition( v != Vertex_handle()); -// CGAL_triangulation_precondition( !tr.is_infinite(v)); +// CGAL_precondition( v != Vertex_handle()); +// CGAL_precondition( !tr.is_infinite(v)); // // // The Circulator moves ccw. // std::vector segments; diff --git a/Mesh_2/include/CGAL/Delaunay_mesher_2.h b/Mesh_2/include/CGAL/Delaunay_mesher_2.h index ac01fe0e68d..f2dc490f3f2 100644 --- a/Mesh_2/include/CGAL/Delaunay_mesher_2.h +++ b/Mesh_2/include/CGAL/Delaunay_mesher_2.h @@ -29,7 +29,7 @@ template class Delaunay_mesher_2 { - /** \name \c Tr types */ + /** \name `Tr` types */ typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Face_handle Face_handle; typedef typename Tr::Edge Edge; @@ -118,10 +118,10 @@ private: public: /** \name MARKING FUNCTIONS */ - /** The value type of \a InputIterator should be \c Point, and represents + /** The value type of \a InputIterator should be `Point`, and represents seeds. Connected components of seeds are marked with the value of - \a mark. Other components are marked with \c !mark. The connected - component of infinite faces is always marked with \c false. + \a mark. Other components are marked with `!mark`. The connected + component of infinite faces is always marked with `false`. */ template void set_seeds(InputIterator b, InputIterator e, @@ -190,7 +190,7 @@ public: propagate_marks(tr.infinite_face(), false); } - /** Propagates the mark \c mark recursively. */ + /** Propagates the mark `mark` recursively. */ static void propagate_marks(const Face_handle fh, bool mark) { // std::queue only works with std::list on VC++6, and not with diff --git a/Mesh_2/include/CGAL/Delaunay_mesher_no_edge_refinement_2.h b/Mesh_2/include/CGAL/Delaunay_mesher_no_edge_refinement_2.h index 583929efe30..9caf4f52b7b 100644 --- a/Mesh_2/include/CGAL/Delaunay_mesher_no_edge_refinement_2.h +++ b/Mesh_2/include/CGAL/Delaunay_mesher_no_edge_refinement_2.h @@ -26,7 +26,7 @@ template class Delaunay_mesher_no_edge_refinement_2 { - /** \name \c Tr types */ + /** \name `Tr` types */ typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Face_handle Face_handle; typedef typename Tr::Edge Edge; @@ -109,10 +109,10 @@ private: public: /** \name MARKING FUNCTIONS */ - /** The value type of \a InputIterator should be \c Point, and represents + /** The value type of \a InputIterator should be `Point`, and represents seeds. Connected components of seeds are marked with the value of - \a mark. Other components are marked with \c !mark. The connected - component of infinite faces is always marked with \c false. + \a mark. Other components are marked with `!mark`. The connected + component of infinite faces is always marked with `false`. */ template void set_seeds(InputIterator b, InputIterator e, @@ -181,7 +181,7 @@ public: propagate_marks(tr.infinite_face(), false); } - /** Propagates the mark \c mark recursivly. */ + /** Propagates the mark `mark` recursivly. */ static void propagate_marks(const Face_handle fh, bool mark) { // std::queue only works with std::list on VC++6, and not with diff --git a/Mesh_2/include/CGAL/Mesh_2/Clusters.h b/Mesh_2/include/CGAL/Mesh_2/Clusters.h index 7ac17276f29..93a42015025 100644 --- a/Mesh_2/include/CGAL/Mesh_2/Clusters.h +++ b/Mesh_2/include/CGAL/Mesh_2/Clusters.h @@ -70,7 +70,7 @@ public: /** \name Clusters public types */ /** - * \c Cluster register several informations about clusters. + * `Cluster` register several informations about clusters. * A cluster is a set of vertices v_i incident to one vertice * v_0, so that angles between segments [v_0, v_i] is less than 60 * degres. @@ -127,7 +127,7 @@ private: Tr& tr; /**< The triangulation itself. */ /** - * Multimap \c Vertex_handle -> \c Cluster + * Multimap `Vertex_handle -> Cluster` * Each vertex can have several clusters. */ Cluster_map cluster_map; @@ -178,14 +178,14 @@ public: private: /** - * Computes clusters of the vertex \c v, using the auxiliary function + * Computes clusters of the vertex `v`, using the auxiliary function * construct_cluster(). */ void create_clusters_of_vertex(const Vertex_handle v); /** - * Adds the sequence [\c begin, \c end] to the cluster \c c and adds it - * to the clusters of the vertex \c v. + * Adds the sequence `[begin, end]` to the cluster `c` and adds it + * to the clusters of the vertex `v`. */ void construct_cluster(const Vertex_handle v, const Constrained_edge_circulator& begin, @@ -196,7 +196,7 @@ public: /** \name Functions to manage clusters during the refinement process. */ /** - * Update the cluster of [\c va,\c vb], putting \c vm instead of \c vb. + * Updates the cluster of `[va,vb]`, putting `vm` instead of `vb`. * If reduction=false, the edge [va,vm] is not set reduced. */ void update_cluster(Cluster& c, iterator it, @@ -205,8 +205,8 @@ public: bool reduction = true); /** - * Returns the cluster of [\c va,\c vb] in \c c and return true - * if it is in a cluster. Returns also a const_iterator in \c it. + * Returns the cluster of `[va,vb]` in `c` and return true + * if it is in a cluster. Returns also a const_iterator in `it`. */ bool get_cluster(const Vertex_handle va, const Vertex_handle vb, Cluster& c, iterator& it); diff --git a/Mesh_2/include/CGAL/Mesh_2/Mesh_global_optimizer_2.h b/Mesh_2/include/CGAL/Mesh_2/Mesh_global_optimizer_2.h index 0ffcca179cc..4c6dacd7802 100644 --- a/Mesh_2/include/CGAL/Mesh_2/Mesh_global_optimizer_2.h +++ b/Mesh_2/include/CGAL/Mesh_2/Mesh_global_optimizer_2.h @@ -21,7 +21,7 @@ #define CGAL_MESH_2_OPTIMIZER_VERBOSE #endif -#include +#include #include #include #include @@ -92,7 +92,7 @@ public: void set_time_limit(double time) { time_limit_ = time; } double time_limit() const { return time_limit_; } - /** The value type of \a InputIterator should be \c Point, and represents + /** The value type of \a InputIterator should be `Point`, and represents seeds. */ template @@ -108,7 +108,7 @@ public: } } - Mesh_optimization_return_code operator()(const int nb_iterations) + Mesh_optimization_return_code operator()(const std::size_t nb_iterations) { running_time_.reset(); running_time_.start(); @@ -141,7 +141,7 @@ public: bool convergence_stop = false; // Iterate - int i = -1; + std::size_t i = -1; while ( ++i < nb_iterations && ! is_time_limit_reached() ) { this->before_move(); @@ -222,7 +222,7 @@ public: private: /** - * Returns moves for vertices of set \c moving_vertices + * Returns moves for vertices of set `moving_vertices`. */ Moves_vector compute_moves(Vertex_set& moving_vertices) { @@ -260,7 +260,7 @@ private: } /** - * Returns the move for vertex \c v + * Returns the move for vertex `v`. */ Vector_2 compute_move(const Vertex_handle& v) { @@ -284,7 +284,7 @@ private: } /** - * Returns the minimum cicumradius length of faces incident to \c v + * Returns the minimum cicumradius length of faces incident to `v`. */ FT min_sq_circumradius(const Vertex_handle& v) const { @@ -395,8 +395,8 @@ private: seeds_.end(), seeds_mark_/*faces that are not in domain are tagged false*/); //Connected components of seeds are marked with the value of - // \a mark. Other components are marked with \c !mark. The connected - // component of infinite faces is always marked with \c false. + // \a mark. Other components are marked with `!mark`. The connected + // component of infinite faces is always marked with `false`. } void after_all_moves() @@ -464,7 +464,7 @@ private: bool seeds_mark_; double time_limit_; - CGAL::Timer running_time_; + CGAL::Real_timer running_time_; std::list big_moves_; diff --git a/Mesh_2/include/CGAL/Mesh_2/Mesh_sizing_field.h b/Mesh_2/include/CGAL/Mesh_2/Mesh_sizing_field.h index 94236ba7ea0..b37602a8b57 100644 --- a/Mesh_2/include/CGAL/Mesh_2/Mesh_sizing_field.h +++ b/Mesh_2/include/CGAL/Mesh_2/Mesh_sizing_field.h @@ -57,20 +57,20 @@ public: } /** - * Returns size at point \c p. + * Returns size at point `p`. */ FT operator()(const Point_2& p) const { return this->operator()(p, last_face_); } /** - * Returns size at point \c p, using \c v to accelerate \c p location + * Returns size at point `p`, using `v` to accelerate `p` location * in triangulation */ FT operator()(const Point_2& p, const Vertex_handle& v) const { return this->operator()(p, v->face()); } /** - * Returns size at point \c p. + * Returns size at point `p`. */ FT operator()(const Point_2& p, const Face_handle& c) const { @@ -99,7 +99,7 @@ public: private: /** - * Returns size at point \c p, by interpolation inside facet + * Returns size at point `p`, by interpolation inside facet. */ FT interpolate_on_face_vertices(const Point_2& #ifdef CGAL_MESH_2_SIZING_FIELD_USE_BARYCENTRIC_COORDINATES @@ -128,8 +128,8 @@ private: } /** - * Returns size at point \c p, by interpolation inside edge - * (\c e f is assumed to be an infinite face) + * Returns size at point `p`, by interpolation inside edge + * (`f` is assumed to be an infinite face) */ FT interpolate_on_edge_vertices(const Point_2& #ifdef CGAL_MESH_2_SIZING_FIELD_USE_BARYCENTRIC_COORDINATES diff --git a/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h b/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h index 8f2cf435d60..94a585cf134 100644 --- a/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h +++ b/Mesh_2/include/CGAL/Mesh_2/Refine_edges.h @@ -41,7 +41,7 @@ namespace Mesh_2 { namespace details { - /** This class defines several auxiliary types for \c Refine_edges. */ + /** This class defines several auxiliary types for `Refine_edges`. */ template struct Refine_edges_base_types { @@ -50,7 +50,7 @@ namespace Mesh_2 { typedef std::pair Constrained_edge; - /** Object predicate that tests if a given \c Constrained_Edge is + /** Object predicate that tests if a given `Constrained_Edge` is really an edge of the triangulation and is constrained. */ class Is_a_constrained_edge { @@ -98,7 +98,7 @@ namespace Mesh_2 { typedef typename Tr::Point Point; typedef typename Tr::Geom_traits Geom_traits; - /** Operator that takes an edge (\c fh, \c index). */ + /** Operator that takes an edge (`fh`, `index`). */ bool operator()(const Tr& tr, const Face_handle& fh, const int i) const @@ -117,7 +117,7 @@ namespace Mesh_2 { ); } - /** Operator that takes an edge (\c va, \c vb). */ + /** Operator that takes an edge (`va`, `vb`). */ bool operator()(const Tr& tr, const Vertex_handle& va, const Vertex_handle& vb) const @@ -132,7 +132,7 @@ namespace Mesh_2 { } /** - * Operator that takes an edge (\c fh, \c index) and a point \c p. + * Operator that takes an edge (`fh`, `index`) and a point `p`. * Tests if the point encroached the edge. */ bool operator()(const Tr& tr, @@ -147,7 +147,7 @@ namespace Mesh_2 { } /** - * Operator that takes an edge (\c va, \c vb) and a point \c p. + * Operator that takes an edge (`va`, `vb`) and a point `p`. * Tests if the point encroached the edge. */ bool operator()(const Tr& tr, @@ -179,7 +179,7 @@ namespace Mesh_2 { typedef typename Tr::Point Point; typedef typename Tr::Geom_traits Geom_traits; - /** Operator that takes an edge (\c fh, \c index). */ + /** Operator that takes an edge (`fh`, `index`). */ bool operator()(const Tr& tr, const Face_handle& fh, const int i) const @@ -197,7 +197,7 @@ namespace Mesh_2 { return aux_outside_of_circle(tr, vi, vb, va, mvi); } - /** Operator that takes an edge (\c va, \c vb). */ + /** Operator that takes an edge (`va`, `vb`). */ bool operator()(const Tr& tr, const Vertex_handle& va, const Vertex_handle& vb) const @@ -269,7 +269,7 @@ namespace Mesh_2 { * \param Is_locally_conform defines the locally conform criterion: Gabriel * or Delaunay. It defaults to the Garbriel criterion. * \param Container is the type of container. It defaults to a filtered - * queue of \c Vertex_handle pair (see \c Filtered_queue_container). + * queue of `Vertex_handle` pair (see `Filtered_queue_container`). */ template < class Tr, @@ -615,7 +615,7 @@ public: protected: /** \name Auxiliary functions */ - /** Add an \c Edge \c e in the queue. */ + /** Add an edge `e` in the queue. */ void add_constrained_edge_to_be_conformed(const Edge& e) { const Vertex_handle& va = e.first->vertex(tr. cw(e.second)); @@ -624,7 +624,7 @@ protected: // base class } - /** Add an edge (\c va,\c vb) in the queue. */ + /** Add an edge `(va, vb)` in the queue. */ void add_constrained_edge_to_be_conformed(const Vertex_handle& va, const Vertex_handle& vb) { diff --git a/Mesh_2/include/CGAL/Mesh_2/Refine_edges_visitor.h b/Mesh_2/include/CGAL/Mesh_2/Refine_edges_visitor.h index 442ab8b3ff4..e6efb736235 100644 --- a/Mesh_2/include/CGAL/Mesh_2/Refine_edges_visitor.h +++ b/Mesh_2/include/CGAL/Mesh_2/Refine_edges_visitor.h @@ -65,7 +65,7 @@ public: Null_mesh_visitor previous_level() const { return null_mesh_visitor; } /** - * Store vertex handles and markers at left and right of the edge \c e. + * Store vertex handles and markers at left and right of the edge `e`. */ void before_conflicts(const Edge& e, const Point&) { @@ -84,7 +84,7 @@ public: faces_mesher.before_insertion_impl(Face_handle(), p, z); } - /** Restore markers in the star of \c v. */ + /** Restore markers in the star of `v`. */ void after_insertion(const Vertex_handle& v) { Tr& tr = faces_mesher.triangulation_ref_impl(); diff --git a/Mesh_2/include/CGAL/Mesh_2/Refine_edges_with_clusters.h b/Mesh_2/include/CGAL/Mesh_2/Refine_edges_with_clusters.h index 827a7dc7557..889403114c4 100644 --- a/Mesh_2/include/CGAL/Mesh_2/Refine_edges_with_clusters.h +++ b/Mesh_2/include/CGAL/Mesh_2/Refine_edges_with_clusters.h @@ -27,13 +27,13 @@ namespace Mesh_2 { /** * This class is the base for the first level of Mesh_2: the edge * conforming level. It \e does handle clusters. - * To handle clusters, an helping \c Clusters object is used. + * To handle clusters, an helping `Clusters` object is used. * * \param Tr is the type of triangulation on which the level acts. * \param Is_locally_conform defines the locally conform criterion: Gabriel * or Delaunay. It defaults to the Garbriel criterion. * \param Container is the type of container. It defaults to a filtered - * queue of \c Vertex_handle pair (see \c Filtered_queue_container). + * queue of `Vertex_handle` pair (see `Filtered_queue_container`). */ template < class Tr, diff --git a/Mesh_2/include/CGAL/Mesh_2/Refine_faces.h b/Mesh_2/include/CGAL/Mesh_2/Refine_faces.h index 1d7126e80e9..f5e9dfc41c4 100644 --- a/Mesh_2/include/CGAL/Mesh_2/Refine_faces.h +++ b/Mesh_2/include/CGAL/Mesh_2/Refine_faces.h @@ -212,7 +212,7 @@ public: } } - /** Restore markers in the star of \c v. */ + /** Restore markers in the star of `v`. */ void after_insertion_impl(const Vertex_handle& v) { #ifdef CGAL_MESH_2_VERBOSE @@ -254,11 +254,11 @@ public: Mesh_2::Face_badness is_bad(Quality q) const; /** - * Adds the sequence [\c begin, \c end[ to the list + * Adds the sequence `[begin, end[` to the list * of bad faces. * Use this overriden function if the list of bad faces can be * computed easily without testing all faces. - * \param Fh_it is an iterator of \c Face_Handle. + * \param Fh_it is an iterator of `Face_Handle`. */ template void set_bad_faces(Fh_it begin, Fh_it end) diff --git a/Mesh_2/include/CGAL/Triangulation_conformer_2.h b/Mesh_2/include/CGAL/Triangulation_conformer_2.h index 6993cbf24dd..28e8c5868e3 100644 --- a/Mesh_2/include/CGAL/Triangulation_conformer_2.h +++ b/Mesh_2/include/CGAL/Triangulation_conformer_2.h @@ -38,10 +38,10 @@ protected: /** \name INITIALIZED */ enum Initialization { - NONE, /**< \c this is not initialized. */ - CLUSTERS, /**< \c this clusters are initialized. */ - DELAUNAY, /**< \c this has been \e Delaunay-initialized. */ - GABRIEL /**< \c this has been \e Gabriel-initialized. */ + NONE, /**< `this` is not initialized. */ + CLUSTERS, /**< `this` clusters are initialized. */ + DELAUNAY, /**< `this` has been \e Delaunay-initialized. */ + GABRIEL /**< `this` has been \e Gabriel-initialized. */ }; // --- PROTECTED DATAS --- diff --git a/Mesh_2/include/CGAL/lloyd_optimize_mesh_2.h b/Mesh_2/include/CGAL/lloyd_optimize_mesh_2.h index 56f9d84b16e..fe7a7c321ac 100644 --- a/Mesh_2/include/CGAL/lloyd_optimize_mesh_2.h +++ b/Mesh_2/include/CGAL/lloyd_optimize_mesh_2.h @@ -15,61 +15,168 @@ #include -#include - #include #include #include #include #include -#include -#include + +#include #include -// see -CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS - - namespace CGAL { -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable:4003) // not enough actual parameters for macro -#endif +/*! + * @ingroup PkgMesh2Functions + * + * The function `lloyd_optimize_mesh_2()` is a mesh optimization process + * based on the minimization of a global energy function. + * + * In `lloyd_optimize_mesh_2()`, the minimized global energy may be interpreted + * as the \f$ L^1\f$-norm of the error achieved + * when the function \f$ x^2\f$ is interpolated on the mesh domain + * using a piecewise linear function which is linear + * in each cell of the Voronoi diagram of the mesh vertices. + * + * The optimizer `lloyd_optimize_mesh_2()` works in iterative steps. + * At each iteration, mesh vertices are moved into + * positions that bring to zero the energy gradient + * and the Delaunay triangulation is updated. + * Vertices on the mesh boundaries are not moved. + * + * @tparam CDT is required to be or derive from `CGAL::Constrained_Delaunay_triangulation_2`, + * with vertex base and face base of its underlying `TriangulationDataStructure_2` + * being models of `DelaunayMeshVertexBase_2` and `DelaunayMeshFaceBase_2`, respectively. + * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param cdt the initial mesh that will be modified by the algorithm to represent the final optimized mesh. + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{seeds} + * \cgalParamDescription{2D points used to define the domain to mesh. + * If `seeds_are_in_domain==true`, the mesh domain is the union of + * the bounded connected components including at least + * one seed. If `seeds_are_in_domain==false`, the domain is the + * union of the bounded components including no seed.} + * \cgalParamType{a class model of `ConstRange` whose iterator is a model of `InputIterator` with `CDT::Point_2` as value type.} + * \cgalParamDefault{No seed.} + * \cgalParamNEnd + * + * \cgalParamNBegin{seeds_are_in_domain} + * \cgalParamDescription{specified if seeds indicate bounded connected components inside or outside of the domain.} + * \cgalParamType{`bool`} + * \cgalParamDefault{false} + * \cgalParamNEnd + * + * \cgalParamNBegin{max_iteration_number} + * \cgalParamDescription{limit on the number of performed iterations. 0 means that there is + * no limit on the number of performed iterations.} + * \cgalParamPrecondition{`max_iteration_number >=0`} + * \cgalParamType{`int`} + * \cgalParamDefault{0} + * \cgalParamNEnd + * + * \cgalParamNBegin{time_limit} + * \cgalParamDescription{CPU time limit (in seconds) after which the optimization process is stopped. + * This time is measured using `CGAL::Real_timer`. 0 means that there is no time limit.} + * \cgalParamType{`double`} + * \cgalParamPrecondition{`time_limit` \f$ \geq\f$ 0} + * \cgalParamDefault{0} + * \cgalParamNEnd + * + * \cgalParamNBegin{freeze_bound} + * \cgalParamDescription{designed to reduce running time of each optimization iteration. + * Any vertex that has a displacement less than a given fraction of the length + * of its shortest incident edge, is frozen (i.e.\ is not relocated). + * The parameter `freeze_bound` gives the threshold ratio. + * If it is set to 0, freezing of vertices is disabled.} + * \cgalParamPrecondition{`0<= freeze_bound <=1`} + * \cgalParamType{`double`} + * \cgalParamDefault{0.001} + * \cgalParamNEnd + * + * \cgalParamNBegin{convergence} + * \cgalParamDescription{threshold ratio of stopping criterion based on convergence: the optimization process is stopped + * when at the last iteration the displacement of any vertex is less than + * a given fraction of the length of the shortest edge incident to that vertex.} + * \cgalParamPrecondition{`0 <=convergence <= 1`} + * \cgalParamType{`double`} + * \cgalParamDefault{0.001} + * \cgalParamNEnd + * + * \cgalNamedParamsEnd + * + * @returns an enum value providing some information about the outcome of the algorithm. + * + * \sa `CGAL::Mesh_optimization_return_code` + * \sa `CGAL::refine_Delaunay_mesh_2()` + */ +template +Mesh_optimization_return_code +lloyd_optimize_mesh_2(CDT& cdt, const CGAL_NP_CLASS& np = parameters::default_values()) +{ + using parameters::choose_parameter; + using parameters::get_parameter; + using parameters::get_parameter_reference; + using parameters::is_default_parameter; - BOOST_PARAMETER_FUNCTION( - (Mesh_optimization_return_code), - lloyd_optimize_mesh_2, - parameters::tag, - (required (in_out(cdt),*)) - (optional - (max_iteration_number_, *, 0 ) - (convergence_, *, 0.001 ) - (time_limit_, *, 0. ) - (freeze_bound_, *, 0.001 ) - (seeds_begin_, *, CGAL::Emptyset_iterator())//see comments below - (seeds_end_, *, CGAL::Emptyset_iterator())//see comments below - (mark_, *, false) //if "false", seeds indicate "outside" regions - ) - ) + std::size_t max_iterations = choose_parameter(get_parameter(np, internal_np::number_of_iterations), 0); + const double convergence_ratio = choose_parameter(get_parameter(np, internal_np::convergence_ratio), 0.001); + const double freeze_bound = choose_parameter(get_parameter(np, internal_np::vertex_freeze_bound), 0.001); + const double time_limit = choose_parameter(get_parameter(np, internal_np::maximum_running_time), 0.); + // Seeds + // { + typedef std::vector Default_seeds; + typedef typename internal_np::Lookup_named_param_def::reference Seeds; + Default_seeds ds; + Seeds seeds = choose_parameter(get_parameter_reference(np, internal_np::seeds), ds); + // } + const bool mark = choose_parameter(get_parameter(np, internal_np::seeds_are_in_domain), false); + + if (is_default_parameter::value || + is_default_parameter::value) { return lloyd_optimize_mesh_2_impl(cdt, - max_iteration_number_, - convergence_, - freeze_bound_, - time_limit_, - seeds_begin_, - seeds_end_, - mark_); + max_iterations, + convergence_ratio, + freeze_bound, + time_limit, + seeds.begin(), + seeds.end(), + mark); } + else + { + return lloyd_optimize_mesh_2_impl(cdt, + max_iterations, + convergence_ratio, + freeze_bound, + time_limit, + choose_parameter(get_parameter(np, internal_np::i_seed_begin_iterator), CGAL::Emptyset_iterator()), + choose_parameter(get_parameter(np, internal_np::i_seed_end_iterator), CGAL::Emptyset_iterator()), + mark); + } +} -#if defined(BOOST_MSVC) -# pragma warning(pop) -#endif +#ifndef DOXYGEN_RUNNING + // Overload handling parameters passed with operator= + template + Mesh_optimization_return_code + lloyd_optimize_mesh_2(CDT& cdt, + const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) + { + return lloyd_optimize_mesh_2(cdt, internal_np::combine_named_parameters(np1, np2, nps...)); + } /** * this partial specialization is a workaround @@ -83,7 +190,7 @@ namespace CGAL template Mesh_optimization_return_code lloyd_optimize_mesh_2_impl(CDT& cdt, - const int max_iterations, + const std::size_t max_iterations, const double convergence_ratio, const double freeze_bound, const double time_limit, @@ -99,7 +206,7 @@ namespace CGAL template Mesh_optimization_return_code lloyd_optimize_mesh_2_impl(CDT& cdt, - const int max_iterations, + const std::size_t max_iterations, const double convergence_ratio, const double freeze_bound, const double time_limit, @@ -124,7 +231,7 @@ namespace CGAL #endif // 1000 iteration max to avoid infinite loop - int nb_iterations = (0 == max_iterations) + std::size_t nb_iterations = (0 == max_iterations) ? 1000 : max_iterations; @@ -139,11 +246,8 @@ namespace CGAL return rc; } +#endif // DOXYGEN_RUNNING } //end namespace CGAL -CGAL_PRAGMA_DIAG_POP - -#include - #endif diff --git a/Mesh_2/package_info/Mesh_2/dependencies b/Mesh_2/package_info/Mesh_2/dependencies index a0eb105c10e..8e839394994 100644 --- a/Mesh_2/package_info/Mesh_2/dependencies +++ b/Mesh_2/package_info/Mesh_2/dependencies @@ -1,5 +1,4 @@ Algebraic_foundations -BGL Circulator Distance_2 Hash_map diff --git a/Mesh_2/test/Mesh_2/test_double_map.cpp b/Mesh_2/test/Mesh_2/test_double_map.cpp index 7ef6a121834..f7f82d21647 100644 --- a/Mesh_2/test/Mesh_2/test_double_map.cpp +++ b/Mesh_2/test/Mesh_2/test_double_map.cpp @@ -12,7 +12,7 @@ typedef CGAL::Double_map Map; int main(int argc, char** argv) { - unsigned int number_of_elements = 500; + int number_of_elements = 500; #ifdef CGAL_USE_BOOST_BIMAP std::cerr << "(Using the \"Boost.Bimap implementation\" of ...)\n\n"; @@ -58,14 +58,14 @@ int main(int argc, char** argv) assert(f.empty() && f2.empty()); /* AUTOMATIC CHECKS */ std::cerr << "Filling f with " << number_of_elements << " random integers...\n"; - for(unsigned int n=0; nsecond; @@ -152,7 +152,7 @@ int main(int argc, char** argv) assert(counter==number_of_elements); std::cerr << "Filling f with f(i)=i*i, i=0.." << number_of_elements -1 << "...\n"; - for(unsigned int n=0; n #include @@ -54,6 +56,50 @@ struct Lloyd_tester cdt.number_of_vertices() <= 640 ); + const size_type number_of_constraints = number_of_constrained_edges(cdt); + const size_type number_of_vertices1 = cdt.number_of_vertices(); + + CGAL::Mesh_optimization_return_code rc + = CGAL::lloyd_optimize_mesh_2(cdt, + CGAL::parameters::number_of_iterations(10). + convergence(0.001). + freeze_bound(0.001). + seeds(seeds)); + const size_type number_of_vertices2 = cdt.number_of_vertices(); + std::cerr << " done (return code = "<< rc <<").\n"; + std::cerr << "Number of vertices: " << number_of_vertices2 << "\n\n"; + + assert( cdt.is_valid() ); + assert( number_of_vertices1 == number_of_vertices2 ); + assert( number_of_constraints == number_of_constrained_edges(cdt)); + } +}; + +struct Lloyd_tester_original_BP_API +{ + void operator()(CDT& cdt) const + { + std::vector seeds; + seeds.reserve(32); + + std::cerr << "Reading fish-and-rectangle.poly..."; + std::ifstream poly_file("fish-and-rectangle.poly"); + CGAL::IO::read_triangle_poly_file(cdt, poly_file, std::back_inserter(seeds)); + assert( cdt.is_valid() ); + + std::cerr << " done.\nNumber of vertices: " << cdt.number_of_vertices() + << "\nNumber of seeds: " << seeds.size() << "\n\n"; + + std::cerr << "Meshing the triangulation with size 0.1..."; + CGAL::refine_Delaunay_mesh_2(cdt, + CGAL::parameters::seeds(seeds). + criteria(Criteria(0.125, 0.1))); + std::cerr << " done.\nNumber of vertices: " << cdt.number_of_vertices() << "\n\n"; + assert( cdt.is_valid() ); + assert( 580 <= cdt.number_of_vertices() && + cdt.number_of_vertices() <= 640 ); + + const size_type number_of_constraints = number_of_constrained_edges(cdt); const size_type number_of_vertices1 = cdt.number_of_vertices(); @@ -80,5 +126,11 @@ int main() CDT cdt; Lloyd_tester tester; tester(cdt); + + std::cerr << "TESTING lloyd_optimize_mesh_2 with Epick (original Boost Parameter API)...\n\n"; + cdt = CDT(); + Lloyd_tester_original_BP_API tester_bis; + tester_bis(cdt); + return 0; } diff --git a/Mesh_2/test/Mesh_2/test_mesh_opti_projection_traits.cpp b/Mesh_2/test/Mesh_2/test_mesh_opti_projection_traits.cpp index 88b379f1a1f..ef11be72b58 100644 --- a/Mesh_2/test/Mesh_2/test_mesh_opti_projection_traits.cpp +++ b/Mesh_2/test/Mesh_2/test_mesh_opti_projection_traits.cpp @@ -54,7 +54,7 @@ int main() std::cout << "Run Lloyd optimization..."; CGAL::lloyd_optimize_mesh_2(cdt, - CGAL::parameters::max_iteration_number = 10); + CGAL::parameters::number_of_iterations(10)); std::cout << " done." << std::endl; std::cout << "Number of vertices: " << cdt.number_of_vertices() << std::endl; diff --git a/Mesh_3/benchmark/Mesh_3/StdAfx.h b/Mesh_3/benchmark/Mesh_3/StdAfx.h index e28abce381a..a07ee4b3f16 100644 --- a/Mesh_3/benchmark/Mesh_3/StdAfx.h +++ b/Mesh_3/benchmark/Mesh_3/StdAfx.h @@ -253,7 +253,6 @@ #include #include //#include -//#include //#include //#include //#include diff --git a/Mesh_3/doc/Mesh_3/CGAL/Labeled_mesh_domain_3.h b/Mesh_3/doc/Mesh_3/CGAL/Labeled_mesh_domain_3.h deleted file mode 100644 index 59808d44899..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/Labeled_mesh_domain_3.h +++ /dev/null @@ -1,318 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3Domains - -\brief The class `Labeled_mesh_domain_3` implements indexed domains. - -This class is a model of concept `MeshDomain_3`. - -Any boundary facet is labeled , with a, where b!=0. - -This class includes a labeling function that provides the index of the subdomain in which any -query point lies. An intersection between a segment and bounding -surfaces is detected when both segment endpoints are associated with different -values of subdomain indices. The intersection is then constructed by bisection. -The bisection stops when the query segment is shorter than an error bound -`e` given by the product of the -length of the diagonal of the bounding box (in world coordinates), or the radius of the bounding sphere, and -a relative error bound passed as argument to the constructor of `Labeled_mesh_domain_3`. - -This class has a constructor taking a labeling function. It has also three -static template member functions that act as named constructors: -
      -
    • `create_gray_image_mesh_domain()`, to create a domain from a 3D gray image, -
    • `create_labeled_image_mesh_domain()`, to create a domain from a 3D labeled image, and -
    • `create_implicit_mesh_domain()`, to create a domain from an implicit function. -
    - -\tparam BGT is a geometric traits class that provides -the basic operations to implement -intersection tests and intersection computations -through a bisection method. This parameter must be instantiated -with a model of the concept `BisectionGeometricTraits_3`. - -\cgalHeading{Labeling function} - -A labeling function `f` must return `0` if the point isn't located in any subdomain. The return type of labeling functions is an integer. - -Let `p` be a Point. -
      -
    • `f(p)=0` means that `p` is outside domain.
    • -
    • `f(p)=a`, `a!=0` means that `p` is inside subdomain `a`.
    • -
    -`CGAL::Implicit_multi_domain_to_labeling_function_wrapper` is a good candidate for this template parameter -if there are several components to mesh. - -The function type can be any model of the concept `Callable` compatible with the signature `Subdomain_index(const Point_3&)`: it can be a function, a function object, a lambda expression... that takes a `%Point_3` as argument, and returns a type convertible to `Subdomain_index`. - -\cgalModels MeshDomain_3 - -\sa `Implicit_multi_domain_to_labeling_function_wrapper` -\sa `CGAL::make_mesh_3()`. - -*/ -template -class Labeled_mesh_domain_3 -{ -public: - -/// \name Types -///@{ - -/// The subdomain index of this model of `MeshDomain_3`. -typedef int Subdomain_index; - -/// The type of object that stores the function using type-erasure -typedef std::function Labeling_function; - -///@} -/// \name Types imported from the geometric traits class -///@{ - -/// The point type of the geometric traits class -typedef typename Geom_traits::Point_3 Point_3; -/// The sphere type of the geometric traits class -typedef typename Geom_traits::Sphere_3 Sphere_3; -/// The iso-cuboid type of the geometric traits class -typedef typename Geom_traits::Iso_cuboid_3 Iso_cuboid_3; -/// The number type (a field type) of the geometric traits class -typedef typename Geom_traits::FT FT; -///@} - -/// \name Creation -/// @{ -/*! \brief Construction from a function, a bounding -object and a relative error bound. - -This constructor uses named parameters (from the Boost Parameter -Library). They can be specified in any order. - -\cgalHeading{Named Parameters} -- `parameters::function` (mandatory) the labeling function, compatible with `Labeling_function`. -- `parameters::bounding_object` (mandatory) the bounding object is either a bounding sphere (of type `Sphere_3`), a bounding box (type `Bbox_3`), or a bounding `Iso_cuboid_3`. It bounds the meshable space. -- `parameters::relative_error_bound` (optional) the relative error bound used to compute intersection points between the implicit surface and query segments. The -bisection is stopped when the length of the intersected segment is less than the product of `relative_error_bound` by the diameter of the bounding object. Its default value is `FT(1e-3)`. - -\cgalHeading{Example} -From the example (\ref Mesh_3/mesh_implicit_domains_2.cpp): -\snippet Mesh_3/mesh_implicit_domains_2.cpp Domain creation - - */ -template -Labeled_mesh_domain_3(const A_i&...); - -///@} - -/// \name Creation of domains from implicit functions - -/*! -\brief Construction from an implicit function - -This static method is a named constructor. It constructs a domain -whose bounding surface is described implicitly as the zero level set of a -function. The domain to be discretized is assumed to be the domain where -the function has negative values. - -The method takes as argument a bounding sphere which is required to -circumscribe the surface and to have its center inside the domain. - -This constructor uses named parameters (from the Boost Parameter -Library). They can be specified in any order. - -\cgalHeading{Named Parameters} -
      -
    • `parameters::function` (mandatory) the implicit function, -compatible with the signature `FT(Point_3)`: it takes a point as argument, -and returns a scalar value. That object must be model of `CopyConstructible`. -
    • `parameters::bounding_object` (mandatory) the bounding object is -either a bounding sphere (of type `Sphere_3`), a bounding box (type -`Bbox_3`), or a bounding `Iso_cuboid_3`. It must bounds the surface, and -its center must be inside the domain. -
    - -\cgalHeading{Examples} - -From the example (\ref Mesh_3/mesh_implicit_sphere.cpp), where the name of -the parameters is not specified, as they are given is the same order as the -parameters definition: - -\snippet Mesh_3/mesh_implicit_sphere.cpp Domain creation - -From the example (\ref Mesh_3/mesh_implicit_sphere_variable_size.cpp): - -\snippet Mesh_3/mesh_implicit_sphere_variable_size.cpp Domain creation - - */ -template -static -Labeled_mesh_domain_3 -create_implicit_mesh_domain(A_i&...); - -/// \name Creation of domains from 3D images - - -/*! -\brief Construction from a 3D gray image - -This static method is a named constructor. It constructs a domain -described by a 3D gray image. A 3D gray image is a grid of voxels, -where each voxel is associated with a gray level value. Unless otherwise specified by the parameter `image_values_to_subdom_indices`, the domain to -be discretized is the union of voxels that lie inside a surface -described by an isolevel value, called \a isovalue. The voxels lying -inside the domain have gray level values that are larger than the -isovalue. - -The value of voxels is interpolated to a gray level value at any query point. - -This constructor uses named parameters (from the Boost Parameter -Library). They can be specified in any order. - -\cgalHeading{Named Parameters} -The parameters are optional unless otherwise specified. -
      - -
    • `parameters::image` (mandatory) the input 3D image. Must -be a `CGAL::Image_3` object. - -
    • `parameters::iso_value` the isovalue, inside - `image`, of the surface describing the boundary of the object to be - meshed. Its default value is `0`. - -
    • `parameters::image_values_to_subdom_indices` a function or - a function object, compatible with the signature - `Subdomain_index(double)`. This function returns the subdomain index - corresponding to a pixel value. If this parameter is used, then the - parameter `iso_value` is ignored. - -
    • `parameter::value_outside` the value attached to voxels - outside of the domain to be meshed. It should be lower than - `iso_value`. Its default value is `0`. - -
    • `parameter::relative_error_bound` is the relative error - bound, relative to the diameter of the box of the image. Its default - value is `FT(1e-3)`.
    - -\cgalHeading{Examples} - -From the example (\ref Mesh_3/mesh_3D_gray_image.cpp), where the name -of the parameters is not specified, as they are given is the same -order as the parameters definition: - -\snippet Mesh_3/mesh_3D_gray_image.cpp Domain creation - -From the example (\ref Mesh_3/mesh_3D_gray_vtk_image.cpp): - -\snippet Mesh_3/mesh_3D_gray_vtk_image.cpp Domain creation - - */ -template -static -Labeled_mesh_domain_3 -create_gray_image_mesh_domain(A_i&...); - -/*! -\brief Construction from a 3D labeled image - -This static method is a named constructor. It constructs a -domain described by a 3D labeled image. A 3D labeled image is a grid -of voxels, where each voxel is associated with an index (a subdomain -index) characterizing the subdomain in which the voxel lies. The -domain to be discretized is the union of voxels that have non-zero -values. - -This constructor uses named parameters (from the Boost Parameter -Library). They can be specified in any order. - -\cgalHeading{Named Parameters} -The parameters are optional unless otherwise specified. -
      - -
    • `parameters::image` (mandatory) the input 3D image. Must -be a `CGAL::Image_3` object. - -
    • `parameters::weights` an input 3D image that provides -weights associated to each voxel (the word type is `unsigned char`, -and the voxels values are integers between 0 and 255). -The weights image can be generated with `CGAL::Mesh_3::generate_label_weights()`. -Its dimensions must be the same as the dimensions of `parameters::image`. - -
    • `parameter::value_outside` the value attached to voxels - outside of the domain to be meshed. Its default value is `0`. - -
    • `parameter::relative_error_bound` is the relative error - bound, relative to the diameter of the box of the image. Its default - value is `FT(1e-3)`.
    - -\cgalHeading{Example} - -From the example (\ref Mesh_3/mesh_3D_image.cpp): - -\snippet Mesh_3/mesh_3D_image.cpp Domain creation - -From the example (\ref Mesh_3/mesh_3D_weighted_image.cpp), -where the labeled image is used with a precomputed 3D image of weights : - -\snippet Mesh_3/mesh_3D_weighted_image.cpp Domain creation - - */ -template -static -Labeled_mesh_domain_3 -create_labeled_image_mesh_domain(A_i&...); - -/// \name Deprecated constructors -/// -/// Those three constructors have been deprecated since CGAL-4.13, and -/// replaced by the constructor using the Boost Parameter Library. -/// -/// @{ - -/*! -\brief Construction from a labeling function, a bounding Sphere and a relative error bound. -\param f the labeling function. -\param bounding_sphere the bounding sphere of the meshable space. -\param relative_error_bound is the relative error bound used to compute intersection points between the implicit surface and query segments. The -bisection is stopped when the length of the intersected segment is less than the product of `relative_error_bound` by the radius of -`bounding_sphere`. -\deprecated This constructor is deprecated since CGAL-4.13, and -replaced by the constructor using the Boost Parameter Library. -*/ -Labeled_mesh_domain_3(Labeling_function f, - const Sphere_3& bounding_sphere, - const FT& relative_error_bound = FT(1e-3)); - -/*! -\brief Construction from a labeling function, a bounding box and a relative error bound. -\param f the labeling function. -\param bbox the bounding box of the meshable space. -\param relative_error_bound is the relative error bound used to compute intersection points between the implicit surface and query segments. The -bisection is stopped when the length of the intersected segment is less than the product of `relative_error_bound` by the diagonal of -`bounding_box`. -\deprecated This constructor is deprecated since CGAL-4.13, and -replaced by the constructor using the Boost Parameter Library. -*/ -Labeled_mesh_domain_3(Labeling_function f, - const Bbox_3& bbox, - const FT& relative_error_bound = FT(1e-3)); - -/*! -\brief Construction from a function, a bounding Iso_cuboid_3 and a relative error bound. -\param f the function. -\param bbox the bounding box of the meshable space. -\param relative_error_bound is the relative error bound used to compute intersection points between the implicit surface and query segments. The -bisection is stopped when the length of the intersected segment is less than the product of `relative_error_bound` by the diagonal of -`bounding_box`. -\deprecated This constructor is deprecated since CGAL-4.13, and -replaced by the constructor using the Boost Parameter Library. -*/ -Labeled_mesh_domain_3(Labeling_function f, - const Iso_cuboid_3& bbox, - const FT& relative_error_bound = FT(1e-3)); - -/// @} - -}; /* end Labeled_mesh_domain_3 */ -} /* end namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/Mesh_3/parameters.h b/Mesh_3/doc/Mesh_3/CGAL/Mesh_3/parameters.h new file mode 100644 index 00000000000..65fa962d512 --- /dev/null +++ b/Mesh_3/doc/Mesh_3/CGAL/Mesh_3/parameters.h @@ -0,0 +1,456 @@ +namespace CGAL { + +namespace parameters { + +/*! + * \ingroup PkgMesh3Parameters + * + * The function `parameters::manifold()` is used to drive the + * meshing algorithm for surfaces. + * It ensures that the surface of the output mesh is a manifold surface + * without boundaries. + * The manifold property of the output mesh can be achieved only if the input surface + * is a manifold. + * Note that the meshing algorithm provably terminates only if the input + * sharp edges have been protected, using the + * feature protection (see \ref Mesh_3Protectionof0and1dimensionalExposed). + * + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::refine_mesh_3()` + * \sa `CGAL::parameters::manifold_with_boundary()` + * \sa `CGAL::parameters::non_manifold()` + */ +unspecified_type manifold(); + +/*! + * \ingroup PkgMesh3Parameters + * + * The function `parameters::non_manifold()` is used to drive the + * meshing algorithm for surfaces. + * It does not ensure that the surface of the output mesh is a manifold surface. + * The manifold property of the output mesh might nevertheless result from an appropriate + * choice of meshing criteria. + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::refine_mesh_3()` + * \sa `CGAL::parameters::manifold_with_boundary()` + * \sa `CGAL::parameters::manifold()` + */ +unspecified_type non_manifold(); + +/*! + * \ingroup PkgMesh3Parameters + * + * The function `parameters::manifold_with_boundary()` is used to drive the + * meshing algorithm for surfaces. + * It ensures that the surface of the output mesh is a manifold surface which + * may have boundaries. + * The manifold property of the output mesh can be achieved only if the input surface + * is a manifold. + * Note that the meshing algorithm provably terminates only if the input + * sharp edges have been protected, using the + * feature protection (see \ref Mesh_3Protectionof0and1dimensionalExposed). + * + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::refine_mesh_3()` + * \sa `CGAL::parameters::non_manifold()` + * \sa `CGAL::parameters::manifold()` + */ +unspecified_type manifold_with_boundary(); + +/*! + * \ingroup PkgMesh3Parameters + * + * The function `parameters::exude()` allows the user to trigger a call to `exude_mesh_3()` in the + * `make_mesh_3()` and `refine_mesh_3()` mesh generation functions. + * It also allows the user to pass parameters + * to the optimization function `exude_mesh_3()` through these mesh generation functions. + * + * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{time_limit} + * \cgalParamDescription{is used to set up, in seconds, a CPU time limit after which the optimization process + * is stopped. This time is measured using the `Real_timer` class. The default value is + * 0 and means that there is no time limit.} + * \cgalParamType{`double`} + * \cgalParamPrecondition{`time_limit >= 0`} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalParamNBegin{sliver_bound} + * \cgalParamDescription{is designed to give, in degrees, a targeted lower bound on dihedral angles of mesh cells. + * The exudation process considers in turn all the mesh cells that have a smallest dihedral + * angle less than sliver_bound and tries to make them disappear by weighting their vertices. + * The optimization process stops when every cell in the mesh achieves this quality. The + * default value is 0 and means that there is no targeted bound: the exuder then runs as long + * as it can improve the smallest dihedral angles of the set of cells incident to some vertices.} + * \cgalParamType{`double`} + * \cgalParamPrecondition{`0 <= sliver_bound <= 180`} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * \cgalHeading{Example} + * + * \code{.cpp} + * // Mesh generation with an exudation step + * C3t3 c3t3 = make_mesh_3(domain, + * criteria, + * parameters::exude()); + * + * refine_mesh_3(c3t3, + * domain, + * criteria, + * parameters::exude(parameters::time_limit(10))); + * \endcode + * + * \sa `CGAL::parameters::no_exude()` + * \sa `CGAL::exude_mesh_3()` + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::refine_mesh_3()` + * + */ +template +unspecified_type exude(const Named_function_parameters& np = parameters::default_values()); + +/*! + * \ingroup PkgMesh3Parameters + * + * Provides an option indicating that 0 and 1-dimensional features + * have to be taken into account (the domain must be a model of `MeshDomainWithFeatures_3`). + * This is the default behavior when the domain is a model + * of `MeshDomainWithFeatures_3`. + * + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::refine_mesh_3()` + * \sa `CGAL::parameters::no_features()` + * + */ +unspecified_type features(); + +/*! + * \ingroup PkgMesh3Parameters + * + * The function `parameters::lloyd()` allows the user to trigger a call of + * `lloyd_optimize_mesh_3()` in the mesh generation functions + * `make_mesh_3()` and `refine_mesh_3()`. It also allows the user to pass + * parameters to the optimization function + * `lloyd_optimize_mesh_3()` through these mesh generation functions. + * + * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{time_limit} + * \cgalParamDescription{to set up, in seconds, a CPU time limit after which the optimization process is stopped. + * This time is measured using `CGAL::Real_timer`. 0 means that there is no time limit.} + * \cgalParamType{`double`} + * \cgalParamPrecondition{`time_limit >= 0`} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalParamNBegin{max_iteration_number} + * \cgalParamDescription{limit on the number of performed iterations. 0 means that there is + * no limit on the number of performed iterations.} + * \cgalParamPrecondition{`max_iteration_number >=0`} + * \cgalParamType{`int`} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalParamNBegin{freeze_bound} + * \cgalParamDescription{designed to reduce running time of each optimization iteration. + * Any vertex that has a displacement less than a given fraction of the length + * of its shortest incident edge, is frozen (i.e.\ is not relocated). + * The parameter `freeze_bound` gives the threshold ratio. + * If it is set to 0, freezing of vertices is disabled.} + * \cgalParamPrecondition{`0<= freeze_bound <=1`} + * \cgalParamType{`double`} + * \cgalParamDefault{0.01} + * \cgalParamNEnd + * \cgalParamNBegin{convergence} + * \cgalParamDescription{threshold ratio of stopping criterion based on convergence: the optimization process is stopped + * when at the last iteration the displacement of any vertex is less than + * a given fraction of the length of the shortest edge incident to that vertex.} + * \cgalParamPrecondition{`0 <=convergence <= 1`} + * \cgalParamType{`double`} + * \cgalParamDefault{0.02} + * \cgalParamNEnd + * \cgalParamNBegin{do_freeze} + * \cgalParamDescription{completes the `freeze_bound` parameter. If it is set to `true` (default value), + * frozen vertices will not move anymore in next iterations. Otherwise, at each iteration, any vertex that + * moves, unfreezes all its incident vertices.} + * \cgalParamType{`bool`} + * \cgalParamDefault{true} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * \cgalHeading{Example} + * + * \code{.cpp} + * // Mesh generation with lloyd optimization step + * C3t3 c3t3 = make_mesh_3(domain, + * criteria, + * parameters::lloyd()); + * + * refine_mesh_3(c3t3, + * domain, + * criteria, + * parameters::lloyd(parameters::time_limit(10))); + * + * \endcode + * + * \sa `CGAL::parameters::no_lloyd()` + * \sa `CGAL::lloyd_optimize_mesh_3()` + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::refine_mesh_3()` + * + */ +template +unspecified_type lloyd(const Named_function_parameters& np = parameters::default_values()); + +/*! + * \ingroup PkgMesh3Parameters + * + * The function `parameters::no_exude()` allows the user to tell the mesh generation functions + * `make_mesh_3()` and `refine_mesh_3()` that no exudation must be done. + * + * \cgalHeading{Example} + * + * \code{.cpp} + * // Mesh generation without exudation + * C3t3 c3t3 = make_mesh_3(domain, + * criteria, + * parameters::no_exude()); + * \endcode + * + * \sa `CGAL::parameters::exude()` + * \sa `CGAL::exude_mesh_3()` + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::refine_mesh_3()` + * + */ +unspecified_type no_exude(); + +/*! + * \ingroup PkgMesh3Parameters + * + * Provides an option indicating no special treatment should be done + * with 0 and 1-dimensional features. + * + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::refine_mesh_3()` + * \sa `CGAL::parameters::features()` + * + */ +unspecified_type no_features(); + +/*! + * \ingroup PkgMesh3Parameters + * + * The function `parameters::no_lloyd()` allows the user to tell the mesh generation functions + * `make_mesh_3()` and `refine_mesh_3()` that no lloyd optimization must be done. + * + * \cgalHeading{Example} + * + * \code{.cpp} + * // Mesh generation without lloyd optimization + * C3t3 c3t3 = make_mesh_3(domain, + * criteria, + * parameters::no_lloyd()); + * \endcode + * + * \sa `CGAL::parameters::lloyd()` + * \sa `CGAL::lloyd_optimize_mesh_3()` + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::refine_mesh_3()` + * + */ +unspecified_type no_lloyd(); + +/*! + * \ingroup PkgMesh3Parameters + * + * The function `parameters::no_odt()` allows the user to tell the mesh generation functions + * `make_mesh_3()` and `refine_mesh_3()` that no ODT optimization must be done. + * + * \cgalHeading{Example} + * + * \code{.cpp} + * // Mesh generation without odt optimization + * C3t3 c3t3 = make_mesh_3(domain, + * criteria, + * parameters::no_odt()); + * \endcode + * + * \sa `CGAL::parameters::odt()` + * \sa `CGAL::odt_optimize_mesh_3()` + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::refine_mesh_3()` + * + */ +unspecified_type no_odt(); + +/*! + * \ingroup PkgMesh3Parameters + * + * The function `parameters::no_perturb()` allows the user to tell mesh generation global functions + * `make_mesh_3()` and `refine_mesh_3()` that no perturbation must be done. + * + * \cgalHeading{Example} + * + * \code{.cpp} + * // Mesh generation without perturbation + * C3t3 c3t3 = make_mesh_3(domain, + * criteria, + * parameters::no_perturb()); + * \endcode + * + * \sa `CGAL::parameters::perturb()` + * \sa `CGAL::perturb_mesh_3()` + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::refine_mesh_3()` + * + */ +unspecified_type no_perturb(); + +/*! + * \ingroup PkgMesh3Parameters + * + * The function `parameters::odt()` allows the user to trigger a call to + * `CGAL::odt_optimize_mesh_3()` in + * `CGAL::make_mesh_3()` and `CGAL::refine_mesh_3()` mesh optimization functions. It also + * allows the user to pass parameters to the optimization function + * `odt_optimize_mesh_3()` through these mesh generation functions. + * + * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{time_limit} + * \cgalParamDescription{is used to set up, in seconds, + * a CPU time limit after which the optimization process is stopped. This time is + * measured using `Real_timer`. + * The default value is 0 and means that there is no time limit.} + * \cgalParamType{`double`} + * \cgalParamPrecondition{`time_limit >= 0`} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalParamNBegin{max_iteration_number} + * \cgalParamDescription{sets a limit on the number of performed iterations. + * The default value of 0 means that there is + * no limit on the number of performed iterations.} + * \cgalParamType{`std::size_t`} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalParamNBegin{convergence} + * \cgalParamDescription{is a stopping criterion based on convergence: + * the optimization process is stopped, when at the last iteration, + * the displacement of any vertex is less than a given percentage of the length + * the shortest edge incident to that vertex. + * The parameter `convergence` gives the threshold ratio.} + * \cgalParamType{`double`} + * \cgalParamPrecondition{`0 <= convergence <= 1`} + * \cgalParamDefault{0.02} + * \cgalParamNEnd + * \cgalParamNBegin{freeze_bound} + * \cgalParamDescription{is designed to reduce running time of each optimization iteration. Any vertex + * that has a displacement less than a given percentage of the length of its shortest incident edge, is frozen (i.e.\ is + * not relocated). The parameter `freeze_bound` gives the threshold ratio.} + * \cgalParamType{`double`} + * \cgalParamPrecondition{`0 <= freeze_bound <= 1`} + * \cgalParamDefault{0.01} + * \cgalParamNEnd + * \cgalParamNBegin{do_freeze} + * \cgalParamDescription{completes the `freeze_bound` parameter. If it is set to `true`, + * frozen vertices will not move anymore in next iterations. Otherwise, at each iteration, any vertex that + * moves, unfreezes all its incident vertices.} + * \cgalParamType{`bool`} + * \cgalParamDefault{true} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * \cgalHeading{Example} + * + * \code{.cpp} + * // Mesh generation with odt optimization step + * C3t3 c3t3 = make_mesh_3(domain, + * criteria, + * parameters::odt()); + * + * refine_mesh_3(c3t3, + * domain, + * criteria, + * parameters::odt(parameters::time_limit(10))); + * \endcode + * + * \sa `CGAL::parameters::no_odt()` + * \sa `CGAL::odt_optimize_mesh_3()` + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::refine_mesh_3()` + * + */ +template +unspecified_type odt(const Named_function_parameters& np = parameters::default_values()); + +/*! + * \ingroup PkgMesh3Parameters + * + * The function `parameters::perturb()` allows the user to trigger a call to + * `perturb_mesh_3()` in + * `make_mesh_3()` and `refine_mesh_3()` mesh generation functions. It also + * allows the user to pass parameters + * to the optimization function `perturb_mesh_3()` through these mesh generation functions. + * + * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{time_limit} + * \cgalParamDescription{is used to set up, in seconds, a CPU time limit after which the optimization process + * is stopped. This time is measured using the `Real_timer` class. The default value is + * 0 and means that there is no time limit.} + * \cgalParamType{`double`} + * \cgalParamPrecondition{`time_limit >= 0`} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalParamNBegin{sliver_bound} + * \cgalParamDescription{is designed to give, in degrees, a targeted lower bound on dihedral angles of mesh cells. + * The exudation process considers in turn all the mesh cells that have a smallest dihedral + * angle less than sliver_bound and tries to make them disappear by weighting their vertices. + * The optimization process stops when every cell in the mesh achieves this quality. The + * default value is 0 and means that there is no targeted bound: the exuder then runs as long + * as it can improve the smallest dihedral angles of the set of cells incident to some vertices.} + * \cgalParamType{`double`} + * \cgalParamPrecondition{`0 <= sliver_bound <= 180`} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * \cgalHeading{Example} + * + * \code{.cpp} + * // Mesh generation with a perturbation step + * C3t3 c3t3 = make_mesh_3(domain, + * criteria, + * parameters::perturb()); + * + * refine_mesh_3(c3t3, + * domain, + * criteria, + * parameters::perturb(parameters::time_limit(10))); + * + * \endcode + * + * \sa `CGAL::parameters::no_perturb()` + * \sa `CGAL::perturb_mesh_3()` + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::refine_mesh_3()` + * + */ +template +unspecified_type perturb(const Named_function_parameters& np = parameters::default_values()); + +} /* namespace parameters */ + +} /* namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/Mesh_criteria_3.h b/Mesh_3/doc/Mesh_3/CGAL/Mesh_criteria_3.h deleted file mode 100644 index f6511eda70b..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/Mesh_criteria_3.h +++ /dev/null @@ -1,161 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3MeshClasses - -The class `Mesh_criteria_3` is a model of both concepts `MeshCriteria_3` -and `MeshCriteriaWithFeatures_3`. -It gathers the refinement criteria for mesh tetrahedra and -surface facets where -surface facets are facets in the mesh approximating the domain surface patches. -In addition, for domain with exposed 1-dimensional features, -the class `Mesh_criteria_3` -handles the definition of a sizing field to guide the discretization of -1-dimensional features. - -\tparam Tr has to be instantiated with the type used for -`C3T3::Triangulation`, -where `C3T3` is the model of `MeshComplex_3InTriangulation_3` -used in the mesh generation process, -and `C3T3::Triangulation` its nested triangulation type. - -\cgalModels `MeshCriteria_3` - -\cgalHeading{Example} - -\code{.cpp} - -// Create a Mesh_criteria_3 object with all cell and facet parameters set -Mesh_criteria_3 criteria (parameters::facet_angle=30, - parameters::facet_size=1, - parameters::facet_distance=0.1, - parameters::cell_radius_edge_ratio=2, - parameters::cell_size=1.5); - -// Create a Mesh_criteria_3 object with size ignored (note that the order changed) -Mesh_criteria_3 criteria (parameters::cell_radius_edge_ratio=2, - parameters::facet_angle=30, - parameters::facet_distance=0.1); - -\endcode - -\sa `MeshCriteria_3` -\sa `MeshCriteriaWithFeatures_3` -\sa `MeshCellCriteria_3` -\sa `MeshEdgeCriteria_3` -\sa `MeshFacetCriteria_3` -\sa `MeshDomainField_3` -\sa `CGAL::Mesh_cell_criteria_3` -\sa `CGAL::Mesh_edge_criteria_3` -\sa `CGAL::Mesh_facet_criteria_3` -\sa `CGAL::Mesh_facet_topology` - -*/ -template< typename Tr > -class Mesh_criteria_3 -{ -public: - -/// \name Types -/// @{ - -/*! -The criteria for edges. -*/ -typedef Mesh_edge_criteria_3 Edge_criteria; - -/*! -The criteria for facets. -*/ -typedef Mesh_facet_criteria_3 Facet_criteria; - -/*! -The -criteria for cells. -*/ -typedef Mesh_cell_criteria_3 Cell_criteria; - -/// @} - -/// \name Creation -/// @{ - -/*! -Construction from facet and cell criteria. The edge criteria are ignored -in this case. -*/ -Mesh_criteria_3(const Facet_criteria& facet_criteria, - const Cell_criteria& cell_criteria); - -/*! -Construction from edge, facet and cell criteria. -*/ -Mesh_criteria_3(const Edge_criteria& edge_criteria, - const Facet_criteria& facet_criteria, - const Cell_criteria& cell_criteria); - -/*! -\brief Construction from criteria parameters. This constructor uses named -parameters (from Boost.Parameter) for convenient criteria -construction. - -\tparam FT must be a model of `Field` -\tparam Fieldi (`i`=1,..,4) should be either a model -of the concept `Field` or a model of the concept `MeshDomainField_3` - -The parameters are named parameters and can be passed in any order -provided their name is given (see example below). The name of each -parameter is the one that is written in the description of the -function (e.g. `parameters::facet_size`). - -The description of each parameter is as follows: - -- `edge_size`: a scalar field (resp. a constant) providing a space varying -(resp. a uniform) -upper bound for the lengths of curve edges. This parameter has to be set to a positive -value when 1-dimensional features protection is used. - -- `facet_angle`: a lower bound for the angles (in degrees) of the -surface mesh facets. - -- `facet_size`: a scalar field (resp. a constant) describing -a space varying (resp. a uniform) upper-bound or for the radii of the surface Delaunay balls. - -- `facet_distance`: a scalar field (resp. a constant) describing a space varying (resp. a uniform) -upper bound for the distance between the facet circumcenter and the center of its surface -Delaunay ball. - -- `facet_topology`: the set of topological constraints -which have to be verified by each surface facet. The default value is -`CGAL::FACET_VERTICES_ON_SURFACE`. See `Mesh_facet_topology` manual page to -get all possible values. - -- `cell_radius_edge_ratio`: an upper bound for the radius-edge ratio of the mesh tetrahedra. - -- `cell_size`: a scalar field (resp. a constant) describing -a space varying (resp. a uniform) upper-bound for the circumradii of the mesh tetrahedra. - -Note that each size or distance parameter can be specified using two ways: either as -a scalar field or as a numerical value when the field is uniform. - -Each parameter has a special default value `ignored` which means that the -corresponding criterion will be ignored. -Numerical sizing or distance values, as well as scalar fields -should be given in the unit used for coordinates of points in the mesh domain class -of the mesh generation process. - -*/ -template -Mesh_criteria_3(Field1 parameters::edge_size = ignored, - FT parameters::facet_angle = ignored, - Field2 parameters::facet_size = ignored, - Field3 parameters::facet_distance = ignored, - Mesh_facet_topology parameters::facet_topology = CGAL::FACET_VERTICES_ON_SURFACE, - FT parameters::cell_radius_edge_ratio = ignored, - Field4 parameters::cell_size = ignored); - -/// @} - -}; /* end Mesh_criteria_3 */ -} /* end namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/exude_mesh_3.h b/Mesh_3/doc/Mesh_3/CGAL/exude_mesh_3.h deleted file mode 100644 index e9b8167c8e2..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/exude_mesh_3.h +++ /dev/null @@ -1,81 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3Functions - -The function `exude_mesh_3()` performs a sliver exudation process on a Delaunay mesh. - -The sliver exudation process consists in optimizing the weights of vertices -of the weighted Delaunay triangulation in such a way that slivers disappear and -the quality of the mesh improves. - -\warning This optimizer modifies the weight of vertices of the triangulation and, -if called, must be the last optimizer to be called. If the mesh is refined after -this optimization has been performed, all improvements will be lost. - -\pre `time_limit` \f$ \geq\f$ 0 and 0 \f$ \leq\f$ `sliver_bound` \f$ \leq\f$ 180 - -\tparam C3T3 is required to be a model of the concept -`MeshComplex_3InTriangulation_3`. -The argument `c3t3`, passed by -reference, provides the initial mesh -and is modified by the algorithm -to represent the final optimized mesh. - -The function has two optional parameters which are named parameters (we use the Boost.Parameter library). -Therefore, when calling the function, the parameters can be provided in any order -provided that the names of the parameters are used -(see example at the bottom of this page). - -\cgalHeading{Named Parameters} -- `parameters::time_limit` is used to set up, in seconds, -a CPU time limit after which the optimization process is stopped. This time is -measured using the `Real_timer` class. -The default value is 0 and means that there is no time limit. - -- `parameters::sliver_bound` is designed to give, in degrees, a targeted -lower bound on dihedral angles of mesh cells. -The exudation process considers in turn all the mesh cells -that have a smallest dihedral angle less than `sliver_bound` -and tries to make them disappear by weighting their vertices. -The optimization process -stops when every cell in the mesh achieves this quality. -The default value is 0 and means that there is no targeted bound: -the exuder then runs as long as -it can improve the smallest dihedral angles of the set of cells -incident to some vertices. - -\return -The function `exude_mesh_3()` returns a value of type `CGAL::Mesh_optimization_return_code` -which is: -
      -
    • `CGAL::BOUND_REACHED` when the targeted bound for the smallest dihedral angle in the mesh is reached. -
    • `CGAL::TIME_LIMIT_REACHED` when the time limit is reached. -
    • `CGAL::CANT_IMPROVE_ANYMORE` when exudation process stops because it can no longer improve -the smallest dihedral angle of the set of cells incident to some vertex in the mesh. -
    - -\cgalHeading{Example} - -\code{.cpp} -// Exude without sliver_bound, using at most 10s CPU time -exude_mesh_3(c3t3, - parameters::time_limit=10); -\endcode - -\sa `CGAL::Mesh_optimization_return_code` -\sa `CGAL::make_mesh_3()` -\sa `CGAL::refine_mesh_3()` -\sa `CGAL::perturb_mesh_3()` -\sa `CGAL::lloyd_optimize_mesh_3()` -\sa `CGAL::odt_optimize_mesh_3()` - -*/ - -template -Mesh_optimization_return_code -exude_mesh_3(C3T3& c3t3, - double parameters::time_limit=0, - double parameters::sliver_bound=0); - -} /* namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/lloyd_optimize_mesh_3.h b/Mesh_3/doc/Mesh_3/CGAL/lloyd_optimize_mesh_3.h deleted file mode 100644 index b891d23810f..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/lloyd_optimize_mesh_3.h +++ /dev/null @@ -1,116 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3Functions - -The function `lloyd_optimize_mesh_3()` is a mesh optimization process -based on the minimization of a global energy function. - -In `lloyd_optimize_mesh_3()`, the minimized global energy may be interpreted -as the \f$ L^1\f$-norm of the error achieved -when the function \f$ x^2\f$ is interpolated on the mesh domain -using a piecewise linear function which is linear -in each cell of the Voronoi diagram of the mesh vertices. - -The optimizer `lloyd_optimize_mesh_3()` works in iterative steps. -At each iteration, mesh vertices are moved into -positions that bring to zero the energy gradient -and the Delaunay triangulation is updated. -Vertices on the mesh boundaries are handled -in a special way so as to preserve an accurate -representation of the domain boundaries. - -\pre `time_limit` \f$ \geq\f$ 0 and 0 \f$ \leq\f$ `convergence` \f$ \leq\f$ 1 and 0 \f$ \leq\f$ `freeze_bound` \f$ \leq\f$ 1 - -\tparam C3T3 is required to be a model of the concept -`MeshComplex_3InTriangulation_3`. -The argument `c3t3`, passed by -reference, provides the initial mesh -and is modified by the algorithm -to represent the final optimized mesh. - -\tparam MD is required to be a model of the concept -`MeshDomain_3`. The argument `domain` must be the `MD` -object used to create the `c3t3` parameter. - -The function has four optional parameters which are named parameters (we use the Boost.Parameter library). -Therefore, when calling the function, the parameters can be provided in any order -provided that the names of the parameters are used -(see example at the bottom of this page). - -\cgalHeading{Named Parameters} - -- `parameters::time_limit` -is used to set up, in seconds, -a CPU time limit after which the optimization process is stopped. This time is -measured using `Real_timer`. -The default value is 0 and means that there is no time limit. - -- `parameters::%max_iteration_number` sets a limit on the -number of performed iterations. The default value of 0 means that there is -no limit on the number of performed iterations. - -- `parameters::%convergence` is a stopping criterion based on convergence: -the optimization process is stopped, when at the last iteration, -the displacement of any vertex is less than a given percentage of the -length of the shortest edge incident to that vertex. -The parameter `convergence` gives the threshold ratio. - -- `parameters::freeze_bound` is designed to reduce running time of each optimization iteration. Any vertex -that has a displacement less than a given percentage of the length (the of its shortest incident edge, is frozen (i.e.\ is -not relocated). The parameter `freeze_bound` gives the threshold ratio. - -- `parameters::do_freeze` completes the `freeze_bound` parameter. If it is set to `true` (default value), -frozen vertices will not move anymore in next iterations. Otherwise, at each iteration, any vertex that -moves, unfreezes all its incident vertices. - - -\return -The function `lloyd_optimize_mesh_3()` returns a value of type `CGAL::Mesh_optimization_return_code` -which is: -
      -
    • `CGAL::TIME_LIMIT_REACHED` when the time limit is reached. -
    • `CGAL::MAX_ITERATION_NUMBER_REACHED` when `lloyd_optimize_mesh_3()` stops because it has performed `max_iteration_number` iterations. -
    • `CGAL::CONVERGENCE_REACHED` when `lloyd_optimize_mesh_3()` stops because the convergence criterion -is achieved. -
    • `CGAL::ALL_VERTICES_FROZEN` when all vertices have been frozen, when the -`do_freeze` parameter is set to true. -
    • `CGAL::CANT_IMPROVE_ANYMORE` when `lloyd_optimize_mesh_3()` stops because -most vertices have been frozen, and no better convergence can be reached. -
    - -\cgalHeading{Example} - - -\code{.cpp} -// Lloyd-smoothing until convergence reaches 0.01, freezing vertices which -// move less than 0.001*shortest_incident_edge_length -lloyd_optimize_mesh_3(c3t3, - domain, - parameters::convergence=0.01, - parameters::freeze_bound=0.001, - parameters::do_freeze=true); - -\endcode - -\sa `CGAL::Mesh_optimization_return_code` -\sa `CGAL::make_mesh_3()` -\sa `CGAL::refine_mesh_3()` -\sa `CGAL::exude_mesh_3()` -\sa `CGAL::perturb_mesh_3()` -\sa `CGAL::odt_optimize_mesh_3()` - -\note This function requires the \ref thirdpartyEigen library. -*/ - -template -Mesh_optimization_return_code -lloyd_optimize_mesh_3(C3T3& c3t3, - const MD& domain, - double parameters::time_limit=0, - std::size_t parameters::max_iteration_number=0, - double parameters::convergence=0.02, - double parameters::freeze_bound = 0.01, - bool parameters::do_freeze=true); - -} /* namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/make_mesh_3.h b/Mesh_3/doc/Mesh_3/CGAL/make_mesh_3.h deleted file mode 100644 index 312b556343f..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/make_mesh_3.h +++ /dev/null @@ -1,170 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3Functions - -The function `make_mesh_3()` is a 3D -mesh generator. It produces simplicial meshes which discretize -3D domains. - -The mesh generation algorithm is a Delaunay refinement process -followed by an optimization phase. -The criteria driving the Delaunay refinement -process may be tuned to achieve the user needs with respect to -the size of mesh elements, the accuracy of boundaries approximation, -etc. - -The optimization phase is a sequence of optimization processes, -amongst the following available optimizers: an ODT-smoothing, -a Lloyd-smoothing, a sliver perturber, and a sliver exuder. -Each optimization process -can be activated or not, -according to the user requirements -and available time. -By default, only the perturber and the exuder are activated. -Note that the benefits of the exuder will be lost if the mesh -is further refined afterward, and that ODT-smoothing, Lloyd-smoothing, -and sliver perturber should never be called after the sliver exuder. -In the case of further refinement, only the sliver exuder can be used. - -The function outputs the mesh to an object which provides iterators to -traverse the resulting mesh data structure or can be written to a file -(see \ref Mesh_3_section_examples ). - - -\tparam C3T3 is required to be a model of -the concept `MeshComplex_3InTriangulation_3`, -and a model of `MeshComplexWithFeatures_3InTriangulation_3` -if the domain is a model of `MeshDomainWithFeatures_3`. -This is the return type. -The type `C3T3` is in particular required to provide a nested type -`C3T3::Triangulation` for the 3D triangulation -embedding the mesh. The vertex and cell base classes of the -triangulation `C3T3::Triangulation` are required to be models of the -concepts `MeshVertexBase_3` and `MeshCellBase_3` -respectively. - -\tparam MD is required to be a model of -the concept `MeshDomain_3`, or of the refined concept -`MeshDomainWithFeatures_3` -if the domain has corners and curves that need to be accurately represented in the mesh. -The argument `domain` -is the sole link through which the domain -to be discretized is known by the mesh generation algorithm. - - -\tparam MC has to be a model of the concept -`MeshCriteria_3`, or a model of the refined concept `MeshCriteriaWithFeatures_3` if the domain has exposed features. -The argument `criteria` of type `MC` specifies the -size and shape requirements for mesh tetrahedra -and surface facets. These criteria -form the rules which drive the refinement process. All mesh elements -satisfy those criteria at the end of the refinement process. -In addition, if the domain has features, the argument -`criteria` provides a sizing field to guide the discretization -of 1-dimensional exposed features. - -\cgalHeading{Named Parameters} - -- `features` allows -the user to specify whether 0 and 1-dimensional features have to be -taken into account or not -when the domain is a model of `MeshDomainWithFeatures_3`. -The type `Features` of this parameter is an internal undescribed type. -The library provides functions to construct appropriate values of that type. -
      -
    • \link parameters::features() `parameters::features(domain)` \endlink sets `features` according to the domain, -i.e.\ 0 and 1-dimensional features are taken into account if `domain` is a -`MeshDomainWithFeatures_3`. This is the default behavior -if parameter `features` is not specified. -
    • `parameters::no_features()` prevents the representation -of 0 and 1-dimensional features in the mesh. -
    - -- `manifold` allows the user to drive the meshing algorithm, -and ensure that the output mesh surface follows the given manifold criterion. -It can be activated with `parameters::manifold()`, `parameters::manifold_with_boundary()` -and `parameters::non_manifold()`. Note that the meshing algorithm cannot generate a manifold -surface if the input surface is not manifold. - -The four additional parameters are optimization parameters. -They control which optimization processes are performed -and allow the user to tune the parameters of the optimization processes. -Individual optimization parameters are not described here as they are -internal types (see instead the documentation page of each optimizer). -For each optimization algorithm, there exist two global functions -that allow to enable or disable the optimizer: - -- `lloyd`: `parameters::lloyd()` and `parameters::no_lloyd()` are designed to -trigger or not a call to `lloyd_optimize_mesh_3()` function and to set the -parameters of this optimizer. If one parameter is not set, the default value of -`lloyd_optimize_mesh_3()` is used for this parameter. - -- `ODT`: `parameters::odt()` and `parameters::no_odt()` are designed to -trigger or not a call to `odt_optimize_mesh_3` function and -to set the parameters of this optimizer. -If one parameter is not set, the default value of -`odt_optimize_mesh_3()` is used for this parameter. - -- `perturb`: `parameters::perturb()` and `parameters::no_perturb()` are designed to -trigger or not a call to `perturb_mesh_3` function and -to set the parameters of this optimizer. If one parameter is not set, the default value of -`CGAL::perturb_mesh_3` is used for this parameter, except for the time bound which is set to be -equal to the refinement CPU time. - -- `exude`: `parameters::exude()` and `parameters::no_exude()` are designed to -trigger or not a call to `exude_mesh_3()` function and to override to set the -parameters of this optimizer. If one parameter is not set, the default value of -`exude_mesh_3()` is used for this parameter, except for the time bound which is set to be -equal to the refinement CPU time. - -The optimization parameters can be passed in an arbitrary order. If one parameter -is not passed, its default value is used. The default values are -`no_lloyd()`, `no_odt()`, `perturb()` and `exude()`. - -Note that whatever may be the optimization processes activated, -they are always launched in the order that is a suborder -of the following (see user manual for further -details): *ODT-smoother*, *Lloyd-smoother*, *perturber*, and *exuder*. - -Beware that optimization of the mesh is obtained -by perturbing mesh vertices and modifying the mesh connectivity -and that this has an impact -on the strict compliance to the refinement criteria. -Though a strict compliance to mesh criteria -is guaranteed at the end of the Delaunay refinement, this may no longer be true after -some optimization processes. Also beware that the default behavior does involve some -optimization processes. - -\sa `refine_mesh_3()` -\sa `parameters::features()` -\sa `parameters::no_features()` -\sa `parameters::manifold()` -\sa `parameters::manifold_with_boundary()` -\sa `parameters::non_manifold()` -\sa `exude_mesh_3()` -\sa `perturb_mesh_3()` -\sa `lloyd_optimize_mesh_3()` -\sa `odt_optimize_mesh_3()` -\sa `parameters::exude()` -\sa `parameters::no_exude()` -\sa `parameters::perturb()` -\sa `parameters::no_perturb()` -\sa `parameters::lloyd()` -\sa `parameters::no_lloyd()` -\sa `parameters::odt()` -\sa `parameters::no_odt()` - -*/ - -template -C3T3 make_mesh_3(const MD& domain, - const MC& criteria, - parameters::internal::Features_options features = parameters::features(domain), - parameters::internal::Lloyd_options lloyd = parameters::no_lloyd(), - parameters::internal::Odt_options odt = parameters::no_odt(), - parameters::internal::Perturb_options perturb = parameters::perturb(), - parameters::internal::Exude_options exude = parameters::exude(), - parameters::internal::Manifold_options manifold = parameters::non_manifold()); - -} /* namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/odt_optimize_mesh_3.h b/Mesh_3/doc/Mesh_3/CGAL/odt_optimize_mesh_3.h deleted file mode 100644 index eab650a577a..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/odt_optimize_mesh_3.h +++ /dev/null @@ -1,111 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3Functions - -The function `odt_optimize_mesh_3()` is a mesh optimization process -based on the minimization of a global energy function. - -In `odt_optimize_mesh_3()`, the minimized global energy may be interpreted -as the \f$ L^1\f$-norm of the error achieved -when the function \f$ x^2\f$ is interpolated on the mesh domain -using a piecewise linear function which is linear in each mesh cell. - -The optimizer `odt_optimize_mesh_3()` works in iterative steps. -At each iteration, mesh vertices are moved into -positions that bring to zero the energy gradient -and the Delaunay triangulation is updated. -Vertices on the mesh boundaries are handled -in a special way so as to preserve an accurate -representation of the domain boundaries. - -\pre `time_limit` \f$ \geq\f$ 0 and 0 \f$ \leq\f$ `convergence` \f$ \leq\f$ 1 and 0 \f$ \leq\f$ `freeze_bound` \f$ \leq\f$ 1 - -\tparam C3T3 is required to be a model of the concept -`MeshComplex_3InTriangulation_3`. -The argument `c3t3`, passed by -reference, provides the initial mesh -and is modified by the algorithm -to represent the final optimized mesh. - -\tparam MD is required to be a model of the concept -`MeshDomain_3`. The argument `domain` must be the `MD` -object used to create the `c3t3` parameter. - -The function has four optional parameters which are named parameters -(we use the Boost.Parameter library). -Therefore, when calling the function, the parameters can be provided in any order -provided that the names of the parameters are used -(see example at the bottom of this page). - -\cgalHeading{Named Parameters} - -- `parameters::time_limit` -is used to set up, in seconds, -a CPU time limit after which the optimization process is stopped. This time is -measured using `Real_timer`. -The default value is 0 and means that there is no time limit. - -- `parameters::max_iteration_number` sets a limit on the -number of performed iterations. The default value of 0 means that there is -no limit on the number of performed iterations. - -- `parameters::convergence` is a stopping criterion based on convergence: -the optimization process is stopped, when at the last iteration, -the displacement of any vertex is less than a given percentage of the length -the shortest edge incident to that vertex. -The parameter `convergence` gives the threshold ratio. - -- `parameters::freeze_bound` is designed to reduce running time of each optimization iteration. Any vertex -that has a displacement less than a given percentage of the length (the of its shortest incident edge, is frozen (i.e.\ is -not relocated). The parameter `freeze_bound` gives the threshold ratio. - -- `parameters::do_freeze` completes the `freeze_bound` parameter. If it is set to `true` (default value), -frozen vertices will not move anymore in next iterations. Otherwise, at each iteration, any vertex that -moves, unfreezes all its incident vertices. - - -\return -The function `odt_optimize_mesh_3()` returns a value of type `CGAL::Mesh_optimization_return_code` -which is: -
      -
    • `CGAL::TIME_LIMIT_REACHED` when the time limit is reached. -
    • `CGAL::MAX_ITERATION_NUMBER_REACHED` when `odt_optimize_mesh_3()` stops because it has performed `max_iteration_number` iterations. -
    • `CGAL::CONVERGENCE_REACHED` when `odt_optimize_mesh_3()` stops because the convergence criterion -is achieved. -
    • `CGAL::ALL_VERTICES_FROZEN` when all vertices have been frozen, when the -`do_freeze` parameter is set to true. -
    • `CGAL::CANT_IMPROVE_ANYMORE` when `odt_optimize_mesh_3()` stops because -most vertices have been frozen, and no better convergence can be reached. -
    - -\cgalHeading{Example} - -\code{.cpp} -// 100 iterations of ODT-smoothing -odt_optimize_mesh_3(c3t3, - domain, - parameters::max_iteration_number = 100, - parameters::convergence = 0); -\endcode - -\sa `CGAL::Mesh_optimization_return_code` -\sa `CGAL::make_mesh_3()` -\sa `CGAL::refine_mesh_3()` -\sa `CGAL::exude_mesh_3()` -\sa `CGAL::perturb_mesh_3()` -\sa `CGAL::lloyd_optimize_mesh_3()` - -*/ - -template -Mesh_optimization_return_code -odt_optimize_mesh_3(C3T3& c3t3, - const MD& domain, - double parameters::time_limit=0, - std::size_t parameters::max_iteration_number=0, - double parameters::convergence=0.02, - double parameters::freeze_bound = 0.01, - bool parameters::do_freeze=true); - -} /* namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/perturb_mesh_3.h b/Mesh_3/doc/Mesh_3/CGAL/perturb_mesh_3.h deleted file mode 100644 index 216f3d5e662..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/perturb_mesh_3.h +++ /dev/null @@ -1,91 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3Functions - -The function `perturb_mesh_3()` is a mesh optimizer that -improves the quality of a Delaunay mesh -by changing the positions of some vertices of the mesh. - -The perturber tries to improve the dihedral angles of the worst cells in the mesh -degree by degree: the -step number `n` is considered as successful -if after this step the worst tetrahedron of the mesh has a minimal dihedral -angle larger than `n` degrees. -The perturber exits if this is not the case. - -\pre `time_limit` \f$ \geq\f$ 0 and 0 \f$ \leq\f$ `sliver_bound` \f$ \leq\f$ 180 - -\tparam C3T3 is required to be a model of the concept -`MeshComplex_3InTriangulation_3`. -The argument `c3t3`, passed by -reference, provides the initial mesh -and is modified by the algorithm -to represent the final optimized mesh. - -\tparam MD is required to be a model of the concept -`MeshDomain_3`. The argument `domain` must be the `MD` -object used to create the `c3t3` parameter. - -The function has two optional parameters which are named parameters (we use the Boost.Parameter library). -Therefore, when calling the function, the parameters can be provided in any order -provided that the names of the parameters are used -(see example at the bottom of this page). - -\cgalHeading{Named Parameters} - -- `parameters::time_limit` -is used to set up, in seconds, -a CPU time limit after which the optimization process is stopped. This time is -measured using `Real_timer`. -The default value is 0 and means that there is no time limit. - -- `parameters::sliver_bound` -is designed to give, in degrees, a targeted -lower bound on dihedral angles of mesh cells. -The function `perturb_mesh_3()` runs as long as steps are successful -and step number `sliver_bound` (after which -the worst tetrahedron in the mesh has a smallest angle larger than -`sliver_bound` degrees) has not been reached. -The default value is 0 and means that there is no targeted bound: -the perturber then runs as long as -steps are successful. - - -\return -The function `perturb_mesh_3()` returns a value of type `CGAL::Mesh_optimization_return_code` -which is: -
      -
    • `CGAL::BOUND_REACHED` when the targeted bound for the smallest dihedral angle in the mesh is reached. -
    • `CGAL::TIME_LIMIT_REACHED` when the time limit is reached. -
    • `CGAL::CANT_IMPROVE_ANYMORE` when the perturbation process stops because the last step is unsuccessful. -
    - - -\cgalHeading{Example} - -\code{.cpp} -// Perturb until every dihedral angle of the mesh is >= 10 degrees -// No time bound is set -perturb_mesh_3(c3t3, - domain, - parameters::sliver_bound = 10); -\endcode - -\sa `CGAL::Mesh_optimization_return_code` -\sa `CGAL::make_mesh_3()` -\sa `CGAL::refine_mesh_3()` -\sa `CGAL::exude_mesh_3()` -\sa `CGAL::lloyd_optimize_mesh_3()` -\sa `CGAL::odt_optimize_mesh_3()` - -*/ - -template -Mesh_optimization_return_code -perturb_mesh_3(C3T3& c3t3, - const MD& domain, - double parameters::time_limit=0, - double parameters::sliver_bound=0); - -} /* namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/CGAL/refine_mesh_3.h b/Mesh_3/doc/Mesh_3/CGAL/refine_mesh_3.h deleted file mode 100644 index afeebe8c634..00000000000 --- a/Mesh_3/doc/Mesh_3/CGAL/refine_mesh_3.h +++ /dev/null @@ -1,517 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgMesh3Functions - -The function `refine_mesh_3()` is a 3D -mesh generator. It produces simplicial meshes which discretize -3D domains. - -The mesh generation algorithm is a Delaunay refinement process -followed by an optimization phase. -The criteria driving the Delaunay refinement -process may be tuned to achieve the user needs with respect to -the size of mesh elements, the accuracy of boundaries approximation, -etc. - -The optimization phase is a sequence of optimization processes, -amongst the following available optimizers: an ODT-smoothing, -a Lloyd smoothing, a sliver perturber, and a sliver exuder. -Each optimization process -can be activated or not, -according to the user requirements -and available time. -By default, only the perturber and the exuder are activated. -Note that the benefits of the exuder will be lost if the mesh -is further refined afterward. - -\attention The function template `refine_mesh_3()` may be used to refine a previously -computed mesh, e.g.: -\code{.cpp} -C3T3 c3t3 = CGAL::make_mesh_3(domain,criteria); - -CGAL::refine_mesh_3(c3t3, domain, new_criteria); -\endcode - -Please note that we guarantee the result if and only if the domain does -not change from one refinement to the next one. - - -\tparam C3T3 is required to be a model of -the concept -`MeshComplex_3InTriangulation_3`, -and a model of `MeshComplexWithFeatures_3InTriangulation_3` -if the domain is a model of `MeshDomainWithFeatures_3`. -The argument `c3t3` is passed by -reference as this object is modified by the refinement process. As the -refinement process only adds points to the triangulation, all -vertices of the triangulation of `c3t3` remain in the -mesh during the refinement process. Object `c3t3` can be used to insert -specific points in the domain to ensure that they will be contained in the -final triangulation. -The type `C3T3` is in particular required to provide a nested type -`C3T3::Triangulation` for the 3D triangulation -embedding the mesh. The vertex and cell base classes of the -triangulation `C3T3::Triangulation` are required to be models of the -concepts `MeshVertexBase_3` and `MeshCellBase_3` -respectively. - -\tparam MD is required to be a model of -the concept `MeshDomain_3` or of the refined concept -`MeshDomainWithFeatures_3` if 0 and 1-dimensional features -of the input complex have to be accurately represented in the mesh. -The argument `domain` -is the sole link through which the domain -to be discretized is known by the mesh generation algorithm. - -\tparam MC is required to be a model of the concept -`MeshCriteria_3`, or a model of the refined concept `MeshCriteriaWithFeatures_3` -if the domain has exposed features. The argument `criteria` of -type `MC` specifies the -size and shape requirements for mesh tetrahedra -and surface facets. These criteria -form the rules which drive the refinement process. All mesh elements -satisfy those criteria at the end of the refinement process. -In addition, if the domain has features, the argument -`criteria` provides a sizing field to guide the discretization -of 1-dimensional exposed features. - -The four additional parameters are optimization parameters. -They control which optimization processes are performed -and allow the user to tune the parameters of the optimization processes. -Individual optimization parameters are not described here as they are -internal types (see instead the documentation page of each optimizer). -For each optimization algorithm, there exist two global functions -that allow to enable or disable the optimizer: - -\cgalHeading{Named Parameters} -- `manifold` allows the user to drive the meshing algorithm, -and ensure that the output mesh surface follows the given manifold criterion. -It can be activated with `parameters::manifold()`, `parameters::manifold_with_boundary()` -and `parameters::non_manifold()`. Note that the meshing algorithm cannot generate a manifold -surface if the input surface is not manifold. - -- `lloyd` `parameters::lloyd()` and `parameters::no_lloyd()` are designed to -trigger or not a call to `lloyd_optimize_mesh_3()` function and to set the -parameters of this optimizer. If one parameter is not set, the default value of -`lloyd_optimize_mesh_3()` is used for this parameter. - -- `ODT` `parameters::odt()` and `parameters::no_odt()` are designed to -trigger or not a call to `odt_optimize_mesh_3()` function and -to set the parameters of this optimizer. -If one parameter is not set, the default value of -`odt_optimize_mesh_3()` is used for this parameter. - -- `perturb` `parameters::perturb()` and `parameters::no_perturb()` are designed to -trigger or not a call to `perturb_mesh_3()` function and -to set the parameters of this optimizer. If one parameter is not set, the default value of -`perturb_mesh_3()` is used for this parameter, except for the time bound which is set to be -equal to the refinement CPU time. - -- `exude` `parameters::exude()` and `parameters::no_exude()` are designed to -trigger or not a call to `exude_mesh_3()` function and to override to set the -parameters of this optimizer. If one parameter is not set, the default value of -`exude_mesh_3()` is used for this parameter, except for the time bound which is set to be -equal to the refinement CPU time. - -The optimization parameters can be passed in arbitrary order. If one parameter -is not passed, its default value is used. The default values are -`no_lloyd()`, `no_odt()`, `perturb()` and `exude()`. -Note that whatever may be the optimization processes activated, -they are always launched in the order that is a suborder -of the following (see user manual for further -details): *ODT-smoother*, *Lloyd-smoother*, *perturber*, and *exuder*. - -Beware that optimization of the mesh is obtained -by perturbing mesh vertices and modifying the mesh connectivity -and that this has an impact -on the strict compliance to the refinement criteria. -Though a strict compliance to mesh criteria -is guaranteed at the end of the Delaunay refinement, this may no longer be true after -some optimization processes. Also beware that the default behavior does involve some -optimization processes. - -\sa `CGAL::make_mesh_3()` -\sa `CGAL::parameters::manifold` -\sa `CGAL::parameters::manifold_with_boundary` -\sa `CGAL::parameters::non_manifold` -\sa `CGAL::exude_mesh_3()` -\sa `CGAL::perturb_mesh_3()` -\sa `CGAL::lloyd_optimize_mesh_3()` -\sa `CGAL::odt_optimize_mesh_3()` -\sa `CGAL::parameters::exude` -\sa `CGAL::parameters::no_exude` -\sa `CGAL::parameters::perturb` -\sa `CGAL::parameters::no_perturb` -\sa `CGAL::parameters::lloyd` -\sa `CGAL::parameters::no_lloyd` -\sa `CGAL::parameters::odt` -\sa `CGAL::parameters::no_odt` - -*/ - -template -void refine_mesh_3(C3T3& c3t3, - const MD& mesh_domain, - const MC& mesh_criteria, - parameters::internal::Lloyd_options lloyd = parameters::no_lloyd(), - parameters::internal::Odt_options odt = parameters::no_odt(), - parameters::internal::Perturb_options perturb = parameters::perturb(), - parameters::internal::Exude_options exude = parameters::exude(), - parameters::internal::Manifold_options manifold = parameters::non_manifold()); - -namespace parameters { - - /*! - \ingroup PkgMesh3Parameters - - The function `parameters::manifold()` is used to drive the - meshing algorithm for surfaces. - It ensures that the surface of the output mesh is a manifold surface - without boundaries. - The manifold property of the output mesh can be achieved only if the input surface - is a manifold. - Note that the meshing algorithm provably terminates only if the input - sharp edges have been protected, using the - feature protection (see \ref Mesh_3Protectionof0and1dimensionalExposed). - - \sa `CGAL::make_mesh_3()` - \sa `CGAL::refine_mesh_3()` - \sa `CGAL::parameters::manifold_with_boundary()` - \sa `CGAL::parameters::non_manifold()` - */ - parameters::internal::Manifold_options manifold(); - - /*! - \ingroup PkgMesh3Parameters - - The function `parameters::non_manifold()` is used to drive the - meshing algorithm for surfaces. - It does not ensure that the surface of the output mesh is a manifold surface. - The manifold property of the output mesh might nevertheless result from an appropriate - choice of meshing criteria. - \sa `CGAL::make_mesh_3()` - \sa `CGAL::refine_mesh_3()` - \sa `CGAL::parameters::manifold_with_boundary()` - \sa `CGAL::parameters::manifold()` - */ - parameters::internal::Manifold_options non_manifold(); - - /*! - \ingroup PkgMesh3Parameters - - The function `parameters::manifold_with_boundary()` is used to drive the - meshing algorithm for surfaces. - It ensures that the surface of the output mesh is a manifold surface which - may have boundaries. - The manifold property of the output mesh can be achieved only if the input surface - is a manifold. - Note that the meshing algorithm provably terminates only if the input - sharp edges have been protected, using the - feature protection (see \ref Mesh_3Protectionof0and1dimensionalExposed). - - \sa `CGAL::make_mesh_3()` - \sa `CGAL::refine_mesh_3()` - \sa `CGAL::parameters::non_manifold()` - \sa `CGAL::parameters::manifold()` - */ - parameters::internal::Manifold_options manifold_with_boundary(); - -/*! -\ingroup PkgMesh3Parameters - -The function `parameters::exude()` allows the user to trigger a call to `exude_mesh_3()` in the -`make_mesh_3()` and `refine_mesh_3()` mesh generation functions. -It also allows the user to pass parameters -to the optimization function `exude_mesh_3()` through these mesh generation functions. - -\cgalHeading{Parameters} - -The parameters are named parameters. They are the same (i.e.\ they have the same -name and the same default values) as the parameters of `exude_mesh_3()` -function. See its manual page for further details. - -\cgalHeading{Example} - -\code{.cpp} -// Mesh generation with an exudation step -C3t3 c3t3 = make_mesh_3(domain, - criteria, - parameters::exude()); - -refine_mesh_3(c3t3, - domain, - criteria, - parameters::exude(parameters::time_limit=10)); -\endcode - -\sa `CGAL::parameters::no_exude()` -\sa `CGAL::exude_mesh_3()` -\sa `CGAL::make_mesh_3()` -\sa `CGAL::refine_mesh_3()` - -*/ -parameters::internal::Exude_options exude( - double parameters::time_limit = 0, - double parameters::sliver_bound = 0); - -/*! -\ingroup PkgMesh3Parameters - -The function `parameters::features()` provides a value of internal type `Features` -to specify if 0 and 1-dimensional features have to be taken into account. -The provided value is a default value that triggers the representation -of corners and curves in the mesh when the domain is a model -of `MeshDomainWithFeatures_3`. - -Provides a `Features_options` value such that -0 and 1-dimensional input features are taken into account -if domain is a model of the refined concept `MeshDomainWithFeatures_3`. - -\sa `CGAL::make_mesh_3()` -\sa `CGAL::refine_mesh_3()` -\sa `CGAL::parameters::no_features()` - -*/ -parameters::internal::Features_options features(); - -/*! -\ingroup PkgMesh3Parameters - -The function `parameters::lloyd()` allows the user to trigger a call of -`lloyd_optimize_mesh_3()` in the mesh generation functions -`make_mesh_3()` and `refine_mesh_3()`. It also allows the user to pass -parameters to the optimization function -`lloyd_optimize_mesh_3()` through these mesh generation functions. - -\cgalHeading{Parameters} - -The parameters are named parameters. They are the same (i.e.\ they have the same -name and the same default values) as the parameters of the `lloyd_optimize_mesh_3()` -function. See its manual page for further details. - -\cgalHeading{Example} - -\code{.cpp} -// Mesh generation with lloyd optimization step -C3t3 c3t3 = make_mesh_3(domain, - criteria, - parameters::lloyd()); - -refine_mesh_3(c3t3, - domain, - criteria, - parameters::lloyd(parameters::time_limit=10)); - -\endcode - -\sa `CGAL::parameters::no_lloyd()` -\sa `CGAL::lloyd_optimize_mesh_3()` -\sa `CGAL::make_mesh_3()` -\sa `CGAL::refine_mesh_3()` - -*/ -parameters::internal::Lloyd_options lloyd( -double parameters::time_limit = 0, -std::size_t parameters::max_iteration_number = 0, -double parameters::convergence = 0.02, -double parameters::freeze_bound = 0.01, -bool parameters::do_freeze=true); - -/*! -\ingroup PkgMesh3Parameters - -The function `parameters::no_exude()` allows the user to tell the mesh generation functions -`make_mesh_3()` and `refine_mesh_3()` that no exudation must be done. - -\cgalHeading{Example} - -\code{.cpp} -// Mesh generation without exudation -C3t3 c3t3 = make_mesh_3(domain, - criteria, - parameters::no_exude()); -\endcode - -\sa `CGAL::parameters::exude()` -\sa `CGAL::exude_mesh_3()` -\sa `CGAL::make_mesh_3()` -\sa `CGAL::refine_mesh_3()` - -*/ -parameters::internal::Exude_options no_exude(); - -/*! -\ingroup PkgMesh3Parameters - -The function `parameters::no_features()` allows the user to prevent the handling -of 0 and 1-dimensional features. This is useful when the -domain is a model of `MeshDomainWithFeatures_3` -and the user does not want corners and curves -to be accurately represented -in the mesh. - -Returns a `Features_options` value that prevents the mesh generator -to take into account 0 and 1-dimensional input features. - -\sa `CGAL::make_mesh_3()` -\sa `CGAL::refine_mesh_3()` -\sa `CGAL::parameters::features()` - -*/ -parameters::internal::Features_options no_features(); - -/*! -\ingroup PkgMesh3Parameters - -The function `parameters::no_lloyd()` allows the user to tell the mesh generation functions -`make_mesh_3()` and `refine_mesh_3()` that no lloyd optimization must be done. - -\cgalHeading{Example} - -\code{.cpp} -// Mesh generation without lloyd optimization -C3t3 c3t3 = make_mesh_3(domain, - criteria, - parameters::no_lloyd()); -\endcode - -\sa `CGAL::parameters::lloyd()` -\sa `CGAL::lloyd_optimize_mesh_3()` -\sa `CGAL::make_mesh_3()` -\sa `CGAL::refine_mesh_3()` - -*/ -parameters::internal::Lloyd_options no_lloyd(); - -/*! -\ingroup PkgMesh3Parameters - -The function `parameters::no_odt()` allows the user to tell the mesh generation functions -`make_mesh_3()` and `refine_mesh_3()` that no odt optimization must be done. - -\cgalHeading{Example} - -\code{.cpp} -// Mesh generation without odt optimization -C3t3 c3t3 = make_mesh_3(domain, - criteria, - parameters::no_odt()); -\endcode - -\sa `CGAL::parameters::odt()` -\sa `CGAL::odt_optimize_mesh_3()` -\sa `CGAL::make_mesh_3()` -\sa `CGAL::refine_mesh_3()` - -*/ -parameters::internal::Odt_options no_odt(); - -/*! -\ingroup PkgMesh3Parameters - -The function `parameters::no_perturb()` allows the user to tell mesh generation global functions -`make_mesh_3()` and `refine_mesh_3()` that no perturbation must be done. - -\cgalHeading{Example} - -\code{.cpp} -// Mesh generation without perturbation -C3t3 c3t3 = make_mesh_3(domain, - criteria, - parameters::no_perturb()); -\endcode - -\sa `CGAL::parameters::perturb()` -\sa `CGAL::perturb_mesh_3()` -\sa `CGAL::make_mesh_3()` -\sa `CGAL::refine_mesh_3()` - -*/ -parameters::internal::Perturb_options no_perturb(); - -/*! -\ingroup PkgMesh3Parameters - -The function `parameters::odt()` allows the user to trigger a call to -`CGAL::odt_optimize_mesh_3()` in -`CGAL::make_mesh_3()` and `CGAL::refine_mesh_3()` mesh optimization functions. It also -allows the user to pass parameters to the optimization function -`odt_optimize_mesh_3()` through these mesh generation functions. - -\cgalHeading{Parameters} - -The parameters are named parameters. They are the same (i.e.\ they have the same -name and the same default values) as the parameters of `odt_optimize_mesh_3()` -function. See its manual page for further details. - -\cgalHeading{Example} - -\code{.cpp} -// Mesh generation with odt optimization step -C3t3 c3t3 = make_mesh_3(domain, - criteria, - parameters::odt()); - -refine_mesh_3(c3t3, - domain, - criteria, - parameters::odt(parameters::time_limit=10)); -\endcode - -\sa `CGAL::parameters::no_odt()` -\sa `CGAL::odt_optimize_mesh_3()` -\sa `CGAL::make_mesh_3()` -\sa `CGAL::refine_mesh_3()` - -*/ -parameters::internal::Odt_options odt( -double parameters::time_limit = 0, -std::size_t parameters::max_iteration_number = 0, -double parameters::convergence = 0.02, -double parameters::freeze_bound = 0.01, -bool parameters::do_freeze=true); - -/*! -\ingroup PkgMesh3Parameters - -The function `parameters::perturb()` allows the user to trigger a call to -`perturb_mesh_3()` in -`make_mesh_3()` and `refine_mesh_3()` mesh generation functions. It also -allows the user to pass parameters -to the optimization function `perturb_mesh_3()` through these mesh generation functions. - -\cgalHeading{Parameters} - -The parameters are named parameters. They are the same (i.e.\ they have the same -name and the same default values) as the parameters of `perturb_mesh_3()` -function. See its manual page for further details. - -\cgalHeading{Example} - -\code{.cpp} -// Mesh generation with a perturbation step -C3t3 c3t3 = make_mesh_3(domain, - criteria, - parameters::perturb()); - -refine_mesh_3(c3t3, - domain, - criteria, - parameters::perturb(parameters::time_limit=10)); - -\endcode - -\sa `CGAL::parameters::no_perturb()` -\sa `CGAL::perturb_mesh_3()` -\sa `CGAL::make_mesh_3()` -\sa `CGAL::refine_mesh_3()` - -*/ -parameters::internal::Perturb_options perturb( - double parameters::time_limit = 0, - double parameters::sliver_bound = 0); - -} /* namespace parameters */ - -} /* namespace CGAL */ diff --git a/Mesh_3/doc/Mesh_3/Concepts/MeshCriteriaWithFeatures_3.h b/Mesh_3/doc/Mesh_3/Concepts/MeshCriteriaWithFeatures_3.h index 644c5a94eed..84a1f461abb 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/MeshCriteriaWithFeatures_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/MeshCriteriaWithFeatures_3.h @@ -12,11 +12,10 @@ additionnally encapsulates the concept `MeshEdgeCriteria_3`, that describes the requirements, in terms of sizing, for the discretization of the domain \f$ 1\f$-dimensional features. -\cgalRefines `MeshDomain_3` +\cgalRefines `MeshCriteria_3` \cgalHasModel `CGAL::Mesh_criteria_3` -\sa `MeshCriteria_3` \sa `MeshEdgeCriteria_3` \sa `MeshFacetCriteria_3` \sa `MeshCellCriteria_3` diff --git a/Mesh_3/doc/Mesh_3/Concepts/MeshDomainWithFeatures_3.h b/Mesh_3/doc/Mesh_3/Concepts/MeshDomainWithFeatures_3.h index 7b596fc79dc..279762200af 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/MeshDomainWithFeatures_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/MeshDomainWithFeatures_3.h @@ -89,13 +89,13 @@ const Point_3& p, const Curve_index& ci, FT d) const; /// @{ /*! -Returns the length of the curve segment from \c p to \c q, on the curve -with index \c curve_index. +Returns the length of the curve segment from `p` to `q`, on the curve +with index `curve_index`. -If the curve with index \c curve_index is a loop, the +If the curve with index `curve_index` is a loop, the orientation identifies which portion of the loop corresponds to the curve -segment, otherwise \c orientation must be compatible with the orientation -of \c p and \c q on the curve. +segment, otherwise `orientation` must be compatible with the orientation +of `p` and `q` on the curve. */ FT curve_segment_length(const Point_3& p, const Point_3& q, const Curve_index& curve_index, @@ -121,14 +121,14 @@ CGAL::Sign distance_sign(const Point_3& p, const Point_3& q, /*! Returns the length of curve with index -\c curve_index +`curve_index` */ FT curve_length(const Curve_index& curve_index) const; /*! -Returns `true` if the portion of the curve of index \c index, -between the points \c c1 and \c c2, is covered by the spheres of -centers \c c1 and \c c2 and squared radii \c sq_r1 and \c sq_r2 -respectively. The points \c c1 and \c c2 are assumed to lie on the curve. +Returns `true` if the portion of the curve of index `index`, +between the points `c1` and `c2`, is covered by the spheres of +centers `c1` and `c2` and squared radii `sq_r1` and `sq_r2` +respectively. The points `c1` and `c2` are assumed to lie on the curve. */ bool is_curve_segment_covered(const Curve_index& index, CGAL::Orientation orientation, diff --git a/Mesh_3/doc/Mesh_3/Doxyfile.in b/Mesh_3/doc/Mesh_3/Doxyfile.in index 5865b0989ca..13f34ec4653 100644 --- a/Mesh_3/doc/Mesh_3/Doxyfile.in +++ b/Mesh_3/doc/Mesh_3/Doxyfile.in @@ -6,8 +6,16 @@ ALIASES += "cgalDescribePolylineType=A polyline is defined as a sequence of poin INPUT += \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Polyhedral_complex_mesh_domain_3.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_domain_with_polyline_features_3.h \ - ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_facet_topology.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_3/generate_label_weights.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/exude_mesh_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/odt_optimize_mesh_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/lloyd_optimize_mesh_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/perturb_mesh_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/refine_mesh_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/make_mesh_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Labeled_mesh_domain_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_criteria_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_facet_topology.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_vertex_base_3.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Mesh_cell_base_3.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/Compact_mesh_cell_base_3.h @@ -28,3 +36,5 @@ HTML_EXTRA_FILES = ${CGAL_PACKAGE_DOC_DIR}/fig/implicit_domain_3.jpg ${CGAL_PACKAGE_DOC_DIR}/fig/no-protection-complex.png EXAMPLE_PATH += ${CGAL_PACKAGE_INCLUDE_DIR} # non-documented headers are advertised + +EXCLUDE_SYMBOLS += details diff --git a/Mesh_3/doc/Mesh_3/Mesh_3.txt b/Mesh_3/doc/Mesh_3/Mesh_3.txt index fabeb649e60..29ba32bd500 100644 --- a/Mesh_3/doc/Mesh_3/Mesh_3.txt +++ b/Mesh_3/doc/Mesh_3/Mesh_3.txt @@ -301,29 +301,24 @@ of the `C3T3`. They can be removed using the function `remove_isolated_vertices( \section Mesh_3_section_interface Interface +As of \cgal 5.6, this package uses \ref bgl_namedparameters to set parameters. More details are provided in \ref FromBoostNPtoCGALNP. + \subsection Mesh_3TheGlobalFunctions The Global Functions A 3D mesh generation process is launched through a call to one of the two following functions: \code{.cpp} -template +template C3T3 make_mesh_3(const MeshDomain& domain, const MeshCriteria& criteria, - parameters::internal::Features_options features = parameters::features(domain), - parameters::internal::Lloyd_options lloyd = parameters::no_lloyd(), - parameters::internal::Odt_options odt = parameters::no_odt(), - parameters::internal::Perturb_options perturb = parameters::perturb(), - parameters::internal::Exude_options exude = parameters::exude()); + const NamedParameters& np); -template +template void refine_mesh_3(C3T3& c3t3, const MeshDomain& domain, const MeshCriteria& criteria, - parameters::internal::Lloyd_options lloyd = parameters::no_lloyd(), - parameters::internal::Odt_options odt = parameters::no_odt(), - parameters::internal::Perturb_options perturb = parameters::perturb(), - parameters::internal::Exude_options exude = parameters::exude()); + const NamedParameters& np); \endcode The function `make_mesh_3()` generates from scratch a mesh @@ -581,7 +576,7 @@ is an isosurface defined by an implicit function. \cgalFigureRef{figureimplicit_domain} shows a cut view of the resulting mesh. -Note the use of named parameters (from Boost library) in the +Note the use of named parameters in the constructor of the `Mesh_criteria` instance. \cgalExample{Mesh_3/mesh_implicit_sphere.cpp} diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image.cpp index fa7e38b7dca..d877389a530 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image.cpp @@ -23,8 +23,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main(int argc, char*argv[]) { @@ -37,12 +36,12 @@ int main(int argc, char*argv[]) } /// [Domain creation] Mesh_domain domain = - Mesh_domain::create_gray_image_mesh_domain(image, 2.9f, 0.f); + Mesh_domain::create_gray_image_mesh_domain(image, params::iso_value(2.9f).value_outside(0.f)); /// [Domain creation] // Mesh criteria - Mesh_criteria criteria(facet_angle=30, facet_size=6, facet_distance=2, - cell_radius_edge_ratio=3, cell_size=8); + Mesh_criteria criteria(params::facet_angle(30).facet_size(6).facet_distance(2). + cell_radius_edge_ratio(3).cell_size(8)); // Meshing C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_multiple_values.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_multiple_values.cpp index 1c99e0379f1..71b3a5950a4 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_multiple_values.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_multiple_values.cpp @@ -26,8 +26,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; template struct Image_to_multiple_iso_level_sets { @@ -63,18 +62,17 @@ int main(int argc, char*argv[]) } // Domain - namespace p = CGAL::parameters; Mesh_domain domain = Mesh_domain::create_gray_image_mesh_domain - (p::image = image, - p::image_values_to_subdomain_indices = - Image_to_multiple_iso_level_sets(iso_values), - p::value_outside = 0.f + (params::image(image). + image_values_to_subdomain_indices( + Image_to_multiple_iso_level_sets(iso_values)). + value_outside(0.f) ); // Mesh criteria - Mesh_criteria criteria(facet_angle=30, facet_size=6, facet_distance=2, - cell_radius_edge_ratio=3, cell_size=8); + Mesh_criteria criteria(params::facet_angle(30).facet_size(6).facet_distance(2). + cell_radius_edge_ratio(3).cell_size(8)); // Meshing C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp index 86edd7f2e78..afed1a34b52 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp @@ -32,8 +32,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main(int argc, char* argv[]) { @@ -46,12 +45,12 @@ int main(int argc, char* argv[]) } /// [Domain creation] Mesh_domain domain = - Mesh_domain::create_gray_image_mesh_domain(image, 2.9f, 0.f); + Mesh_domain::create_gray_image_mesh_domain(image, params::iso_value(2.9f).value_outside(0.f)); /// [Domain creation] /// [Mesh criteria] - Mesh_criteria criteria(facet_angle = 30, facet_size = 6, facet_distance = 2, - cell_radius_edge_ratio = 3, cell_size = 8); + Mesh_criteria criteria(params::facet_angle(30).facet_size(6).facet_distance(2). + cell_radius_edge_ratio(3).cell_size(8)); /// [Meshing] C3t3 c3t3; diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_gray_vtk_image.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_gray_vtk_image.cpp index a42b1144a0a..55799a97747 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_gray_vtk_image.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_gray_vtk_image.cpp @@ -79,18 +79,17 @@ int main(int argc, char* argv[]) return 0; } /// [Domain creation] - // To avoid verbose function and named parameters call - using namespace CGAL::parameters; + namespace params = CGAL::parameters; Mesh_domain domain = Mesh_domain::create_gray_image_mesh_domain (image, - image_values_to_subdomain_indices = Less(iso), - value_outside = 0); + params::image_values_to_subdomain_indices(Less(iso)). + value_outside(0)); /// [Domain creation] // Mesh criteria - Mesh_criteria criteria(facet_angle=30, facet_size=fs, facet_distance=fd, - cell_radius_edge_ratio=3, cell_size=cs); + Mesh_criteria criteria(params::facet_angle(30).facet_size(fs).facet_distance(fd). + cell_radius_edge_ratio(3).cell_size(cs)); // Meshing C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_image.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_image.cpp index dbae9919419..484863d158c 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_image.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_image.cpp @@ -26,8 +26,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main(int argc, char* argv[]) { @@ -45,8 +44,8 @@ int main(int argc, char* argv[]) /// [Domain creation] // Mesh criteria - Mesh_criteria criteria(facet_angle=30, facet_size=6, facet_distance=4, - cell_radius_edge_ratio=3, cell_size=8); + Mesh_criteria criteria(params::facet_angle(30).facet_size(6).facet_distance(4). + cell_radius_edge_ratio(3).cell_size(8)); /// [Meshing] C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_image_variable_size.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_image_variable_size.cpp index c7f205091ba..2f07fbf3abf 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_image_variable_size.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_image_variable_size.cpp @@ -31,8 +31,7 @@ typedef CGAL::Mesh_criteria_3 Mesh_criteria; typedef CGAL::Mesh_constant_domain_field_3 Sizing_field; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main(int argc, char* argv[]) { @@ -55,8 +54,8 @@ int main(int argc, char* argv[]) domain.index_from_subdomain_index(127)); // Mesh criteria - Mesh_criteria criteria(facet_angle=30, facet_size=6, facet_distance=2, - cell_radius_edge_ratio=3, cell_size=size); + Mesh_criteria criteria(params::facet_angle(30).facet_size(6).facet_distance(2). + cell_radius_edge_ratio(3).cell_size(size)); // Meshing C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp index fcf5d94744d..253c41a920b 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_custom_initialization.cpp @@ -31,8 +31,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main() { @@ -44,8 +43,8 @@ int main() Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image); // Mesh criteria - Mesh_criteria criteria(facet_angle=30, facet_size=3, facet_distance=1, - cell_radius_edge_ratio=3, cell_size=3); + Mesh_criteria criteria(params::facet_angle(30).facet_size(3).facet_distance(1). + cell_radius_edge_ratio(3).cell_size(3)); /// [Meshing] C3t3 c3t3; diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_image_with_features.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_features.cpp index 877fa104635..15d8c843bcf 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_image_with_features.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_image_with_features.cpp @@ -32,8 +32,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; /// [Add 1D features] #include "read_polylines.h" @@ -92,9 +91,9 @@ int main(int argc, char* argv[]) /// [Call add_1D_features] /// Note that `edge_size` is needed with 1D-features [Mesh criteria] - Mesh_criteria criteria(edge_size=6, - facet_angle=30, facet_size=6, facet_distance=4, - cell_radius_edge_ratio=3, cell_size=8); + Mesh_criteria criteria(params::edge_size(6). + facet_angle(30).facet_size(6).facet_distance(4). + cell_radius_edge_ratio(3).cell_size(8)); /// [Mesh criteria] // Meshing diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_weighted_image.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_weighted_image.cpp index 161aa000de6..bfb9e3190ba 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_weighted_image.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_weighted_image.cpp @@ -24,8 +24,7 @@ using C3t3 = CGAL::Mesh_complex_3_in_triangulation_3; // Criteria using Mesh_criteria = CGAL::Mesh_criteria_3; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main(int argc, char* argv[]) { @@ -45,13 +44,13 @@ int main(int argc, char* argv[]) Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image, - weights = img_weights, - relative_error_bound = 1e-6); + params::weights(img_weights). + relative_error_bound(1e-6)); /// [Domain creation] // Mesh criteria - Mesh_criteria criteria(facet_angle=30, facet_size=6, facet_distance=0.5, - cell_radius_edge_ratio=3, cell_size=8); + Mesh_criteria criteria(params::facet_angle(30).facet_size(6).facet_distance(0.5). + cell_radius_edge_ratio(3).cell_size(8)); /// [Meshing] C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); diff --git a/Mesh_3/examples/Mesh_3/mesh_cubes_intersection.cpp b/Mesh_3/examples/Mesh_3/mesh_cubes_intersection.cpp index 90577147ecb..8f42c8f556d 100644 --- a/Mesh_3/examples/Mesh_3/mesh_cubes_intersection.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_cubes_intersection.cpp @@ -19,7 +19,7 @@ // IO #include -using namespace CGAL::parameters; +namespace params = CGAL::parameters; // Domain typedef CGAL::Exact_predicates_inexact_constructions_kernel K; @@ -76,18 +76,18 @@ int main() Mesh_domain domain(Function_wrapper(v, vps), K::Sphere_3(CGAL::ORIGIN, 5.*5.)); // Set mesh criteria - Mesh_criteria criteria(edge_size = 0.15, - facet_angle = 30, facet_size = 0.2, - cell_radius_edge_ratio = 2, cell_size = 0.4); + Mesh_criteria criteria(params::edge_size(0.15). + facet_angle(30).facet_size(0.2). + cell_radius_edge_ratio(2).cell_size(0.4)); // Mesh generation - C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, no_exude(), no_perturb()); + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, params::no_exude().no_perturb()); // Perturbation (maximum cpu time: 10s, targeted dihedral angle: default) - CGAL::perturb_mesh_3(c3t3, domain, time_limit = 10); + CGAL::perturb_mesh_3(c3t3, domain, params::time_limit(10)); // Exudation - CGAL::exude_mesh_3(c3t3,12); + CGAL::exude_mesh_3(c3t3,params::time_limit(12)); // Output std::ofstream medit_file("out_cubes_intersection.mesh"); diff --git a/Mesh_3/examples/Mesh_3/mesh_cubes_intersection_with_features.cpp b/Mesh_3/examples/Mesh_3/mesh_cubes_intersection_with_features.cpp index fd9f1780c62..568f3fec14a 100644 --- a/Mesh_3/examples/Mesh_3/mesh_cubes_intersection_with_features.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_cubes_intersection_with_features.cpp @@ -20,7 +20,7 @@ // IO #include -using namespace CGAL::parameters; +namespace params = CGAL::parameters; // Domain typedef CGAL::Exact_predicates_inexact_constructions_kernel K; @@ -163,18 +163,18 @@ int main() domain.add_features(polylines.begin(),polylines.end()); // Set mesh criteria - Mesh_criteria criteria(edge_size = 0.15, - facet_angle = 30, facet_size = 0.2, - cell_radius_edge_ratio = 2, cell_size = 0.4); + Mesh_criteria criteria(params::edge_size(0.15). + facet_angle(30).facet_size(0.2). + cell_radius_edge_ratio(2).cell_size(0.4)); // Mesh generation - C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, no_exude(), no_perturb()); + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, params::no_exude().no_perturb()); // Perturbation (maximum cpu time: 10s, targeted dihedral angle: default) - CGAL::perturb_mesh_3(c3t3, domain, time_limit = 10); + CGAL::perturb_mesh_3(c3t3, domain, params::time_limit(10)); // Exudation - CGAL::exude_mesh_3(c3t3,12); + CGAL::exude_mesh_3(c3t3, params::time_limit(12)); // Output std::ofstream medit_file("out_cubes_intersection_with_features.mesh"); diff --git a/Mesh_3/examples/Mesh_3/mesh_hybrid_mesh_domain.cpp b/Mesh_3/examples/Mesh_3/mesh_hybrid_mesh_domain.cpp index c0ba926d412..d2ab9f47a39 100644 --- a/Mesh_3/examples/Mesh_3/mesh_hybrid_mesh_domain.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_hybrid_mesh_domain.cpp @@ -190,8 +190,7 @@ FT sphere_centered_at_111 (const Point& p) return dx*dx+dy*dy+dz*dz-1; } -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main() { @@ -215,8 +214,7 @@ int main() // (Warning: Sphere_3 constructor uses square radius !) Implicit_domain sphere_domain = Implicit_domain::create_implicit_mesh_domain(sphere_centered_at_111, - K::Sphere_3(K::Point_3(1, 1, 1), - 2.)); + K::Sphere_3(K::Point_3(1, 1, 1), K::FT(2))); Domain domain(sphere_domain, polyhedron_domain); @@ -240,7 +238,7 @@ int main() // Mesh generation (without optimization) C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, - no_perturb(), no_exude()); + params::no_perturb().no_exude()); // Output dump_c3t3(c3t3, "out"); diff --git a/Mesh_3/examples/Mesh_3/mesh_implicit_domains.cpp b/Mesh_3/examples/Mesh_3/mesh_implicit_domains.cpp index 4d9187f5692..0dcf61431e5 100644 --- a/Mesh_3/examples/Mesh_3/mesh_implicit_domains.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_implicit_domains.cpp @@ -12,7 +12,7 @@ // IO #include -using namespace CGAL::parameters; +namespace params = CGAL::parameters; #ifdef CGAL_CONCURRENT_MESH_3 typedef CGAL::Parallel_tag Concurrency_tag; @@ -49,7 +49,8 @@ int main() v.push_back(f2); // Domain (Warning: Sphere_3 constructor uses square radius !) - Mesh_domain domain(Function_wrapper(v), K::Sphere_3(CGAL::ORIGIN, 5.*5.), 1e-6); + Mesh_domain domain(Function_wrapper(v), K::Sphere_3(CGAL::ORIGIN, CGAL::square(K::FT(5))), + params::relative_error_bound(1e-6)); // Set mesh criteria Facet_criteria facet_criteria(30, 0.2, 0.02); // angle, size, approximation @@ -57,13 +58,13 @@ int main() Mesh_criteria criteria(facet_criteria, cell_criteria); // Mesh generation - C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, no_exude(), no_perturb()); + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, params::no_exude().no_perturb()); // Perturbation (maximum cpu time: 10s, targeted dihedral angle: default) - CGAL::perturb_mesh_3(c3t3, domain, time_limit = 10); + CGAL::perturb_mesh_3(c3t3, domain, params::time_limit(10)); // Exudation - CGAL::exude_mesh_3(c3t3,12); + CGAL::exude_mesh_3(c3t3, params::time_limit(12)); // Output std::ofstream medit_file("out.mesh"); diff --git a/Mesh_3/examples/Mesh_3/mesh_implicit_domains_2.cpp b/Mesh_3/examples/Mesh_3/mesh_implicit_domains_2.cpp index e3ec7922475..adff2af9689 100644 --- a/Mesh_3/examples/Mesh_3/mesh_implicit_domains_2.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_implicit_domains_2.cpp @@ -12,8 +12,6 @@ // IO #include -using namespace CGAL::parameters; - // Domain typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef FT_to_point_function_wrapper Function; @@ -46,11 +44,10 @@ int main() vps.push_back("+-"); /// [Domain creation] (Warning: Sphere_3 constructor uses square radius !) - namespace param = CGAL::parameters; - Mesh_domain domain(param::function = Function_wrapper(v, vps), - param::bounding_object = K::Sphere_3(CGAL::ORIGIN, - 5.*5.), - param::relative_error_bound = 1e-6); + namespace params = CGAL::parameters; + Mesh_domain domain(Function_wrapper(v, vps), + K::Sphere_3(CGAL::ORIGIN, CGAL::square(K::FT(5))), + params::relative_error_bound(1e-6)); /// [Domain creation] // Set mesh criteria @@ -59,13 +56,13 @@ int main() Mesh_criteria criteria(facet_criteria, cell_criteria); // Mesh generation - C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, no_exude(), no_perturb()); + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, params::no_exude().no_perturb()); // Perturbation (maximum cpu time: 10s, targeted dihedral angle: default) - CGAL::perturb_mesh_3(c3t3, domain, time_limit = 10); + CGAL::perturb_mesh_3(c3t3, domain, params::time_limit(10)); // Exudation - CGAL::exude_mesh_3(c3t3,12); + CGAL::exude_mesh_3(c3t3, params::time_limit(12)); // Output std::ofstream medit_file("out.mesh"); diff --git a/Mesh_3/examples/Mesh_3/mesh_implicit_ellipsoid.cpp b/Mesh_3/examples/Mesh_3/mesh_implicit_ellipsoid.cpp index da98a23a98c..db7dabd145e 100644 --- a/Mesh_3/examples/Mesh_3/mesh_implicit_ellipsoid.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_implicit_ellipsoid.cpp @@ -35,8 +35,7 @@ FT ellipsoid_function (const Point& p) return x2+2*y2+4*z2-1; } -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main() { @@ -51,7 +50,7 @@ int main() Mesh_criteria criteria(facet_criteria, cell_criteria); // Mesh generation (without optimization) - C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, no_perturb(), no_exude()); + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, params::no_perturb().no_exude()); // Output std::ofstream medit_file("out_wo.mesh"); @@ -59,7 +58,7 @@ int main() medit_file.close(); // Perturbation (5s, 12degree) - CGAL::perturb_mesh_3(c3t3, domain, time_limit=5, sliver_bound=12); + CGAL::perturb_mesh_3(c3t3, domain, params::time_limit(5).sliver_bound(12)); // Exudation CGAL::exude_mesh_3(c3t3); diff --git a/Mesh_3/examples/Mesh_3/mesh_implicit_sphere.cpp b/Mesh_3/examples/Mesh_3/mesh_implicit_sphere.cpp index 2e318913c84..d2cec7e4d94 100644 --- a/Mesh_3/examples/Mesh_3/mesh_implicit_sphere.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_implicit_sphere.cpp @@ -28,8 +28,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; // Function FT sphere_function (const Point& p) @@ -39,13 +38,13 @@ int main() { /// [Domain creation] (Warning: Sphere_3 constructor uses squared radius !) Mesh_domain domain = - Mesh_domain::create_implicit_mesh_domain(sphere_function, - K::Sphere_3(CGAL::ORIGIN, 2.)); + Mesh_domain::create_implicit_mesh_domain( sphere_function, + K::Sphere_3(CGAL::ORIGIN, K::FT(2))); /// [Domain creation] // Mesh criteria - Mesh_criteria criteria(facet_angle=30, facet_size=0.1, facet_distance=0.025, - cell_radius_edge_ratio=2, cell_size=0.1); + Mesh_criteria criteria(params::facet_angle(30).facet_size(0.1).facet_distance(0.025). + cell_radius_edge_ratio(2).cell_size(0.1)); // Mesh generation C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); diff --git a/Mesh_3/examples/Mesh_3/mesh_implicit_sphere_variable_size.cpp b/Mesh_3/examples/Mesh_3/mesh_implicit_sphere_variable_size.cpp index 61c3952bb68..7c4ad34100b 100644 --- a/Mesh_3/examples/Mesh_3/mesh_implicit_sphere_variable_size.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_implicit_sphere_variable_size.cpp @@ -42,8 +42,7 @@ struct Spherical_sizing_field } }; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; // Function FT sphere_function (const Point& p) @@ -52,20 +51,18 @@ FT sphere_function (const Point& p) int main() { /// [Domain creation] (Warning: Sphere_3 constructor uses squared radius !) - namespace p = CGAL::parameters; Mesh_domain domain = Mesh_domain::create_implicit_mesh_domain - (p::function = &sphere_function, - p::bounding_object = K::Sphere_3(CGAL::ORIGIN, 2.) + (sphere_function, K::Sphere_3(CGAL::ORIGIN, K::FT(2)) ); /// [Domain creation] // Mesh criteria Spherical_sizing_field size; - Mesh_criteria criteria(facet_angle=30, facet_size=0.1, facet_distance=0.025, - cell_radius_edge_ratio=2, cell_size=size); + Mesh_criteria criteria(params::facet_angle(30).facet_size(0.1).facet_distance(0.025). + cell_radius_edge_ratio(2).cell_size(size)); // Mesh generation - C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, no_exude(), no_perturb()); + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, params::no_exude().no_perturb()); // Output std::ofstream medit_file("out.mesh"); diff --git a/Mesh_3/examples/Mesh_3/mesh_optimization_example.cpp b/Mesh_3/examples/Mesh_3/mesh_optimization_example.cpp index 4d0e36ff5d3..5d9354615ee 100644 --- a/Mesh_3/examples/Mesh_3/mesh_optimization_example.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_optimization_example.cpp @@ -26,8 +26,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; // Mesh Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main(int argc, char* argv[]) { @@ -42,20 +41,20 @@ int main(int argc, char* argv[]) Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image); // Mesh criteria - Mesh_criteria criteria(facet_angle=30, facet_size=5, facet_distance=1.5, - cell_radius_edge_ratio=2, cell_size=7); + Mesh_criteria criteria(params::facet_angle(30).facet_size(5).facet_distance(1.5). + cell_radius_edge_ratio(2).cell_size(7)); // Mesh generation and optimization in one call (sliver_bound is the // targeted dihedral angle in degrees) C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, - no_exude(), - perturb(sliver_bound=10, time_limit=15)); + params::no_exude(). + perturb(params::sliver_bound(10).time_limit(15))); // Mesh generation and optimization in several call C3t3 c3t3_bis = CGAL::make_mesh_3(domain, criteria, - no_perturb(), no_exude()); + params::no_perturb().no_exude()); - CGAL::perturb_mesh_3(c3t3_bis, domain, time_limit=15); + CGAL::perturb_mesh_3(c3t3_bis, domain, params::time_limit(15)); // Output std::ofstream medit_file("out.mesh"); diff --git a/Mesh_3/examples/Mesh_3/mesh_optimization_lloyd_example.cpp b/Mesh_3/examples/Mesh_3/mesh_optimization_lloyd_example.cpp index b4db268fc59..42b8c1d0c4a 100644 --- a/Mesh_3/examples/Mesh_3/mesh_optimization_lloyd_example.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_optimization_lloyd_example.cpp @@ -26,8 +26,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; // Mesh Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main(int argc, char*argv[]) { @@ -41,21 +40,21 @@ int main(int argc, char*argv[]) Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image); // Mesh criteria - Mesh_criteria criteria(facet_angle=30, facet_distance=1.2, - cell_radius_edge_ratio=2); + Mesh_criteria criteria(params::facet_angle(30).facet_distance(1.2). + cell_radius_edge_ratio(2)); // Mesh generation and optimization in one call C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, - lloyd(time_limit=30), - no_perturb(), - exude(time_limit=10, sliver_bound=10)); + params::lloyd(params::time_limit(30)). + no_perturb(). + exude(params::time_limit(10).sliver_bound(10))); // Mesh generation and optimization in several call C3t3 c3t3_bis = CGAL::make_mesh_3(domain, criteria, - no_perturb(), no_exude()); + params::no_perturb().no_exude()); - CGAL::lloyd_optimize_mesh_3(c3t3_bis, domain, time_limit=30); - CGAL::exude_mesh_3(c3t3_bis, sliver_bound=10, time_limit=10); + CGAL::lloyd_optimize_mesh_3(c3t3_bis, domain, params::time_limit(30)); + CGAL::exude_mesh_3(c3t3_bis, params::sliver_bound(10), params::time_limit(10)); // Output std::ofstream medit_file("out.mesh"); diff --git a/Mesh_3/examples/Mesh_3/mesh_polyhedral_complex.cpp b/Mesh_3/examples/Mesh_3/mesh_polyhedral_complex.cpp index eaee6876dc8..b502b7593e6 100644 --- a/Mesh_3/examples/Mesh_3/mesh_polyhedral_complex.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_polyhedral_complex.cpp @@ -31,8 +31,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3< // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; const char* const filenames[] = { "meshes/patch-01.off", @@ -71,9 +70,9 @@ int main() domain.detect_features(); //includes detection of borders // Mesh criteria - Mesh_criteria criteria(edge_size = 8, - facet_angle = 25, facet_size = 8, facet_distance = 0.2, - cell_radius_edge_ratio = 3, cell_size = 10); + Mesh_criteria criteria(params::edge_size(8). + facet_angle(25).facet_size(8).facet_distance(0.2). + cell_radius_edge_ratio(3).cell_size(10)); // Mesh generation C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); diff --git a/Mesh_3/examples/Mesh_3/mesh_polyhedral_complex_sm.cpp b/Mesh_3/examples/Mesh_3/mesh_polyhedral_complex_sm.cpp index bc4b4821dca..9bf6c385370 100644 --- a/Mesh_3/examples/Mesh_3/mesh_polyhedral_complex_sm.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_polyhedral_complex_sm.cpp @@ -33,8 +33,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3< // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; const char* const filenames[] = { "meshes/patch-01.off", @@ -94,9 +93,9 @@ int main() domain.detect_features(); //includes detection of borders // Mesh criteria - Mesh_criteria criteria(edge_size = 8, - facet_angle = 25, facet_size = 8, facet_distance = 0.2, - cell_radius_edge_ratio = 3, cell_size = 10); + Mesh_criteria criteria(params::edge_size(8). + facet_angle(25).facet_size(8).facet_distance(0.2). + cell_radius_edge_ratio(3).cell_size(10)); #ifdef CGAL_MESHING_STEPS_WITH_CIN std::cout << "Ready for mesh generation ? (y or n)"; diff --git a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain.cpp b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain.cpp index eb24c7ef70a..cd56e3bc5c7 100644 --- a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain.cpp @@ -29,8 +29,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main(int argc, char*argv[]) { @@ -54,11 +53,11 @@ int main(int argc, char*argv[]) Mesh_domain domain(polyhedron); // Mesh criteria (no cell_size set) - Mesh_criteria criteria(facet_angle=25, facet_size=0.15, facet_distance=0.008, - cell_radius_edge_ratio=3); + Mesh_criteria criteria(params::facet_angle(25).facet_size(0.15).facet_distance(0.008). + cell_radius_edge_ratio(3)); // Mesh generation - C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, no_perturb(), no_exude()); + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, params::no_perturb().no_exude()); // Output std::ofstream medit_file("out_1.mesh"); @@ -66,10 +65,10 @@ int main(int argc, char*argv[]) medit_file.close(); // Set tetrahedron size (keep cell_radius_edge_ratio), ignore facets - Mesh_criteria new_criteria(cell_radius_edge_ratio=3, cell_size=0.03); + Mesh_criteria new_criteria(params::cell_radius_edge_ratio(3).cell_size(0.03)); // Mesh refinement (and make the output manifold) - CGAL::refine_mesh_3(c3t3, domain, new_criteria, manifold()); + CGAL::refine_mesh_3(c3t3, domain, new_criteria, params::manifold()); // Output medit_file.open("out_2.mesh"); diff --git a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_sm.cpp b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_sm.cpp index c7ab9c43a4d..eac3d9a4701 100644 --- a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_sm.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_sm.cpp @@ -28,8 +28,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main(int argc, char*argv[]) { @@ -53,11 +52,11 @@ int main(int argc, char*argv[]) Mesh_domain domain(polyhedron); // Mesh criteria (no cell_size set) - Mesh_criteria criteria(facet_angle=25, facet_size=0.15, facet_distance=0.008, - cell_radius_edge_ratio=3); + Mesh_criteria criteria(params::facet_angle(25).facet_size(0.15).facet_distance(0.008). + cell_radius_edge_ratio(3)); // Mesh generation - C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, no_perturb(), no_exude()); + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, params::no_perturb().no_exude()); // Output std::ofstream medit_file("out_1.mesh"); @@ -65,7 +64,7 @@ int main(int argc, char*argv[]) medit_file.close(); // Set tetrahedron size (keep cell_radius_edge_ratio), ignore facets - Mesh_criteria new_criteria(cell_radius_edge_ratio=3, cell_size=0.03); + Mesh_criteria new_criteria(params::cell_radius_edge_ratio(3).cell_size(0.03)); // Mesh refinement CGAL::refine_mesh_3(c3t3, domain, new_criteria); diff --git a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_features.cpp b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_features.cpp index c6b092e5db1..917aeec1cf4 100644 --- a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_features.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_features.cpp @@ -29,8 +29,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3< // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main(int argc, char*argv[]) { @@ -55,9 +54,9 @@ int main(int argc, char*argv[]) domain.detect_features(); // Mesh criteria - Mesh_criteria criteria(edge_size = 0.025, - facet_angle = 25, facet_size = 0.05, facet_distance = 0.005, - cell_radius_edge_ratio = 3, cell_size = 0.05); + Mesh_criteria criteria(params::edge_size(0.025). + facet_angle(25).facet_size(0.05).facet_distance(0.005). + cell_radius_edge_ratio(3).cell_size(0.05)); // Mesh generation C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); diff --git a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_features_sm.cpp b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_features_sm.cpp index a05a3aa1669..cbdf8b90b97 100644 --- a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_features_sm.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_features_sm.cpp @@ -30,8 +30,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3< // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main(int argc, char*argv[]) { @@ -56,9 +55,9 @@ int main(int argc, char*argv[]) domain.detect_features(); // Mesh criteria - Mesh_criteria criteria(edge_size = 0.025, - facet_angle = 25, facet_size = 0.05, facet_distance = 0.005, - cell_radius_edge_ratio = 3, cell_size = 0.05); + Mesh_criteria criteria(params::edge_size(0.025). + facet_angle(25).facet_size(0.05).facet_distance(0.005). + cell_radius_edge_ratio(3).cell_size(0.05)); // Mesh generation C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); diff --git a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_lipschitz_sizing.cpp b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_lipschitz_sizing.cpp index d6ab36133bc..520c1b1eb4c 100644 --- a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_lipschitz_sizing.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_lipschitz_sizing.cpp @@ -34,8 +34,7 @@ typedef CGAL::Mesh_criteria_3 Mesh_criteria; // Sizing field typedef CGAL::Mesh_3::Lipschitz_sizing Lip_sizing; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main(int argc, char*argv[]) { @@ -69,12 +68,12 @@ int main(int argc, char*argv[]) 0.5); //max_size // Mesh criteria - Mesh_criteria criteria(edge_size = min_size, - facet_angle = 25, - facet_size = min_size, - facet_distance = 0.005, - cell_radius_edge_ratio = 3, - cell_size = lip_sizing); + Mesh_criteria criteria(params::edge_size(min_size). + facet_angle(25). + facet_size(min_size). + facet_distance(0.005). + cell_radius_edge_ratio(3). + cell_size(lip_sizing)); // Mesh generation C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); diff --git a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_surface_inside.cpp b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_surface_inside.cpp index 51009ad7cb8..4f81ca6ce6f 100644 --- a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_surface_inside.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_surface_inside.cpp @@ -26,8 +26,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3< // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main(int argc, char*argv[]) { @@ -53,13 +52,16 @@ int main(int argc, char*argv[]) domain.detect_features(); // Mesh criteria - Mesh_criteria criteria(edge_size = 0.025, - facet_angle = 25, facet_size = 0.05, facet_distance = 0.005, - cell_radius_edge_ratio = 3, cell_size = 0.05); + Mesh_criteria criteria(params::edge_size(0.025). + facet_angle(25). + facet_size(0.05). + facet_distance(0.005). + cell_radius_edge_ratio(3). + cell_size(0.05)); // Mesh generation C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, - no_perturb(), no_exude()); + params::no_perturb().no_exude()); std::cerr << t.time() << " sec." << std::endl; // Output diff --git a/Mesh_3/examples/Mesh_3/mesh_two_implicit_spheres_with_balls.cpp b/Mesh_3/examples/Mesh_3/mesh_two_implicit_spheres_with_balls.cpp index 7458ae88390..781631cdb5a 100644 --- a/Mesh_3/examples/Mesh_3/mesh_two_implicit_spheres_with_balls.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_two_implicit_spheres_with_balls.cpp @@ -37,8 +37,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3< // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; // Function FT sphere_function1 (const Point& p) @@ -65,9 +64,11 @@ int main() K::Sphere_3(Point(1, 0, 0), 6.)); // Mesh criteria - Mesh_criteria criteria(edge_size = 0.15, - facet_angle = 25, facet_size = 0.15, - cell_radius_edge_ratio = 2, cell_size = 0.15); + Mesh_criteria criteria(params::edge_size(0.15). + facet_angle(25). + facet_size(0.15). + cell_radius_edge_ratio(2). + cell_size(0.15)); // Create edge that we want to preserve Polylines polylines (1); @@ -85,7 +86,7 @@ int main() // Mesh generation without feature preservation C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, - CGAL::parameters::no_features()); + params::no_features()); std::ofstream medit_file("out-no-protection.mesh"); CGAL::IO::write_MEDIT(medit_file, c3t3); diff --git a/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface.cpp b/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface.cpp index 3a22bb35526..2edfeed09cb 100644 --- a/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface.cpp +++ b/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface.cpp @@ -22,8 +22,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3< // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main() { @@ -49,13 +48,13 @@ int main() domain.detect_features(); //includes detection of borders // Mesh criteria - Mesh_criteria criteria(edge_size = 0.025, - facet_angle = 25, - facet_size = 0.1, - facet_distance = 0.001); + Mesh_criteria criteria(params::edge_size(0.025). + facet_angle(25). + facet_size(0.1). + facet_distance(0.001)); // Mesh generation - C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, no_perturb(), no_exude()); + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, params::no_perturb().no_exude()); // Output the facets of the c3t3 to an OFF file. The facets will not be // oriented. diff --git a/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface_sm.cpp b/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface_sm.cpp index 1ddf6772d04..58aadb62dc7 100644 --- a/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface_sm.cpp +++ b/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface_sm.cpp @@ -21,8 +21,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3< // Criteria typedef CGAL::Mesh_criteria_3 Mesh_criteria; -// To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; int main() { @@ -48,13 +47,13 @@ int main() domain.detect_features(); //includes detection of borders // Mesh criteria - Mesh_criteria criteria(edge_size = 0.025, - facet_angle = 25, - facet_size = 0.1, - facet_distance = 0.001); + Mesh_criteria criteria(params::edge_size(0.025). + facet_angle(25). + facet_size(0.1). + facet_distance(0.001)); // Mesh generation - C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, no_perturb(), no_exude()); + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria, params::no_perturb().no_exude()); // Output the facets of the c3t3 to an OFF file. The facets will not be // oriented. diff --git a/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h b/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h index f8ea786fb06..2663b352f08 100644 --- a/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h +++ b/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -123,21 +122,21 @@ public: } #endif - /// Marks \c facet as visited + /// Marks `facet` as visited void set_facet_visited (const int facet) { CGAL_precondition(facet>=0 && facet <4); bits_ |= char(1 << facet); } - /// Marks \c facet as not visited + /// Marks `facet` as not visited void reset_visited (const int facet) { CGAL_precondition(facet>=0 && facet<4); bits_ = char(bits_ & (15 & ~(1 << facet))); } - /// Returns \c true if \c facet is marked as visited + /// Returns `true` if `facet` is marked as visited bool is_facet_visited (const int facet) const { CGAL_precondition(facet>=0 && facet<4); @@ -194,7 +193,7 @@ public: ++this->m_erase_counter; } - /// Marks \c facet as visited + /// Marks `facet` as visited void set_facet_visited (const int facet) { CGAL_precondition(facet>=0 && facet<4); @@ -206,7 +205,7 @@ public: } } - /// Marks \c facet as not visited + /// Marks `facet` as not visited void reset_visited (const int facet) { CGAL_precondition(facet>=0 && facet<4); @@ -219,7 +218,7 @@ public: } } - /// Returns \c true if \c facet is marked as visited + /// Returns `true` if `facet` is marked as visited bool is_facet_visited (const int facet) const { CGAL_precondition(facet>=0 && facet<4); @@ -351,7 +350,7 @@ public: Vertex_handle vertex(int i) const { - CGAL_triangulation_precondition( i >= 0 && i <= 3 ); + CGAL_precondition( i >= 0 && i <= 3 ); return V[i]; } @@ -374,13 +373,13 @@ public: if (v == V[0]) { return 0; } if (v == V[1]) { return 1; } if (v == V[2]) { return 2; } - CGAL_triangulation_assertion( v == V[3] ); + CGAL_assertion( v == V[3] ); return 3; } Cell_handle neighbor(int i) const { - CGAL_triangulation_precondition( i >= 0 && i <= 3); + CGAL_precondition( i >= 0 && i <= 3); return N[i]; } @@ -403,7 +402,7 @@ public: if (n == N[0]) return 0; if (n == N[1]) return 1; if (n == N[2]) return 2; - CGAL_triangulation_assertion( n == N[3] ); + CGAL_assertion( n == N[3] ); return 3; } @@ -412,8 +411,8 @@ public: void set_neighbor(int i, Cell_handle n) { - CGAL_triangulation_precondition( i >= 0 && i <= 3); - CGAL_triangulation_precondition( this != n.operator->() ); + CGAL_precondition( i >= 0 && i <= 3); + CGAL_precondition( this != n.operator->() ); N[i] = n; } @@ -426,10 +425,10 @@ public: void set_neighbors(Cell_handle n0, Cell_handle n1, Cell_handle n2, Cell_handle n3) { - CGAL_triangulation_precondition( this != n0.operator->() ); - CGAL_triangulation_precondition( this != n1.operator->() ); - CGAL_triangulation_precondition( this != n2.operator->() ); - CGAL_triangulation_precondition( this != n3.operator->() ); + CGAL_precondition( this != n0.operator->() ); + CGAL_precondition( this != n1.operator->() ); + CGAL_precondition( this != n2.operator->() ); + CGAL_precondition( this != n3.operator->() ); N[0] = n0; N[1] = n1; N[2] = n2; @@ -462,7 +461,7 @@ public: // but there's not much we can do for this now. void set_vertex(int i, Vertex_handle v) { - CGAL_triangulation_precondition( i >= 0 && i <= 3); + CGAL_precondition( i >= 0 && i <= 3); invalidate_weighted_circumcenter_cache(); V[i] = v; } @@ -527,42 +526,42 @@ public: bool is_cache_valid() const { return sliver_cache_validity_; } void reset_cache_validity() const { sliver_cache_validity_ = false; } - /// Set surface index of \c facet to \c index + /// Set surface index of `facet` to `index` void set_surface_patch_index(const int facet, const Surface_patch_index& index) { CGAL_precondition(facet>=0 && facet<4); surface_index_table_[facet] = index; } - /// Returns surface index of facet \c facet + /// Returns surface index of facet `facet` Surface_patch_index surface_patch_index(const int facet) const { CGAL_precondition(facet>=0 && facet<4); return surface_index_table_[facet]; } - /// Sets surface center of \c facet to \c point + /// Sets surface center of `facet` to `point` void set_facet_surface_center(const int facet, const Point_3& point) { CGAL_precondition(facet>=0 && facet<4); surface_center_table_[facet] = point; } - /// Returns surface center of \c facet + /// Returns surface center of `facet` Point_3 get_facet_surface_center(const int facet) const { CGAL_precondition(facet>=0 && facet<4); return surface_center_table_[facet]; } - /// Sets surface center index of \c facet to \c index + /// Sets surface center index of `facet` to `index` void set_facet_surface_center_index(const int facet, const Index& index) { CGAL_precondition(facet>=0 && facet<4); surface_center_index_table_[facet] = index; } - /// Returns surface center of \c facet + /// Returns surface center of `facet` Index get_facet_surface_center_index(const int facet) const { CGAL_precondition(facet>=0 && facet<4); @@ -585,7 +584,7 @@ public: void set_surface_index(const int facet, const Surface_index& index) { set_surface_patch_index(facet,index); } - /// Returns surface index of facet \c facet + /// Returns surface index of facet `facet` Surface_index surface_index(const int facet) const { return surface_patch_index(facet); } #endif // CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX diff --git a/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h b/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h index 2cc5e2cb59d..99bc1e6b313 100644 --- a/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Gray_image_mesh_domain_3.h @@ -64,12 +64,12 @@ public: const Image_word_type value_outside = 0., const FT& error_bound = FT(1e-3), CGAL::Random* p_rng = nullptr) - : Base(Wrapper(image, + : Base(parameters::function = Wrapper(image, Transform(iso_value), Transform(iso_value)(value_outside)), - Mesh_3::internal::compute_bounding_box(image), - error_bound, - p_rng) + parameters::bounding_object = Mesh_3::internal::compute_bounding_box(image), + parameters::relative_error_bound = error_bound, + parameters::p_rng = p_rng) { CGAL_assertion(Transform(iso_value)(value_outside) == 0); } @@ -79,10 +79,10 @@ public: const Image_word_type value_outside = 0., const FT& error_bound = FT(1e-3), CGAL::Random* p_rng = nullptr) - : Base(Wrapper(image, transform, transform(value_outside)), - Mesh_3::internal::compute_bounding_box(image), - error_bound, - p_rng) + : Base(parameters::function = Wrapper(image, transform, transform(value_outside)), + parameters::bounding_object = Mesh_3::internal::compute_bounding_box(image), + parameters::relative_error_bound = error_bound, + parameters::p_rng = p_rng) { CGAL_assertion(transform(value_outside) == 0); } diff --git a/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h b/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h index 3b969f95e8d..764444851de 100644 --- a/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h @@ -65,8 +65,8 @@ public: const Sphere_3& bounding_sphere, const FT& error_bound = FT(1e-6), CGAL::Random* p_rng = nullptr) - : Base(Wrapper(f), bounding_sphere, error_bound, - Null_subdomain_index(), p_rng) {} + : Base(parameters::function = Wrapper(f), parameters::bounding_object = bounding_sphere, parameters::relative_error_bound = error_bound, + parameters::null_subdomain_index = Null_subdomain_index(), parameters::p_rng = p_rng) {} /// Destructor virtual ~Implicit_mesh_domain_3() {} diff --git a/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h b/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h index 31ffaee34c8..bc2ff03ff73 100644 --- a/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h @@ -75,9 +75,9 @@ public: Subdomain_index value_outside = 0, Null null = Null(), CGAL::Random* p_rng = nullptr) - : Base(Wrapper(image, Identity(), value_outside), - compute_bounding_box(image), - error_bound, + : Base(parameters::function = Wrapper(image, Identity(), value_outside), + parameters::bounding_object = compute_bounding_box(image), + parameters::relative_error_bound = error_bound, parameters::null_subdomain_index = null, parameters::p_rng = p_rng) {} @@ -85,10 +85,10 @@ public: Labeled_image_mesh_domain_3(const Image& image, const FT error_bound, CGAL::Random* p_rng) - : Base(Wrapper(image), - compute_bounding_box(image), - error_bound, - p_rng) + : Base(parameters::function = Wrapper(image), + parameters::bounding_object = compute_bounding_box(image), + parameters::relative_error_bound = error_bound, + parameters::p_rng = p_rng) {} /// Destructor @@ -97,7 +97,7 @@ public: using Base::bbox; private: - /// Returns a box enclosing image \c im + /// Returns a box enclosing image `im` Bbox_3 compute_bounding_box(const Image& im) const { return Bbox_3(-im.vx()+im.tx(), diff --git a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h index 5acc5b01507..6faf6ee86ba 100644 --- a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h @@ -26,7 +26,6 @@ #include #include -#include #include #include #include @@ -43,10 +42,7 @@ // support for implicit functions #include - -#include -#include -#include +#include #ifdef CGAL_MESH_3_VERBOSE # include #endif @@ -76,7 +72,7 @@ namespace internal { template void operator()(T*) const { } }; - /// Returns a box enclosing image \c im + // Returns a box enclosing image `im` inline Bbox_3 compute_bounding_box(const Image_3& im) { return Bbox_3(-1+im.tx(),-1+im.ty(),-1+im.tz(), @@ -124,6 +120,7 @@ namespace internal { } // end namespace CGAL::Mesh_3::internal } // end namespace CGAL::Mesh_3 +#ifndef DOXYGEN_RUNNING struct Null_subdomain_index { template bool operator()(const T& x) const { return 0 == x; } @@ -137,11 +134,15 @@ struct Construct_pair_from_subdomain_indices { return result_type(a, b); } }; // end class template Construct_pair_from_subdomain_indices +#endif + +namespace details +{ template -class Labeled_mesh_domain_3_impl_details +class Labeled_mesh_domain_3_impl { protected: typedef Surface_patch_index_ Surface_patch_index; @@ -150,7 +151,7 @@ protected: typedef typename Geom_traits::Iso_cuboid_3 Iso_cuboid_3; typedef typename Geom_traits::FT FT; typedef std::shared_ptr CGAL_Random_share_ptr_t; - /// Returns squared error bound from \c bbox and \c error + // Returns squared error bound from `bbox` and `error` FT squared_error_bound(const Iso_cuboid_3& bbox, const FT& error) const { typename Geom_traits::Compute_squared_distance_3 squared_distance = @@ -181,28 +182,11 @@ protected: return Construct_pair_from_subdomain_indices(); } - template - Labeled_mesh_domain_3_impl_details(ArgumentPack const& args) - : function_(args[parameters::function]) - , bbox_(iso_cuboid(args[parameters::bounding_object])) - , cstr_s_p_index(args[parameters::construct_surface_patch_index | - construct_pair_functor()]) - , null(args[parameters::null_subdomain_index | Null_subdomain_index()]) - , p_rng_(args[parameters::p_rng|0] == 0 ? - CGAL_Random_share_ptr_t(new CGAL::Random(0)) : - CGAL_Random_share_ptr_t(args[parameters::p_rng|(CGAL::Random*)(0)], - Mesh_3::internal::Do_not_delete())) - , squared_error_bound_ - ( squared_error_bound(bbox_, - args[parameters::relative_error_bound|FT(1e-3)])) - { - } - template - Labeled_mesh_domain_3_impl_details(const Function& f, + Labeled_mesh_domain_3_impl(const Function& f, const Bounding_object& bounding, const FT& error_bound, Construct_surface_patch_index cstr_s_p_i, @@ -218,68 +202,135 @@ protected: , squared_error_bound_(squared_error_bound(bbox_,error_bound)) {} - /// The function which answers subdomain queries + // The function which answers subdomain queries typedef std::function Function; Function function_; - /// The bounding box + // The bounding box const Iso_cuboid_3 bbox_; typedef std::function< Surface_patch_index(Subdomain_index, Subdomain_index)> Construct_surface_patch_index; Construct_surface_patch_index cstr_s_p_index; - /// The functor that decides which sub-domain indices correspond to the - /// outside of the domain. + // The functor that decides which sub-domain indices correspond to the + // outside of the domain. typedef std::function Null; Null null; - /// The random number generator used by Construct_initial_points + // The random number generator used by Construct_initial_points CGAL_Random_share_ptr_t p_rng_; - /// Error bound relative to sphere radius + // Error bound relative to sphere radius FT squared_error_bound_; -}; // Labeled_mesh_domain_3_impl_details +}; // Labeled_mesh_domain_3_impl -/** - * \class Labeled_mesh_domain_3 - * - * Function f must take his values into N. - * Let p be a Point. - * - f(p)=0 means that p is outside domain. - * - f(p)=a, a!=0 means that p is inside subdomain a. - * - * Any boundary facet is labelled , with a, where b!=0. - */ +} // namespace details + +/*! +\ingroup PkgMesh3Domains + +\brief The class `Labeled_mesh_domain_3` implements indexed domains. + +This class is a model of concept `MeshDomain_3`. + +Any boundary facet is labeled , with a, where b!=0. + +This class includes a labeling function that provides the index of the subdomain in which any +query point lies. An intersection between a segment and bounding +surfaces is detected when both segment endpoints are associated with different +values of subdomain indices. The intersection is then constructed by bisection. +The bisection stops when the query segment is shorter than an error bound +`e` given by the product of the +length of the diagonal of the bounding box (in world coordinates), or the radius of the bounding sphere, and +a relative error bound passed as argument to the constructor of `Labeled_mesh_domain_3`. + +This class has a constructor taking a labeling function. It has also three +static template member functions that act as named constructors: +
      +
    • `create_gray_image_mesh_domain()`, to create a domain from a 3D gray image, +
    • `create_labeled_image_mesh_domain()`, to create a domain from a 3D labeled image, and +
    • `create_implicit_mesh_domain()`, to create a domain from an implicit function. +
    + +\tparam BGT is a geometric traits class that provides +the basic operations to implement +intersection tests and intersection computations +through a bisection method. This parameter must be instantiated +with a model of the concept `BisectionGeometricTraits_3`. + +\cgalHeading{Labeling function} + +A labeling function `f` must return `0` if the point isn't located in any subdomain. The return type of labeling functions is an integer. + +Let `p` be a Point. +
      +
    • `f(p)=0` means that `p` is outside domain.
    • +
    • `f(p)=a`, `a!=0` means that `p` is inside subdomain `a`.
    • +
    +`CGAL::Implicit_multi_domain_to_labeling_function_wrapper` is a good candidate for this template parameter +if there are several components to mesh. + +The function type can be any model of the concept `Callable` compatible with the signature `Subdomain_index(const Point_3&)`: it can be a function, a function object, a lambda expression... that takes a `%Point_3` as argument, and returns a type convertible to `Subdomain_index`. + +\cgalModels `MeshDomain_3` + +\sa `Implicit_multi_domain_to_labeling_function_wrapper` +\sa `CGAL::make_mesh_3()`. + +*/ template > -class Labeled_mesh_domain_3 : - protected Labeled_mesh_domain_3_impl_details +class Labeled_mesh_domain_3 +#ifndef DOXYGEN_RUNNING +: protected details::Labeled_mesh_domain_3_impl +#endif { public: //------------------------------------------------------- // Index Types //------------------------------------------------------- - /// Type of indexes for cells of the input complex + // Type of indexes for cells of the input complex +/// \name Types +///@{ + /// The subdomain index of this model of `MeshDomain_3` typedef Subdomain_index_ Subdomain_index; + // +#ifdef DOXYGEN_RUNNING + /// The type of object that stores the function using type-erasure. + typedef std::function< Subdomain_index(const Point_3 &)> Labeling_function; +///@} + +/// \name Types imported from the geometric traits class +///@{ + /// The point type of the geometric traits class + typedef typename Geom_traits::Point_3 Point_3; + /// The sphere type of the geometric traits class + typedef typename Geom_traits::Sphere_3 Sphere_3; + /// The iso-cuboid type of the geometric traits class + typedef typename Geom_traits::Iso_cuboid_3 Iso_cuboid_3; + /// The number type (a field type) of the geometric traits class + typedef typename Geom_traits::FT FT; +///@} +#else typedef boost::optional Subdomain; - /// Type of indexes for cells of the input complex + // Type of indexes for cells of the input complex typedef Surface_patch_index_ Surface_patch_index; typedef boost::optional Surface_patch; - /// Type of indexes to characterize the lowest dimensional face of the input - /// complex on which a vertex lie + // Type of indexes to characterize the lowest dimensional face of the input + // complex on which a vertex lie typedef typename CGAL::Mesh_3::internal:: Index_generator::Index Index; private: - typedef Labeled_mesh_domain_3_impl_details Impl_details; typedef typename Impl_details::Null Null; typedef typename Impl_details::Construct_surface_patch_index @@ -287,7 +338,7 @@ private: typedef typename Impl_details::Function Function; public: - /// Geometric object types + // Geometric object types typedef typename BGT::Point_3 Point_3; typedef typename BGT::Segment_3 Segment_3; typedef typename BGT::Ray_3 Ray_3; @@ -310,208 +361,509 @@ public: typedef typename BGT::FT FT; typedef BGT Geom_traits; - - - BOOST_PARAMETER_CONSTRUCTOR(Labeled_mesh_domain_3, - (Impl_details), - parameters::tag, - (required - (function_,(Function)) - (bounding_object_,*) - ) - (optional - (relative_error_bound_, (const FT&)) - (p_rng_, (CGAL::Random*)) - (null_subdomain_index_,(Null)) - (construct_surface_patch_index_, - (Construct_surface_patch_index)) - ) - ) using Impl_details::construct_pair_functor; - /** - * Backward-compatibility constructors, with `null_subdomain_index` as - * fourth parameter. - * @{ - */ - Labeled_mesh_domain_3(const Function& f, - const Sphere_3& bounding_sphere, - const FT& error_bound = FT(1e-3), - Null null = Null_subdomain_index(), - CGAL::Random* p_rng = nullptr) - : Impl_details(f, bounding_sphere, - error_bound, - construct_pair_functor(), - null, p_rng) {} - - Labeled_mesh_domain_3(const Function& f, - const Bbox_3& bbox, - const FT& error_bound = FT(1e-3), - Null null = Null_subdomain_index(), - CGAL::Random* p_rng = nullptr) - : Impl_details(f, bbox, - error_bound, - construct_pair_functor(), - null, p_rng) {} - - Labeled_mesh_domain_3(const Function& f, - const Iso_cuboid_3& bbox, - const FT& error_bound = FT(1e-3), - Null null = Null_subdomain_index(), - CGAL::Random* p_rng = nullptr) - : Impl_details(f, bbox, error_bound, - construct_pair_functor(), - null, p_rng) - {} - /** - * @} - */ - - /// Named constructors - /// @{ -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable: 4003) #endif - // see -CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS +/// \name Creation +/// @{ + /*! \brief Construction from a function, a bounding object and a relative error bound. + * + * \tparam Function a type compatible with `Labeling_function` + * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * \tparam Bounding_object either a bounding sphere (of type `Sphere_3`), a bounding box (type `Bbox_3`), + * or a bounding `Iso_cuboid_3` + * + * \param function the labeling function + * \param bounding_object the bounding object bounding the meshable space. + * \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{relative_error_bound} + * \cgalParamDescription{the relative error bound used to compute intersection points between the implicit surface and query segments. + * The bisection is stopped when the length of the intersected segment is less than the product + * of `relative_error_bound` by the diameter of the bounding object.} + * \cgalParamDefault{FT(1e-3)} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * \cgalHeading{Example} + * From the example (\ref Mesh_3/mesh_implicit_domains_2.cpp): + * \snippet Mesh_3/mesh_implicit_domains_2.cpp Domain creation + * + */ + template + Labeled_mesh_domain_3(const Function& function, + const Bounding_object& bounding_object, + const CGAL_NP_CLASS& np = parameters::default_values(), + typename std::enable_if>::type* = nullptr) + :Impl_details(function, + bounding_object, + parameters::choose_parameter(parameters::get_parameter(np, internal_np::error_bound), FT(1e-3)), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::surface_patch_index), construct_pair_functor()), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::null_subdomain_index_param), Null_subdomain_index()), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::rng), nullptr)) + {} +///@} + +#ifndef DOXYGEN_RUNNING + template + Labeled_mesh_domain_3(const CGAL_NP_CLASS& np) + :Impl_details(parameters::get_parameter(np, internal_np::function_param), + parameters::get_parameter(np, internal_np::bounding_object_param), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::error_bound), FT(1e-3)), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::surface_patch_index), construct_pair_functor()), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::null_subdomain_index_param), Null_subdomain_index()), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::rng), nullptr)) + {} + + // Overload handling parameters passed with operator= + template + Labeled_mesh_domain_3(const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) + : Labeled_mesh_domain_3(internal_np::combine_named_parameters(np1, np2, nps...)) + {} - BOOST_PARAMETER_MEMBER_FUNCTION( - (Labeled_mesh_domain_3), - static create_gray_image_mesh_domain, - parameters::tag, - (required - (image_, (const CGAL::Image_3&)) - ) - (optional - (iso_value_, *, 0) - (value_outside_, *, 0) - (relative_error_bound_, (const FT&), - FT(1e-3)) - (p_rng_, (CGAL::Random*), (CGAL::Random*)(0)) - (image_values_to_subdomain_indices_, *, - Null_functor()) - (null_subdomain_index_,*,Null_functor()) - (construct_surface_patch_index_, *, - Null_functor()) - ) - ) +#ifndef CGAL_NO_DEPRECATED_CODE + template +#if !defined(BOOST_MSVC) + CGAL_DEPRECATED +#endif + Labeled_mesh_domain_3(const Function& function, + const Bounding_object& bounding_object, + double error_bound, + typename std::enable_if>::type* = nullptr) + : Labeled_mesh_domain_3(function, + bounding_object, + parameters::relative_error_bound(error_bound)) + {} +#endif +#endif + +/// \name Creation of domains from 3D images +/// @{ + /*! + * \brief Construction from a 3D gray image + * + * This static method is a named constructor. It constructs a domain + * described by a 3D gray image. A 3D gray image is a grid of voxels, + * where each voxel is associated with a gray level value. Unless otherwise specified by the parameter `image_values_to_subdom_indices`, the domain to + * be discretized is the union of voxels that lie inside a surface + * described by an isolevel value, called \a isovalue. The voxels lying + * inside the domain have gray level values that are larger than the + * isovalue. + * + * The value of voxels is interpolated to a gray level value at any query point. + * + * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * \param image_ the input 3D image. + * \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{iso_value} + * \cgalParamDescription{the isovalue, inside + * `image`, of the surface describing the boundary of the object to be + * meshed.} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalParamNBegin{image_values_to_subdomain_indices} + * \cgalParamDescription{a function or a function object, compatible with the signature + * `Subdomain_index(double)`. This function returns the subdomain index + * corresponding to a pixel value. If this parameter is used, then the + * parameter `iso_value` is ignored.} + * \cgalParamDefault{Null_functor()} + * \cgalParamNEnd + * \cgalParamNBegin{value_outside} + * \cgalParamDescription{the value attached to voxels + * outside of the domain to be meshed. It should be lower than + * `iso_value`.} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalParamNBegin{relative_error_bound} + * \cgalParamDescription{ is the relative error + * bound, relative to the diameter of the box of the image.} + * \cgalParamDefault{FT(1e-3)} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * \cgalHeading{Examples} + * + * From the example (\ref Mesh_3/mesh_3D_gray_image.cpp): + * + * \snippet Mesh_3/mesh_3D_gray_image.cpp Domain creation + * + * From the example (\ref Mesh_3/mesh_3D_gray_vtk_image.cpp): + * + * \snippet Mesh_3/mesh_3D_gray_vtk_image.cpp Domain creation + * + */ + template + static Labeled_mesh_domain_3 create_gray_image_mesh_domain(const CGAL::Image_3& image_, const CGAL_NP_CLASS& np = parameters::default_values()) { + using parameters::get_parameter; + using parameters::choose_parameter; + auto iso_value_ = choose_parameter(get_parameter(np, internal_np::iso_value_param), 0); + auto value_outside_ = choose_parameter(get_parameter(np, internal_np::voxel_value), 0); + FT relative_error_bound_ = choose_parameter(get_parameter(np, internal_np::error_bound), FT(1e-3)); + auto image_values_to_subdomain_indices_ = choose_parameter(get_parameter(np, internal_np::image_subdomain_index), Null_functor()); + CGAL::Random* p_rng_ = choose_parameter(get_parameter(np, internal_np::rng), nullptr); + auto null_subdomain_index_ = choose_parameter(get_parameter(np, internal_np::null_subdomain_index_param), Null_functor()); + auto construct_surface_patch_index_ = choose_parameter(get_parameter(np, internal_np::surface_patch_index), Null_functor()); namespace p = CGAL::parameters; return Labeled_mesh_domain_3 - (create_gray_image_wrapper - (image_, - iso_value_, - image_values_to_subdomain_indices_, - value_outside_), - Mesh_3::internal::compute_bounding_box(image_), - p::relative_error_bound = relative_error_bound_, - p::p_rng = p_rng_, - p::null_subdomain_index = - create_null_subdomain_index(null_subdomain_index_), - p::construct_surface_patch_index = - create_construct_surface_patch_index(construct_surface_patch_index_)); + (p::function = create_gray_image_wrapper + (image_, + iso_value_, + image_values_to_subdomain_indices_, + value_outside_), + p::bounding_object = Mesh_3::internal::compute_bounding_box(image_), + p::relative_error_bound = relative_error_bound_, + p::p_rng = p_rng_, + p::null_subdomain_index = + create_null_subdomain_index(null_subdomain_index_), + p::construct_surface_patch_index = + create_construct_surface_patch_index(construct_surface_patch_index_)); + } - BOOST_PARAMETER_MEMBER_FUNCTION( - (Labeled_mesh_domain_3), - static create_labeled_image_mesh_domain, - parameters::tag, - (required - (image_, (const CGAL::Image_3&)) - ) - (optional - (relative_error_bound_, (const FT&), - FT(1e-3)) - (weights_, (const CGAL::Image_3&), CGAL::Image_3()) - (value_outside_, *, 0) - (p_rng_, (CGAL::Random*), (CGAL::Random*)(0)) - (image_values_to_subdomain_indices_, *, - Null_functor()) - (null_subdomain_index_,*,Null_functor()) - (construct_surface_patch_index_, *, - Null_functor()) - ) - ) + /*! + * \brief Construction from a 3D labeled image + * + * This static method is a named constructor. It constructs a + * domain described by a 3D labeled image. A 3D labeled image is a grid + * of voxels, where each voxel is associated with an index (a subdomain + * index) characterizing the subdomain in which the voxel lies. The + * domain to be discretized is the union of voxels that have non-zero + * values. + * + * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * \param image_ the input 3D image. + * \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{weights} + * \cgalParamDescription{an input 3D image that provides + * weights associated to each voxel (the word type is `unsigned char`, + * and the voxels values are integers between 0 and 255). + * The weights image can be generated with `CGAL::Mesh_3::generate_label_weights()`. + * Its dimensions must be the same as the dimensions of `parameters::image`.} + * \cgalParamDefault{CGAL::Image_3()} + * \cgalParamExtra{A const reference will be taken to the parameter passed.} + * \cgalParamNEnd + * \cgalParamNBegin{value_outside} + * \cgalParamDescription{the value attached to voxels + * outside of the domain to be meshed. It should be lower than + * `iso_value`.} + * \cgalParamDefault{0} + * \cgalParamNEnd + * + * \cgalParamNBegin{relative_error_bound} + * \cgalParamDescription{ is the relative error + * bound, relative to the diameter of the box of the image.} + * \cgalParamDefault{FT(1e-3)} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * \cgalHeading{Example} + * + * From the example (\ref Mesh_3/mesh_3D_image.cpp): + * + * \snippet Mesh_3/mesh_3D_image.cpp Domain creation + * + * From the example (\ref Mesh_3/mesh_3D_weighted_image.cpp), + * where the labeled image is used with a precomputed 3D image of weights : + * + * \snippet Mesh_3/mesh_3D_weighted_image.cpp Domain creation + * + */ + template + static Labeled_mesh_domain_3 create_labeled_image_mesh_domain(const CGAL::Image_3& image_, const CGAL_NP_CLASS& np = parameters::default_values()) { + using parameters::get_parameter; + using parameters::get_parameter_reference; + using parameters::choose_parameter; + auto iso_value_ = choose_parameter(get_parameter(np, internal_np::iso_value_param), 0); + auto value_outside_ = choose_parameter(get_parameter(np, internal_np::voxel_value), 0); + FT relative_error_bound_ = choose_parameter(get_parameter(np, internal_np::error_bound), FT(1e-3)); + auto image_values_to_subdomain_indices_ = choose_parameter(get_parameter(np, internal_np::image_subdomain_index), Null_functor()); + CGAL::Random* p_rng_ = choose_parameter(get_parameter(np, internal_np::rng), nullptr); + auto null_subdomain_index_ = choose_parameter(get_parameter(np, internal_np::null_subdomain_index_param), Null_functor()); + auto construct_surface_patch_index_ = choose_parameter(get_parameter(np, internal_np::surface_patch_index), Null_functor()); + const CGAL::Image_3& weights_ = choose_parameter(get_parameter_reference(np, internal_np::weights_param), CGAL::Image_3()); + CGAL_USE(iso_value_); namespace p = CGAL::parameters; + if (weights_.is_valid()) { return Labeled_mesh_domain_3 - (create_weighted_labeled_image_wrapper - (image_, - weights_, - image_values_to_subdomain_indices_, - value_outside_), - Mesh_3::internal::compute_bounding_box(image_), - p::relative_error_bound = relative_error_bound_, - p::p_rng = p_rng_, - p::null_subdomain_index = - create_null_subdomain_index(null_subdomain_index_), - p::construct_surface_patch_index = - create_construct_surface_patch_index(construct_surface_patch_index_)); + (p::function = create_weighted_labeled_image_wrapper + (image_, + weights_, + image_values_to_subdomain_indices_, + value_outside_), + p::bounding_object = Mesh_3::internal::compute_bounding_box(image_), + p::relative_error_bound = relative_error_bound_, + p::p_rng = p_rng_, + p::null_subdomain_index = + create_null_subdomain_index(null_subdomain_index_), + p::construct_surface_patch_index = + create_construct_surface_patch_index(construct_surface_patch_index_)); } else { return Labeled_mesh_domain_3 - (create_labeled_image_wrapper - (image_, - image_values_to_subdomain_indices_, - value_outside_), - Mesh_3::internal::compute_bounding_box(image_), - p::relative_error_bound = relative_error_bound_, - p::p_rng = p_rng_, - p::null_subdomain_index = - create_null_subdomain_index(null_subdomain_index_), - p::construct_surface_patch_index = - create_construct_surface_patch_index(construct_surface_patch_index_)); + (p::function = create_labeled_image_wrapper + (image_, + image_values_to_subdomain_indices_, + value_outside_), + p::bounding_object = Mesh_3::internal::compute_bounding_box(image_), + p::relative_error_bound = relative_error_bound_, + p::p_rng = p_rng_, + p::null_subdomain_index = + create_null_subdomain_index(null_subdomain_index_), + p::construct_surface_patch_index = + create_construct_surface_patch_index(construct_surface_patch_index_)); } } +/// @} - BOOST_PARAMETER_MEMBER_FUNCTION( - (Labeled_mesh_domain_3), - static create_implicit_mesh_domain, - parameters::tag, - (required - (function_, *) - (bounding_object_,*) - ) - (optional - (relative_error_bound_, (const FT&), - FT(1e-3)) - (p_rng_, (CGAL::Random*), (CGAL::Random*)(0)) - (null_subdomain_index_,*,Null_functor()) - (construct_surface_patch_index_, *, - Null_functor()) - ) - ) +#ifndef DOXYGEN_RUNNING + template + static Labeled_mesh_domain_3 create_gray_image_mesh_domain(const CGAL_NP_CLASS& np) { + static_assert(!parameters::is_default_parameter::value, "Value for required parameter not found"); + using parameters::get_parameter; + using parameters::get_parameter_reference; + using parameters::choose_parameter; + const CGAL::Image_3& image_ = get_parameter_reference(np,internal_np::image_3_param); + auto iso_value_ = choose_parameter(get_parameter(np, internal_np::iso_value_param), 0); + auto value_outside_ = choose_parameter(get_parameter(np, internal_np::voxel_value), 0); + FT relative_error_bound_ = choose_parameter(get_parameter(np, internal_np::error_bound), FT(1e-3)); + auto image_values_to_subdomain_indices_ = choose_parameter(get_parameter(np, internal_np::image_subdomain_index), Null_functor()); + CGAL::Random* p_rng_ = choose_parameter(get_parameter(np, internal_np::rng), nullptr); + auto null_subdomain_index_ = choose_parameter(get_parameter(np, internal_np::null_subdomain_index_param), Null_functor()); + auto construct_surface_patch_index_ = choose_parameter(get_parameter(np, internal_np::surface_patch_index), Null_functor()); namespace p = CGAL::parameters; return Labeled_mesh_domain_3 - (make_implicit_to_labeling_function_wrapper(function_), - bounding_object_, - p::relative_error_bound = relative_error_bound_, - p::p_rng = p_rng_, - p::null_subdomain_index = - create_null_subdomain_index(null_subdomain_index_), - p::construct_surface_patch_index = - create_construct_surface_patch_index(construct_surface_patch_index_)); + (p::function = create_gray_image_wrapper + (image_, + iso_value_, + image_values_to_subdomain_indices_, + value_outside_), + p::bounding_object = Mesh_3::internal::compute_bounding_box(image_), + p::relative_error_bound = relative_error_bound_, + p::p_rng = p_rng_, + p::null_subdomain_index = + create_null_subdomain_index(null_subdomain_index_), + p::construct_surface_patch_index = + create_construct_surface_patch_index(construct_surface_patch_index_)); + } -CGAL_PRAGMA_DIAG_POP + // Overload handling parameters passed with operator= + template + static Labeled_mesh_domain_3 create_gray_image_mesh_domain(const CGAL::Image_3& image_, + const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) + { + return create_gray_image_mesh_domain(image_, internal_np::combine_named_parameters(np1, np2, nps...)); + } + // Overload handling parameters passed with operator= + template + static Labeled_mesh_domain_3 create_gray_image_mesh_domain(const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) + { + return create_gray_image_mesh_domain(internal_np::combine_named_parameters(np1, np2, nps...)); + } -#if defined(BOOST_MSVC) -# pragma warning(pop) + template + static Labeled_mesh_domain_3 create_labeled_image_mesh_domain(const CGAL_NP_CLASS& np) + { + static_assert(!parameters::is_default_parameter::value, "Value for required parameter not found"); + using parameters::get_parameter_reference; + const CGAL::Image_3& image_ = get_parameter_reference(np,internal_np::image_3_param); + return create_labeled_image_mesh_domain(image_, np); + } + + // Overload handling parameters passed with operator= + template + static Labeled_mesh_domain_3 create_labeled_image_mesh_domain(const CGAL::Image_3& image_, + const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) + { + return create_labeled_image_mesh_domain(image_, internal_np::combine_named_parameters(np1, np2, nps...)); + } + // Overload handling parameters passed with operator= + template + static Labeled_mesh_domain_3 create_labeled_image_mesh_domain(const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) + { + return create_labeled_image_mesh_domain(internal_np::combine_named_parameters(np1, np2, nps...)); + } #endif - /// @} - /** - * Constructs a set of \ccc{n} points on the surface, and output them to - * the output iterator \ccc{pts} whose value type is required to be - * \ccc{std::pair}. +/// \name Creation of domains from implicit functions +/// @{ + + /*! + * \brief Construction from an implicit function + * + * This static method is a named constructor. It constructs a domain + * whose bounding surface is described implicitly as the zero level set of a + * function. The domain to be discretized is assumed to be the domain where + * the function has negative values. + * + * The method takes as argument a bounding sphere which is required to + * circumscribe the surface and to have its center inside the domain. + * + * \tparam Function a type compatible with the signature `FT(Point_3)`: it takes a point as argument, + * and returns a scalar value. That object must be model of `CopyConstructible` + * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * \tparam Bounding_object either a bounding sphere (of type `Sphere_3`), a bounding box (type `Bbox_3`), + * or a bounding `Iso_cuboid_3` + * + * \param function the implicit function + * \param bounding_object object boundint the meshable domain and its center is inside the domain. + * \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{relative_error_bound} + * \cgalParamDescription{ is the relative error + * bound, relative to the diameter of the box of the image.} + * \cgalParamDefault{FT(1e-3)} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * \cgalHeading{Examples} + * + * From the example (\ref Mesh_3/mesh_implicit_sphere.cpp): + * + * \snippet Mesh_3/mesh_implicit_sphere.cpp Domain creation + * + * From the example (\ref Mesh_3/mesh_implicit_sphere_variable_size.cpp): + * + * \snippet Mesh_3/mesh_implicit_sphere_variable_size.cpp Domain creation + * + */ + template + static Labeled_mesh_domain_3 create_implicit_mesh_domain(const Function& function, + const Bounding_object& bounding_object, + const CGAL_NP_CLASS& np = parameters::default_values() +#ifndef DOXYGEN_RUNNING + , typename std::enable_if>::type* = nullptr +#endif +) + { + using parameters::get_parameter; + using parameters::choose_parameter; + FT relative_error_bound_ = choose_parameter(get_parameter(np, internal_np::error_bound), FT(1e-3)); + CGAL::Random* p_rng_ = choose_parameter(get_parameter(np, internal_np::rng), nullptr); + auto null_subdomain_index_ = choose_parameter(get_parameter(np, internal_np::null_subdomain_index_param), Null_functor()); + auto construct_surface_patch_index_ = choose_parameter(get_parameter(np, internal_np::surface_patch_index), Null_functor()); + namespace p = CGAL::parameters; + return Labeled_mesh_domain_3 + (p::function = make_implicit_to_labeling_function_wrapper(function), + p::bounding_object = bounding_object, + p::relative_error_bound = relative_error_bound_, + p::p_rng = p_rng_, + p::null_subdomain_index = + create_null_subdomain_index(null_subdomain_index_), + p::construct_surface_patch_index = + create_construct_surface_patch_index(construct_surface_patch_index_)); + } +/// @} +#ifndef DOXYGEN_RUNNING + template + static Labeled_mesh_domain_3 create_implicit_mesh_domain(const CGAL_NP_CLASS& np = parameters::default_values()) + { + static_assert(!parameters::is_default_parameter::value, "Value for required parameter not found"); + static_assert(!parameters::is_default_parameter::value, "Value for required parameter not found"); + + using parameters::get_parameter; + return create_implicit_mesh_domain(parameters::get_parameter(np, internal_np::function_param), + parameters::get_parameter(np, internal_np::bounding_object_param), + np); + } + + // Overload handling parameters passed with operator= + template + static Labeled_mesh_domain_3 create_implicit_mesh_domain(const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) + { + return create_implicit_mesh_domain(internal_np::combine_named_parameters(np1, np2, nps...)); + } + + +#ifndef CGAL_NO_DEPRECATED_CODE + template + CGAL_DEPRECATED + static Labeled_mesh_domain_3 + create_gray_image_mesh_domain(const CGAL::Image_3& image_, + double iso_value, + double value_outside=0, + double relative_error_bound = 1e-3, + CGAL::Random* rng = nullptr, + SubdomainIndex image_values_to_subdom_indices = SubdomainIndex(), + NullSubdomainIndex null_subdomain_index_ = NullSubdomainIndex(), + ConstructSurfacePatchIndex construct_surface_patch_index_ = ConstructSurfacePatchIndex()) + { + return create_gray_image_mesh_domain(image_, parameters::iso_value(iso_value) + .image_values_to_subdomain_indices(image_values_to_subdom_indices) + .value_outside(value_outside) + .relative_error_bound(relative_error_bound) + .p_rng(rng).null_subdomain_index(null_subdomain_index_) + .construct_surface_patch_index(construct_surface_patch_index_)); + } + + template + CGAL_DEPRECATED + static Labeled_mesh_domain_3 + create_labeled_image_mesh_domain(const CGAL::Image_3& image_, + double relative_error_bound, + const CGAL::Image_3& weights_ = CGAL::Image_3(), + int value_outside=0, + CGAL::Random* rng = nullptr, + SubdomainIndex image_values_to_subdom_indices = SubdomainIndex(), + NullSubdomainIndex null_subdomain_index_ = NullSubdomainIndex(), + ConstructSurfacePatchIndex construct_surface_patch_index_ = ConstructSurfacePatchIndex()) + { + return create_labeled_image_mesh_domain(image_, parameters::weights(weights_) + .image_values_to_subdomain_indices(image_values_to_subdom_indices) + .value_outside(value_outside) + .relative_error_bound(relative_error_bound) + .p_rng(rng) + .null_subdomain_index(null_subdomain_index_) + .construct_surface_patch_index(construct_surface_patch_index_)); + } +#endif + + + /* + * Constructs a set of `n` points on the surface, and output them to + * the output iterator `pts` whose value type is required to be + * `std::pair`. */ struct Construct_initial_points { @@ -525,21 +877,21 @@ CGAL_PRAGMA_DIAG_POP const Labeled_mesh_domain_3& r_domain_; }; - /// Returns Construct_initial_points object + // Returns Construct_initial_points object Construct_initial_points construct_initial_points_object() const { return Construct_initial_points(*this); } - /** + /* * Returns a bounding box of the domain */ Bbox_3 bbox() const { return this->bbox_.bbox(); } - /** - * Returns true if point~\ccc{p} is in the domain. If \ccc{p} is in the + /* + * Returns true if point `p` is in the domain. If `p` is in the * domain, the parameter index is set to the index of the subdomain * including $p$. It is set to the default value otherwise. */ @@ -560,16 +912,16 @@ CGAL_PRAGMA_DIAG_POP const Labeled_mesh_domain_3& r_domain_; }; - /// Returns Is_in_domain object + // Returns Is_in_domain object Is_in_domain is_in_domain_object() const { return Is_in_domain(*this); } - /** - * Returns true is the element \ccc{type} intersect properly any of the + /* + * Returns `true` if the element `type` intersect properly any of the * surface patches describing the either the domain boundary or some * subdomain boundary. - * \ccc{Type} is either \ccc{Segment_3}, \ccc{Ray_3} or \ccc{Line_3}. + * `Type` is either `Segment_3`, `Ray_3` or `Line_3`. * Parameter index is set to the index of the intersected surface patch - * if \ccc{true} is returned and to the default \ccc{Surface_patch_index} + * if `true` is returned and to the default `Surface_patch_index` * value otherwise. */ struct Do_intersect_surface @@ -593,8 +945,8 @@ CGAL_PRAGMA_DIAG_POP } private: - /// Returns true if points \c a & \c b do not belong to the same subdomain - /// \c index is set to the surface index of subdomains f(a), f(b) + // Returns true if points `a` and `b` do not belong to the same subdomain + // `index` is set to the surface index of subdomains f(a), f(b) Surface_patch operator()(const Point_3& a, const Point_3& b) const { // If f(a) != f(b), then [a,b] intersects some surface. Here we consider @@ -613,8 +965,8 @@ CGAL_PRAGMA_DIAG_POP return Surface_patch(); } - /** - * Clips \c query to a segment \c s, and call operator()(s) + /* + * Clips `query` to a segment `s`, and call `operator()(s)` */ template Surface_patch clip_to_segment(const Query& query) const @@ -631,19 +983,19 @@ CGAL_PRAGMA_DIAG_POP const Labeled_mesh_domain_3& r_domain_; }; - /// Returns Do_intersect_surface object + // Returns Do_intersect_surface object Do_intersect_surface do_intersect_surface_object() const { return Do_intersect_surface(*this); } - /** - * Returns a point in the intersection of the primitive \ccc{type} + /* + * Returns a point in the intersection of the primitive `type` * with some boundary surface. - * \ccc{Type1} is either \ccc{Segment_3}, \ccc{Ray_3} or \ccc{Line_3}. - * The integer \ccc{dimension} is set to the dimension of the lowest + * `Type1` is either `Segment_3`, `Ray_3` or `Line_3`. + * The integer `dimension` is set to the dimension of the lowest * dimensional face in the input complex containing the returned point, and - * \ccc{index} is set to the index to be stored at a mesh vertex lying + * `index` is set to the index to be stored at a mesh vertex lying * on this face. */ struct Construct_intersection @@ -670,11 +1022,11 @@ CGAL_PRAGMA_DIAG_POP } private: - /** + /* * Returns a point in the intersection of [a,b] with the surface - * \c a must be the source point, and \c b the out point. It's important + * `a` must be the source point, and `b` the out point. It's important * because it drives bisection cuts. - * Indeed, the returned point is the first intersection from \c [a,b] + * Indeed, the returned point is the first intersection from `[a,b]` * with a subdomain surface. */ Intersection operator()(const Point_3& a, const Point_3& b) const @@ -743,7 +1095,7 @@ CGAL_PRAGMA_DIAG_POP } } - /// Clips \c query to a segment \c s, and call operator()(s) + // Clips `query` to a segment `s`, and call `operator()(s)` template Intersection clip_to_segment(const Query& query) const { @@ -759,36 +1111,36 @@ CGAL_PRAGMA_DIAG_POP const Labeled_mesh_domain_3& r_domain_; }; - /// Returns Construct_intersection object + // Returns Construct_intersection object Construct_intersection construct_intersection_object() const { return Construct_intersection(*this); } - /** + /* * Returns the index to be stored in a vertex lying on the surface identified - * by \c index. + * by `index`. */ Index index_from_surface_patch_index(const Surface_patch_index& index) const { return Index(index); } - /** + /* * Returns the index to be stored in a vertex lying in the subdomain - * identified by \c index. + * identified by `index`. */ Index index_from_subdomain_index(const Subdomain_index& index) const { return Index(index); } - /** - * Returns the \c Surface_patch_index of the surface patch - * where lies a vertex with dimension 2 and index \c index. + /* + * Returns the `Surface_patch_index` of the surface patch + * where lies a vertex with dimension 2 and index `index`. */ Surface_patch_index surface_patch_index(const Index& index) const { return boost::get(index); } - /** + /* * Returns the index of the subdomain containing a vertex - * with dimension 3 and index \c index. + * with dimension 3 and index `index`. */ Subdomain_index subdomain_index(const Index& index) const { return boost::get(index); } @@ -810,7 +1162,7 @@ CGAL_PRAGMA_DIAG_POP // ----------------------------------- protected: - /// Returns Surface_patch_index from \c i and \c j + // Returns Surface_patch_index from `i` and `j` Surface_patch_index make_surface_index(const Subdomain_index i, const Subdomain_index j) const { @@ -820,7 +1172,7 @@ protected: return this->cstr_s_p_index(j, i); } - /// Returns the bounding sphere of an Iso_cuboid_3 + // Returns the bounding sphere of an Iso_cuboid_3 Sphere_3 bounding_sphere(const Iso_cuboid_3& bbox) const { typename BGT::Construct_sphere_3 sphere = BGT().construct_sphere_3_object(); @@ -986,11 +1338,13 @@ protected: } public: - /// Returns bounding box + // Returns bounding box const Iso_cuboid_3& bounding_box() const { return this->bbox_; } +#endif //DOXYGEN_RUNNING }; // end class Labeled_mesh_domain_3 +#ifndef DOXYGEN_RUNNING //------------------------------------------------------- // Method implementation //------------------------------------------------------- @@ -1072,7 +1426,7 @@ Construct_initial_points::operator()(OutputIterator pts, #endif return pts; } - +#endif } // end namespace CGAL diff --git a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h index 6bb15751a03..6a5e0923a01 100644 --- a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h +++ b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h @@ -712,18 +712,18 @@ public: { } /** - * @brief tries to move \c old_vertex to \c new_position in the mesh + * @brief tries to move `old_vertex` to `new_position` in the mesh * @param old_vertex the old vertex * @param move the translation from the old position to the new - * @param new_position the new position of \c old_vertex + * @param new_position the new position of `old_vertex` * @param criterion the criterion which will be used to verify the new * position is ok. c3t3 minimal value of new criterion shall not decrease. * @param modified_vertices contains the vertices incident to cells which * may have been impacted by relocation * @return a pair which contains: - * - a bool which is \c true if the move has been done. + * - a bool which is `true` if the move has been done. * - a Vertex_handle which is always filled and may be the new vertex (if - * the move is a success), or the vertex which lies at \c v's position in + * the move is a success), or the vertex which lies at `v`'s position in * the updated c3t3. */ template @@ -735,7 +735,7 @@ public: OutputIterator modified_vertices, bool *could_lock_zone = nullptr); - /** @brief tries to move \c old_vertex to \c new_position in the mesh + /** @brief tries to move `old_vertex` to `new_position` in the mesh * * Same as update_mesh, but with the precondition that * Th().no_topological_change(tr_, old_vertex, new_position, @@ -750,7 +750,7 @@ public: bool *could_lock_zone = nullptr); /** - * Updates mesh moving vertex \c old_vertex to \c new_position. Returns the + * Updates mesh moving vertex `old_vertex` to `new_position`. Returns the * new vertex of the triangulation. * * Insert into modified vertices the vertices which are impacted by to move. @@ -762,7 +762,7 @@ public: bool fill_modified_vertices = true); /** - * Updates mesh moving vertex \c old_vertex to \c new_position. Returns the + * Updates mesh moving vertex `old_vertex` to `new_position`. Returns the * new vertex of the triangulation. */ Vertex_handle update_mesh(const Vertex_handle& old_vertex, @@ -799,14 +799,14 @@ public: #endif /** - * @brief Project \c p on surface, using incident facets of \c v + * @brief Project `p` on surface, using incident facets of `v` * @param v The vertex from which p was moved * @param p The point to project * @param index The index of the surface patch where v lies, if known. * @return the projected point * - * \c p is projected as follows using normal of least square fitting plane - * on \c v incident surface points. If \c index is specified, only + * `p` is projected as follows using normal of least square fitting plane + * on `v` incident surface points. If `index` is specified, only * surface points that are on the same surface patch are used to compute * the fitting plane. */ @@ -815,16 +815,16 @@ public: Surface_patch_index index = Surface_patch_index()) const; /** - * Returns the minimum value for criterion for incident cells of \c vh + * Returns the minimum value for criterion for incident cells of `vh` */ template FT min_incident_value(const Vertex_handle& vh, const SliverCriterion& criterion) const; /** - * Moves \c old_vertex to \c new_position - * Stores the cells which have to be updated in \c outdated_cells - * Updates the Vertex_handle old_vertex to its new value in \c moving_vertices + * Moves `old_vertex` to `new_position` + * Stores the cells which have to be updated in `outdated_cells` + * Updates the Vertex_handle old_vertex to its new value in `moving_vertices` * The second one (with the could_lock_zone param) is for the parallel version */ Vertex_handle move_point(const Vertex_handle& old_vertex, @@ -839,11 +839,11 @@ public: bool *could_lock_zone) const; /** - * Try to lock ALL the incident cells and return in \c cells the ones - * whose \c filter says "true". + * Try to lock ALL the incident cells and return in `cells` the ones + * whose `filter` says `true`. * Return value: - * - false: everything is unlocked and \c cells is empty - * - true: ALL incident cells are locked and \c cells is filled + * - false: everything is unlocked and `cells` is empty + * - true: ALL incident cells are locked and `cells` is filled */ template bool @@ -852,10 +852,10 @@ public: const Filter &filter) const; /** - * Try to lock ALL the incident cells and return in \c cells the slivers + * Try to lock ALL the incident cells and return in `cells` the slivers * Return value: - * - false: everything is unlocked and \c cells is empty - * - true: incident cells are locked and \c cells contains all slivers + * - false: everything is unlocked and `cells` is empty + * - true: incident cells are locked and `cells` contains all slivers */ template bool @@ -872,8 +872,8 @@ public: Cell_vector &slivers) const; /** - * Outputs to out the sliver (wrt \c criterion and \c sliver_bound) incident - * to \c v + * Outputs to out the sliver (wrt `criterion` and `sliver_bound`) incident + * to `v` */ template OutputIterator @@ -891,7 +891,7 @@ public: OutputIterator out) const; /** - * Returns the sliver (wrt \c criterion and \c sliver_bound) incident to \c v + * Returns the sliver (wrt `criterion` and `sliver_bound`) incident to `v` */ template Cell_vector @@ -917,7 +917,7 @@ public: /** - * Returns the number of slivers incident to \c v + * Returns the number of slivers incident to `v` */ template std::size_t @@ -932,8 +932,8 @@ public: const FT& sliver_bound) const; /** - * Returns the minimum criterion value of cells contained in \c cells - * Precondition: cells of \c cells must not be infinite. + * Returns the minimum criterion value of cells contained in `cells` + * Precondition: cells of `cells` must not be infinite. * Warning: Here we don't check if cells are in c3t3 */ template @@ -1092,10 +1092,10 @@ private: , c3t3_(c3t3) {} /** - * @brief Updates facet \c facet in c3t3 + * @brief Updates facet `facet` in c3t3 * @param facet the facet to update - * @param update if set to \c false, checking only is done - * @return true if \c facet is in c3t3 + * @param update if set to `false`, checking only is done + * @return true if `facet` is in c3t3 */ Surface_patch operator()(const Facet& facet, const bool update = true) const { @@ -1103,15 +1103,15 @@ private: } /** - * @brief Updates facet \c facet in c3t3 + * @brief Updates facet `facet` in c3t3 * @param facet the facet to update - * @param update_c3t3 if set to \c false, checking only is done - * @param update_surface_center if set to \c true, the facet surface + * @param update_c3t3 if set to `false`, checking only is done + * @param update_surface_center if set to `true`, the facet surface * center is updated. - * @return true if \c facet is in c3t3 + * @return true if `facet` is in c3t3 * - * By default, \c update_c3t3 is \c true, and \c update_surface_center - * is equal to \c update_c3t3. + * By default, `update_c3t3` is `true`, and `update_surface_center` + * is equal to `update_c3t3`. */ Surface_patch operator()(const Facet& facet, const bool update_c3t3, @@ -1162,10 +1162,10 @@ private: } /** - * @brief Updates cell \c ch in c3t3 + * @brief Updates cell `ch` in c3t3 * @param ch the cell to update - * @param update if set to \c false, checking only is done - * @return true if \c ch is in c3t3 + * @param update if set to `false`, checking only is done + * @return true if `ch` is in c3t3 */ Subdomain operator()(const Cell_handle& ch, const bool update = true) const { @@ -1556,7 +1556,7 @@ private: // Private methods // ----------------------------------- /** - * Returns the minimum criterion value of c3t3 cells contained in \c cells. + * Returns the minimum criterion value of c3t3 cells contained in `cells`. */ template FT min_sliver_in_c3t3_value(const Cell_vector& cells, @@ -1586,7 +1586,7 @@ private: } /** - * Removes objects of [begin,end[ range from \c c3t3_ + * Removes objects of [begin,end[ range from `c3t3_` */ template void remove_from_c3t3(ForwardIterator begin, ForwardIterator end) const @@ -1596,7 +1596,7 @@ private: } /** - * Remove cells and facets of \c cells from c3t3 + * Remove cells and facets of `cells` from c3t3 */ template < typename ForwardIterator > void remove_cells_and_facets_from_c3t3(ForwardIterator cells_begin, @@ -1608,7 +1608,7 @@ private: } /** - * Insert into \c out the vertices of range [cells_begin,cells_end[ + * Insert into `out` the vertices of range [cells_begin,cells_end[ */ template void fill_modified_vertices(InputIterator cells_begin, @@ -1688,15 +1688,15 @@ private: Surface_patch_index index = Surface_patch_index()) const; /** - * @brief Project \c p on surface, using incident facets of \c v + * @brief Project `p` on surface, using incident facets of `v` * @param v The vertex from which p was moved * @param p The point to project * @param index The index of the surface patch where v lies, if known. * @return a `boost::optional` with the projected point if the projection * was possible, or `boost::none`. * - * \c p is projected using the normal of least square fitting plane - * on \c v incident surface points. If \c index is specified, only + * `p` is projected using the normal of least square fitting plane + * on `v` incident surface points. If `index` is specified, only * surface points that are on the same surface patch are used to compute * the fitting plane. */ @@ -1706,8 +1706,8 @@ private: Surface_patch_index index = Surface_patch_index()) const; /** - * @brief Returns the projection of \c p, using direction of - * \c projection_vector + * @brief Returns the projection of `p`, using direction of + * `projection_vector` */ Bare_point project_on_surface_aux(const Bare_point& p, @@ -1715,8 +1715,8 @@ private: const Vector_3& projection_vector) const; /** - * Reverts the move from \c old_point to \c new_vertex. Returns the inserted - * vertex located at \c old_point + * Reverts the move from `old_point` to `new_vertex`. Returns the inserted + * vertex located at `old_point` * and an output iterator on outdated cells */ template @@ -1736,7 +1736,7 @@ private: } /** - * Returns the boundary of restricted facets of \c facets, + * Returns the boundary of restricted facets of `facets`, and the list of vertices of all restricted facets, which should not contain the vertex that is moving */ @@ -1746,7 +1746,7 @@ private: Vertex_set& incident_surface_vertices) const; /** - * Returns the boundary of restricted facets of \c cells + * Returns the boundary of restricted facets of `cells` and the list of vertices of all restricted facets. */ Facet_boundary @@ -1760,13 +1760,13 @@ private: } /** - * Returns false if there is a vertex belonging to one facet of \c facets + * Returns false if there is a vertex belonging to one facet of `facets` * which has not his dimension < 3 */ bool check_no_inside_vertices(const Facet_vector& facets) const; /** - * Returns the impacted cells when moving \c vertex to \c conflict_point + * Returns the impacted cells when moving `vertex` to `conflict_point` */ template OutputIterator @@ -1805,7 +1805,7 @@ private: DeletedCellsOutputIterator deleted_cells) const; /** - * Updates \c boundary wrt \c edge: if edge is already in boundary we remove + * Updates `boundary` wrt `edge`: if edge is already in boundary we remove * it, else we add it. */ void update_boundary(Facet_boundary& boundary, @@ -1831,7 +1831,7 @@ private: } /** - * Returns the facets of \c cells (returns each facet only once i.e. use + * Returns the facets of `cells` (returns each facet only once i.e. use * canonical facet) */ Facet_vector get_facets(const Cell_vector& cells) const @@ -1900,7 +1900,7 @@ private: } #else /** - * Returns the facets of \c cells (returns each facet only once i.e. use + * Returns the facets of `cells` (returns each facet only once i.e. use * canonical facet) */ template @@ -1991,7 +1991,7 @@ private: /** - * Returns the facets of \c cells (returns each facet only once i.e. use + * Returns the facets of `cells` (returns each facet only once i.e. use * canonical facet) */ template @@ -2060,7 +2060,7 @@ private: } /** - * Restore mesh for cells and facets of \c cells, using domain_ + * Restore mesh for cells and facets of `cells`, using domain_ */ template void restore_mesh(ForwardIterator first_cell, ForwardIterator last_cell) @@ -2070,7 +2070,7 @@ private: } /** - * Restore mesh for cells of \c cells and facets of \c facets, using domain_ + * Restore mesh for cells of `cells` and facets of `facets`, using domain_ */ template void restore_mesh(CellForwardIterator first_cell, @@ -2085,8 +2085,8 @@ private: } /** - * Returns true if facets of \c facets have the same boundary as - * \c old_boundary, and if the list of vertices has not changed. + * Returns true if facets of `facets` have the same boundary as + * `old_boundary`, and if the list of vertices has not changed. */ bool check_surface_mesh(const Vertex_handle& moving_vertex, const Facet_vector& facets, @@ -2113,7 +2113,7 @@ private: } /** - * Orders handles \c h1, \c h2 & \c h3 + * Orders handles `h1`, `h2` & `h3` */ template void order_handles(Handle& h1, Handle& h2, Handle& h3) const @@ -3353,8 +3353,8 @@ move_point_no_topo_change(const Vertex_handle& old_vertex, /** - * @brief Returns the projection of \c p, using direction of - * \c projection_vector + * @brief Returns the projection of `p`, using direction of + * `projection_vector` */ template typename C3T3_helpers::Bare_point diff --git a/Mesh_3/include/CGAL/Mesh_3/Image_plus_weights_to_labeled_function_wrapper.h b/Mesh_3/include/CGAL/Mesh_3/Image_plus_weights_to_labeled_function_wrapper.h index e1d54932eb6..1c0adbcd617 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Image_plus_weights_to_labeled_function_wrapper.h +++ b/Mesh_3/include/CGAL/Mesh_3/Image_plus_weights_to_labeled_function_wrapper.h @@ -107,9 +107,9 @@ public: ~Image_plus_weights_to_labeled_function_wrapper() {} /** - * Returns an int corresponding to the label at point \c p + * Returns an int corresponding to the label at point `p`. * @param p the input point - * @return the label at point \c p + * @return the label at point `p` */ template return_type operator()(const Point_3& p) const diff --git a/Mesh_3/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h b/Mesh_3/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h index 0ba137121ca..45246e4463d 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h +++ b/Mesh_3/include/CGAL/Mesh_3/Image_to_labeled_function_wrapper.h @@ -72,9 +72,9 @@ public: ~Image_to_labeled_function_wrapper() {} /** - * Returns an int corresponding to the label at point \c p + * Returns an int corresponding to the label at point `p`. * @param p the input point - * @return the label at point \c p + * @return the label at point `p` */ template return_type operator()(const Point_3& p) const diff --git a/Mesh_3/include/CGAL/Mesh_3/Lloyd_move.h b/Mesh_3/include/CGAL/Mesh_3/Lloyd_move.h index d4a638c78c6..f709f4b4f1a 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Lloyd_move.h +++ b/Mesh_3/include/CGAL/Mesh_3/Lloyd_move.h @@ -68,7 +68,7 @@ public: typedef SizingField Sizing_field; /** - * @brief Return the move to apply on \c v according to Lloyd optimization + * @brief Returns the move to apply on `v` according to Lloyd optimization * function. */ Vector_3 operator()(const Vertex_handle& v, @@ -162,7 +162,7 @@ private: /** - * Return the move for the inside vertex \c v. + * Returns the move for the inside vertex `v`. */ Vector_3 lloyd_move_inside_domain(const Vertex_handle& v, const Cell_vector& incident_cells, @@ -210,7 +210,7 @@ private: } /** - * Return the move for the on-boundary vertex \c v. + * Returns the move for the on-boundary vertex `v`. */ Vector_3 lloyd_move_on_boundary(const Vertex_handle& v, const C3T3& c3t3, @@ -254,7 +254,7 @@ private: /** * Returns a vector containing the surface delaunay ball centers of the surface - * facets that are incident to vertex \c v. + * facets that are incident to vertex `v`. */ std::vector extract_lloyd_boundary_points(const Vertex_handle& v, const C3T3& c3t3) const @@ -298,7 +298,7 @@ private: } /** - * Return the move from \c v to the centroid of the segment [a,b]. + * Returns the move from `v` to the centroid of the segment `[a,b]`. */ Vector_3 centroid_segment_move(const Vertex_handle& v, const Bare_point& a, @@ -320,7 +320,7 @@ private: } /** - * Return the move from \c v to the centroid of triangle [a,b,c]. + * Returns the move from `v` to the centroid of triangle `[a,b,c]`. */ Vector_3 centroid_triangle_move(const Vertex_handle& v, const Bare_point& a, @@ -397,7 +397,7 @@ private: } /** - * Return the move from \c v to the centroid of polygon[first,last]. + * Returns the move from `v` to the centroid of polygon `[first,last]`. * The polygon has to be convex. */ template @@ -523,8 +523,8 @@ private: } /** - * Turn around the edge \c edge and add the values computed from tets made by - * `v` and the circumcenters of cells incident to \c edge. + * Turns around the edge `edge` and adds the values computed from tets made by + * `v` and the circumcenters of cells incident to `edge`. * * Note that this function abundantly uses dual() calls and using a cell base * which stores the circumcenter thus improves its efficiency. diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h b/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h index adf53d159c5..714430116f6 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h @@ -313,19 +313,19 @@ public: private: /** - * Returns moves for vertices of set \c moving_vertices + * Returns moves for vertices of set `moving_vertices`. */ Moves_vector compute_moves(Moving_vertices_set& moving_vertices); /** - * Returns the move for vertex \c v + * Returns the move for vertex `v`. * \warning This function should be called only on moving vertices * even for frozen vertices, it could return a non-zero vector */ Vector_3 compute_move(const Vertex_handle& v); /** - * Updates mesh using moves of \c moves vector. Updates moving_vertices with + * Updates mesh using moves of `moves` vector. Updates moving_vertices with * the new set of moving vertices after the move. */ void update_mesh(const Moves_vector& moves, @@ -343,17 +343,17 @@ private: bool check_convergence() const; /** - * Returns the average circumradius length of cells incident to \c v + * Returns the average circumradius length of cells incident to `v`. */ FT average_circumradius_length(const Vertex_handle& v) const; /** - * Returns the minimum cicumradius length of cells incident to \c v + * Returns the minimum cicumradius length of cells incident to `v`. */ FT min_circumradius_sq_length(const Vertex_handle& v, const Cell_vector& incident_cells) const; /** - * Returns the squared circumradius length of cell \c cell + * Returns the squared circumradius length of cell `cell`. */ FT sq_circumradius_length(const Cell_handle& cell, const Vertex_handle& v) const; diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesh_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Mesh_sizing_field.h index 84c84128618..e1d52d202f2 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesh_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesh_sizing_field.h @@ -107,42 +107,42 @@ public: Mesh_sizing_field(Tr& tr); /** - * Fill sizing field, using size associated to point in \c value_map + * Fills sizing field, using size associated to point in `value_map` */ void fill(const std::map& value_map); /** - * Returns size at point \c p. + * Returns size at point `p`. */ FT operator()(const Bare_point& p) const { return this->operator()(p, this->get_last_cell()); } /** - * Returns size at point \c p, using \c v to accelerate \c p location + * Returns size at point `p`, using `v` to accelerate `p` location * in triangulation */ FT operator()(const Bare_point& p, const Vertex_handle& v) const { return this->operator()(p, v->cell()); } /** - * Returns size at point \c p. + * Returns size at point `p`. */ FT operator()(const Bare_point& p, const Cell_handle& c) const; /** - * Returns size at point \c p. Assumes that p is the centroid of c. + * Returns size at point `p`. Assumes that p is the centroid of c. */ FT operator()(const Bare_point& p, const std::pair& c) const; private: /** - * Returns size at point \c p, by interpolation into tetrahedron. + * Returns size at point `p`, by interpolation into tetrahedron. */ FT interpolate_on_cell_vertices(const Bare_point& p, const Cell_handle& cell) const; /** - * Returns size at point \c p, by interpolation into facet (\c cell is assumed + * Returns size at point `p`, by interpolation into facet (`cell` is assumed * to be an infinite cell). */ FT interpolate_on_facet_vertices(const Bare_point& p, diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesh_surface_cell_base_3.h b/Mesh_3/include/CGAL/Mesh_3/Mesh_surface_cell_base_3.h index f0db722f898..3483e08ac54 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesh_surface_cell_base_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesh_surface_cell_base_3.h @@ -55,21 +55,21 @@ public: Mesh_surface_cell_base_3_base() : bits_(0) {} - /// Marks \c facet as visited + /// Marks `facet` as visited. void set_facet_visited (const int facet) { CGAL_precondition(facet>=0 && facet <4); bits_ |= (1 << facet); } - /// Marks \c facet as not visited + /// Marks `facet` as not visited. void reset_visited (const int facet) { CGAL_precondition(facet>=0 && facet<4); bits_ &= (15 & ~(1 << facet)); } - /// Returns \c true if \c facet is marked as visited + /// Returns `true` if `facet` is marked as visited. bool is_facet_visited (const int facet) const { CGAL_precondition(facet>=0 && facet<4); @@ -92,7 +92,7 @@ public: bits_ = 0; } - /// Marks \c facet as visited + /// Marks `facet` as visited. void set_facet_visited (const int facet) { CGAL_precondition(facet>=0 && facet<4); @@ -103,7 +103,7 @@ public: } } - /// Marks \c facet as not visited + /// Marks `facet` as not visited. void reset_visited (const int facet) { CGAL_precondition(facet>=0 && facet<4); @@ -114,7 +114,7 @@ public: } } - /// Returns \c true if \c facet is marked as visited + /// Returns `true` if `facet` is marked as visited. bool is_facet_visited (const int facet) const { CGAL_precondition(facet>=0 && facet<4); @@ -187,42 +187,42 @@ public: // Default copy constructor and assignment operator are ok - /// Set surface index of \c facet to \c index + /// Sets surface index of `facet` to `index` void set_surface_patch_index(const int facet, const Surface_patch_index& index) { CGAL_precondition(facet>=0 && facet<4); surface_index_table_[facet] = index; } - /// Returns surface index of facet \c facet + /// Returns surface index of facet `facet`. Surface_patch_index surface_patch_index(const int facet) const { CGAL_precondition(facet>=0 && facet<4); return surface_index_table_[facet]; } - /// Sets surface center of \c facet to \c point + /// Sets surface center of `facet` to `point`. void set_facet_surface_center(const int facet, const Point& point) { CGAL_precondition(facet>=0 && facet<4); surface_center_table_[facet] = point; } - /// Returns surface center of \c facet + /// Returns surface center of `facet`. Point get_facet_surface_center(const int facet) const { CGAL_precondition(facet>=0 && facet<4); return surface_center_table_[facet]; } - /// Sets surface center index of \c facet to \c index + /// Sets surface center index of `facet` to `index`. void set_facet_surface_center_index(const int facet, const Index& index) { CGAL_precondition(facet>=0 && facet<4); surface_center_index_table_[facet] = index; } - /// Returns surface center of \c facet + /// Returns surface center of `facet`. Index get_facet_surface_center_index(const int facet) const { CGAL_precondition(facet>=0 && facet<4); @@ -245,7 +245,7 @@ public: void set_surface_index(const int facet, const Surface_index& index) { set_surface_patch_index(facet,index); } - /// Returns surface index of facet \c facet + /// Returns surface index of facet `facet`. Surface_index surface_index(const int facet) const { return surface_patch_index(facet); } #endif // CGAL_MESH_3_NO_DEPRECATED_SURFACE_INDEX diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h index 1a13e725a44..e8f105cd241 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h @@ -568,7 +568,7 @@ refine_mesh(std::string dump_after_refine_surface_prefix) std::cerr << "Total refining surface time: " << timer.time() << "s" << std::endl; std::cerr << std::endl; - CGAL_triangulation_postcondition(r_tr.is_valid()); + CGAL_postcondition(r_tr.is_valid()); elapsed_time += timer.time(); timer.stop(); timer.reset(); timer.start(); @@ -613,7 +613,7 @@ refine_mesh(std::string dump_after_refine_surface_prefix) std::cerr << "Total refining time: " << timer.time()+elapsed_time << "s" << std::endl; std::cerr << std::endl; - CGAL_triangulation_postcondition(r_tr.is_valid()); + CGAL_postcondition(r_tr.is_valid()); #endif (void)(forced_stop()); // sets *error_code diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesher_level.h b/Mesh_3/include/CGAL/Mesh_3/Mesher_level.h index fc2727797d1..752e7630119 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesher_level.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesher_level.h @@ -120,7 +120,7 @@ template < class Element, /**< Type of elements that this level refines. */ class Previous, /* = Null_mesher_level, */ /**< Previous level type, defaults to - \c Null_mesher_level. */ + `Null_mesher_level`. */ class Triangulation_traits /** Traits class that defines types for the triangulation. */ > @@ -198,7 +198,7 @@ public: { } - /** \name FUNCTIONS IMPLEMENTED IN THE CLASS \c Derived */ + /** \name FUNCTIONS IMPLEMENTED IN THE CLASS `Derived` */ /** Access to the triangulation */ Triangulation& triangulation() @@ -248,7 +248,7 @@ public: return derived().number_of_bad_elements_impl(); } - /** Tells if, as regards the elements of type \c Element, the refinement is + /** Tells if, as regards the elements of type `Element`, the refinement is done. */ bool no_longer_element_to_refine() { @@ -292,13 +292,13 @@ public: visitor.previous_level()); } - /** Gives the point that should be inserted to refine the element \c e */ + /** Gives the point that should be inserted to refine the element `e` */ Bare_point refinement_point(const Element& e) { return derived().refinement_point_impl(e); } - /** Actions before testing conflicts for point \c p and element \c e */ + /** Actions before testing conflicts for point `p` and element `e` */ template void before_conflicts(const Element& e, const Point& p, Mesh_visitor visitor) @@ -311,7 +311,7 @@ public: point conflicts with something, and do what is needed. The return type is made of two booleans: - the first one tells if the point can be inserted, - - in case of, the first one is \c false, the second one tells if + - in case of, the first one is `false`, the second one tells if the tested element should be reconsidered latter. */ Mesher_level_conflict_status private_test_point_conflict(const Point& p, @@ -321,8 +321,8 @@ public: } /** - * Actions before inserting the point \c p in order to refine the - * element \c e. The zone of conflicts is \c zone. + * Actions before inserting the point `p` in order to refine the + * element `e`. The zone of conflicts is `zone`. */ template void before_insertion(Element& e, const Point& p, Zone& zone, @@ -343,7 +343,7 @@ public: visitor.after_insertion(vh); } - /** Actions after testing conflicts for point \c p and element \c e + /** Actions after testing conflicts for point `p` and element `e` * if no point is inserted. */ template void after_no_insertion(const Element& e, const Point& p, Zone& zone, @@ -361,7 +361,7 @@ public: */ /** - * Tells it the algorithm is done, regarding elements of type \c Element + * Tells it the algorithm is done, regarding elements of type `Element` * or elements of previous levels. */ bool is_algorithm_done() @@ -383,7 +383,7 @@ public: /** * This function takes one element from the queue, and try to refine - * it. It returns \c true if one point has been inserted. + * it. It returns `true` if one point has been inserted. * @todo Merge with try_to_refine_element(). */ template @@ -426,7 +426,7 @@ public: /** \name STEP BY STEP FUNCTIONS */ /** - * Inserts exactly one point, if possible, and returns \c false if no + * Inserts exactly one point, if possible, and returns `false` if no * point has been inserted because the algorithm is done. */ template @@ -457,7 +457,7 @@ template < class Element, /**< Type of elements that this level refines. */ class Previous, /* = Null_mesher_level, */ /**< Previous level type, defaults to - \c Null_mesher_level. */ + `Null_mesher_level`. */ class Triangulation_traits, /** Traits class that defines types for the triangulation. */ typename Concurrency_tag> @@ -519,8 +519,8 @@ public: point conflicts with something, and do what is needed. The return type is made of two booleans: - the first one tells if the point can be inserted, - - in case of, the first one is \c false, the second one tells if - the tested element should be reconsidered latter. + - in case of, the first one is `false`, the second one tells if + the tested element should be reconsidered later. This function is called by the superior level, if any. */ Mesher_level_conflict_status @@ -648,7 +648,7 @@ public: /** * Applies one step of the algorithm: tries to refine one element of - * previous level or one element of this level. Return \c false iff + * previous level or one element of this level. Return `false` iff * is_algorithm_done()==true . */ template @@ -681,7 +681,7 @@ template < class Element, /**< Type of elements that this level refines. */ class Previous, /* = Null_mesher_level, */ /**< Previous level type, defaults to - \c Null_mesher_level. */ + `Null_mesher_level`. */ class Triangulation_traits> /** Traits class that defines types for the triangulation. */ class Mesher_level @@ -1109,7 +1109,7 @@ public: /** * Applies one step of the algorithm: tries to refine one element of - * previous level or one element of this level. Return \c false iff + * previous level or one element of this level. Return `false` iff * is_algorithm_done()==true . * Note that when parallelism is activated, this is not "one step" * but the full refinement. diff --git a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h index 0f1f29e51bc..71f9b7b1988 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h @@ -196,8 +196,8 @@ private: Vertex_handle get_vertex_corner_from_point(const Bare_point& p, const Index& p_index) const; - /// Insert point(p,w) into the triangulation and set its dimension to \c dim - /// and its index to \c index. + /// Inserts `point(p,w)` into the triangulation and set its dimension to `dim` + /// and its index to `index`. /// The handle of the newly created vertex is returned. Vertex_handle insert_point(const Bare_point& p, const Weight& w, @@ -206,8 +206,8 @@ private: const bool special_ball = false); /** - * Insert point(p,w) into the triangulation and set its dimension to \c dim and - * its index to \c index. + * Inserts `point(p,w)` into the triangulation and set its dimension to `dim` and + * its index to `index`. * The handle of the newly created vertex is returned. * * This function also ensures that `point(p,w)` will not be inside a @@ -223,12 +223,12 @@ private: const Index& index, ErasedVeOutIt out); - /// Insert balls between the points identified by the handles \c vp and \c vq - /// on the curve identified by \c curve_index. + /// Inserts balls between the points identified by the handles `vp` and `vq` + /// on the curve identified by `curve_index`. /// - /// \param orientation Orientation of the curve segment between \c vp and - /// \c vq, given the orientation of the curve of index - /// \c curve_index + /// \param orientation Orientation of the curve segment between `vp` and + /// `vq`, given the orientation of the curve of index + /// `curve_index` template ErasedVeOutIt insert_balls(const Vertex_handle& vp, const Vertex_handle& vq, @@ -251,25 +251,25 @@ private: const Curve_index& curve_index, ErasedVeOutIt out); - /// Return `true` if the balls of \c va and \c vb intersect, and (va,vb) is not + /// Returns `true` if the balls of `va` and `vb` intersect, and `(va,vb)` is not /// an edge of the complex. bool non_adjacent_but_intersect(const Vertex_handle& va, const Vertex_handle& vb) const; - /// Return `true` if the balls of \c va and \c vb intersect. + /// Returns `true` if the balls of `va` and `vb` intersect. bool do_balls_intersect(const Vertex_handle& va, const Vertex_handle& vb) const; - /// Change the size of the ball of the vertex \c v. + /// Changes the size of the ball of the vertex `v`. Vertex_handle change_ball_size(const Vertex_handle& v, const FT squared_size, const bool special_ball = false); - /// Return `true` if balls of v1 and v2 intersect "enough". - /// \param orientation Orientation of the curve segment between \c v1 and - /// \c v2, given the orientation of the curve of index - /// \c curve_index + /// Returns `true` if balls of v1 and v2 intersect "enough". + /// \param orientation Orientation of the curve segment between `v1` and + /// `v2`, given the orientation of the curve of index + /// `curve_index` /// \pre `c3t3.curve_index(v1, v2) == curve_index` bool is_sampling_dense_enough(const Vertex_handle& v1, const Vertex_handle& v2, @@ -280,17 +280,17 @@ private: /// of those vertices is ok. If not, fix it. void check_and_repopulate_edges(); - /// Check if the vertex \c v is well sampled, and if its not the case, fix it. - /// Fill `out` with deleted vertices during this process. The value type of `out` + /// Checks if the vertex `v` is well sampled, and if its not the case, fix it. + /// Fills `out` with deleted vertices during this process. The value type of `out` /// is `Vertex_handle`. template ErasedVeOutIt check_and_fix_vertex_along_edge(const Vertex_handle& v, ErasedVeOutIt out); - /// Given two vertices \c start and \c next inserted on the curve with - /// index \c curve_index, return `CGAL::POSITIVE` if the curve arc from - /// \c start to \c next is oriented in the same orientation as the curve - /// segment with index \c curve_index, or `CGAL::NEGATIVE` otherwise. + /// Given two vertices `start` and `next` inserted on the curve with + /// index `curve_index`, returns `CGAL::POSITIVE` if the curve arc from + /// `start` to `next` is oriented in the same orientation as the curve + /// segment with index `curve_index`, or `CGAL::NEGATIVE` otherwise. /// /// \pre `c3t3.curve_index(v1, v2) == curve_index` CGAL::Orientation @@ -298,13 +298,13 @@ private: const Vertex_handle& next, Curve_index curve_index) const; - /// Walk along the edge from \c start, following the direction \c start to - /// \c next, and fills \c out with the vertices which do not fulfill + /// Walks along the edge from `start`, following the direction `start` to + /// `next`, and fills `out` with the vertices which do not fulfill /// the sampling conditions. /// - /// \param orientation Orientation of the curve segment between \c v1 and - /// \c v2, given the orientation of the curve of index - /// \c curve_index + /// \param orientation Orientation of the curve segment between `v1` and + /// `v2`, given the orientation of the curve of index + /// `curve_index` /// /// \pre `c3t3.curve_index(v1, v2) == curve_index` template @@ -315,8 +315,8 @@ private: const CGAL::Orientation orientation, ErasedVeOutIt out) const; - /// Return the next vertex along edge, i.e the vertex after \c start, following - /// the direction from \c previous to \c start. + /// Returns the next vertex along edge, i.e the vertex after `start`, following + /// the direction from `previous` to `start`. /// \pre (previous,start) is in c3t3 /// \pre `c3t3.curve_index(start, previous) == curve_index` Vertex_handle @@ -324,13 +324,13 @@ private: const Vertex_handle& previous, const Curve_index& curve_index) const; - /// Replace the vertices between ]begin,last[ with new vertices, along the curve - /// identified by \c curve_index. + /// Replaces the vertices within `]begin,last[` with new vertices, along the curve + /// identified by `curve_index`. /// The value type of `InputIterator` is `Vertex_handle`. /// - /// \param orientation Orientation of the curve segment between \c begin and - /// \c last, given the orientation of the curve of index - /// \c curve_index + /// \param orientation Orientation of the curve segment between `begin` and + /// `last`, given the orientation of the curve of index + /// `curve_index` /// template ErasedVeOutIt repopulate(InputIterator begin, @@ -346,33 +346,33 @@ private: const CGAL::Orientation orientation, ErasedVeOutIt out); - /// Check if the size of \c v2 is compatible (i.e. greater) with the linear - /// interpolation of the sizes of \c v1 and \c v3. + /// Checks if the size of `v2` is compatible (i.e. greater) with the linear + /// interpolation of the sizes of `v1` and `v3`. bool is_sizing_field_correct(const Vertex_handle& v1, const Vertex_handle& v2, const Vertex_handle& v3, const Curve_index& index, const CGAL::Orientation orientation) const; - /// Repopulate all incident curves around the corner \c v. - /// \pre \c v is a corner of c3t3 + /// Repopulates all incident curves around the corner `v`. + /// \pre `v` is a corner of c3t3 template ErasedVeOutIt repopulate_edges_around_corner(const Vertex_handle& v, ErasedVeOutIt out); - /// Return `true` if the edge with index \c curve_index is already treated. + /// Returns `true` if the edge with index `curve_index` is already treated. bool is_treated(const Curve_index& curve_index) const { return ( treated_edges_.find(curve_index) != treated_edges_.end() ); } - /// Set the edge with index \c curve_index as treated. + /// Sets the edge with index `curve_index` as treated. void set_treated(const Curve_index& curve_index) { treated_edges_.insert(curve_index); } - /// Compute the Euclidean distance between the bare points of \c va and \c vb. + /// Computes the Euclidean distance between the bare points of `va` and `vb`. FT compute_distance(const Vertex_handle& va, const Vertex_handle& vb) const { typename C3T3::Triangulation::Geom_traits::Construct_point_3 cp = @@ -384,14 +384,14 @@ private: return compute_distance(cp(wpa), cp(wpb)); } - /// Compute the Euclidean distance between the bare points \c and \c q. + /// Computes the Euclidean distance between the bare points `p` and `q`. FT compute_distance(const Bare_point& p, const Bare_point& q) const { return CGAL::sqrt(c3t3_.triangulation().geom_traits(). compute_squared_distance_3_object()(p,q)); } - /// Return the radius of the ball of vertex \c v. + /// Returns the radius of the ball of vertex `v`. FT get_radius(const Vertex_handle& v) const { typename Gt::Compute_weight_3 cw = diff --git a/Mesh_3/include/CGAL/Mesh_3/Refine_cells_3.h b/Mesh_3/include/CGAL/Mesh_3/Refine_cells_3.h index f3d1e0ba7fa..4ee48c865ea 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Refine_cells_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Refine_cells_3.h @@ -438,7 +438,7 @@ public: // Parallel: it's always lazy, so do nothing void remove_element_from_refinement_queue(Cell_handle, Parallel_tag) {} - /// Handle cells contained in \c zone (before their destruction by insertion) + /// Handles cells contained in `zone` (before their destruction by insertion) void before_insertion_handle_cells_in_conflict_zone(Zone& zone); bool try_lock_element(const Cell_handle &ch, int lock_radius = 0) const @@ -479,7 +479,7 @@ public: return sstr.str(); } - /// Adds \c cell to the refinement queue if needed + /// Adds `cell` to the refinement queue if needed. void treat_new_cell(const Cell_handle& cell); #ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED @@ -531,20 +531,20 @@ private: // Updates cells incident to vertex, and add them to queue if needed void update_star_self(const Vertex_handle& vertex); - /// Set \c cell to domain, with subdomain index \c index + /// Sets `cell` to domain, with subdomain index `index`. void set_cell_in_domain(const Cell_handle& cell, const Subdomain_index& index) { r_c3t3_.add_to_complex(cell, index); } - /// Removes \c cell from domain + /// Removes `cell` from domain. void remove_cell_from_domain(const Cell_handle& cell) { r_c3t3_.remove_from_complex(cell); } - /// Sets index and dimension of vertex \c v + /// Sets index and dimension of vertex `v`. void set_vertex_properties(Vertex_handle& v, const Index& index) { r_c3t3_.set_index(v, index); @@ -702,15 +702,18 @@ scan_triangulation_impl() { #if defined(CGAL_MESH_3_VERBOSE) || defined(CGAL_MESH_3_PROFILING) std::cerr << "Scanning triangulation for bad cells (sequential)... "; + int count = 0; #endif - int count = 0; + for(Finite_cell_iterator cell_it = r_tr_.finite_cells_begin(); cell_it != r_tr_.finite_cells_end(); ++cell_it) { treat_new_cell(cell_it); +#if defined(CGAL_MESH_3_VERBOSE) || defined(CGAL_MESH_3_PROFILING) ++count; +#endif } #if defined(CGAL_MESH_3_VERBOSE) || defined(CGAL_MESH_3_PROFILING) std::cerr << count << " cells scanned, "; diff --git a/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h b/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h index 2f0db096e09..53461adecf3 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h @@ -409,19 +409,19 @@ protected: return ( (facet < mirror)?facet:mirror ); } - /// Returns true if \c f has already been visited + /// Returns true if `f` has already been visited. bool is_facet_visited(const Facet& f) const { return f.first->is_facet_visited(f.second); } - /// Sets facet \c f to visited + /// Sets facet `f` to visited. void set_facet_visited(Facet& f) const { f.first->set_facet_visited(f.second); } - /// Sets the facet \c f and its mirrored facet's surface centers to \c p + /// Sets the facet `f` and its mirrored facet's surface centers to `p`. void set_facet_surface_center(const Facet& f, const Bare_point& p, const Index& index) const @@ -435,32 +435,32 @@ protected: mirror.first->set_facet_surface_center_index(mirror.second,index); } - /// Returns facet surface center of \c f + /// Returns facet surface center of `f`. Bare_point get_facet_surface_center(const Facet& f) const { return f.first->get_facet_surface_center(f.second); } - /// Returns index of surface center of facet \c f + /// Returns index of surface center of facet `f`. Index get_facet_surface_center_index(const Facet& f) const { return f.first->get_facet_surface_center_index(f.second); } - /// Sets \c f to surface facets, with index \c index + /// Sets `f` to surface facets, with index `index`. void set_facet_on_surface(const Facet& f, const Surface_patch_index& index) { r_c3t3_.add_to_complex(f, index); } - /// Returns index of facet \c f + /// Returns index of facet `f`. Surface_patch_index get_facet_surface_index(const Facet& f) const { return r_c3t3_.surface_patch_index(f.first, f.second); } - /// Sets index and dimension of vertex \c v + /// Sets index and dimension of vertex `v`. void set_vertex_properties(Vertex_handle& v, const Index& index) { r_c3t3_.set_index(v, index); @@ -554,13 +554,13 @@ protected: return stream.str(); } - /// Returns to if \c f is on surface + /// Returns to if `f` is on surface bool is_facet_on_surface(const Facet& f) const { return r_c3t3_.is_in_complex(f) ; } - /// Removes \c f from surface facets + /// Removes `f` from surface facets. void remove_facet_from_surface(const Facet& f) { r_c3t3_.remove_from_complex(f); @@ -595,9 +595,9 @@ protected: void treat_new_facet(Facet& facet); /** - * Computes at once is_facet_on_surface and facet_surface_center. + * Computes simultaneously `is_facet_on_surface` and `facet_surface_center`. * @param facet The input facet - * @return \c true if \c facet is on surface, \c false otherwise + * @return `true` if `facet` is on surface, `false` otherwise */ void compute_facet_properties(const Facet& facet, Facet_properties& fp, bool force_exact = false ) const; @@ -835,12 +835,12 @@ public: Container_::get_next_local_element_impl()); } - /// Tests if \c p encroaches facet from zone + /// Tests if `p` encroaches facet from `zone`. // For sequential Mesher_level_conflict_status test_point_conflict_from_superior_impl(const Weighted_point& p, Zone& zone); - /// Tests if \c p encroaches facet from zone + /// Tests if `p` encroaches facet from `zone`. // For parallel template Mesher_level_conflict_status @@ -875,7 +875,7 @@ public: , bool &facet_is_in_its_cz , bool &could_lock_zone); - /// Insert \c p into the triangulation + /// Inserts `p` into the triangulation. Vertex_handle insert_impl(const Weighted_point& p, const Zone& zone); bool try_lock_element(const Facet &f, int lock_radius = 0) const @@ -1836,8 +1836,8 @@ is_encroached_facet_refinable(Facet& facet) const } /** - * \c facet is an internal facet we are going to remove - * \c source_facet is the facet we want to refine by inserting a new point + * `facet` is an internal facet we are going to remove + * `source_facet` is the facet we want to refine by inserting a new point */ template bool diff --git a/Mesh_3/include/CGAL/Mesh_3/Sliver_perturber.h b/Mesh_3/include/CGAL/Mesh_3/Sliver_perturber.h index 483c96be347..222eb87cc76 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Sliver_perturber.h +++ b/Mesh_3/include/CGAL/Mesh_3/Sliver_perturber.h @@ -553,7 +553,7 @@ private: int build_priority_queue(const FT& sliver_bound, PQueue& pqueue) const; /** - * Updates priority queue for all vertices of \c vertices + * Updates priority queue for all vertices of `vertices`. */ // Sequential int update_priority_queue(const Vertex_vector& vertices, @@ -568,7 +568,7 @@ private: #endif /** - * Updates \c pv in priority queue + * Updates `pv` in priority queue. */ int update_priority_queue(const PVertex& pv, PQueue& pqueue) const; @@ -582,7 +582,7 @@ private: ) const; /** - * Returns a pvertex from a vertex handle \c vh, using id \c pv_id + * Returns a pvertex from a vertex handle `vh`, using the id `pv_id`. */ PVertex make_pvertex(const Vertex_handle& vh, @@ -595,13 +595,13 @@ private: const typename PVertex::id_type& pv_id) const; /** - * Updates a pvertex \c pv + * Updates a pvertex `pv`. */ void update_pvertex(PVertex& pv, const FT& sliver_bound) const; void update_pvertex__concurrent(PVertex& pv, const FT& sliver_bound) const; /** - * Returns \c vh pvertex id + * Returns `vh` pvertex id. */ typename PVertex::id_type get_pvertex_id(const Vertex_handle& vh) const { @@ -609,7 +609,7 @@ private: } /** - * Update bad vertices vector, wrt \c sliver_bound + * Updates bad vertices vector, wrt. `sliver_bound`. */ // Sequential void update_bad_vertices(std::vector &bad_vertices, diff --git a/Mesh_3/include/CGAL/Mesh_3/Slivers_exuder.h b/Mesh_3/include/CGAL/Mesh_3/Slivers_exuder.h index ab4d9b679d0..58ce138b241 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Slivers_exuder.h +++ b/Mesh_3/include/CGAL/Mesh_3/Slivers_exuder.h @@ -157,7 +157,7 @@ protected: } /** - * A functor to remove one \c Cell_handle from a priority queue + * A functor to remove one `Cell_handle` from a priority queue */ class Erase_from_queue { @@ -172,7 +172,7 @@ protected: }; /** - * Delete cells of \c cells from \c cells_queue + * Deletes cells of `cells` from `cells_queue`. */ void delete_cells_from_queue(const Cell_vector& cells) { @@ -288,7 +288,7 @@ protected: } /** - * A functor to remove one \c Cell_handle from a priority queue + * A functor to remove one `Cell_handle` from a priority queue */ class Erase_from_queue { @@ -300,7 +300,7 @@ protected: }; /** - * Delete cells of \c cells from \c cells_queue + * Deletes cells of `cells` from `cells_queue`. */ void delete_cells_from_queue(const Cell_vector& cells) { @@ -525,7 +525,7 @@ private: const Vertex_handle& new_vertex); /** - * Orders handles \c h1 & \c h2 + * Orders handles `h1` & `h2` */ template static @@ -594,8 +594,8 @@ private: /** - * Returns the \c Boundary_facets_from_outside object containing mirror facets - * of \c facets + * Returns the `Boundary_facets_from_outside` object containing mirror facets + * of `facets`. */ Boundary_facets_from_outside get_boundary_facets_from_outside(const Facet_vector& facets) const @@ -616,7 +616,7 @@ private: } /** - * Add a cell \c ch to \c cells_queue + * Adds a cell `ch` to `cells_queue`. */ template void add_cell_to_queue(Cell_handle ch, FT criterion_value) @@ -651,7 +651,7 @@ private: }; /** - * Removes objects of [begin,end[ range from \c c3t3_ + * Removes objects of [begin,end[ range from `c3t3_`. */ template void remove_from_c3t3(ForwardIterator begin, ForwardIterator end) @@ -852,8 +852,8 @@ private: const Vertex_handle& vh) const; /** - * Checks if the sliver criterion values from \c criterion_values are the same as - * those that will be found if wp is inserted in the triangulation + * Checks if the sliver criterion values from `criterion_values` are the same as + * those that will be found if wp is inserted in the triangulation. */ bool check_ratios(const Sliver_values& criterion_values, const Weighted_point& wp, diff --git a/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h b/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h index f24235b6cee..6459aaeb047 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h +++ b/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h @@ -109,8 +109,8 @@ public: ~Triangulation_helpers() {} /** - * Returns true if moving \c v to \c p makes no topological - * change in \c tr + * Returns `true` if moving `v` to `p` makes no topological + * change in `tr`. */ bool no_topological_change(Tr& tr, const Vertex_handle v, @@ -137,7 +137,7 @@ public: const Bare_point& p) const; /** - * Returns the squared distance from \c vh to its closest vertex + * Returns the squared distance from `vh` to its closest vertex. * * \pre `vh` is not the infinite vertex */ @@ -156,7 +156,7 @@ public: private: /** - * Returns true if \c v is well_oriented on each cell of \c cell_tos + * Returns `true` if `v` is well_oriented on each cell of `cell_tos`. */ // For sequential version bool well_oriented(const Tr& tr, diff --git a/Mesh_3/include/CGAL/Mesh_3/Triangulation_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Triangulation_sizing_field.h index 11cf08c0e61..547365f9a1e 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Triangulation_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Triangulation_sizing_field.h @@ -73,17 +73,17 @@ public: Triangulation_sizing_field(const Tr& tr); /** - * Fill sizing field, using size associated to point in \c value_map. + * Fills the sizing field, using size associated to point in `value_map`. */ void fill(const std::map& value_map); /** - * Returns size at point \c p. + * Returns size at point `p`. */ FT operator()(const Weighted_point& p) const; /** - * Returns size at point \c p. (needed for compatibility) + * Returns size at point `p`. (needed for compatibility) */ template FT operator()(const Weighted_point& p, const Handle&) const @@ -91,20 +91,20 @@ public: private: /** - * Returns size at point \c p, by interpolation into tetrahedron. + * Returns size at point `p`, by interpolation into tetrahedron. */ FT interpolate_on_cell_vertices(const Weighted_point& p, const CCell_handle& cell) const; /** - * Returns size at point \c p, by interpolation into facet (\c cell is assumed + * Returns size at point `p`, by interpolation into facet (`cell` is assumed * to be an infinite cell). */ FT interpolate_on_facet_vertices(const Weighted_point& p, const CCell_handle& cell) const; /** - * Returns a hint for \c p location. + * Returns a hint for `p` location. */ CCell_handle get_hint(const Weighted_point& p) const { return last_cell_; } diff --git a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h index 74bb943f76e..d8a8804edb5 100644 --- a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h +++ b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h @@ -33,6 +33,7 @@ struct Get_point { const double vx, vy, vz; const double tx, ty, tz; + const std::size_t xdim, ydim, zdim; Get_point(const CGAL::Image_3* image) : vx(image->vx()) , vy(image->vy()) @@ -40,15 +41,27 @@ struct Get_point , tx(image->tx()) , ty(image->ty()) , tz(image->tz()) + , xdim(image->xdim()) + , ydim(image->ydim()) + , zdim(image->zdim()) {} Point operator()(const std::size_t i, const std::size_t j, const std::size_t k) const { - return Point(double(i) * vx + tx, - double(j) * vy + ty, - double(k) * vz + tz); + double x = double(i) * vx + tx; + double y = double(j) * vy + ty; + double z = double(k) * vz + tz; + + if (i == 0) x += 1. / 6. * vx; + else if (i == xdim - 1) x -= 1. / 6. * vx; + if (j == 0) y += 1. / 6. * vy; + else if (j == ydim - 1) y -= 1. / 6. * vy; + if (k == 0) z += 1. / 6. * vz; + else if (k == zdim - 1) z -= 1. / 6. * vz; + + return Point(x, y, z); } }; template @@ -107,14 +120,20 @@ void initialize_triangulation_from_labeled_image(C3T3& c3t3, if(protect_features) { init_tr_from_labeled_image_call_init_features (c3t3, domain, criteria, - CGAL::Mesh_3::internal::Has_features()); + CGAL::internal::Has_features()); } const double max_v = (std::max)((std::max)(image.vx(), image.vy()), image.vz()); - typedef std::vector > Seeds; + struct Seed { + std::size_t i, j, k; + std::size_t radius; + }; + using Seeds = std::vector; + using Subdomain = typename Mesh_domain::Subdomain; + Seeds seeds; Get_point get_point(&image); std::cout << "Searching for connected components..." << std::endl; @@ -122,20 +141,34 @@ void initialize_triangulation_from_labeled_image(C3T3& c3t3, std::back_inserter(seeds), CGAL::Emptyset_iterator(), transform, - get_point, Image_word_type()); std::cout << " " << seeds.size() << " components were found." << std::endl; std::cout << "Construct initial points..." << std::endl; - for(typename Seeds::const_iterator it = seeds.begin(), end = seeds.end(); - it != end; ++it) + for(const Seed seed : seeds) { - const double radius = double(it->second + 1)* max_v; + const Bare_point seed_point = get_point(seed.i, seed.j, seed.k); + Cell_handle seed_cell = tr.locate(cwp(seed_point)); + + const Subdomain seed_label + = domain.is_in_domain_object()(seed_point); + const Subdomain seed_cell_label + = (seed_cell == Cell_handle() || tr.is_infinite(seed_cell)) + ? Subdomain() //seed_point is OUTSIDE_AFFINE_HULL + : domain.is_in_domain_object()( + seed_cell->weighted_circumcenter(tr.geom_traits())); + + if ( seed_label != boost::none + && seed_cell_label != boost::none + && *seed_label == *seed_cell_label) + continue; //this means the connected component has already been initialized + + const double radius = double(seed.radius + 1)* max_v; CGAL::Random_points_on_sphere_3 points_on_sphere_3(radius); typename Mesh_domain::Construct_intersection construct_intersection = domain.construct_intersection_object(); std::vector directions; - if(it->second < 2) { + if(seed.radius < 2) { // shoot in six directions directions.push_back(Vector_3(-radius, 0, 0)); directions.push_back(Vector_3(+radius, 0, 0)); @@ -153,9 +186,10 @@ void initialize_triangulation_from_labeled_image(C3T3& c3t3, for(const Vector_3& v : directions) { - const Bare_point test = it->first + v; + const Bare_point test = seed_point + v; + const typename Mesh_domain::Intersection intersect = - construct_intersection(Segment_3(it->first, test)); + construct_intersection(Segment_3(seed_point, test)); if (std::get<2>(intersect) != 0) { const Bare_point& bpi = std::get<0>(intersect); diff --git a/Mesh_3/include/CGAL/Mesh_3/internal/check_weights.h b/Mesh_3/include/CGAL/Mesh_3/internal/check_weights.h index 4d228953ad5..b1c6080f30c 100644 --- a/Mesh_3/include/CGAL/Mesh_3/internal/check_weights.h +++ b/Mesh_3/include/CGAL/Mesh_3/internal/check_weights.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include namespace CGAL { @@ -33,7 +33,7 @@ template bool has_non_protecting_weights(const Triangulation& tr, const MeshDomain&) { - const bool with_features = Has_features::value; + const bool with_features = ::CGAL::internal::Has_features::value; typedef typename Triangulation::FT FT; typedef typename Triangulation::Weighted_point Weighted_point; diff --git a/Mesh_3/include/CGAL/Mesh_3/parameters.h b/Mesh_3/include/CGAL/Mesh_3/parameters.h new file mode 100644 index 00000000000..b38d501b29f --- /dev/null +++ b/Mesh_3/include/CGAL/Mesh_3/parameters.h @@ -0,0 +1,34 @@ +// Copyright (c) 2009 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// + +#ifndef CGAL_MESH_3_PARAMETERS_H +#define CGAL_MESH_3_PARAMETERS_H + +#include +#include +#include +#include +#include + +namespace CGAL { +namespace parameters { + +#define CGAL_NP_BASE internal_np::No_property +#define CGAL_NP_BUILD(P, V) P(V) + +#include + +#undef CGAL_NP_BASE +#undef CGAL_NP_BUILD + +} } // end of CGAL::parameters namespace + + +#endif //CGAL_MESH_3_PARAMETERS_H diff --git a/Mesh_3/include/CGAL/Mesh_3/parameters_defaults.h b/Mesh_3/include/CGAL/Mesh_3/parameters_defaults.h index e9f06c9c590..12ec9eca38d 100644 --- a/Mesh_3/include/CGAL/Mesh_3/parameters_defaults.h +++ b/Mesh_3/include/CGAL/Mesh_3/parameters_defaults.h @@ -23,14 +23,14 @@ #include +// see also default_values_for_mesh_3 namespace +// in CGAL/STL_Extension/internal/mesh_option_classes.h + namespace CGAL { namespace parameters { namespace default_values_for_mesh_3 { -// exude_mesh_3 -const double exude_sliver_bound = 0.; // perturb_mesh_3 -const double perturb_sliver_bound = 0.; template CGAL::Mesh_3::Min_dihedral_angle_criterion @@ -40,17 +40,6 @@ CGAL::Mesh_3::Min_dihedral_angle_criterion return CGAL::Mesh_3::Min_dihedral_angle_criterion(bound, c3t3.triangulation()); } -// global optimizers -const bool do_freeze = true; - -// lloyd_optimize_mesh_3 -const double lloyd_freeze_ratio = 0.01; -const double lloyd_convergence_ratio = 0.02; - -// odt_optimize_mesh_3 -const double odt_freeze_ratio = 0.01; -const double odt_convergence_ratio = 0.02; - } } // end namespace parameters::default_values_for_mesh_3 } // end namespace CGAL diff --git a/Mesh_3/include/CGAL/Mesh_3/search_for_connected_components_in_labeled_image.h b/Mesh_3/include/CGAL/Mesh_3/search_for_connected_components_in_labeled_image.h index 56c5d7bc6d5..343b16ebdc2 100644 --- a/Mesh_3/include/CGAL/Mesh_3/search_for_connected_components_in_labeled_image.h +++ b/Mesh_3/include/CGAL/Mesh_3/search_for_connected_components_in_labeled_image.h @@ -34,14 +34,12 @@ template void search_for_connected_components_in_labeled_image(const CGAL::Image_3& image, PointsOutputIterator it, DomainsOutputIterator dom_it, TransformOperator transform, - Construct_point point, Image_word_type) { const std::size_t nx = image.xdim(); @@ -97,9 +95,9 @@ search_for_connected_components_in_labeled_image(const CGAL::Image_3& image, % (long)static_evaluate(image.image(), i, j, k) % number_of_connected_components % (int)current_label; -#endif // CGAL_MESH_3_SEARCH_FOR_CONNECTED_COMPONENTS_IN_LABELED_IMAGE_VERBOSE int nb_voxels = 0; +#endif // CGAL_MESH_3_SEARCH_FOR_CONNECTED_COMPONENTS_IN_LABELED_IMAGE_VERBOSE Indices_queue queue; Indices indices(i, j ,k, 0); @@ -137,7 +135,9 @@ search_for_connected_components_in_labeled_image(const CGAL::Image_3& image, { visited[offset] = true; second_pass[offset] = false; +#ifdef CGAL_MESH_3_SEARCH_FOR_CONNECTED_COMPONENTS_IN_LABELED_IMAGE_VERBOSE ++nb_voxels; +#endif boost::get<0>(bbox_min) = (std::min)(i, boost::get<0>(bbox_min)); boost::get<0>(bbox_max) = (std::max)(i, boost::get<0>(bbox_max)); boost::get<1>(bbox_min) = (std::min)(j, boost::get<1>(bbox_min)); @@ -210,8 +210,7 @@ search_for_connected_components_in_labeled_image(const CGAL::Image_3& image, { // if(nb_voxels >= 100) { - *it++ = std::make_pair(point(i, j, k), - depth+1); + *it++ = { i, j, k, std::size_t(depth + 1) }; #if CGAL_MESH_3_SEARCH_FOR_CONNECTED_COMPONENTS_IN_LABELED_IMAGE_VERBOSE > 1 std::cerr << boost::format("Found seed %5%, which is voxel " "(%1%, %2%, %3%), value=%4%\n") diff --git a/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h b/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h index 1b5e004548a..93b4119a1b1 100644 --- a/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h +++ b/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h @@ -49,7 +49,7 @@ namespace Mesh_3 { namespace details { /** - * @brief Returns the angle in radian of vectors \c u and \c v + * @brief Returns the angle in radian of vectors `u` and `v` */ template typename K::FT @@ -98,7 +98,7 @@ angle_in_radian(const typename K::Vector_3& u, } /** - * @brief Returns the angle in radian of vectors \c u and \c v + * @brief Returns the angle in radian of vectors `u` and `v` */ template typename Kernel_traits::Kernel::FT @@ -108,7 +108,7 @@ angle_in_radian(const Vector_3& u, const Vector_3& v) } /** - * @brief Returns the squared length of edge \c e + * @brief Returns the squared length of edge `e`. */ template typename Tr::Geom_traits::FT @@ -133,8 +133,8 @@ edge_sq_length(const typename Tr::Edge& e, } /** - * @brief Returns the minimal incident edge length of \c v - * in triangulation \c tr + * @brief Returns the minimal incident edge length of `v` + * in triangulation `tr`. */ template typename Tr::Geom_traits::FT @@ -210,7 +210,7 @@ public: /** * @brief This operator try to move vertex \v using the perturbation. * @param v the vertex to move - * @param slivers a vector which contains incident slivers of \c v + * @param slivers a vector which contains incident slivers of `v` * @param c3t3 the c3t3 * @param domain the domain * @param criterion the criterion which is used to evaluate if a cell is @@ -219,12 +219,12 @@ public: * @param modified_vertices an output vector which contains vertices of c3t3 * which may have been impacted by v relocation. * @return a pair containing: - * - a bool which is \c true if a move has been done. + * - a bool which is `true` if a move has been done. * - a Vertex_handle which is always filled and may be the new vertex (if - * the move is a success), or the vertex which lies at \c v's position in + * the move is a success), or the vertex which lies at `v`'s position in * the new c3t3. * - * Note that this function is hill_climbing only. The min \c criterion value + * Note that this function is hill_climbing only. The min `criterion` value * of c3t3 could not decrease. */ std::pair @@ -432,7 +432,7 @@ protected: /** * Tries to apply a gradient perturbation using direction of - * \c gradient_vector + * `gradient_vector` */ std::pair apply_perturbation(const Vertex_handle& v, @@ -1054,7 +1054,7 @@ private: } /** - * @brief returns the cotangent of \c value + * @brief returns the cotangent of `value`. */ FT cotangent(const FT& value) const { @@ -1062,8 +1062,8 @@ private: } /** - * @brief returns the normal of facet (ch,i), oriented from inside to outside - * of \c ch + * @brief returns the normal of facet `(ch,i)`, oriented from inside to outside + * of `ch`. */ Vector_3 normal_estimate(const C3T3& c3t3, const Cell_handle& ch, const int i) const { @@ -1157,7 +1157,7 @@ protected: FT sphere_sq_radius() const { return sphere_sq_radius_; } /** - * @brief returns a FT between \c min and \c max + * @brief returns a FT between `min` and `max`. */ FT random_ft(const FT& min = FT(0.), const FT& max = FT(1.)) const { @@ -1166,7 +1166,7 @@ protected: } /** - * @brief returns a random vector with size \c vector_size + * @brief returns a random vector with size `vector_size`. */ Vector_3 random_vector_fixed_size(const C3T3& c3t3, const FT& vector_sq_size) const @@ -1184,7 +1184,7 @@ protected: } /** - * @brief returns a random vector with size between 0 and \c vector_size + * @brief returns a random vector with size between 0 and `vector_size`. */ Vector_3 random_vector_max_size(const C3T3& c3t3, const FT& vector_max_sq_size) const @@ -1299,7 +1299,7 @@ private: // ----------------------------------- /** - * @brief try to improve mesh using random moves of \c v + * @brief tries to improve mesh using random moves of `v`. */ std::pair apply_perturbation(const Vertex_handle& v, @@ -1410,7 +1410,7 @@ private: } private: - // If set to \c true, then random point will be generated on sphere surface. + // If set to `true`, then random points will be generated on sphere surface. bool on_sphere_; }; diff --git a/Mesh_3/include/CGAL/Mesh_cell_criteria_3.h b/Mesh_3/include/CGAL/Mesh_cell_criteria_3.h index 53e0c20ea4f..06193693760 100644 --- a/Mesh_3/include/CGAL/Mesh_cell_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_cell_criteria_3.h @@ -82,8 +82,8 @@ public: ~Mesh_cell_criteria_3() { } /** - * @brief returns whether the cell \c cell is bad or not. - * @param tr the triangulation within which \c cell lives + * @brief returns whether the cell `cell` is bad or not. + * @param tr the triangulation within which `cell` lives * @param cell the cell */ Is_cell_bad operator()(const Tr& tr, const Cell_handle& cell) const diff --git a/Mesh_3/include/CGAL/Mesh_constant_domain_field_3.h b/Mesh_3/include/CGAL/Mesh_constant_domain_field_3.h index ded5f26da80..002117b14ae 100644 --- a/Mesh_3/include/CGAL/Mesh_constant_domain_field_3.h +++ b/Mesh_3/include/CGAL/Mesh_constant_domain_field_3.h @@ -57,7 +57,7 @@ public: return d_; } - /// Sets size at any point of dimension \c dim and index \c index + /// Sets size at any point of dimension `dim` and index `index`. void set_size(const FT& size, const int dim, const Index& index) { values_.insert(std::make_pair(std::make_pair(dim,index),size)); diff --git a/Mesh_3/include/CGAL/Mesh_criteria_3.h b/Mesh_3/include/CGAL/Mesh_criteria_3.h index 5c88815ec9d..c7dcfeb33ab 100644 --- a/Mesh_3/include/CGAL/Mesh_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_criteria_3.h @@ -22,10 +22,8 @@ #include #include - +#include #include -#include -#include #include #include #include @@ -33,29 +31,6 @@ #include namespace CGAL { -namespace parameters { - -// see -CGAL_PRAGMA_DIAG_PUSH -// 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_ ) - BOOST_PARAMETER_NAME( (facet_angle, tag) facet_angle_ ) - BOOST_PARAMETER_NAME( (facet_size, tag) facet_size_ ) - BOOST_PARAMETER_NAME( (facet_sizing_field, tag) facet_sizing_field_ ) - BOOST_PARAMETER_NAME( (facet_distance, tag) facet_distance_ ) - BOOST_PARAMETER_NAME( (facet_topology, tag) facet_topology_ ) - BOOST_PARAMETER_NAME( (cell_radius_edge, tag) cell_radius_edge_ ) - BOOST_PARAMETER_NAME( (cell_radius_edge_ratio, tag) cell_radius_edge_ratio_ ) - BOOST_PARAMETER_NAME( (cell_size, tag) cell_size_ ) - BOOST_PARAMETER_NAME( (cell_sizing_field, tag) cell_sizing_field_ ) - BOOST_PARAMETER_NAME( (sizing_field, tag) sizing_field_ ) - -CGAL_PRAGMA_DIAG_POP - -} // end namespace parameters namespace internal { @@ -93,22 +68,22 @@ public: // This template constructor is not instantiated when named parameters // are not used, so Facet_criteria and Cell_criteria construction from FT // is not a problem - template - Mesh_criteria_3_impl(const ArgumentPack& args) - : edge_criteria_(args[parameters::edge_size - | args[parameters::edge_sizing_field - | args[parameters::sizing_field | FT(DBL_MAX)] ] ]) - , facet_criteria_(args[parameters::facet_angle | FT(0)], - args[parameters::facet_size - | args[parameters::facet_sizing_field - | args[parameters::sizing_field | FT(0)] ] ], - args[parameters::facet_distance | FT(0)], - args[parameters::facet_topology | CGAL::FACET_VERTICES_ON_SURFACE]) - , cell_criteria_(args[parameters::cell_radius_edge_ratio - | args[parameters::cell_radius_edge | FT(0)] ], - args[parameters::cell_size - | args[parameters::cell_sizing_field - | args[parameters::sizing_field | FT(0)] ] ]) + template + Mesh_criteria_3_impl(const CGAL_NP_CLASS& np) + :edge_criteria_(parameters::choose_parameter(parameters::get_parameter(np, internal_np::edge_size_param), + parameters::choose_parameter(parameters::get_parameter_reference(np, internal_np::edge_sizing_field_param), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::sizing_field_param), FT(DBL_MAX))))), + facet_criteria_(parameters::choose_parameter(parameters::get_parameter(np, internal_np::facet_angle_param), FT(0)), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::facet_size_param), + parameters::choose_parameter(parameters::get_parameter_reference(np, internal_np::facet_sizing_field_param), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::sizing_field_param), FT(0)))), + parameters::choose_parameter(parameters::get_parameter_reference(np, internal_np::facet_distance_param), FT(0)), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::facet_topology_param), CGAL::FACET_VERTICES_ON_SURFACE)), + cell_criteria_(parameters::choose_parameter(parameters::get_parameter(np, internal_np::cell_radius_edge_ratio_param), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::cell_radius_edge_param), FT(0))), + parameters::choose_parameter(parameters::get_parameter(np, internal_np::cell_size_param), + parameters::choose_parameter(parameters::get_parameter_reference(np, internal_np::cell_sizing_field_param), + parameters::choose_parameter(parameters::get_parameter_reference(np, internal_np::sizing_field_param), FT(0))))) { } #ifndef CGAL_NO_DEPRECATED_CODE @@ -150,17 +125,67 @@ private: -// Class Mesh_criteria_3 -// Provides default mesh criteria to drive Mesh_3 process + +/*! +\ingroup PkgMesh3MeshClasses + +The class gathers the refinement criteria for mesh tetrahedra and +surface facets where +surface facets are facets in the mesh approximating the domain surface patches. +In addition, for domains with exposed 1-dimensional features, +the class `Mesh_criteria_3` +handles the definition of a sizing field to guide the discretization of +1-dimensional features. + +\tparam Tr has to be instantiated with the type used for +`C3T3::Triangulation`, +where `C3T3` is the model of `MeshComplex_3InTriangulation_3` +used in the mesh generation process, +and `C3T3::Triangulation` its nested triangulation type. + +\cgalModels `MeshCriteria_3` and `MeshCriteriaWithFeatures_3` + +\cgalHeading{Example} + +\code{.cpp} + +// Create a Mesh_criteria_3 object with all cell and facet parameters set +Mesh_criteria_3 criteria (parameters::facet_angle(30). + parameters::facet_size(1). + parameters::facet_distance(0.1). + parameters::cell_radius_edge_ratio(2). + parameters::cell_size(1.5)); + +// Create a Mesh_criteria_3 object with size ignored (note that the order changed) +Mesh_criteria_3 criteria (parameters::cell_radius_edge_ratio(2). + parameters::facet_angle(30). + parameters::facet_distance(0.1)); + +\endcode + +\sa `MeshCriteria_3` +\sa `MeshCriteriaWithFeatures_3` +\sa `MeshCellCriteria_3` +\sa `MeshEdgeCriteria_3` +\sa `MeshFacetCriteria_3` +\sa `MeshDomainField_3` +\sa `CGAL::Mesh_cell_criteria_3` +\sa `CGAL::Mesh_edge_criteria_3` +\sa `CGAL::Mesh_facet_criteria_3` +\sa `CGAL::Mesh_facet_topology` + +*/ template , typename FacetCriteria = Mesh_facet_criteria_3, typename CellCriteria = Mesh_cell_criteria_3 > class Mesh_criteria_3 +#ifndef DOXYGEN_RUNNING : public internal::Mesh_criteria_3_impl< Tr, EdgeCriteria, FacetCriteria, CellCriteria > +#endif { typedef internal::Mesh_criteria_3_impl< Tr, EdgeCriteria, @@ -168,38 +193,109 @@ class Mesh_criteria_3 CellCriteria> Base; public: +#ifdef DOXYGEN_RUNNING +/// \name Types +/// @{ + +/*! +The criteria for edges. +*/ +typedef Mesh_edge_criteria_3 Edge_criteria; + +/*! +The criteria for facets. +*/ +typedef Mesh_facet_criteria_3 Facet_criteria; + +/*! +The +criteria for cells. +*/ +typedef Mesh_cell_criteria_3 Cell_criteria; + +/// @} +#else typedef typename Base::Edge_criteria Edge_criteria; typedef typename Base::Facet_criteria Facet_criteria; typedef typename Base::Cell_criteria Cell_criteria; +#endif - // Constructor + /// Construction from facet and cell criteria, the edge criteria are ignored in this case. Mesh_criteria_3(Facet_criteria facet_criteria, Cell_criteria cell_criteria) : Base(facet_criteria, cell_criteria) {} - // Constructor + /// Constructor from edge, face, and cell criteria. Mesh_criteria_3(Edge_criteria edge_criteria, Facet_criteria facet_criteria, Cell_criteria cell_criteria) : Base(edge_criteria, facet_criteria, cell_criteria) {} +/*! + * \brief Construction from criteria parameters. + * + * Note that each size or distance parameter can be specified using two ways: either as a scalar field or + * as a numerical value when the field is uniform. + * + * If not specified, each parameter has a default value such that the corresponding criterion will be ignored. + * Numerical sizing or distance values, as well as scalar fields should be given in the unit used for coordinates + * of points in the mesh domain class of the mesh generation process. + * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{edge_size} + * \cgalParamDescription{a scalar field (resp. a constant) providing a space varying + * (resp. a uniform) + * upper bound for the lengths of curve edges. This parameter has to be set to a positive + * value when 1-dimensional features protection is used.} + * \cgalParamNEnd + * \cgalParamNBegin{facet_angle} + * \cgalParamDescription{a lower bound for the angles (in degrees) of the + * surface mesh facets.} + * \cgalParamNEnd + * \cgalParamNBegin{facet_size} + * \cgalParamDescription{a scalar field (resp. a constant) describing + * a space varying (resp. a uniform) upper-bound or for the radii of the surface Delaunay balls.} + * \cgalParamNEnd + * \cgalParamNBegin{facet_distance} + * \cgalParamDescription{a scalar field (resp. a constant) describing a space varying (resp. a uniform) + * upper bound for the distance between the facet circumcenter and the center of its surface + * Delaunay ball.} + * \cgalParamNEnd + * \cgalParamNBegin{facet_topology} + * \cgalParamDescription{the set of topological constraints + * which have to be verified by each surface facet. See `Mesh_facet_topology` manual page to + * get all possible values.} + * \cgalParamDefault{CGAL::FACET_VERTICES_ON_SURFACE} + * \cgalParamNEnd + * \cgalParamNBegin{cell_radius_edge_ratio} + * \cgalParamDescription{ an upper bound for the radius-edge ratio of the mesh tetrahedra.} + * \cgalParamNEnd + * \cgalParamNBegin{cell_size} + * \cgalParamDescription{ a scalar field (resp. a constant) describing + * a space varying (resp. a uniform) upper-bound for the circumradii of the mesh tetrahedra.} + * \cgalParamNEnd + * \cgalNamedParamsEnd + */ +template +Mesh_criteria_3(const CGAL_NP_CLASS& np = parameters::default_values()): Base(np) +{ +} - // For convenient constructor call (see examples) - BOOST_PARAMETER_CONSTRUCTOR(Mesh_criteria_3, (Base), parameters::tag, - (optional (edge_size_,*) - (edge_sizing_field_,*) - (facet_angle_,*) - (facet_size_,*) - (facet_sizing_field_,*) - (facet_distance_,*) - (facet_topology_,*) - (cell_radius_edge_,*) - (cell_size_,*) - (cell_sizing_field_,*) - (sizing_field_,*) - )) +// Overload handling parameters passed with operator= +template +Mesh_criteria_3(const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) + : Mesh_criteria_3(internal_np::combine_named_parameters(np1, np2, nps...)) +{ +} }; // end class Mesh_criteria_3 diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index 92059291d3a..bccf9024bb1 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -227,7 +227,7 @@ public: return result; } - /// Returns signed geodesic distance between \c p and \c q + /// Returns signed geodesic distance between `p` and `q`. FT signed_geodesic_distance(const Point_3& p, const Point_3& q) const { // Locate p & q on polyline @@ -259,7 +259,7 @@ public: } - /// Returns a point at geodesic distance \c distance from p along the + /// Returns a point at geodesic distance `distance` from p along the /// polyline. The polyline is oriented from starting point to end point. /// The distance could be negative. Point_3 point_at(const Point_3& p, FT distance) const @@ -595,7 +595,7 @@ public: /// Add a 0-dimensional feature in the domain. Corner_index add_corner(const Point_3& p); - /// Overloads where the last parameter \c out is not `CGAL::Emptyset_iterator()`. + /// Overload where the last parameter `out` is not `CGAL::Emptyset_iterator()`. template IndicesOutputIterator add_corners(InputIterator first, InputIterator end, @@ -613,7 +613,7 @@ public: Corner_index register_corner(const Point_3& p, const Curve_index& index); Corner_index add_corner_with_context(const Point_3& p, const Surface_patch_index& index); - /// Overloads where the last parameter \c out is not + /// Overload where the last parameter `out` is not /// `CGAL::Emptyset_iterator()`. template IndicesOutputIterator @@ -743,14 +743,14 @@ public: /** * Returns the index to be stored in a vertex lying on the surface identified - * by \c index. + * by `index`. */ Index index_from_surface_patch_index(const Surface_patch_index& index) const { return Index(index); } /** * Returns the index to be stored in a vertex lying in the subdomain - * identified by \c index. + * identified by `index`. */ Index index_from_subdomain_index(const Subdomain_index& index) const { return Index(index); } @@ -764,15 +764,15 @@ public: { return Index(index); } /** - * Returns the \c Surface_patch_index of the surface patch - * where lies a vertex with dimension 2 and index \c index. + * Returns the `Surface_patch_index` of the surface patch + * where lies a vertex with dimension 2 and index `index`. */ Surface_patch_index surface_patch_index(const Index& index) const { return boost::get(index); } /** * Returns the index of the subdomain containing a vertex - * with dimension 3 and index \c index. + * with dimension 3 and index `index`. */ Subdomain_index subdomain_index(const Index& index) const { return boost::get(index); } diff --git a/Mesh_3/include/CGAL/Mesh_error_code.h b/Mesh_3/include/CGAL/Mesh_error_code.h index 2bbf47a451a..6c8f417e68a 100644 --- a/Mesh_3/include/CGAL/Mesh_error_code.h +++ b/Mesh_3/include/CGAL/Mesh_error_code.h @@ -14,17 +14,13 @@ #include +#include + #include #include namespace CGAL { -enum Mesh_error_code { - CGAL_MESH_3_NO_ERROR = 0, - CGAL_MESH_3_MAXIMAL_NUMBER_OF_VERTICES_REACHED, - CGAL_MESH_3_STOPPED -}; - inline std::string mesh_error_string(const Mesh_error_code& error_code) { switch(error_code) { diff --git a/Mesh_3/include/CGAL/Mesh_facet_criteria_3.h b/Mesh_3/include/CGAL/Mesh_facet_criteria_3.h index 4e41d82ef1c..86972063b11 100644 --- a/Mesh_3/include/CGAL/Mesh_facet_criteria_3.h +++ b/Mesh_3/include/CGAL/Mesh_facet_criteria_3.h @@ -74,8 +74,8 @@ public: ~Mesh_facet_criteria_3() { } /** - * @brief returns whether the facet \c facet is bad or not. - * @param tr the triangulation within which \c facet lives + * @brief returns whether the facet `facet` is bad or not. + * @param tr the triangulation within which `facet` lives * @param facet the facet */ Is_facet_bad operator()(const Tr& tr, const Facet& facet) const diff --git a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h index 818128229e1..4b69af4550d 100644 --- a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h @@ -516,28 +516,28 @@ public: /** * Returns the index to be stored in a vertex lying on the surface identified - * by \c index. + * by `index`. */ Index index_from_surface_patch_index(const Surface_patch_index& index) const { return Index(index); } /** * Returns the index to be stored in a vertex lying in the subdomain - * identified by \c index. + * identified by `index`. */ Index index_from_subdomain_index(const Subdomain_index& index) const { return Index(index); } /** - * Returns the \c Surface_patch_index of the surface patch - * where lies a vertex with dimension 2 and index \c index. + * Returns the `Surface_patch_index` of the surface patch + * where lies a vertex with dimension 2 and index `index`. */ Surface_patch_index surface_patch_index(const Index& index) const { return boost::get(index); } /** * Returns the index of the subdomain containing a vertex - * with dimension 3 and index \c index. + * with dimension 3 and index `index`. */ Subdomain_index subdomain_index(const Index& index) const { return boost::get(index); } diff --git a/Mesh_3/include/CGAL/exude_mesh_3.h b/Mesh_3/include/CGAL/exude_mesh_3.h index 3d9cb841b7c..e5480aa1dee 100644 --- a/Mesh_3/include/CGAL/exude_mesh_3.h +++ b/Mesh_3/include/CGAL/exude_mesh_3.h @@ -19,48 +19,108 @@ #include -#include - #include #include #include #include -#include - -#include +#include namespace CGAL { - -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable:4003) // not enough actual parameters for macro -#endif - -// see -CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS - -BOOST_PARAMETER_FUNCTION( - (Mesh_optimization_return_code), - exude_mesh_3, - parameters::tag, - (required (in_out(c3t3),*) ) - (optional - (time_limit_, *, 0 ) - (sliver_bound_, *, parameters::default_values_for_mesh_3::exude_sliver_bound ) - ) -) +/*! + * @ingroup PkgMesh3Functions + * + * The function `exude_mesh_3()` performs a sliver exudation process on a Delaunay mesh. + * + * The sliver exudation process consists in optimizing the weights of vertices + * of the weighted Delaunay triangulation in such a way that slivers disappear and + * the quality of the mesh improves. + * + * @warning This optimizer modifies the weight of vertices of the triangulation and, + * if called, must be the last optimizer to be called. If the mesh is refined after + * this optimization has been performed, all improvements will be lost. + * + * @tparam C3T3 a model of the concept `MeshComplex_3InTriangulation_3`. + * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param c3t3 the initial mesh that will be modified by the algorithm to represent the final optimized mesh. + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{time_limit} + * \cgalParamDescription{is used to set up, in seconds, a CPU time limit after which the optimization process + * is stopped. This time is measured using the `Real_timer` class. The default value is + * 0 and means that there is no time limit.} + * \cgalParamType{`double`} + * \cgalParamPrecondition{`time_limit >= 0`} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalParamNBegin{sliver_bound} + * \cgalParamDescription{is designed to give, in degrees, a targeted lower bound on dihedral angles of mesh cells. + * The exudation process considers in turn all the mesh cells that have a smallest dihedral + * angle less than `sliver_bound` and tries to make them disappear by weighting their vertices. + * The optimization process stops when every cell in the mesh achieves this quality. The + * default value is 0 and means that there is no targeted bound: the exuder then runs as long + * as it can improve the smallest dihedral angles of the set of cells incident to some vertices.} + * \cgalParamType{`double`} + * \cgalParamPrecondition{`0<= sliver_bound <= 180`} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * \return a value of type `CGAL::Mesh_optimization_return_code` which is: + *
      + *
    • `CGAL::BOUND_REACHED` when the targeted bound for the smallest dihedral angle in the mesh is reached. + *
    • `CGAL::TIME_LIMIT_REACHED` when the time limit is reached. + *
    • `CGAL::CANT_IMPROVE_ANYMORE` when exudation process stops because it can no longer improve + * the smallest dihedral angle of the set of cells incident to some vertex in the mesh. + *
    + * + * \cgalHeading{Example} + * + * \code{.cpp} + * // Exude without sliver_bound, using at most 10s CPU time + * exude_mesh_3(c3t3, + * parameters::time_limit(10)); + * \endcode + * + * \sa `CGAL::Mesh_optimization_return_code` + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::refine_mesh_3()` + * \sa `CGAL::perturb_mesh_3()` + * \sa `CGAL::lloyd_optimize_mesh_3()` + * \sa `CGAL::odt_optimize_mesh_3()` + * + */ +template +Mesh_optimization_return_code exude_mesh_3(C3T3& c3t3,const CGAL_NP_CLASS& np = parameters::default_values()) { - return exude_mesh_3_impl(c3t3, time_limit_, sliver_bound_); + using parameters::choose_parameter; + using parameters::get_parameter; + double time_limit=choose_parameter(get_parameter(np,internal_np::maximum_running_time),parameters::default_values_for_mesh_3::time_limit); + double sliver_bound= choose_parameter(get_parameter(np,internal_np::lower_sliver_bound),parameters::default_values_for_mesh_3::exude_sliver_bound); + return exude_mesh_3_impl(c3t3,time_limit,sliver_bound); } -CGAL_PRAGMA_DIAG_POP -#if defined(BOOST_MSVC) -# pragma warning(pop) +#ifndef CGAL_NO_DEPRECATED_CODE +template +Mesh_optimization_return_code exude_mesh_3(C3T3& c3t3, double time_limit = 0, double sliver_bound = 0) +{ + return exude_mesh_3(c3t3, CGAL::parameters::time_limit(time_limit).sliver_bound(sliver_bound)); +} #endif - - +#ifndef DOXYGEN_RUNNING +// Overload handling parameters passed with operator= +template +Mesh_optimization_return_code exude_mesh_3(C3T3& c3t3, + const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) +{ + return exude_mesh_3(c3t3,internal_np::combine_named_parameters(np1, np2, nps...)); +} template Mesh_optimization_return_code @@ -83,10 +143,8 @@ exude_mesh_3_impl(C3T3& c3t3, // Launch exudation return exuder(); } - +#endif //DOXYGEN_RUNNING } //namespace CGAL -#include - #endif // CGAL_EXUDE_MESH_3_H diff --git a/Mesh_3/include/CGAL/lloyd_optimize_mesh_3.h b/Mesh_3/include/CGAL/lloyd_optimize_mesh_3.h index 8b3ec746e76..54c239802e8 100644 --- a/Mesh_3/include/CGAL/lloyd_optimize_mesh_3.h +++ b/Mesh_3/include/CGAL/lloyd_optimize_mesh_3.h @@ -19,9 +19,7 @@ #include -#include - -#include +#include #include #include #include @@ -29,44 +27,136 @@ #include #include -#include namespace CGAL { - -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable:4003) // not enough actual parameters for macro -#endif - -// see -CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS - -BOOST_PARAMETER_FUNCTION( - (Mesh_optimization_return_code), - lloyd_optimize_mesh_3, - parameters::tag, - (required (in_out(c3t3),*) (domain,*) ) - (optional - (time_limit_, *, 0 ) - (max_iteration_number_, *, 0 ) - (convergence_, *, parameters::default_values_for_mesh_3::lloyd_convergence_ratio ) - (freeze_bound_, *, parameters::default_values_for_mesh_3::lloyd_freeze_ratio ) - (do_freeze_, *, parameters::default_values_for_mesh_3::do_freeze )) -) +/*! + * \ingroup PkgMesh3Functions + * + * The function `lloyd_optimize_mesh_3()` is a mesh optimization process + * based on the minimization of a global energy function. + * + * In `lloyd_optimize_mesh_3()`, the minimized global energy may be interpreted + * as the \f$ L^1\f$-norm of the error achieved + * when the function \f$ x^2\f$ is interpolated on the mesh domain + * using a piecewise linear function which is linear + * in each cell of the Voronoi diagram of the mesh vertices. + * + * The optimizer `lloyd_optimize_mesh_3()` works in iterative steps. + * At each iteration, mesh vertices are moved into + * positions that bring to zero the energy gradient + * and the Delaunay triangulation is updated. + * Vertices on the mesh boundaries are handled + * in a special way so as to preserve an accurate + * representation of the domain boundaries. + * + * \tparam C3T3 a model of the concept `MeshComplex_3InTriangulation_3`. + * \tparam MD a model of the concept `MeshDomain_3`. + * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param c3t3 the initial mesh that will be modified by the algorithm to represent the final optimized mesh. + * @param domain the domain used to create the `c3t3` parameter + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{time_limit} + * \cgalParamDescription{to set up, in seconds, a CPU time limit after which the optimization process is stopped. + * This time is measured using `CGAL::Real_timer`. 0 means that there is no time limit.} + * \cgalParamType{`double`} + * \cgalParamPrecondition{`time_limit >= 0`} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalParamNBegin{max_iteration_number} + * \cgalParamDescription{limit on the number of performed iterations. 0 means that there is + * no limit on the number of performed iterations.} + * \cgalParamPrecondition{`max_iteration_number >=0`} + * \cgalParamType{`int`} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalParamNBegin{freeze_bound} + * \cgalParamDescription{designed to reduce running time of each optimization iteration. + * Any vertex that has a displacement less than a given fraction of the length + * of its shortest incident edge, is frozen (i.e.\ is not relocated). + * The parameter `freeze_bound` gives the threshold ratio. + * If it is set to 0, freezing of vertices is disabled.} + * \cgalParamPrecondition{`0<= freeze_bound <=1`} + * \cgalParamType{`double`} + * \cgalParamDefault{0.01} + * \cgalParamNEnd + * \cgalParamNBegin{convergence} + * \cgalParamDescription{threshold ratio of stopping criterion based on convergence: the optimization process is stopped + * when at the last iteration the displacement of any vertex is less than + * a given fraction of the length of the shortest edge incident to that vertex.} + * \cgalParamPrecondition{`0 <=convergence <= 1`} + * \cgalParamType{`double`} + * \cgalParamDefault{0.02} + * \cgalParamNEnd + * \cgalParamNBegin{do_freeze} + * \cgalParamDescription{completes the `freeze_bound` parameter. If it is set to `true` (default value), + * frozen vertices will not move anymore in next iterations. Otherwise, at each iteration, any vertex that + * moves, unfreezes all its incident vertices.} + * \cgalParamType{`bool`} + * \cgalParamDefault{true} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * \return a value of type `CGAL::Mesh_optimization_return_code` which is: + *
      + *
    • `CGAL::TIME_LIMIT_REACHED` when the time limit is reached. + *
    • `CGAL::MAX_ITERATION_NUMBER_REACHED` when `lloyd_optimize_mesh_3()` stops because it has performed `max_iteration_number` iterations. + *
    • `CGAL::CONVERGENCE_REACHED` when `lloyd_optimize_mesh_3()` stops because the convergence criterion + * is achieved. + *
    • `CGAL::ALL_VERTICES_FROZEN` when all vertices have been frozen, when the + * `do_freeze` parameter is set to true. + *
    • `CGAL::CANT_IMPROVE_ANYMORE` when `lloyd_optimize_mesh_3()` stops because + * most vertices have been frozen, and no better convergence can be reached. + *
    + * + * \cgalHeading{Example} + * + * + * \code{.cpp} + * // Lloyd-smoothing until convergence reaches 0.01, freezing vertices which + * // move less than 0.001*shortest_incident_edge_length + * lloyd_optimize_mesh_3(c3t3, + * domain, + * parameters::convergence(0.01). + * parameters::freeze_bound(0.001). + * parameters::do_freeze(true)); + * + * \endcode + * + * \sa `CGAL::Mesh_optimization_return_code` + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::refine_mesh_3()` + * \sa `CGAL::exude_mesh_3()` + * \sa `CGAL::perturb_mesh_3()` + * \sa `CGAL::odt_optimize_mesh_3()` + * + * \note This function requires the \ref thirdpartyEigen library. + */ +template +Mesh_optimization_return_code lloyd_optimize_mesh_3(C3T3& c3t3, MeshDomain& domain,const CGAL_NP_CLASS& np = parameters::default_values()) { - return lloyd_optimize_mesh_3_impl(c3t3, domain, - time_limit_, max_iteration_number_, - convergence_, freeze_bound_ - , do_freeze_); + using parameters::choose_parameter; + using parameters::get_parameter; + std::size_t max_iterations = choose_parameter(get_parameter(np, internal_np::number_of_iterations), 0); + const double convergence_ratio = choose_parameter(get_parameter(np, internal_np::convergence_ratio), parameters::default_values_for_mesh_3::lloyd_convergence_ratio); + const double freeze_bound = choose_parameter(get_parameter(np, internal_np::vertex_freeze_bound), parameters::default_values_for_mesh_3::lloyd_freeze_ratio); + const double time_limit = choose_parameter(get_parameter(np, internal_np::maximum_running_time), parameters::default_values_for_mesh_3::time_limit); + bool do_freeze = choose_parameter(get_parameter(np,internal_np::freeze),true); + return lloyd_optimize_mesh_3_impl(c3t3, domain, time_limit, max_iterations, convergence_ratio, freeze_bound, do_freeze); } -CGAL_PRAGMA_DIAG_POP - -#if defined(BOOST_MSVC) -# pragma warning(pop) -#endif +#ifndef DOXYGEN_RUNNING +// Overload handling parameters passed with operator= +template +Mesh_optimization_return_code lloyd_optimize_mesh_3(C3T3& c3t3,MeshDomain& domain, const CGAL_NP_CLASS_1& np1, const CGAL_NP_CLASS_2& np2, const NP& ... nps) +{ + return lloyd_optimize_mesh_3(c3t3,domain, internal_np::combine_named_parameters(np1, np2, nps...)); +} template Mesh_optimization_return_code @@ -106,10 +196,8 @@ lloyd_optimize_mesh_3_impl(C3T3& c3t3, // Launch optimization return opt(static_cast(max_iteration_number)); } - +#endif //DOXYGEN_RUNNING } // end namespace CGAL -#include - #endif // CGAL_LLOYD_OPTIMIZE_MESH_3_H diff --git a/Mesh_3/include/CGAL/make_mesh_3.h b/Mesh_3/include/CGAL/make_mesh_3.h index 39acb952459..64105159344 100644 --- a/Mesh_3/include/CGAL/make_mesh_3.h +++ b/Mesh_3/include/CGAL/make_mesh_3.h @@ -19,113 +19,19 @@ #include -#include - #include -#include #include #include #include -#include +#include #include #include -#include #include namespace CGAL { -namespace parameters { - namespace internal { - // Features - struct Features_options - { - Features_options(bool b) : b_(b) {} - bool features() const { return b_; } - private: - bool b_; - }; - - // ----------------------------------- - // Features generator - // ----------------------------------- - // struct Features_option_generator - template - struct Features_options_generator {}; - - template<> - struct Features_options_generator - { - Features_options operator()() { return Features_options(true); } - }; - - template<> - struct Features_options_generator - { - Features_options operator()() { return Features_options(false); } - }; - - // struct Domain_features_generator is designed to handle cases where - // MeshDomain::Has_features is not a valid type - template< typename MeshDomain, bool MeshDomainHasHasFeatures > - struct Domain_features_generator {}; - - template< typename MeshDomain > - struct Domain_features_generator< MeshDomain, false > - { - Features_options operator()() - { - return Features_options_generator()(); - } - }; - - template< typename MeshDomain > - struct Domain_features_generator< MeshDomain, true > - { - Features_options operator()() - { - return Features_options_generator()(); - } - }; - - } // end namespace internal - - // ----------------------------------- - // Features_options - // ----------------------------------- - inline internal::Features_options - features() { return internal::Features_options(true); } - - inline internal::Features_options - no_features() { return internal::Features_options(false); } - - template < typename MeshDomain > - inline internal::Features_options - features(const MeshDomain& /*domain*/) - { - typedef typename internal::Domain_features_generator< - MeshDomain, - CGAL::Mesh_3::internal::has_Has_features::value > Generator; - - return Generator()(); - } - - // ----------------------------------- - // Parameters - // ----------------------------------- - -// see -CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS - - BOOST_PARAMETER_NAME( features_param ) - -CGAL_PRAGMA_DIAG_POP - -} // end namespace parameters::internal - // ----------------------------------- // Initialize c3t3 stuff // ----------------------------------- @@ -369,65 +275,189 @@ struct C3t3_initializer < C3T3, MD, MC, true, CGAL::Tag_false > // make_mesh_3 stuff // ----------------------------------- -// Manual redirections -// boost::parameter can't handle make_mesh_3 return_type alone... -template -C3T3 make_mesh_3(const MD& md, const MC& mc, const T& ...t) +/*! + * \ingroup PkgMesh3Functions + * + * The function `make_mesh_3()` is a 3D + * mesh generator. It produces simplicial meshes which discretize + * 3D domains. + * + * The mesh generation algorithm is a Delaunay refinement process + * followed by an optimization phase. + * The criteria driving the Delaunay refinement + * process may be tuned to achieve the user needs with respect to + * the size of mesh elements, the accuracy of boundaries approximation, + * etc. + * + * The optimization phase is a sequence of optimization processes, + * amongst the following available optimizers: an ODT-smoothing, + * a Lloyd-smoothing, a sliver perturber, and a sliver exuder. + * Each optimization process + * can be activated or not, + * according to the user requirements + * and available time. + * By default, only the perturber and the exuder are activated. + * Note that the benefits of the exuder will be lost if the mesh + * is further refined afterward, and that ODT-smoothing, Lloyd-smoothing, + * and sliver perturber should never be called after the sliver exuder. + * In the case of further refinement, only the sliver exuder can be used. + * + * The function outputs the mesh to an object which provides iterators to + * traverse the resulting mesh data structure or can be written to a file + * (see \ref Mesh_3_section_examples ). + * + * \tparam C3T3 either a model of the concept `MeshComplex_3InTriangulation_3` or + * of `MeshComplexWithFeatures_3InTriangulation_3` if `MD` + * is a model of `MeshDomainWithFeatures_3`. + * The type `C3T3` is in particular required to provide a nested type + * `C3T3::Triangulation` for the 3D triangulation + * embedding the mesh. The vertex and cell base classes of the + * triangulation `C3T3::Triangulation` are required to be models of the + * concepts `MeshVertexBase_3` and `MeshCellBase_3` respectively. + * + * \tparam MD either a model of the concept `MeshDomain_3` or of + * `MeshDomainWithFeatures_3` if 0 and 1-dimensional features + * of the input complex have to be accurately represented in the mesh. + * + * \tparam MC either a model of the concept `MeshCriteria_3` or a model + * of `MeshCriteriaWithFeatures_3` if the domain has exposed features. + * + * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * \param domain the domain used to create the `c3t3` parameter. It is the sole link through which the domain + * to be discretized is known by the mesh generation algorithm. + * \param criteria specifies the size and shape requirements for mesh tetrahedra + * and surface facets. These criteria form the rules which drive + * the refinement process. All mesh elements satisfy those criteria + * at the end of the refinement process. + * In addition, if the domain has features, the argument + * `criteria` provides a sizing field to guide the discretization + * of 1-dimensional exposed features. + * + * \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + * + * \cgalNamedParamsBegin + * \cgalParamSectionBegin{Feature preservation options} + * \cgalParamDescription{If the domain is a model of `MeshDomainWithFeatures_3`, 0 and 1-dimensional features can be + * taken into account while generating the mesh. The following two named parameters control + * this option: + *
      + *
    • \link parameters::features() `parameters::features(domain)` \endlink + *
    • `parameters::no_features()` + *
    } + * \cgalParamDefault{`parameters::features(domain)`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{Topological options (manifoldness)} + * \cgalParamDescription{In order to drive the meshing algorithm and ensure that the output mesh follows a desired topological criterion, + * three named parameters control this option: + *
      + *
    • `parameters::manifold()` + *
    • `parameters::manifold_with_boundary()` + *
    • `parameters::non_manifold()` + *
    + * Note that the meshing algorithm cannot generate a manifold surface if the input surface is not manifold.} + * \cgalParamDefault{`parameters::non_manifold()`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{Lloyd optimization} + * \cgalParamDescription{`lloyd_optimize_mesh_3()` can optionally be called after the meshing process. + * Two named parameters control this behavior: + *
      + *
    • `parameters::no_lloyd()` + *
    • `parameters::lloyd_optimize_mesh_3()` + *
    } + * \cgalParamDefault{`parameters::no_lloyd()`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{ODT optimization} + * \cgalParamDescription{`odt_optimize_mesh_3()` can optionally be called after the meshing process. + * Two named parameters control this behavior: + *
      + *
    • `parameters::no_odt()` + *
    • `parameters::odt()` + *
    } + * \cgalParamDefault{`parameters::no_odt()`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{Mesh perturbation} + * \cgalParamDescription{`perturb_mesh_3()` can optionally be called after the meshing process. + * Two named parameters control this behavior: + *
      + *
    • `parameters::no_perturb()` + *
    • `parameters::perturb()` + *
    } + * \cgalParamDefault{`parameters::perturb()`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{Mesh exudation} + * \cgalParamDescription{`exude_mesh_3()` can optionally be called after the meshing process. + * Two named parameters control this behavior: + *
      + *
    • `parameters::no_exude()` + *
    • `parameters::exude()` + *
    } + * \cgalParamDefault{`parameters::exude()`} + * \cgalParamSectionEnd + * \cgalNamedParamsEnd + * + * Note that regardless of which optimization processes are activated, + * they are always launched in the order that is a suborder + * of the following (see user manual for further + * details): *ODT-smoother*, *Lloyd-smoother*, *perturber*, and *exuder*. + * + * Beware that optimization of the mesh is obtained + * by perturbing mesh vertices and modifying the mesh connectivity + * and that this has an impact + * on the strict compliance to the refinement criteria. + * Though a strict compliance to mesh criteria + * is guaranteed at the end of the Delaunay refinement, this may no longer be true after + * some optimization processes. Also beware that the default behavior does involve some + * optimization processes. + * + * \sa `refine_mesh_3()` + * \sa `exude_mesh_3()` + * \sa `perturb_mesh_3()` + * \sa `lloyd_optimize_mesh_3()` + * \sa `odt_optimize_mesh_3()` + */ +template +C3T3 make_mesh_3(MeshDomain& domain, MeshCriteria& criteria, const CGAL_NP_CLASS& np = parameters::default_values()) { - C3T3 c3t3; - make_mesh_3_bp(c3t3,md,mc,t...); - return c3t3; + using parameters::choose_parameter; + using parameters::get_parameter; + C3T3 c3t3; + parameters::internal::Exude_options exude_param = choose_parameter(get_parameter(np, internal_np::exude_options_param), parameters::exude().v); + parameters::internal::Perturb_options perturb_param = choose_parameter(get_parameter(np, internal_np::perturb_options_param), parameters::perturb().v); + parameters::internal::Odt_options odt_param = choose_parameter(get_parameter(np, internal_np::odt_options_param), parameters::no_odt().v); + parameters::internal::Lloyd_options lloyd_param = choose_parameter(get_parameter(np, internal_np::lloyd_options_param), parameters::no_lloyd().v); + parameters::internal::Features_options features_param = choose_parameter(get_parameter(np, internal_np::features_options_param), parameters::features(domain).v); + parameters::internal::Mesh_3_options mesh_options_param = choose_parameter(get_parameter(np, internal_np::mesh_param), parameters::internal::Mesh_3_options()); + parameters::internal::Manifold_options manifold_options_param = choose_parameter(get_parameter(np, internal_np::manifold_param), parameters::internal::Manifold_options()); + + make_mesh_3_impl(c3t3, domain, criteria, + exude_param, perturb_param, odt_param, lloyd_param, + features_param.features(), mesh_options_param, + manifold_options_param); + return c3t3; } -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable:4003) // not enough actual parameters for macro -#endif - -// see -CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS - -BOOST_PARAMETER_FUNCTION( - (void), - make_mesh_3_bp, - parameters::tag, - (required (in_out(c3t3),*) (domain,*) (criteria,*) ) // nondeduced - (deduced - (optional - (features_param, (parameters::internal::Features_options), parameters::features(domain)) - (exude_param, (parameters::internal::Exude_options), parameters::exude()) - (perturb_param, (parameters::internal::Perturb_options), parameters::perturb()) - (odt_param, (parameters::internal::Odt_options), parameters::no_odt()) - (lloyd_param, (parameters::internal::Lloyd_options), parameters::no_lloyd()) - (mesh_options_param, (parameters::internal::Mesh_3_options), - parameters::internal::Mesh_3_options()) - (manifold_options_param, (parameters::internal::Manifold_options), - parameters::internal::Manifold_options()) - ) - ) -) +#ifndef DOXYGEN_RUNNING +// Overload handling parameters passed with operator= +template +C3T3 make_mesh_3(MeshDomain& domain, MeshCriteria& criteria, + const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) { - make_mesh_3_impl(c3t3, domain, criteria, - exude_param, perturb_param, odt_param, lloyd_param, - features_param.features(), mesh_options_param, - manifold_options_param); + return make_mesh_3(domain, criteria, internal_np::combine_named_parameters(np1, np2, nps...)); } -CGAL_PRAGMA_DIAG_POP - -#if defined(BOOST_MSVC) -# pragma warning(pop) -#endif - /** * @brief This function meshes the domain defined by mesh_traits * (respecting criteria), and outputs the mesh to c3t3 * * @param domain the domain to be discretized * @param criteria the criteria - * @param exude if it is set to \c true, an exudation step will be done at + * @param exude if it is set to `true`, an exudation step will be done at * the end of the Delaunay refinement process * * @return The mesh as a C3T3 object @@ -455,7 +485,7 @@ void make_mesh_3_impl(C3T3& c3t3, C3T3, MeshDomain, MeshCriteria, - Mesh_3::internal::has_Has_features::value > () (c3t3, + ::CGAL::internal::has_Has_features::value > () (c3t3, domain, criteria, with_features, @@ -466,12 +496,12 @@ void make_mesh_3_impl(C3T3& c3t3, // Build mesher and launch refinement process // Don't reset c3t3 as we just created it refine_mesh_3(c3t3, domain, criteria, - exude, perturb, odt, lloyd, parameters::no_reset_c3t3(), mesh_options, - manifold_options); + parameters::exude_options=exude, parameters::perturb_options=perturb, parameters::odt_options=odt, parameters::lloyd_options= lloyd, + parameters::no_reset_c3t3(), parameters::mesh_options= mesh_options, + parameters::manifold_option= manifold_options); } +#endif //DOXYGEN_RUNNING } // end namespace CGAL -#include - #endif // CGAL_MAKE_MESH_3_H diff --git a/Mesh_3/include/CGAL/odt_optimize_mesh_3.h b/Mesh_3/include/CGAL/odt_optimize_mesh_3.h index a08d1154717..5c1d39e36f0 100644 --- a/Mesh_3/include/CGAL/odt_optimize_mesh_3.h +++ b/Mesh_3/include/CGAL/odt_optimize_mesh_3.h @@ -19,9 +19,7 @@ #include -#include - -#include +#include #include #include #include @@ -29,43 +27,134 @@ #include #include -#include namespace CGAL { - -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable:4003) // not enough actual parameters for macro -#endif - -// see -CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS - -BOOST_PARAMETER_FUNCTION( - (Mesh_optimization_return_code), - odt_optimize_mesh_3, - parameters::tag, - (required (in_out(c3t3),*) (domain,*) ) - (optional - (time_limit_, *, 0 ) - (max_iteration_number_, *, 0 ) - (convergence_, *, parameters::default_values_for_mesh_3::odt_convergence_ratio ) - (freeze_bound_, *, parameters::default_values_for_mesh_3::odt_freeze_ratio ) - (do_freeze_, *, parameters::default_values_for_mesh_3::do_freeze )) -) +/*! + * @ingroup PkgMesh3Functions + * + * The function `odt_optimize_mesh_3()` is a mesh optimization process + * based on the minimization of a global energy function. + * + * In `odt_optimize_mesh_3()`, the minimized global energy may be interpreted + * as the \f$ L^1\f$-norm of the error achieved + * when the function \f$ x^2\f$ is interpolated on the mesh domain + * using a piecewise linear function which is linear in each mesh cell. + * + * The optimizer `odt_optimize_mesh_3()` works in iterative steps. + * At each iteration, mesh vertices are moved into + * positions that bring to zero the energy gradient + * and the Delaunay triangulation is updated. + * Vertices on the mesh boundaries are handled + * in a special way so as to preserve an accurate + * representation of the domain boundaries. + * + * @tparam C3T3 a model of the concept `MeshComplex_3InTriangulation_3` + * @tparam MeshDomain a model of the concept `MeshDomain_3` + * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param c3t3 the initial mesh and is modified by the algorithm to represent the final optimized mesh. + * @param domain the domain used to create the `c3t3` parameter + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{time_limit} + * \cgalParamDescription{is used to set up, in seconds, + * a CPU time limit after which the optimization process is stopped. This time is + * measured using `Real_timer`. + * The default value is 0 and means that there is no time limit.} + * \cgalParamType{`double`} + * \cgalParamPrecondition{`time_limit >= 0`} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalParamNBegin{max_iteration_number} + * \cgalParamDescription{sets a limit on the number of performed iterations. + * The default value of 0 means that there is + * no limit on the number of performed iterations.} + * \cgalParamType{`std::size_t`} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalParamNBegin{convergence} + * \cgalParamDescription{is a stopping criterion based on convergence: + * the optimization process is stopped, when at the last iteration, + * the displacement of any vertex is less than a given percentage of the length + * the shortest edge incident to that vertex. + * The parameter `convergence` gives the threshold ratio.} + * \cgalParamType{`double`} + * \cgalParamPrecondition{`0 <= convergence <= 1`} + * \cgalParamDefault{0.02} + * \cgalParamNEnd + * \cgalParamNBegin{freeze_bound} + * \cgalParamDescription{is designed to reduce running time of each optimization iteration. Any vertex + * that has a displacement less than a given percentage of the length of its shortest incident edge, is frozen (i.e.\ is + * not relocated). The parameter `freeze_bound` gives the threshold ratio.} + * \cgalParamType{`double`} + * \cgalParamPrecondition{`0 <= freeze_bound <= 1`} + * \cgalParamDefault{0.01} + * \cgalParamNEnd + * \cgalParamNBegin{do_freeze} + * \cgalParamDescription{completes the `freeze_bound` parameter. If it is set to `true`, + * frozen vertices will not move anymore in next iterations. Otherwise, at each iteration, any vertex that + * moves, unfreezes all its incident vertices.} + * \cgalParamType{`bool`} + * \cgalParamDefault{true} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * \return a value of type `CGAL::Mesh_optimization_return_code` which is: + *
      + *
    • `CGAL::TIME_LIMIT_REACHED` when the time limit is reached. + *
    • `CGAL::MAX_ITERATION_NUMBER_REACHED` when `odt_optimize_mesh_3()` stops because it has performed `max_iteration_number` iterations. + *
    • `CGAL::CONVERGENCE_REACHED` when `odt_optimize_mesh_3()` stops because the convergence criterion + * is achieved. + *
    • `CGAL::ALL_VERTICES_FROZEN` when all vertices have been frozen, when the + * `do_freeze` parameter is set to true. + *
    • `CGAL::CANT_IMPROVE_ANYMORE` when `odt_optimize_mesh_3()` stops because + * most vertices have been frozen, and no better convergence can be reached. + *
    + * + * \cgalHeading{Example} + * + * \code{.cpp} + * // 100 iterations of ODT-smoothing + * odt_optimize_mesh_3(c3t3, + * domain, + * parameters::max_iteration_number = 100, + * parameters::convergence = 0); + * \endcode + * + * \sa `CGAL::Mesh_optimization_return_code` + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::refine_mesh_3()` + * \sa `CGAL::exude_mesh_3()` + * \sa `CGAL::perturb_mesh_3()` + * \sa `CGAL::lloyd_optimize_mesh_3()` + */ +template +Mesh_optimization_return_code odt_optimize_mesh_3(C3T3& c3t3, MeshDomain& domain, const CGAL_NP_CLASS& np = parameters::default_values()) { - return odt_optimize_mesh_3_impl(c3t3, domain, - time_limit_, max_iteration_number_, - convergence_, freeze_bound_ - , do_freeze_ ); + using parameters::choose_parameter; + using parameters::get_parameter; + double time_limit=choose_parameter(get_parameter(np,internal_np::maximum_running_time),parameters::default_values_for_mesh_3::time_limit); + std::size_t max_iteration_number=choose_parameter(get_parameter(np,internal_np::number_of_iterations),0); + double convergence=choose_parameter(get_parameter(np,internal_np::convergence_ratio),parameters::default_values_for_mesh_3::odt_convergence_ratio); + double freeze_bound=choose_parameter(get_parameter(np,internal_np::vertex_freeze_bound),parameters::default_values_for_mesh_3::odt_freeze_ratio); + bool do_freeze=choose_parameter(get_parameter(np,internal_np::freeze),true); + return odt_optimize_mesh_3_impl(c3t3, domain, time_limit, max_iteration_number, convergence, freeze_bound, do_freeze); } -CGAL_PRAGMA_DIAG_POP -#if defined(BOOST_MSVC) -# pragma warning(pop) -#endif +#ifndef DOXYGEN_RUNNING +// Overload handling parameters passed with operator= +template +Mesh_optimization_return_code odt_optimize_mesh_3(C3T3& c3t3, MeshDomain& domain, + const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) +{ + return odt_optimize_mesh_3(c3t3, domain, internal_np::combine_named_parameters(np1, np2, nps...)); +} template Mesh_optimization_return_code @@ -106,8 +195,8 @@ odt_optimize_mesh_3_impl(C3T3& c3t3, return opt(static_cast(max_iteration_number)); } +#endif //DOXYGEN_RUNNING + } // end namespace CGAL -#include - #endif // CGAL_ODT_OPTIMIZE_MESH_3_H diff --git a/Mesh_3/include/CGAL/perturb_mesh_3.h b/Mesh_3/include/CGAL/perturb_mesh_3.h index 669fad1dfb0..e5be05310df 100644 --- a/Mesh_3/include/CGAL/perturb_mesh_3.h +++ b/Mesh_3/include/CGAL/perturb_mesh_3.h @@ -21,54 +21,112 @@ #include -#include #include #include #include #include #include #include - -#include +#include #include namespace CGAL { - -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable:4003) // not enough actual parameters for macro -#endif - -// see -CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS - -BOOST_PARAMETER_FUNCTION( - (Mesh_optimization_return_code), - perturb_mesh_3, - parameters::tag, - (required (in_out(c3t3),*) (domain,*) ) - (optional - (time_limit_, *, 0 ) - (sliver_bound_, *, parameters::default_values_for_mesh_3::perturb_sliver_bound ) - (sliver_criterion_, *, - parameters::default_values_for_mesh_3::default_sliver_criterion(c3t3,sliver_bound_)) - (perturbation_vector_, *, - default_perturbation_vector(c3t3,domain,sliver_criterion_)) - ) -) +/*! + * \ingroup PkgMesh3Functions + * + * The function `perturb_mesh_3()` is a mesh optimizer that + * improves the quality of a Delaunay mesh + * by changing the positions of some vertices of the mesh. + * + * The perturber tries to improve the dihedral angles of the worst cells in the mesh + * degree by degree: the + * step number `n` is considered as successful + * if after this step the worst tetrahedron of the mesh has a minimal dihedral + * angle larger than `n` degrees. + * The perturber exits if this is not the case. + * + * \tparam C3T3 a model of the concept `MeshComplex_3InTriangulation_3` + * \tparam MD a model of the concept `MeshDomain_3` + * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param c3t3 the initial mesh and is modified by the algorithm to represent the final optimized mesh + * @param domain the domain used to create the `c3t3` parameter + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{time_limit} + * \cgalParamDescription{is used to set up, in seconds, a CPU time limit after which the optimization process + * is stopped. This time is measured using the `Real_timer` class. The default value is + * 0 and means that there is no time limit.} + * \cgalParamType{`double`} + * \cgalParamPrecondition{`0 <= sliver_bound <= 180`} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalParamNBegin{sliver_bound} + * \cgalParamDescription{is designed to give, in degrees, a targeted lower bound on dihedral angles of mesh cells. + * The exudation process considers in turn all the mesh cells that have a smallest dihedral + * angle less than sliver_bound and tries to make them disappear by weighting their vertices. + * The optimization process stops when every cell in the mesh achieves this quality. The + * default value is 0 and means that there is no targeted bound: the exuder then runs as long + * as it can improve the smallest dihedral angles of the set of cells incident to some vertices.} + * \cgalParamType{`double`} + * \cgalParamPrecondition{`time_limit >= 0`} + * \cgalParamDefault{0} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * \return a value of type `CGAL::Mesh_optimization_return_code` which is: + *
      + *
    • `CGAL::BOUND_REACHED` when the targeted bound for the smallest dihedral angle in the mesh is reached. + *
    • `CGAL::TIME_LIMIT_REACHED` when the time limit is reached. + *
    • `CGAL::CANT_IMPROVE_ANYMORE` when the perturbation process stops because the last step is unsuccessful. + *
    + * + * \cgalHeading{Example} + * + * \code{.cpp} + * // Perturb until every dihedral angle of the mesh is >= 10 degrees + * // No time bound is set + * perturb_mesh_3(c3t3, + * domain, + * parameters::sliver_bound = 10); + * \endcode + * + * \sa `CGAL::Mesh_optimization_return_code` + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::refine_mesh_3()` + * \sa `CGAL::exude_mesh_3()` + * \sa `CGAL::lloyd_optimize_mesh_3()` + * \sa `CGAL::odt_optimize_mesh_3()` + * + */ +template +Mesh_optimization_return_code perturb_mesh_3(C3T3& c3t3, MeshDomain& domain, const CGAL_NP_CLASS& np = parameters::default_values()) { - CGAL_USE(sliver_bound_); - return perturb_mesh_3_impl(c3t3, domain, time_limit_, sliver_criterion_, - perturbation_vector_); + using parameters::choose_parameter; + using parameters::get_parameter; + double time_limit = choose_parameter(get_parameter(np,internal_np::maximum_running_time),parameters::default_values_for_mesh_3::time_limit); + auto sliver_bound = choose_parameter(get_parameter(np,internal_np::lower_sliver_bound), parameters::default_values_for_mesh_3::perturb_sliver_bound); + auto sliver_criterion = choose_parameter(get_parameter(np, internal_np::sliver_criteria), parameters::default_values_for_mesh_3::default_sliver_criterion(c3t3,sliver_bound)); + auto perturbation_vector = choose_parameter(get_parameter(np,internal_np::perturb_vector), default_perturbation_vector(c3t3,domain,sliver_criterion)); + return perturb_mesh_3_impl(c3t3, domain, time_limit, sliver_criterion, perturbation_vector); } -CGAL_PRAGMA_DIAG_POP -#if defined(BOOST_MSVC) -# pragma warning(pop) -#endif + +#ifndef DOXYGEN_RUNNING +// Overload handling parameters passed with operator= +template +Mesh_optimization_return_code perturb_mesh_3(C3T3& c3t3, MeshDomain& domain, + const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) +{ + return perturb_mesh_3(c3t3,domain, internal_np::combine_named_parameters(np1, np2, nps...)); +} template -#include - #include -#include #include #include #include #include #include - -#include +#include +#include #include @@ -37,7 +34,7 @@ namespace CGAL { namespace details { -/** +/* * @class Insert_vertex_in_c3t3 * * A functor designed to insert unweighted points into the triangulation @@ -101,416 +98,217 @@ private: } // namespace details -namespace parameters { - -namespace internal { - -const int undef_parameter = -1; - -// Helpers -struct Optimization_options_base +/*! + * \ingroup PkgMesh3Functions + * + * The function `refine_mesh_3()` is a 3D + * mesh generator. It produces simplicial meshes which discretize + * 3D domains. + * + * The mesh generation algorithm is a Delaunay refinement process + * followed by an optimization phase. + * The criteria driving the Delaunay refinement + * process may be tuned to achieve the user needs with respect to + * the size of mesh elements, the accuracy of boundaries approximation, + * etc. + * + * The optimization phase is a sequence of optimization processes, + * amongst the following available optimizers: an ODT smoothing, + * a Lloyd smoothing, a sliver perturber, and a sliver exuder. + * Each optimization process + * can be activated or not, + * according to the user requirements + * and available time. + * By default, only the perturber and the exuder are activated. + * Note that the benefits of the exuder will be lost if the mesh + * is further refined afterward. + * + * \attention The function template `refine_mesh_3()` may be used to refine a previously + * computed mesh, e.g.: + * \code{.cpp} + * C3T3 c3t3 = CGAL::make_mesh_3(domain,criteria); + * + * CGAL::refine_mesh_3(c3t3, domain, new_criteria); + * \endcode + * + * Please note that we guarantee the result if and only if the domain does + * not change from one refinement to the next one. + * + * + * \tparam C3T3 either a model of the concept `MeshComplex_3InTriangulation_3` or + * of `MeshComplexWithFeatures_3InTriangulation_3` if `MD` + * is a model of `MeshDomainWithFeatures_3`. + * The type `C3T3` is in particular required to provide a nested type + * `C3T3::Triangulation` for the 3D triangulation + * embedding the mesh. The vertex and cell base classes of the + * triangulation `C3T3::Triangulation` are required to be models of the + * concepts `MeshVertexBase_3` and `MeshCellBase_3` respectively. + * + * \tparam MD either a model of the concept `MeshDomain_3` or of + * `MeshDomainWithFeatures_3` if 0 and 1-dimensional features + * of the input complex have to be accurately represented in the mesh. + * + * \tparam MC either a model of the concept `MeshCriteria_3` or a model + * of `MeshCriteriaWithFeatures_3` if the domain has exposed features. + * + * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters + * + * \param c3t3 the mesh to be refined that is modified by the refinement process. + * As the refinement process only adds points to the triangulation, all + * vertices of the triangulation of `c3t3` remain in the + * mesh during the refinement process. `c3t3` can be used to insert + * specific points in the domain to ensure that they will be contained in the + * final triangulation. + * \param domain the domain used to create the `c3t3` parameter. It is the sole link through which the domain + * to be discretized is known by the mesh generation algorithm. + * \param criteria specifies the size and shape requirements for mesh tetrahedra + * and surface facets. These criteria form the rules which drive + * the refinement process. All mesh elements satisfy those criteria + * at the end of the refinement process. + * In addition, if the domain has features, the argument + * `criteria` provides a sizing field to guide the discretization + * of 1-dimensional exposed features. + * \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below. + * They control which optimization processes are performed + * and allow the user to tune the parameters of the optimization processes. + * Individual optimization parameters are not described here as they are + * internal types (see instead the documentation page of each optimizer). + * For each optimization algorithm, there exist two global functions + * that allow to enable or disable the optimizer. + * + * \cgalNamedParamsBegin + * \cgalParamSectionBegin{Topological options (manifoldness)} + * \cgalParamDescription{In order to drive the meshing algorithm and ensure that the output mesh follows a desired topological criterion, + * three named parameters control this option: + *
      + *
    • `parameters::manifold()` + *
    • `parameters::manifold_with_boundary()` + *
    • `parameters::non_manifold()` + *
    + * Note that the meshing algorithm cannot generate a manifold surface if the input surface is not manifold.} + * \cgalParamDefault{`parameters::non_manifold()`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{Lloyd optimization} + * \cgalParamDescription{`lloyd_optimize_mesh_3()` can optionally be called after the meshing process. + * Two named parameters control this behavior: + *
      + *
    • `parameters::no_lloyd()` + *
    • `parameters::lloyd_optimize_mesh_3()` + *
    } + * \cgalParamDefault{`parameters::no_lloyd()`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{ODT optimization} + * \cgalParamDescription{`odt_optimize_mesh_3()` can optionally be called after the meshing process. + * Two named parameters control this behavior: + *
      + *
    • `parameters::no_odt()` + *
    • `parameters::odt()` + *
    } + * \cgalParamDefault{`parameters::no_odt()`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{Mesh perturbation} + * \cgalParamDescription{`perturb_mesh_3()` can optionally be called after the meshing process. + * Two named parameters control this behavior: + *
      + *
    • `parameters::no_perturb()` + *
    • `parameters::perturb()` + *
    } + * \cgalParamDefault{`parameters::perturb()`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{Mesh exudation} + * \cgalParamDescription{`exude_mesh_3()` can optionally be called after the meshing process. + * Two named parameters control this behavior: + *
      + *
    • `parameters::exude()` + *
    • `parameters::no_exude()` + *
    } + * \cgalParamDefault{`parameters::exude()`} + * \cgalParamSectionEnd + * \cgalNamedParamsEnd + * + * The optimization parameters can be passed in arbitrary order. If one parameter + * is not passed, its default value is used. The default values are + * `no_lloyd()`, `no_odt()`, `perturb()` and `exude()`. + * Note that regardless of which optimization processes are activated, + * they are always launched in the order that is a suborder + * of the following (see user manual for further + * details): *ODT-smoother*, *Lloyd-smoother*, *perturber*, and *exuder*. + * + * Beware that optimization of the mesh is obtained + * by perturbing mesh vertices and modifying the mesh connectivity + * and that this has an impact + * on the strict compliance to the refinement criteria. + * Though a strict compliance to mesh criteria + * is guaranteed at the end of the Delaunay refinement, this may no longer be true after + * some optimization processes. Also beware that the default behavior does involve some + * optimization processes. + * + * \sa `CGAL::make_mesh_3()` + * \sa `CGAL::parameters::manifold()` + * \sa `CGAL::parameters::manifold_with_boundary()` + * \sa `CGAL::parameters::non_manifold()` + * \sa `CGAL::exude_mesh_3()` + * \sa `CGAL::perturb_mesh_3()` + * \sa `CGAL::lloyd_optimize_mesh_3()` + * \sa `CGAL::odt_optimize_mesh_3()` + * \sa `CGAL::parameters::exude()` + * \sa `CGAL::parameters::no_exude()` + * \sa `CGAL::parameters::perturb()` + * \sa `CGAL::parameters::no_perturb()` + * \sa `CGAL::parameters::lloyd()` + * \sa `CGAL::parameters::no_lloyd()` + * \sa `CGAL::parameters::odt()` + * \sa `CGAL::parameters::no_odt()` + */ +template +void refine_mesh_3(C3T3& c3t3, MeshDomain& domain, MeshCriteria& criteria, const CGAL_NP_CLASS& np = parameters::default_values()) { - Optimization_options_base(bool b) - : b_(b), time_limit_(undef_parameter), bound_(undef_parameter) {} + using parameters::choose_parameter; + using parameters::get_parameter; + parameters::internal::Exude_options exude_param = choose_parameter(get_parameter(np, internal_np::exude_options_param), parameters::exude().v); + parameters::internal::Perturb_options perturb_param = choose_parameter(get_parameter(np, internal_np::perturb_options_param), parameters::perturb().v); + parameters::internal::Odt_options odt_param = choose_parameter(get_parameter(np, internal_np::odt_options_param), parameters::no_odt().v); + parameters::internal::Lloyd_options lloyd_param = choose_parameter(get_parameter(np, internal_np::lloyd_options_param), parameters::no_lloyd().v); + bool reset = choose_parameter(get_parameter(np, internal_np::do_reset_c3t3), false); + parameters::internal::Mesh_3_options mesh_options_param = choose_parameter(get_parameter(np, internal_np::mesh_param), parameters::internal::Mesh_3_options()); + parameters::internal::Manifold_options manifold_options_param = choose_parameter(get_parameter(np, internal_np::manifold_param), parameters::internal::Manifold_options()); - operator bool() const { return b_; } - - bool is_time_limit_set() const { return time_limit_ != undef_parameter; } - void set_time_limit(double d) { time_limit_ = d; } - double time_limit() const { return time_limit_; } - - bool is_bound_set() const { return bound_ != undef_parameter; } - void set_bound(double d) { bound_ = d; } - double bound() const { return bound_; } - -private: - bool b_; - double time_limit_; - double bound_; -}; - -struct Global_optimization_options_base -{ - Global_optimization_options_base() - : convergence_(undef_parameter), max_it_nb_(undef_parameter) {} - - bool is_convergence_set() const { return convergence_ != undef_parameter; } - void set_convergence(double d) { convergence_ = d; } - double convergence() const { return convergence_; } - - bool is_max_iteration_number_set() const { return max_it_nb_ != undef_parameter; } - void set_max_iteration_number(int i) { max_it_nb_ = i; } - int max_iteration_number() const { return max_it_nb_; } - -private: - double convergence_; - int max_it_nb_; -}; - -// Perturb -struct Perturb_options : public Optimization_options_base -{ - Perturb_options(bool b) : Optimization_options_base(b) {} -}; - -// Exude -struct Exude_options : public Optimization_options_base -{ - Exude_options(bool b) : Optimization_options_base(b) {} -}; - -// Odt -struct Odt_options : public Optimization_options_base -, public Global_optimization_options_base -{ - Odt_options(bool b) : Optimization_options_base(b) - , Global_optimization_options_base() {} -}; - -// Lloyd -struct Lloyd_options : public Optimization_options_base -, public Global_optimization_options_base -{ - Lloyd_options(bool b) : Optimization_options_base(b) - , Global_optimization_options_base() {} -}; - -// Manifold -struct Manifold_options { - enum { - NON_MANIFOLD = 0, - MANIFOLD_WITH_BOUNDARY = 8, - NO_BOUNDARY = 16, - MANIFOLD = 24 - }; - - Manifold_options(const int topology) - : mesh_topology(topology) - {} - Manifold_options() - : mesh_topology(NON_MANIFOLD) - {} - - int mesh_topology; -}; - -// Various Mesh_3 option -struct Mesh_3_options { -#ifndef CGAL_NO_ATOMIC - typedef std::atomic* Pointer_to_stop_atomic_boolean_t; -#else - typedef bool* Pointer_to_stop_atomic_boolean_t; -#endif - Mesh_3_options(bool nonlinear = false) - // This parameter `nonlinear` adds a compatibility with previous - // API of the constructor of `C3t3_initializer`. - // -- Laurent Rineau, 2019/05/03 - : dump_after_init_prefix() - , dump_after_refine_surface_prefix() - , dump_after_refine_prefix() - , dump_after_glob_opt_prefix() - , dump_after_perturb_prefix() - , dump_after_exude_prefix() - , number_of_initial_points(-1) - , nonlinear_growth_of_balls(nonlinear) - , maximal_number_of_vertices(0) - , pointer_to_error_code(0) -#ifndef CGAL_NO_ATOMIC - , pointer_to_stop_atomic_boolean(0) -#endif - {} - - std::string dump_after_init_prefix; - std::string dump_after_refine_surface_prefix; - std::string dump_after_refine_prefix; - std::string dump_after_glob_opt_prefix; - std::string dump_after_perturb_prefix; - std::string dump_after_exude_prefix; - int number_of_initial_points; - bool nonlinear_growth_of_balls; - std::size_t maximal_number_of_vertices; - Mesh_error_code* pointer_to_error_code; -#ifndef CGAL_NO_ATOMIC - Pointer_to_stop_atomic_boolean_t pointer_to_stop_atomic_boolean; -#endif - -}; // end struct Mesh_3_options - -} // end namespace internal - -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable:4003) // not enough actual parameters for macro -#endif - -// see -CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS - - -// ----------------------------------- -// Perturb -// ----------------------------------- -BOOST_PARAMETER_FUNCTION((internal::Perturb_options), perturb, tag, - (optional (time_limit_, *, internal::undef_parameter ) - (sliver_bound_, *, default_values_for_mesh_3::perturb_sliver_bound ))) -{ - internal::Perturb_options options(true); - - if ( internal::undef_parameter != time_limit_ ) - options.set_time_limit(time_limit_); - - options.set_bound(sliver_bound_); - - return options; + return refine_mesh_3_impl(c3t3, + domain, + criteria, + exude_param, + perturb_param, + odt_param, + lloyd_param, + reset, + mesh_options_param, + manifold_options_param); } -inline internal::Perturb_options no_perturb() { return internal::Perturb_options(false); } - -// ----------------------------------- -// Exude -// ----------------------------------- -BOOST_PARAMETER_FUNCTION((internal::Exude_options), exude, tag, - (optional (time_limit_, *, internal::undef_parameter ) - (sliver_bound_, *, default_values_for_mesh_3::exude_sliver_bound ))) +#ifndef DOXYGEN_RUNNING +// Overload handling parameters passed with operator= +template +void refine_mesh_3(C3T3& c3t3, MeshDomain& domain, MeshCriteria& criteria, + const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) { - internal::Exude_options options(true); - - if ( internal::undef_parameter != time_limit_ ) - options.set_time_limit(time_limit_); - - options.set_bound(sliver_bound_); - - return options; + return refine_mesh_3(c3t3, domain, criteria, internal_np::combine_named_parameters(np1, np2, nps...)); } - -inline internal::Exude_options no_exude() { return internal::Exude_options(false); } - -// ----------------------------------- -// Odt -// ----------------------------------- -BOOST_PARAMETER_FUNCTION((internal::Odt_options), odt, tag, - (optional (time_limit_, *, 0 ) - (max_iteration_number_, *, 0 ) - (convergence_, *, default_values_for_mesh_3::odt_convergence_ratio ) - (freeze_bound_, *, default_values_for_mesh_3::odt_freeze_ratio ))) -{ - internal::Odt_options options(true); - - options.set_time_limit(time_limit_); - options.set_bound(freeze_bound_); - options.set_convergence(convergence_); - options.set_max_iteration_number(max_iteration_number_); - - return options; -} - -inline internal::Odt_options no_odt() { return internal::Odt_options(false); } - -// ----------------------------------- -// Lloyd -// ----------------------------------- -BOOST_PARAMETER_FUNCTION((internal::Lloyd_options), lloyd, tag, - (optional (time_limit_, *, 0 ) - (max_iteration_number_, *, 0 ) - (convergence_, *, default_values_for_mesh_3::lloyd_convergence_ratio ) - (freeze_bound_, *, default_values_for_mesh_3::lloyd_freeze_ratio ))) -{ - internal::Lloyd_options options(true); - - options.set_time_limit(time_limit_); - options.set_bound(freeze_bound_); - options.set_convergence(convergence_); - options.set_max_iteration_number(max_iteration_number_); - - return options; -} - -inline internal::Lloyd_options no_lloyd() { return internal::Lloyd_options(false); } - -// ----------------------------------- -// Manifold options ------------------ -// ----------------------------------- -BOOST_PARAMETER_FUNCTION((internal::Manifold_options), manifold_options, tag, - (optional - (mesh_topology_, (int), -1) - ) - ) -{ - internal::Manifold_options options; - options.mesh_topology = mesh_topology_; - return options; -} - -inline internal::Manifold_options manifold() -{ - return internal::Manifold_options( - internal::Manifold_options::MANIFOLD); -} -inline internal::Manifold_options manifold_with_boundary() -{ - return internal::Manifold_options( - internal::Manifold_options::MANIFOLD_WITH_BOUNDARY); -} -inline internal::Manifold_options non_manifold() -{ - return internal::Manifold_options( - internal::Manifold_options::NON_MANIFOLD); -} - -// ----------------------------------- -// Mesh options -// ----------------------------------- - -// Undocumented Boost parameter for refine_mesh_3 and make_mesh_3. -// Allows to dump the mesh at given stage of the mesh generation -// algorithm. -BOOST_PARAMETER_FUNCTION((internal::Mesh_3_options), mesh_3_options, tag, - (optional - (dump_after_init_prefix_, (std::string), "" ) - (dump_after_refine_surface_prefix_, (std::string), "" ) - (dump_after_refine_prefix_, (std::string), "" ) - (dump_after_glob_opt_prefix_, (std::string), "" ) - (dump_after_perturb_prefix_, (std::string), "" ) - (dump_after_exude_prefix_, (std::string), "" ) - (number_of_initial_points_, (int), -1) - (maximal_number_of_vertices_, (std::size_t), 0) - (nonlinear_growth_of_balls_, (bool), false) - (pointer_to_error_code_, (Mesh_error_code*), ((Mesh_error_code*)0)) - (pointer_to_stop_atomic_boolean_, (internal::Mesh_3_options::Pointer_to_stop_atomic_boolean_t), ((internal::Mesh_3_options::Pointer_to_stop_atomic_boolean_t)0)) - ) - ) -{ - internal::Mesh_3_options options; - - options.dump_after_init_prefix=dump_after_init_prefix_; - options.dump_after_refine_surface_prefix=dump_after_refine_surface_prefix_; - options.dump_after_refine_prefix=dump_after_refine_prefix_; - options.dump_after_glob_opt_prefix=dump_after_glob_opt_prefix_; - options.dump_after_perturb_prefix=dump_after_perturb_prefix_; - options.dump_after_exude_prefix=dump_after_exude_prefix_; - options.number_of_initial_points=number_of_initial_points_; - options.nonlinear_growth_of_balls = nonlinear_growth_of_balls_; - options.maximal_number_of_vertices=maximal_number_of_vertices_; - options.pointer_to_error_code=pointer_to_error_code_; -#ifndef CGAL_NO_ATOMIC - options.pointer_to_stop_atomic_boolean=pointer_to_stop_atomic_boolean_; -#endif - - return options; -} - -// Undocumented Boost parameter for refine_mesh_3 and make_mesh_3. -// Default Mesh_3_options: dump at every stage of the mesh generation. -inline internal::Mesh_3_options mesh_3_dump() -{ - internal::Mesh_3_options options; - - options.dump_after_init_prefix = "mesh_dump_after_init"; - options.dump_after_refine_surface_prefix = "mesh_dump_after_refine_surface"; - options.dump_after_refine_prefix = "mesh_dump_after_refine"; - options.dump_after_glob_opt_prefix = "mesh_dump_after_glob_opt"; - options.dump_after_perturb_prefix = "mesh_dump_after_perturb"; - options.dump_after_exude_prefix = "mesh_dump_after_exude"; - - return options; -} - -CGAL_PRAGMA_DIAG_POP - -#if defined(BOOST_MSVC) -# pragma warning(pop) -#endif - -// ----------------------------------- -// Reset_c3t3 (undocumented) -// ----------------------------------- - CGAL_BOOLEAN_PARAMETER(Reset,reset_c3t3,no_reset_c3t3) - // CGAL_BOOLEAN_PARAMETER defined in - - -// see -CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS - -// ----------------------------------- -// Parameters -// ----------------------------------- -BOOST_PARAMETER_NAME( exude_param ) -BOOST_PARAMETER_NAME( perturb_param ) -BOOST_PARAMETER_NAME( odt_param ) -BOOST_PARAMETER_NAME( lloyd_param ) -BOOST_PARAMETER_NAME( reset_param ) -BOOST_PARAMETER_NAME( mesh_options_param ) -BOOST_PARAMETER_NAME( manifold_options_param ) - -CGAL_PRAGMA_DIAG_POP - -} // end namespace parameters - - - -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable:4003) // not enough actual parameters for macro -#endif - -// see -CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS - -BOOST_PARAMETER_FUNCTION( - (void), - refine_mesh_3, - parameters::tag, - (required (in_out(c3t3),*) (domain,*) (criteria,*) ) // nondeduced - (deduced - (optional - (exude_param, (parameters::internal::Exude_options), parameters::exude()) - (perturb_param, (parameters::internal::Perturb_options), parameters::perturb()) - (odt_param, (parameters::internal::Odt_options), parameters::no_odt()) - (lloyd_param, (parameters::internal::Lloyd_options), parameters::no_lloyd()) - (reset_param, (parameters::Reset), parameters::reset_c3t3()) - (mesh_options_param, (parameters::internal::Mesh_3_options), - parameters::internal::Mesh_3_options()) - (manifold_options_param, (parameters::internal::Manifold_options), - parameters::internal::Manifold_options()) - ) - ) -) -{ - return refine_mesh_3_impl(c3t3, - domain, - criteria, - exude_param, - perturb_param, - odt_param, - lloyd_param, - reset_param(), - mesh_options_param, - manifold_options_param); -} - -CGAL_PRAGMA_DIAG_POP - -#if defined(BOOST_MSVC) -# pragma warning(pop) -#endif - /** * @brief This function refines the mesh c3t3 wrt domain & criteria * * @param c3t3 the mesh to be refined. - * @param domain the domain to be discretized + * @param domain the domain used to be discretized * @param criteria the criteria - * @param exude if \c true, an exudation step will be done at + * @param exude if `true`, an exudation step will be done at * the end of the Delaunay refinement process - * @param perturb if \c true, an explicit vertex perturbation step will be + * @param perturb if `true`, an explicit vertex perturbation step will be * done at the end of refinement process - * @param reset_c3t3 if \c true, a new C3T3 will be construct from param c3t3. + * @param reset_c3t3 if `true`, a new C3T3 will be construct from param c3t3. * The new c3t3 keeps only the vertices (as NON-weighted points with their * dimension and Index) of the triangulation. That allows to refine a mesh * which has been exuded. @@ -619,9 +417,7 @@ void refine_mesh_3_impl(C3T3& c3t3, dump_c3t3(c3t3, mesh_options.dump_after_exude_prefix); } } - +#endif // DOXYGEN_RUNNING } // end namespace CGAL -#include - #endif // CGAL_REFINE_MESH_3_H diff --git a/Mesh_3/test/Mesh_3/test_labeled_mesh_domain_3.cpp b/Mesh_3/test/Mesh_3/test_labeled_mesh_domain_3.cpp index 0c3a1b8c7bb..25a468bbf6f 100644 --- a/Mesh_3/test/Mesh_3/test_labeled_mesh_domain_3.cpp +++ b/Mesh_3/test/Mesh_3/test_labeled_mesh_domain_3.cpp @@ -42,8 +42,8 @@ struct LM3_tester static FT shape_function (const Point_3& p) { - if (p.x() < 0) - return -1; + if (p.x() < 0) + return -1; const FT x2=p.x()*p.x(), y2=p.y()*p.y(), z2=p.z()*p.z(); return x2 + y2 + z2 - 1; } @@ -56,12 +56,12 @@ struct LM3_tester void operator() () const { - typedef typename K::Sphere_3 Sphere_3; - typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + typedef typename K::Sphere_3 Sphere_3; + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; - test_domain(Sphere_3(CGAL::ORIGIN, 4.)); - test_domain(CGAL::Bbox_3(-2.,-2.,-2., 2.,2.,2.)); - test_domain(Iso_cuboid_3(Point_3(-2.,-2.,-2.), Point_3(2.,2.,2.))); + test_domain(Sphere_3(CGAL::ORIGIN, 4.)); + test_domain(CGAL::Bbox_3(-2.,-2.,-2., 2.,2.,2.)); + test_domain(Iso_cuboid_3(Point_3(-2.,-2.,-2.), Point_3(2.,2.,2.))); } private: @@ -72,12 +72,12 @@ private: Function f_sphere(&sphere_function); Function_wrapper wrapper_1(f_sphere); - Mesh_domain domain(wrapper_1, bounding_shape, error_bound); + Mesh_domain domain(wrapper_1, bounding_shape, CGAL::parameters::relative_error_bound(error_bound)); test_construct_initial_points(domain, error_bound); Function f_shape(&shape_function); Function_wrapper wrapper_2(f_shape); - Mesh_domain domain_2(wrapper_2, bounding_shape, error_bound); + Mesh_domain domain_2(wrapper_2, bounding_shape, CGAL::parameters::relative_error_bound(error_bound)); test_is_in_domain(domain_2); test_do_intersect_surface(domain_2); test_construct_intersection(domain_2); @@ -85,171 +85,171 @@ private: void test_construct_initial_points (const Mesh_domain& domain, FT error_bound) const { - typedef typename Mesh_domain::Construct_initial_points Construct_initial_points; - typedef typename Mesh_domain::Index Index; - typedef typename std::vector >::const_iterator Points_const_iterator; - typedef typename K::Compute_squared_distance_3 Compute_squared_distance_3; + typedef typename Mesh_domain::Construct_initial_points Construct_initial_points; + typedef typename Mesh_domain::Index Index; + typedef typename std::vector >::const_iterator Points_const_iterator; + typedef typename K::Compute_squared_distance_3 Compute_squared_distance_3; - Compute_squared_distance_3 squared_distance = K().compute_squared_distance_3_object(); + Compute_squared_distance_3 squared_distance = K().compute_squared_distance_3_object(); - Construct_initial_points construct_initial_points = domain.construct_initial_points_object(); - std::vector > points; - int point_count = 12; - construct_initial_points(std::back_inserter(points), point_count); + Construct_initial_points construct_initial_points = domain.construct_initial_points_object(); + std::vector > points; + int point_count = 12; + construct_initial_points(std::back_inserter(points), point_count); - for (Points_const_iterator iter = points.begin(), end_iter = points.end(); iter != end_iter; ++iter) - { - const Point_3& p = iter->first; + for (Points_const_iterator iter = points.begin(), end_iter = points.end(); iter != end_iter; ++iter) + { + const Point_3& p = iter->first; - FT sd = squared_distance(CGAL::ORIGIN, p); - FT diff = sd - 1; - if (diff < FT(0.)) - diff = -diff; - assert(diff <= error_bound); - } + FT sd = squared_distance(CGAL::ORIGIN, p); + FT diff = sd - 1; + if (diff < FT(0.)) + diff = -diff; + assert(diff <= error_bound); + } } void test_is_in_domain (const Mesh_domain& domain) const { - typedef typename Mesh_domain::Is_in_domain Is_in_domain; - typedef typename Mesh_domain::Subdomain Subdomain; - typedef typename Mesh_domain::Subdomain_index Subdomain_index; + typedef typename Mesh_domain::Is_in_domain Is_in_domain; + typedef typename Mesh_domain::Subdomain Subdomain; + typedef typename Mesh_domain::Subdomain_index Subdomain_index; - Is_in_domain is_in_domain = domain.is_in_domain_object(); + Is_in_domain is_in_domain = domain.is_in_domain_object(); - { - Subdomain subdomain = is_in_domain(Point_3(CGAL::ORIGIN)); - assert(subdomain); - Subdomain_index subdomain_index = *subdomain; - assert(subdomain_index == 1); - } + { + Subdomain subdomain = is_in_domain(Point_3(CGAL::ORIGIN)); + assert(subdomain); + Subdomain_index subdomain_index = *subdomain; + assert(subdomain_index == 1); + } - { - Subdomain subdomain = is_in_domain(Point_3(1.5, 0., 0.)); - assert(!subdomain); - } + { + Subdomain subdomain = is_in_domain(Point_3(1.5, 0., 0.)); + assert(!subdomain); + } } void test_do_intersect_surface (const Mesh_domain& domain) const { - typedef typename Mesh_domain::Do_intersect_surface Do_intersect_surface; - typedef typename Mesh_domain::Surface_patch Surface_patch; - typedef typename Mesh_domain::Surface_patch_index Surface_patch_index; - typedef typename Mesh_domain::Segment_3 Segment_3; - typedef typename Mesh_domain::Ray_3 Ray_3; - typedef typename Mesh_domain::Line_3 Line_3; - typedef typename Mesh_domain::Vector_3 Vector_3; + typedef typename Mesh_domain::Do_intersect_surface Do_intersect_surface; + typedef typename Mesh_domain::Surface_patch Surface_patch; + typedef typename Mesh_domain::Surface_patch_index Surface_patch_index; + typedef typename Mesh_domain::Segment_3 Segment_3; + typedef typename Mesh_domain::Ray_3 Ray_3; + typedef typename Mesh_domain::Line_3 Line_3; + typedef typename Mesh_domain::Vector_3 Vector_3; - Do_intersect_surface do_intersect_surface = domain.do_intersect_surface_object(); + Do_intersect_surface do_intersect_surface = domain.do_intersect_surface_object(); - { - Segment_3 s(Point_3(CGAL::ORIGIN), Point_3(1.5, 0., 0.)); - Surface_patch p = do_intersect_surface(s); - assert(p); - Surface_patch_index pi = *p; - assert(pi.first == 0 && pi.second == 1); - } + { + Segment_3 s(Point_3(CGAL::ORIGIN), Point_3(1.5, 0., 0.)); + Surface_patch p = do_intersect_surface(s); + assert(p); + Surface_patch_index pi = *p; + assert(pi.first == 0 && pi.second == 1); + } - { - Segment_3 s(Point_3(1.5, 1.5, 0.), Point_3(1.5, 0., 0.)); - Surface_patch p = do_intersect_surface(s); - assert(!p); - } + { + Segment_3 s(Point_3(1.5, 1.5, 0.), Point_3(1.5, 0., 0.)); + Surface_patch p = do_intersect_surface(s); + assert(!p); + } - { - Ray_3 r(Point_3(CGAL::ORIGIN), Vector_3(1., 0., 0.)); - Surface_patch p = do_intersect_surface(r); - assert(p); - Surface_patch_index pi = *p; - assert(pi.first == 0 && pi.second == 1); - } + { + Ray_3 r(Point_3(CGAL::ORIGIN), Vector_3(1., 0., 0.)); + Surface_patch p = do_intersect_surface(r); + assert(p); + Surface_patch_index pi = *p; + assert(pi.first == 0 && pi.second == 1); + } - { - Ray_3 r(Point_3(1.5, 0., 0.), Vector_3(0., 1., 0.)); - Surface_patch p = do_intersect_surface(r); - assert(!p); - } + { + Ray_3 r(Point_3(1.5, 0., 0.), Vector_3(0., 1., 0.)); + Surface_patch p = do_intersect_surface(r); + assert(!p); + } - { - Line_3 l(Point_3(CGAL::ORIGIN), Point_3(1.5, 0., 0.)); - Surface_patch p = do_intersect_surface(l); - assert(p); - Surface_patch_index pi = *p; - assert(pi.first == 0 && pi.second == 1); - } + { + Line_3 l(Point_3(CGAL::ORIGIN), Point_3(1.5, 0., 0.)); + Surface_patch p = do_intersect_surface(l); + assert(p); + Surface_patch_index pi = *p; + assert(pi.first == 0 && pi.second == 1); + } - { - Line_3 l(Point_3(1.5, 0., 0.), Point_3(1.5, 0.5, 0.)); - Surface_patch p = do_intersect_surface(l); - assert(!p); - } + { + Line_3 l(Point_3(1.5, 0., 0.), Point_3(1.5, 0.5, 0.)); + Surface_patch p = do_intersect_surface(l); + assert(!p); + } } void test_construct_intersection (const Mesh_domain& domain) const { - typedef typename Mesh_domain::Construct_intersection Construct_intersection; - typedef typename Mesh_domain::Intersection Intersection; - typedef typename Mesh_domain::Subdomain_index Subdomain_index; - typedef typename Mesh_domain::Surface_patch_index Surface_patch_index; - typedef typename Mesh_domain::Index Index; - typedef typename Mesh_domain::Segment_3 Segment_3; - typedef typename Mesh_domain::Ray_3 Ray_3; - typedef typename Mesh_domain::Line_3 Line_3; - typedef typename Mesh_domain::Vector_3 Vector_3; + typedef typename Mesh_domain::Construct_intersection Construct_intersection; + typedef typename Mesh_domain::Intersection Intersection; + typedef typename Mesh_domain::Subdomain_index Subdomain_index; + typedef typename Mesh_domain::Surface_patch_index Surface_patch_index; + typedef typename Mesh_domain::Index Index; + typedef typename Mesh_domain::Segment_3 Segment_3; + typedef typename Mesh_domain::Ray_3 Ray_3; + typedef typename Mesh_domain::Line_3 Line_3; + typedef typename Mesh_domain::Vector_3 Vector_3; - Construct_intersection construct_intersection = domain.construct_intersection_object(); + Construct_intersection construct_intersection = domain.construct_intersection_object(); - { - Segment_3 s(Point_3(CGAL::ORIGIN), Point_3(1.5, 0., 0.)); - Intersection i = construct_intersection(s); - assert(std::get<0>(i) != Point_3(1., 0., 0.)); - Index ii = std::get<1>(i); - assert(boost::get(&ii)); - assert(std::get<2>(i) == 2); - } + { + Segment_3 s(Point_3(CGAL::ORIGIN), Point_3(1.5, 0., 0.)); + Intersection i = construct_intersection(s); + assert(std::get<0>(i) != Point_3(1., 0., 0.)); + Index ii = std::get<1>(i); + assert(boost::get(&ii)); + assert(std::get<2>(i) == 2); + } - { - Segment_3 s(Point_3(1.5, 1.5, 0.), Point_3(1.5, 0., 0.)); - Intersection i = construct_intersection(s); - Index ii = std::get<1>(i); - assert(boost::get(&ii)); - assert(std::get<2>(i) == 0); - } + { + Segment_3 s(Point_3(1.5, 1.5, 0.), Point_3(1.5, 0., 0.)); + Intersection i = construct_intersection(s); + Index ii = std::get<1>(i); + assert(boost::get(&ii)); + assert(std::get<2>(i) == 0); + } - { - Ray_3 r(Point_3(CGAL::ORIGIN), Vector_3(1., 0., 0.)); - Intersection i = construct_intersection(r); - assert(std::get<0>(i) != Point_3(1., 0., 0.)); - Index ii = std::get<1>(i); - assert(boost::get(&ii)); - assert(std::get<2>(i) == 2); - } + { + Ray_3 r(Point_3(CGAL::ORIGIN), Vector_3(1., 0., 0.)); + Intersection i = construct_intersection(r); + assert(std::get<0>(i) != Point_3(1., 0., 0.)); + Index ii = std::get<1>(i); + assert(boost::get(&ii)); + assert(std::get<2>(i) == 2); + } - { - Ray_3 r(Point_3(1.5, 0., 0.), Vector_3(0., 1., 0.)); - Intersection i = construct_intersection(r); - Index ii = std::get<1>(i); - assert(boost::get(&ii)); - assert(std::get<2>(i) == 0); - } + { + Ray_3 r(Point_3(1.5, 0., 0.), Vector_3(0., 1., 0.)); + Intersection i = construct_intersection(r); + Index ii = std::get<1>(i); + assert(boost::get(&ii)); + assert(std::get<2>(i) == 0); + } - { - Line_3 l(Point_3(CGAL::ORIGIN), Point_3(1.5, 0., 0.)); - Intersection i = construct_intersection(l); - assert(std::get<0>(i) != Point_3(1., 0., 0.)); - Index ii = std::get<1>(i); - assert(boost::get(&ii)); - assert(std::get<2>(i) == 2); - } + { + Line_3 l(Point_3(CGAL::ORIGIN), Point_3(1.5, 0., 0.)); + Intersection i = construct_intersection(l); + assert(std::get<0>(i) != Point_3(1., 0., 0.)); + Index ii = std::get<1>(i); + assert(boost::get(&ii)); + assert(std::get<2>(i) == 2); + } - { - Line_3 l(Point_3(1.5, 0., 0.), Point_3(1.5, 0.5, 0.)); - Intersection i = construct_intersection(l); - Index ii = std::get<1>(i); - assert(boost::get(&ii)); - assert(std::get<2>(i) == 0); - } + { + Line_3 l(Point_3(1.5, 0., 0.), Point_3(1.5, 0.5, 0.)); + Intersection i = construct_intersection(l); + Index ii = std::get<1>(i); + assert(boost::get(&ii)); + assert(std::get<2>(i) == 0); + } } }; diff --git a/Mesh_3/test/Mesh_3/test_mesh_capsule_var_distance_bound.cpp b/Mesh_3/test/Mesh_3/test_mesh_capsule_var_distance_bound.cpp index 03b91d15d8c..14390abda0d 100644 --- a/Mesh_3/test/Mesh_3/test_mesh_capsule_var_distance_bound.cpp +++ b/Mesh_3/test/Mesh_3/test_mesh_capsule_var_distance_bound.cpp @@ -50,8 +50,8 @@ auto field = [](const Point& p, const int, const Mesh_domain::Index) int main() { Mesh_domain domain = - Mesh_domain::create_implicit_mesh_domain(capsule_function, - K::Sphere_3(CGAL::ORIGIN, 49.)); + Mesh_domain::create_implicit_mesh_domain(function = capsule_function, + bounding_object = K::Sphere_3(CGAL::ORIGIN, 49.)); // Mesh criteria Mesh_criteria criteria(facet_angle=30, facet_size=0.5, diff --git a/Mesh_3/test/Mesh_3/test_meshing_3D_image.cpp b/Mesh_3/test/Mesh_3/test_meshing_3D_image.cpp index 0d151fc1b9b..9885213a25c 100644 --- a/Mesh_3/test/Mesh_3/test_meshing_3D_image.cpp +++ b/Mesh_3/test/Mesh_3/test_meshing_3D_image.cpp @@ -48,7 +48,7 @@ public: << CGAL::get_default_random().get_seed() << std::endl; Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain (image, - 1e-9, + CGAL::parameters::relative_error_bound = 1e-9, CGAL::parameters::p_rng = &CGAL::get_default_random()); // Set mesh criteria diff --git a/Mesh_3/test/Mesh_3/test_meshing_utilities.h b/Mesh_3/test/Mesh_3/test_meshing_utilities.h index 3270d321e9b..a16c177a937 100644 --- a/Mesh_3/test/Mesh_3/test_meshing_utilities.h +++ b/Mesh_3/test/Mesh_3/test_meshing_utilities.h @@ -153,7 +153,7 @@ struct Tester // Quality should increase C3t3 exude_c3t3(c3t3); std::cerr << "Exude...\n"; - CGAL::exude_mesh_3(exude_c3t3); + CGAL::exude_mesh_3(exude_c3t3, CGAL::parameters::time_limit = 0); verify_c3t3(exude_c3t3,domain,domain_type,v,v,f,f); verify_c3t3_quality(c3t3,exude_c3t3); verify_c3t3_volume(exude_c3t3, volume*0.95, volume*1.05); @@ -164,7 +164,7 @@ struct Tester // Quality should increase C3t3 perturb_c3t3(c3t3); std::cerr << "Perturb...\n"; - CGAL::perturb_mesh_3(perturb_c3t3, domain, CGAL::parameters::time_limit=5); + CGAL::perturb_mesh_3(perturb_c3t3, domain, CGAL::parameters::time_limit =5); verify_c3t3(perturb_c3t3,domain,domain_type,v,v); verify_c3t3_quality(c3t3,perturb_c3t3); verify_c3t3_volume(perturb_c3t3, volume*0.95, volume*1.05); diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h index 10ab7f494f9..5793cc99e49 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h @@ -266,7 +266,6 @@ public: // Construct the segments of the convolution cycles. unsigned int curr_id = 0; - unsigned int cycles = 0; Segments_list conv_segments; Segments_list cycle; Labels_set used_labels; @@ -340,7 +339,6 @@ public: CGAL_assertion(cycle.empty()); } } - ++cycles; } curr1 = next1; diff --git a/Nef_2/include/CGAL/Nef_2/PM_const_decorator.h b/Nef_2/include/CGAL/Nef_2/PM_const_decorator.h index 8ccfb77c1b6..f95e1daefbd 100644 --- a/Nef_2/include/CGAL/Nef_2/PM_const_decorator.h +++ b/Nef_2/include/CGAL/Nef_2/PM_const_decorator.h @@ -485,6 +485,8 @@ check_integrity_and_topological_planarity(bool faces) const std::size_t e_num = number_of_edges(); std::size_t c_num = number_of_connected_components() - iso_vert_num; std::size_t f_num = number_of_face_cycles() - c_num + 1; + CGAL_USE(fc_num); + CGAL_USE(iv_num); CGAL_USE(v_num); CGAL_USE(e_num); CGAL_USE(f_num); diff --git a/Nef_2/include/CGAL/Nef_2/PM_point_locator.h b/Nef_2/include/CGAL/Nef_2/PM_point_locator.h index 0f1443d4e55..ede8d2b033a 100644 --- a/Nef_2/include/CGAL/Nef_2/PM_point_locator.h +++ b/Nef_2/include/CGAL/Nef_2/PM_point_locator.h @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -665,6 +666,7 @@ protected: } + CGAL_USE(flip_count); CGAL_NEF_TRACEN(" flipped "<::max)(); FT max_value = -(std::numeric_limits::max)(); - unsigned int nb_initial = 0; + for (Finite_edges_iterator ei = m_dt.finite_edges_begin(); ei != m_dt.finite_edges_end(); ++ei) { Edge edge = *ei; if (m_dt.is_ghost(edge)) continue; FT value = m_dt.get_edge_relevance(edge); // >= 0 - nb_initial++; min_value = (std::min)(min_value, value); max_value = (std::max)(max_value, value); mindex.insert(PEdge(edge, value)); diff --git a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.h b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.h index e590f0f0489..c7f14a626da 100644 --- a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.h +++ b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/scene.h @@ -440,11 +440,9 @@ public: } CGAL_assertion(vertex_count == 18); - int edge_count = 0; for (std::vector::iterator it = edges.begin(); it != edges.end(); it++) { std::cout << *it << std::endl; - edge_count++; } } diff --git a/Optimisation_basic/include/CGAL/Optimisation/assertions.h b/Optimisation_basic/include/CGAL/Optimisation/assertions.h deleted file mode 100644 index 7186d883d15..00000000000 --- a/Optimisation_basic/include/CGAL/Optimisation/assertions.h +++ /dev/null @@ -1,323 +0,0 @@ -// Copyright (c) 1997-2001 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. -// -// This file is part of CGAL (www.cgal.org) -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Geert-Jan Giezeman, Sven Schoenherr - -#ifndef CGAL_OPTIMISATION_ASSERTIONS_H -#define CGAL_OPTIMISATION_ASSERTIONS_H - -#include - -// macro definitions -// ================= - -// assertions -// ---------- -#if ( defined( CGAL_OPTIMISATION_NO_ASSERTIONS) \ - || defined( CGAL_NO_ASSERTIONS) || defined( NDEBUG)) -# define CGAL_optimisation_assertion(EX) ((void)0) -# define CGAL_optimisation_assertion_msg(EX,MSG) ((void)0) -# define CGAL_optimisation_assertion_code(CODE) -# undef CGAL_OPTIMISATION_ASSERTION_TAG -#else -# define CGAL_optimisation_assertion(EX) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::assertion_fail( # EX ,__FILE__,__LINE__)) -# define CGAL_optimisation_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::assertion_fail( # EX ,__FILE__,__LINE__,MSG)) -# define CGAL_optimisation_assertion_code(CODE) CODE -# define CGAL_OPTIMISATION_ASSERTION_TAG 1 -#endif // optimisation assertions - -#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXACTNESS) \ - || defined( CGAL_CHECK_EXACTNESS) ) \ - || defined( CGAL_OPTIMISATION_NO_ASSERTIONS) \ - || defined( CGAL_NO_ASSERTIONS) || defined( NDEBUG)) -# define CGAL_optimisation_exactness_assertion(EX) ((void)0) -# define CGAL_optimisation_exactness_assertion_msg(EX,MSG) ((void)0) -# define CGAL_optimisation_exactness_assertion_code(CODE) -# undef CGAL_OPTIMISATION_EXACTNESS_ASSERTION_TAG -#else -# define CGAL_optimisation_exactness_assertion(EX) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::assertion_fail( # EX ,__FILE__,__LINE__)) -# define CGAL_optimisation_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::assertion_fail( # EX ,__FILE__,__LINE__,MSG)) -# define CGAL_optimisation_exactness_assertion_code(CODE) CODE -# define CGAL_OPTIMISATION_EXACTNESS_ASSERTION_TAG 1 -#endif // optimisation exactness assertions - -#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXPENSIVE) \ - || defined( CGAL_CHECK_EXPENSIVE) ) \ - || defined( CGAL_OPTIMISATION_NO_ASSERTIONS) \ - || defined( CGAL_NO_ASSERTIONS) || defined( NDEBUG)) -# define CGAL_optimisation_expensive_assertion(EX) ((void)0) -# define CGAL_optimisation_expensive_assertion_msg(EX,MSG) ((void)0) -# define CGAL_optimisation_expensive_assertion_code(CODE) -# undef CGAL_OPTIMISATION_EXPENSIVE_ASSERTION_TAG -#else -# define CGAL_optimisation_expensive_assertion(EX) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::assertion_fail( # EX ,__FILE__,__LINE__)) -# define CGAL_optimisation_expensive_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::assertion_fail( # EX ,__FILE__,__LINE__,MSG)) -# define CGAL_optimisation_expensive_assertion_code(CODE) CODE -# define CGAL_OPTIMISATION_EXPENSIVE_ASSERTION_TAG 1 -#endif // optimisation expensive assertions - -#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXACTNESS) \ - || defined( CGAL_OPTIMISATION_CHECK_EXPENSIVE) \ - || defined( CGAL_CHECK_EXACTNESS) \ - || defined( CGAL_CHECK_EXPENSIVE) ) \ - || defined( CGAL_OPTIMISATION_NO_ASSERTIONS) \ - || defined( CGAL_NO_ASSERTIONS) || defined( NDEBUG)) -# define CGAL_optimisation_expensive_exactness_assertion(EX) \ - ((void)0) -# define CGAL_optimisation_expensive_exactness_assertion_msg(EX,MSG) \ - ((void)0) -# define CGAL_optimisation_expensive_exactness_assertion_code(CODE) -# undef CGAL_OPTIMISATION_EXPENSIVE_EXACTNESS_ASSERTION_TAG -#else -# define CGAL_optimisation_expensive_exactness_assertion(EX) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::assertion_fail( # EX ,__FILE__,__LINE__)) -# define CGAL_optimisation_expensive_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::assertion_fail( # EX ,__FILE__,__LINE__,MSG)) -# define CGAL_optimisation_expensive_exactness_assertion_code(CODE) CODE -# define CGAL_OPTIMISATION_EXPENSIVE_EXACTNESS_ASSERTION_TAG 1 -#endif // optimisation expensive exactness assertions - - - -// preconditions -// ------------- -#if ( defined( CGAL_OPTIMISATION_NO_PRECONDITIONS) \ - || defined( CGAL_NO_PRECONDITIONS) || defined( NDEBUG)) -# define CGAL_optimisation_precondition(EX) ((void)0) -# define CGAL_optimisation_precondition_msg(EX,MSG) ((void)0) -# define CGAL_optimisation_precondition_code(CODE) -# undef CGAL_OPTIMISATION_PRECONDITION_TAG -#else -# define CGAL_optimisation_precondition(EX) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::precondition_fail( # EX ,__FILE__,__LINE__)) -# define CGAL_optimisation_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::precondition_fail( # EX ,__FILE__,__LINE__,MSG)) -# define CGAL_optimisation_precondition_code(CODE) CODE -# define CGAL_OPTIMISATION_PRECONDITION_TAG 1 -#endif // optimisation preconditions - -#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXACTNESS) \ - || defined( CGAL_CHECK_EXACTNESS) ) \ - || defined( CGAL_OPTIMISATION_NO_PRECONDITIONS) \ - || defined( CGAL_NO_PRECONDITIONS) || defined( NDEBUG)) -# define CGAL_optimisation_exactness_precondition(EX) ((void)0) -# define CGAL_optimisation_exactness_precondition_msg(EX,MSG) ((void)0) -# define CGAL_optimisation_exactness_precondition_code(CODE) -# undef CGAL_OPTIMISATION_EXACTNESS_PRECONDITION_TAG -#else -# define CGAL_optimisation_exactness_precondition(EX) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::precondition_fail( # EX ,__FILE__,__LINE__)) -# define CGAL_optimisation_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::precondition_fail( # EX ,__FILE__,__LINE__,MSG)) -# define CGAL_optimisation_exactness_precondition_code(CODE) CODE -# define CGAL_OPTIMISATION_EXACTNESS_PRECONDITION_TAG 1 -#endif // optimisation exactness preconditions - -#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXPENSIVE) \ - || defined( CGAL_CHECK_EXPENSIVE) ) \ - || defined( CGAL_OPTIMISATION_NO_PRECONDITIONS) \ - || defined( CGAL_NO_PRECONDITIONS) || defined( NDEBUG)) -# define CGAL_optimisation_expensive_precondition(EX) ((void)0) -# define CGAL_optimisation_expensive_precondition_msg(EX,MSG) ((void)0) -# define CGAL_optimisation_expensive_precondition_code(CODE) -# undef CGAL_OPTIMISATION_EXPENSIVE_PRECONDITION_TAG -#else -# define CGAL_optimisation_expensive_precondition(EX) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::precondition_fail( # EX ,__FILE__,__LINE__)) -# define CGAL_optimisation_expensive_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::precondition_fail( # EX ,__FILE__,__LINE__,MSG)) -# define CGAL_optimisation_expensive_precondition_code(CODE) CODE -# define CGAL_OPTIMISATION_EXPENSIVE_PRECONDITION_TAG 1 -#endif // optimisation expensive preconditions - -#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXACTNESS) \ - || defined( CGAL_OPTIMISATION_CHECK_EXPENSIVE) \ - || defined( CGAL_CHECK_EXACTNESS) \ - || defined( CGAL_CHECK_EXPENSIVE) ) \ - || defined( CGAL_OPTIMISATION_NO_PRECONDITIONS) \ - || defined( CGAL_NO_PRECONDITIONS) || defined( NDEBUG)) -# define CGAL_optimisation_expensive_exactness_precondition(EX) \ - ((void)0) -# define CGAL_optimisation_expensive_exactness_precondition_msg(EX,MSG) \ - ((void)0) -# define CGAL_optimisation_expensive_exactness_precondition_code(CODE) -# undef CGAL_OPTIMISATION_EXPENSIVE_EXACTNESS_PRECONDITION_TAG -#else -# define CGAL_optimisation_expensive_exactness_precondition(EX) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::precondition_fail( # EX ,__FILE__,__LINE__)) -# define CGAL_optimisation_expensive_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::precondition_fail( # EX ,__FILE__,__LINE__,MSG)) -# define CGAL_optimisation_expensive_exactness_precondition_code(CODE) CODE -# define CGAL_OPTIMISATION_EXPENSIVE_EXACTNESS_PRECONDITION_TAG 1 -#endif // optimisation expensive exactness preconditions - - - -// postconditions -// -------------- -#if ( defined( CGAL_OPTIMISATION_NO_POSTCONDITIONS) \ - || defined( CGAL_NO_POSTCONDITIONS) || defined( NDEBUG)) -# define CGAL_optimisation_postcondition(EX) ((void)0) -# define CGAL_optimisation_postcondition_msg(EX,MSG) ((void)0) -# define CGAL_optimisation_postcondition_code(CODE) -# undef CGAL_OPTIMISATION_POSTCONDITION_TAG -#else -# define CGAL_optimisation_postcondition(EX) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::postcondition_fail( # EX ,__FILE__,__LINE__)) -# define CGAL_optimisation_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::postcondition_fail( # EX ,__FILE__,__LINE__,MSG)) -# define CGAL_optimisation_postcondition_code(CODE) CODE -# define CGAL_OPTIMISATION_POSTCONDITION_TAG 1 -#endif // optimisation postconditions - -#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXACTNESS) \ - || defined( CGAL_CHECK_EXACTNESS) ) \ - || defined( CGAL_OPTIMISATION_NO_POSTCONDITIONS) \ - || defined( CGAL_NO_POSTCONDITIONS) || defined( NDEBUG)) -# define CGAL_optimisation_exactness_postcondition(EX) ((void)0) -# define CGAL_optimisation_exactness_postcondition_msg(EX,MSG) ((void)0) -# define CGAL_optimisation_exactness_postcondition_code(CODE) -# undef CGAL_OPTIMISATION_EXACTNESS_POSTCONDITION_TAG -#else -# define CGAL_optimisation_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::postcondition_fail( # EX ,__FILE__,__LINE__)) -# define CGAL_optimisation_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::postcondition_fail( # EX ,__FILE__,__LINE__,MSG)) -# define CGAL_optimisation_exactness_postcondition_code(CODE) CODE -# define CGAL_OPTIMISATION_EXACTNESS_POSTCONDITION_TAG 1 -#endif // optimisation exactness postconditions - -#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXPENSIVE) \ - || defined( CGAL_CHECK_EXPENSIVE) ) \ - || defined( CGAL_OPTIMISATION_NO_POSTCONDITIONS) \ - || defined( CGAL_NO_POSTCONDITIONS) || defined( NDEBUG)) -# define CGAL_optimisation_expensive_postcondition(EX) ((void)0) -# define CGAL_optimisation_expensive_postcondition_msg(EX,MSG) ((void)0) -# define CGAL_optimisation_expensive_postcondition_code(CODE) -# undef CGAL_OPTIMISATION_EXPENSIVE_POSTCONDITION_TAG -#else -# define CGAL_optimisation_expensive_postcondition(EX) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::postcondition_fail( # EX ,__FILE__,__LINE__)) -# define CGAL_optimisation_expensive_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::postcondition_fail( # EX ,__FILE__,__LINE__,MSG)) -# define CGAL_optimisation_expensive_postcondition_code(CODE) CODE -# define CGAL_OPTIMISATION_EXPENSIVE_POSTCONDITION_TAG 1 -#endif // optimisation expensive postconditions - -#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXACTNESS) \ - || defined( CGAL_OPTIMISATION_CHECK_EXPENSIVE) \ - || defined( CGAL_CHECK_EXACTNESS) \ - || defined( CGAL_CHECK_EXPENSIVE) ) \ - || defined( CGAL_OPTIMISATION_NO_POSTCONDITIONS) \ - || defined( CGAL_NO_POSTCONDITIONS) || defined( NDEBUG)) -# define CGAL_optimisation_expensive_exactness_postcondition(EX) \ - ((void)0) -# define CGAL_optimisation_expensive_exactness_postcondition_msg(EX,MSG) \ - ((void)0) -# define CGAL_optimisation_expensive_exactness_postcondition_code(CODE) -# undef CGAL_OPTIMISATION_EXPENSIVE_EXACTNESS_POSTCONDITION_TAG -#else -# define CGAL_optimisation_expensive_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::postcondition_fail( # EX ,__FILE__,__LINE__)) -# define CGAL_optimisation_expensive_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::postcondition_fail( # EX ,__FILE__,__LINE__,MSG)) -# define CGAL_optimisation_expensive_exactness_postcondition_code(CODE) CODE -# define CGAL_OPTIMISATION_EXPENSIVE_EXACTNESS_POSTCONDITION_TAG 1 -#endif // optimisation expensive exactness postconditions - - - -// warnings -// -------- -#if ( defined( CGAL_OPTIMISATION_NO_WARNINGS) \ - || defined( CGAL_NO_WARNINGS) || defined( NDEBUG)) -# define CGAL_optimisation_warning(EX) ((void)0) -# define CGAL_optimisation_warning_msg(EX,MSG) ((void)0) -# define CGAL_optimisation_warning_code(CODE) -# undef CGAL_OPTIMISATION_WARNING_TAG -#else -# define CGAL_optimisation_warning(EX) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::warning_fail( # EX ,__FILE__,__LINE__)) -# define CGAL_optimisation_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::warning_fail( # EX ,__FILE__,__LINE__,MSG)) -# define CGAL_optimisation_warning_code(CODE) CODE -# define CGAL_OPTIMISATION_WARNING_TAG 1 -#endif // optimisation warnings - -#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXACTNESS) \ - || defined( CGAL_CHECK_EXACTNESS) ) \ - || defined( CGAL_OPTIMISATION_NO_WARNINGS) \ - || defined( CGAL_NO_WARNINGS) || defined( NDEBUG)) -# define CGAL_optimisation_exactness_warning(EX) ((void)0) -# define CGAL_optimisation_exactness_warning_msg(EX,MSG) ((void)0) -# define CGAL_optimisation_exactness_warning_code(CODE) -# undef CGAL_OPTIMISATION_EXACTNESS_WARNING_TAG -#else -# define CGAL_optimisation_exactness_warning(EX) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::warning_fail( # EX ,__FILE__,__LINE__)) -# define CGAL_optimisation_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::warning_fail( # EX ,__FILE__,__LINE__,MSG)) -# define CGAL_optimisation_exactness_warning_code(CODE) CODE -# define CGAL_OPTIMISATION_EXACTNESS_WARNING_TAG 1 -#endif // optimisation exactness warnings - -#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXPENSIVE) \ - || defined( CGAL_CHECK_EXPENSIVE) ) \ - || defined( CGAL_OPTIMISATION_NO_WARNINGS) \ - || defined( CGAL_NO_WARNINGS) || defined( NDEBUG)) -# define CGAL_optimisation_expensive_warning(EX) ((void)0) -# define CGAL_optimisation_expensive_warning_msg(EX,MSG) ((void)0) -# define CGAL_optimisation_expensive_warning_code(CODE) -# undef CGAL_OPTIMISATION_EXPENSIVE_WARNING_TAG -#else -# define CGAL_optimisation_expensive_warning(EX) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::warning_fail( # EX ,__FILE__,__LINE__)) -# define CGAL_optimisation_expensive_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::warning_fail( # EX ,__FILE__,__LINE__,MSG)) -# define CGAL_optimisation_expensive_warning_code(CODE) CODE -# define CGAL_OPTIMISATION_EXPENSIVE_WARNING_TAG 1 -#endif // optimisation expensive warnings - -#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXACTNESS) \ - || defined( CGAL_OPTIMISATION_CHECK_EXPENSIVE) \ - || defined( CGAL_CHECK_EXACTNESS) \ - || defined( CGAL_CHECK_EXPENSIVE) ) \ - || defined( CGAL_OPTIMISATION_NO_WARNINGS) \ - || defined( CGAL_NO_WARNINGS) || defined( NDEBUG)) -# define CGAL_optimisation_expensive_exactness_warning(EX) \ - ((void)0) -# define CGAL_optimisation_expensive_exactness_warning_msg(EX,MSG) \ - ((void)0) -# define CGAL_optimisation_expensive_exactness_warning_code(CODE) -# undef CGAL_OPTIMISATION_EXPENSIVE_EXACTNESS_WARNING_TAG -#else -# define CGAL_optimisation_expensive_exactness_warning(EX) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::warning_fail( # EX ,__FILE__,__LINE__)) -# define CGAL_optimisation_expensive_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?((void)0): ::CGAL::warning_fail( # EX ,__FILE__,__LINE__,MSG)) -# define CGAL_optimisation_expensive_exactness_warning_code(CODE) CODE -# define CGAL_OPTIMISATION_EXPENSIVE_EXACTNESS_WARNING_TAG 1 -#endif // optimisation expensive exactness warnings - - - -#endif // CGAL_OPTIMISATION_ASSERTIONS_H - -// ===== EOF ================================================================== diff --git a/Optimisation_basic/include/CGAL/Optimisation/basic.h b/Optimisation_basic/include/CGAL/Optimisation/basic.h index 6e8dd5f511c..900b0cac964 100644 --- a/Optimisation_basic/include/CGAL/Optimisation/basic.h +++ b/Optimisation_basic/include/CGAL/Optimisation/basic.h @@ -19,7 +19,6 @@ // includes #include -#include #include #include diff --git a/Optimisation_basic/package_info/Optimisation_basic/dependencies b/Optimisation_basic/package_info/Optimisation_basic/dependencies index 4b1b3cb93f3..e69de29bb2d 100644 --- a/Optimisation_basic/package_info/Optimisation_basic/dependencies +++ b/Optimisation_basic/package_info/Optimisation_basic/dependencies @@ -1,4 +0,0 @@ -Installation -Kernel_23 -Profiling_tools -STL_Extension diff --git a/Orthtree/include/CGAL/Orthtree.h b/Orthtree/include/CGAL/Orthtree.h index b2931f84429..bb1dd8a2354 100644 --- a/Orthtree/include/CGAL/Orthtree.h +++ b/Orthtree/include/CGAL/Orthtree.h @@ -320,8 +320,21 @@ public: void refine(const Split_predicate& split_predicate) { // If the tree has already been refined, reset it - if (!m_root.is_leaf()) + if (!m_root.is_leaf()){ + std::queue nodes; + for (std::size_t i = 0; i < Degree::value; ++ i) + nodes.push (m_root[i]); + while (!nodes.empty()) + { + Node node = nodes.front(); + nodes.pop(); + if (!node.is_leaf()) + for (std::size_t i = 0; i < Degree::value; ++ i) + nodes.push (node[i]); + node.free(); + } m_root.unsplit(); + } // Reset the side length map, too m_side_per_depth.resize(1); diff --git a/Orthtree/include/CGAL/Orthtree/Node.h b/Orthtree/include/CGAL/Orthtree/Node.h index cfa49fb5366..a16d2fff192 100644 --- a/Orthtree/include/CGAL/Orthtree/Node.h +++ b/Orthtree/include/CGAL/Orthtree/Node.h @@ -365,7 +365,7 @@ public: } /*! - \brief returns the nth child fo this node. + \brief returns the nth child of this node. \pre `!is_null()` \pre `!is_leaf()` diff --git a/Partition_2/doc/Partition_2/PackageDescription.txt b/Partition_2/doc/Partition_2/PackageDescription.txt index ee33bf48c0a..4d5b6ba9c91 100644 --- a/Partition_2/doc/Partition_2/PackageDescription.txt +++ b/Partition_2/doc/Partition_2/PackageDescription.txt @@ -53,8 +53,6 @@ primitive types and predicates used by the algorithms. \cgalCRPSection{Assertions} -The assertion flags for this package use `PARTITION` in their names -(e.g., `CGAL_PARTITION_NO_POSTCONDITIONS`). The precondition checks for the planar polygon partitioning functions are: counterclockwise ordering of the input vertices and simplicity of the polygon these vertices represent. @@ -99,4 +97,3 @@ original polygon). - `CGAL::y_monotone_partition_is_valid_2()` */ - diff --git a/Partition_2/include/CGAL/Partition_2/partition_approx_convex_2.h b/Partition_2/include/CGAL/Partition_2/partition_approx_convex_2.h index 076e78cee57..88d756d243a 100644 --- a/Partition_2/include/CGAL/Partition_2/partition_approx_convex_2.h +++ b/Partition_2/include/CGAL/Partition_2/partition_approx_convex_2.h @@ -29,7 +29,7 @@ _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") #include #include #include -#include +#include #include #include #include @@ -138,7 +138,7 @@ OutputIterator partition_approx_convex_2(InputIterator first, P_Polygon_2 polygon(first, beyond,traits); - CGAL_partition_precondition( + CGAL_precondition( orientation_2(polygon.begin(), polygon.end(), traits) == COUNTERCLOCKWISE); Circulator first_c(polygon.begin(), polygon.end(), polygon.begin()); @@ -238,7 +238,7 @@ OutputIterator partition_approx_convex_2(InputIterator first, #endif // no postconditions polygon.partition(res, 0); - CGAL_partition_postcondition( + CGAL_postcondition( convex_partition_is_valid_2(polygon.begin(), polygon.end(), res.output_so_far_begin(), res.output_so_far_end(), traits)); diff --git a/Partition_2/include/CGAL/Partition_2/partition_assertions.h b/Partition_2/include/CGAL/Partition_2/partition_assertions.h deleted file mode 100644 index 6d0f0288b3e..00000000000 --- a/Partition_2/include/CGAL/Partition_2/partition_assertions.h +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) 1997 Max-Planck-Institute Saarbruecken (Germany). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Geert-Jan Giezeman, Sven Schoenherr -// -// Generated from script create_assertions.sh - - -// Note that this header file is intentionnaly not protected with a -// macro (as ). Calling it a second time with another value -// for CGAL_NO_ASSERTIONS for example must make a difference. - -#include - -// macro definitions -// ================= -// assertions -// ---------- - -#undef CGAL_partition_assertion -#undef CGAL_partition_assertion_msg -#undef CGAL_partition_assertion_code - -#if defined(CGAL_PARTITION_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) -# define CGAL_partition_assertion(EX) (static_cast(0)) - -#include - -# define CGAL_partition_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_partition_assertion_code(CODE) -#else -# define CGAL_partition_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_partition_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_partition_assertion_code(CODE) CODE -# define CGAL_partition_assertions 1 -#endif // CGAL_PARTITION_NO_ASSERTIONS - - -#undef CGAL_partition_exactness_assertion -#undef CGAL_partition_exactness_assertion_msg -#undef CGAL_partition_exactness_assertion_code - -#if defined(CGAL_PARTITION_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_partition_exactness_assertion(EX) (static_cast(0)) -# define CGAL_partition_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_partition_exactness_assertion_code(CODE) -#else -# define CGAL_partition_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_partition_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_partition_exactness_assertion_code(CODE) CODE -# define CGAL_partition_exactness_assertions 1 -#endif // CGAL_PARTITION_NO_ASSERTIONS - - -#undef CGAL_partition_expensive_assertion -#undef CGAL_partition_expensive_assertion_msg -#undef CGAL_partition_expensive_assertion_code - -#if defined(CGAL_PARTITION_NO_ASSERTIONS) \ - || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_partition_expensive_assertion(EX) (static_cast(0)) -# define CGAL_partition_expensive_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_partition_expensive_assertion_code(CODE) -#else -# define CGAL_partition_expensive_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_partition_expensive_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_partition_expensive_assertion_code(CODE) CODE -# define CGAL_partition_expensive_assertions 1 -#endif // CGAL_PARTITION_NO_ASSERTIONS - - -#undef CGAL_partition_expensive_exactness_assertion -#undef CGAL_partition_expensive_exactness_assertion_msg -#undef CGAL_partition_expensive_exactness_assertion_code - -#if defined(CGAL_PARTITION_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_partition_expensive_exactness_assertion(EX) (static_cast(0)) -# define CGAL_partition_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_partition_expensive_exactness_assertion_code(CODE) -#else -# define CGAL_partition_expensive_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_partition_expensive_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_partition_expensive_exactness_assertion_code(CODE) CODE -# define CGAL_partition_expensive_exactness_assertions 1 -#endif // CGAL_PARTITION_NO_ASSERTIONS - - -// preconditions -// ------------- - -#undef CGAL_partition_precondition -#undef CGAL_partition_precondition_msg -#undef CGAL_partition_precondition_code - -#if defined(CGAL_PARTITION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) -# define CGAL_partition_precondition(EX) (static_cast(0)) -# define CGAL_partition_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_partition_precondition_code(CODE) -#else -# define CGAL_partition_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_partition_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_partition_precondition_code(CODE) CODE -# define CGAL_partition_preconditions 1 -#endif // CGAL_PARTITION_NO_PRECONDITIONS - - -#undef CGAL_partition_exactness_precondition -#undef CGAL_partition_exactness_precondition_msg -#undef CGAL_partition_exactness_precondition_code - -#if defined(CGAL_PARTITION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_partition_exactness_precondition(EX) (static_cast(0)) -# define CGAL_partition_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_partition_exactness_precondition_code(CODE) -#else -# define CGAL_partition_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_partition_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_partition_exactness_precondition_code(CODE) CODE -# define CGAL_partition_exactness_preconditions 1 -#endif // CGAL_PARTITION_NO_PRECONDITIONS - - -#undef CGAL_partition_expensive_precondition -#undef CGAL_partition_expensive_precondition_msg -#undef CGAL_partition_expensive_precondition_code - -#if defined(CGAL_PARTITION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_partition_expensive_precondition(EX) (static_cast(0)) -# define CGAL_partition_expensive_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_partition_expensive_precondition_code(CODE) -#else -# define CGAL_partition_expensive_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_partition_expensive_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_partition_expensive_precondition_code(CODE) CODE -# define CGAL_partition_expensive_preconditions 1 -#endif // CGAL_PARTITION_NO_PRECONDITIONS - - -#undef CGAL_partition_expensive_exactness_precondition -#undef CGAL_partition_expensive_exactness_precondition_msg -#undef CGAL_partition_expensive_exactness_precondition_code - -#if defined(CGAL_PARTITION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_partition_expensive_exactness_precondition(EX) (static_cast(0)) -# define CGAL_partition_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_partition_expensive_exactness_precondition_code(CODE) -#else -# define CGAL_partition_expensive_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_partition_expensive_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_partition_expensive_exactness_precondition_code(CODE) CODE -# define CGAL_partition_expensive_exactness_preconditions 1 -#endif // CGAL_PARTITION_NO_PRECONDITIONS - - -// postconditions -// -------------- - -#undef CGAL_partition_postcondition -#undef CGAL_partition_postcondition_msg -#undef CGAL_partition_postcondition_code - -#if defined(CGAL_PARTITION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) -# define CGAL_partition_postcondition(EX) (static_cast(0)) -# define CGAL_partition_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_partition_postcondition_code(CODE) -#else -# define CGAL_partition_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_partition_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_partition_postcondition_code(CODE) CODE -# define CGAL_partition_postconditions 1 -#endif // CGAL_PARTITION_NO_POSTCONDITIONS - - -#undef CGAL_partition_exactness_postcondition -#undef CGAL_partition_exactness_postcondition_msg -#undef CGAL_partition_exactness_postcondition_code - -#if defined(CGAL_PARTITION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_partition_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_partition_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_partition_exactness_postcondition_code(CODE) -#else -# define CGAL_partition_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_partition_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_partition_exactness_postcondition_code(CODE) CODE -# define CGAL_partition_exactness_postconditions 1 -#endif // CGAL_PARTITION_NO_POSTCONDITIONS - - -#undef CGAL_partition_expensive_postcondition -#undef CGAL_partition_expensive_postcondition_msg -#undef CGAL_partition_expensive_postcondition_code - -#if defined(CGAL_PARTITION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_partition_expensive_postcondition(EX) (static_cast(0)) -# define CGAL_partition_expensive_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_partition_expensive_postcondition_code(CODE) -#else -# define CGAL_partition_expensive_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_partition_expensive_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_partition_expensive_postcondition_code(CODE) CODE -# define CGAL_partition_expensive_postconditions 1 -#endif // CGAL_PARTITION_NO_POSTCONDITIONS - - -#undef CGAL_partition_expensive_exactness_postcondition -#undef CGAL_partition_expensive_exactness_postcondition_msg -#undef CGAL_partition_expensive_exactness_postcondition_code - -#if defined(CGAL_PARTITION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_partition_expensive_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_partition_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_partition_expensive_exactness_postcondition_code(CODE) -#else -# define CGAL_partition_expensive_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_partition_expensive_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_partition_expensive_exactness_postcondition_code(CODE) CODE -# define CGAL_partition_expensive_exactness_postconditions 1 -#endif // CGAL_PARTITION_NO_POSTCONDITIONS - - -// warnings -// -------- - -#undef CGAL_partition_warning -#undef CGAL_partition_warning_msg -#undef CGAL_partition_warning_code - -#if defined(CGAL_PARTITION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) -# define CGAL_partition_warning(EX) (static_cast(0)) -# define CGAL_partition_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_partition_warning_code(CODE) -#else -# define CGAL_partition_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_partition_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_partition_warning_code(CODE) CODE -# define CGAL_partition_warnings 1 -#endif // CGAL_PARTITION_NO_WARNINGS - - -#undef CGAL_partition_exactness_warning -#undef CGAL_partition_exactness_warning_msg -#undef CGAL_partition_exactness_warning_code - -#if defined(CGAL_PARTITION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_partition_exactness_warning(EX) (static_cast(0)) -# define CGAL_partition_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_partition_exactness_warning_code(CODE) -#else -# define CGAL_partition_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_partition_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_partition_exactness_warning_code(CODE) CODE -# define CGAL_partition_exactness_warnings 1 -#endif // CGAL_PARTITION_NO_WARNINGS - - -#undef CGAL_partition_expensive_warning -#undef CGAL_partition_expensive_warning_msg -#undef CGAL_partition_expensive_warning_code - -#if defined(CGAL_PARTITION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_partition_expensive_warning(EX) (static_cast(0)) -# define CGAL_partition_expensive_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_partition_expensive_warning_code(CODE) -#else -# define CGAL_partition_expensive_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_partition_expensive_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_partition_expensive_warning_code(CODE) CODE -# define CGAL_partition_expensive_warnings 1 -#endif // CGAL_PARTITION_NO_WARNINGS - - -#undef CGAL_partition_expensive_exactness_warning -#undef CGAL_partition_expensive_exactness_warning_msg -#undef CGAL_partition_expensive_exactness_warning_code - -#if defined(CGAL_PARTITION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_partition_expensive_exactness_warning(EX) (static_cast(0)) -# define CGAL_partition_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_partition_expensive_exactness_warning_code(CODE) -#else -# define CGAL_partition_expensive_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_partition_expensive_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_partition_expensive_exactness_warning_code(CODE) CODE -# define CGAL_partition_expensive_exactness_warnings 1 -#endif // CGAL_PARTITION_NO_WARNINGS diff --git a/Partition_2/include/CGAL/Partition_2/partition_greene_approx_convex_2.h b/Partition_2/include/CGAL/Partition_2/partition_greene_approx_convex_2.h index 8f3d54ce5dd..194e777a188 100644 --- a/Partition_2/include/CGAL/Partition_2/partition_greene_approx_convex_2.h +++ b/Partition_2/include/CGAL/Partition_2/partition_greene_approx_convex_2.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -90,7 +90,7 @@ void erase_vertices(BidirectionalCirculator first, #endif it = first.current_iterator(); - CGAL_partition_assertion (it != polygon.end()); + CGAL_assertion (it != polygon.end()); while ( (it != polygon.end()) && (*it != *last) ) { @@ -692,9 +692,9 @@ void ga_convex_decomposition(ForwardIterator first, ForwardIterator beyond, Vertex_list polygon(first, beyond); - CGAL_partition_precondition( + CGAL_precondition( orientation_2(polygon.begin(), polygon.end(), traits) == COUNTERCLOCKWISE); - CGAL_partition_precondition( + CGAL_precondition( is_y_monotone_2(polygon.begin(), polygon.end(), traits)); Vertex_circulator point_ref(&polygon); @@ -806,7 +806,7 @@ OutputIterator partition_greene_approx_convex_2(InputIterator first, #endif // no postconditions Polygon_2 polygon(first, beyond); - CGAL_partition_precondition( + CGAL_precondition( orientation_2(polygon.vertices_begin(), polygon.vertices_end(), traits) == COUNTERCLOCKWISE); @@ -822,7 +822,7 @@ OutputIterator partition_greene_approx_convex_2(InputIterator first, (*MP_it).vertices_end(), res, traits); } - CGAL_partition_postcondition( + CGAL_postcondition( convex_partition_is_valid_2(polygon.vertices_begin(), polygon.vertices_end(), res.output_so_far_begin(), diff --git a/Partition_2/include/CGAL/Partition_2/partition_optimal_convex_2.h b/Partition_2/include/CGAL/Partition_2/partition_optimal_convex_2.h index 0b87e73eb84..f5f500720a4 100644 --- a/Partition_2/include/CGAL/Partition_2/partition_optimal_convex_2.h +++ b/Partition_2/include/CGAL/Partition_2/partition_optimal_convex_2.h @@ -67,7 +67,7 @@ #include #include #include -#include +#include #include #include #include @@ -520,7 +520,7 @@ OutputIterator partition_optimal_convex_2(InputIterator first, #endif // no postconditions P_Polygon_2 polygon(first, beyond,traits); - CGAL_partition_precondition( + CGAL_precondition( orientation_2(polygon.begin(), polygon.end(), traits) == COUNTERCLOCKWISE); #ifdef CGAL_PARTITION_OPTIMAL_CONVEX_DEBUG @@ -559,7 +559,7 @@ OutputIterator partition_optimal_convex_2(InputIterator first, // be pruned away. These crop up when there are collinear vertices. // See explanation at top of file. polygon.partition(res, 1); - CGAL_partition_postcondition( + CGAL_postcondition( convex_partition_is_valid_2(polygon.begin(), polygon.end(), res.output_so_far_begin(), res.output_so_far_end(), traits) diff --git a/Partition_2/include/CGAL/Partition_2/partition_y_monotone_2.h b/Partition_2/include/CGAL/Partition_2/partition_y_monotone_2.h index a4918e5548f..d74bc9b9db8 100644 --- a/Partition_2/include/CGAL/Partition_2/partition_y_monotone_2.h +++ b/Partition_2/include/CGAL/Partition_2/partition_y_monotone_2.h @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include @@ -426,7 +426,7 @@ OutputIterator partition_y_monotone_2(InputIterator first, #endif // no postcondition P_Polygon_2 polygon(first, beyond, traits); - CGAL_partition_precondition( + CGAL_precondition( orientation_2(polygon.begin(), polygon.end(), traits) == COUNTERCLOCKWISE); Circulator circ(polygon.begin(), polygon.end()), done = circ; @@ -484,7 +484,7 @@ OutputIterator partition_y_monotone_2(InputIterator first, #endif polygon.partition(res, 0); - CGAL_partition_postcondition( + CGAL_postcondition( y_monotone_partition_is_valid_2(polygon.begin(), polygon.end(), res.output_so_far_begin(), res.output_so_far_end(), traits)); diff --git a/Partition_2/include/CGAL/partition_is_valid_2.h b/Partition_2/include/CGAL/partition_is_valid_2.h index 71ddd0d66e3..f6a5f2bbd7f 100644 --- a/Partition_2/include/CGAL/partition_is_valid_2.h +++ b/Partition_2/include/CGAL/partition_is_valid_2.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -147,8 +147,8 @@ partition_is_valid_2 (InputIterator point_first, InputIterator point_last, for (;point_first != point_last; point_first++) orig_poly.push_back(*point_first); - CGAL_partition_precondition(orientation_2(orig_poly.begin(),orig_poly.end(), - traits) == COUNTERCLOCKWISE); + CGAL_precondition(orientation_2(orig_poly.begin(),orig_poly.end(), + traits) == COUNTERCLOCKWISE); P_Vertex_map output_vertex_set(poly_first, poly_last, traits); @@ -163,7 +163,7 @@ partition_is_valid_2 (InputIterator point_first, InputIterator point_last, std::cout << "Polygon " << poly_num << " is " << std::endl; std::cout << *poly_first << std::endl; #endif - CGAL_partition_assertion ( + CGAL_assertion ( orientation_2(vtx_begin, vtx_end, traits) == COUNTERCLOCKWISE); if (!is_valid(vtx_begin, vtx_end)) { diff --git a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_Delaunay_triangulation_2.h b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_Delaunay_triangulation_2.h index 71c327057ae..03537714d2a 100644 --- a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_Delaunay_triangulation_2.h +++ b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_Delaunay_triangulation_2.h @@ -131,7 +131,7 @@ public: Periodic_2_Delaunay_triangulation_2(const Periodic_2_Delaunay_triangulation_2 &tr) : Base(tr) { - CGAL_triangulation_postcondition( is_valid(true) ); + CGAL_postcondition( is_valid(true) ); } /// Constructor with insertion of points @@ -467,7 +467,7 @@ public: OutputItBoundaryEdges eit, Face_handle start = Face_handle()) const { - CGAL_triangulation_precondition( dimension() == 2); + CGAL_precondition( dimension() == 2); int li; Locate_type lt; Face_handle fh = locate(p, lt, li, start); @@ -487,7 +487,7 @@ public: pit = propagate_conflicts(p, fh, 2, pit); return pit; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return std::make_pair(fit, eit); } @@ -836,7 +836,7 @@ is_valid(bool verbose, int level) const side_of_oriented_circle(*p[0], *p[1], *p[2], *p[3], off[0], off[1], off[2], off[3], false); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); } } } @@ -866,7 +866,7 @@ typename Periodic_2_Delaunay_triangulation_2::Vertex_handle Periodic_2_Delaunay_triangulation_2:: nearest_vertex_2D(const Point& p, Face_handle f) const { - CGAL_triangulation_precondition(dimension() == 2); + CGAL_precondition(dimension() == 2); f = locate(p, f); typename Geom_traits::Compare_distance_2 compare_distance = @@ -914,7 +914,7 @@ typename Periodic_2_Delaunay_triangulation_2::Point Periodic_2_Delaunay_triangulation_2:: dual (Face_handle f) const { - CGAL_triangulation_precondition (dimension() == 2); + CGAL_precondition (dimension() == 2); return circumcenter(f); } @@ -958,9 +958,9 @@ typename Periodic_2_Delaunay_triangulation_2::Vertex_handle Periodic_2_Delaunay_triangulation_2:: insert(const Point &p, Face_handle start) { - CGAL_triangulation_assertion((domain().xmin() <= p.x()) && + CGAL_assertion((domain().xmin() <= p.x()) && (p.x() < domain().xmax())); - CGAL_triangulation_assertion((domain().ymin() <= p.y()) && + CGAL_assertion((domain().ymin() <= p.y()) && (p.y() < domain().ymax())); if (empty()) @@ -1006,7 +1006,7 @@ insert(const Point &p, Locate_type lt, Face_handle loc, int li) { typename Base::Virtual_vertex_reverse_map_it vertices_it = this->virtual_vertices_reverse().find(vh); - CGAL_triangulation_assertion(vertices_it != this->virtual_vertices_reverse().end()); + CGAL_assertion(vertices_it != this->virtual_vertices_reverse().end()); const std::vector &virtual_vertices = vertices_it->second; for (size_t i = 0; i < virtual_vertices.size(); ++i) { @@ -1016,7 +1016,7 @@ insert(const Point &p, Locate_type lt, Face_handle loc, int li) this->try_to_convert_to_one_cover(); if (is_1_cover()) { - CGAL_triangulation_assertion(is_valid()); + CGAL_assertion(is_valid()); } } } @@ -1167,8 +1167,8 @@ remove(Vertex_handle v) // Make sure we have the original vertex CGAL_assertion(v == this->get_original_vertex(v)); - CGAL_triangulation_precondition(v != Vertex_handle()); - CGAL_triangulation_precondition(dimension() == 2); + CGAL_precondition(v != Vertex_handle()); + CGAL_precondition(dimension() == 2); if ( this->number_of_vertices() == 1) { @@ -5070,7 +5070,7 @@ side_of_oriented_circle(const Point &p0, const Point &p1, const Point &p2, if (points[i] == &p0 && (o = orientation(p, p1, p2)) != COLLINEAR) return Oriented_side(o); } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return ON_NEGATIVE_SIDE; } @@ -5114,7 +5114,7 @@ side_of_oriented_circle(const Point &p0, const Point &p1, const Point &p2, != COLLINEAR)) return Oriented_side(orient); } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return ON_NEGATIVE_SIDE; } diff --git a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_offset_2.h b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_offset_2.h index 574fd1d31ec..1692ae346ec 100644 --- a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_offset_2.h +++ b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_offset_2.h @@ -16,7 +16,7 @@ #include -#include +#include #include namespace CGAL @@ -71,14 +71,14 @@ public: int &operator[](int i) { if (i == 0) return _offx; - CGAL_triangulation_assertion(i == 1); + CGAL_assertion(i == 1); return _offy; } /// Return the i-th entry of o. int operator[](int i) const { if (i == 0) return _offx; - CGAL_triangulation_assertion(i == 1); + CGAL_assertion(i == 1); return _offy; } /// Add o' to o using vector addition. diff --git a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2.h b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2.h index 4104f5d9923..a4ca4e36a30 100644 --- a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2.h +++ b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_2.h @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include @@ -418,8 +418,8 @@ public: /// \pre i == {0,1,2} Periodic_segment periodic_segment(Face_handle f, int i) const { - CGAL_triangulation_precondition( number_of_vertices() != 0 ); - CGAL_triangulation_precondition( i >= 0 && i <= 2); + CGAL_precondition( number_of_vertices() != 0 ); + CGAL_precondition( i >= 0 && i <= 2); return make_array(periodic_point(f, ccw(i)), periodic_point(f, cw(i))); } @@ -941,9 +941,9 @@ public: Offset get_neighbor_offset(Face_handle fh, int i, Face_handle nb, int j) const { // Redundance in the signature - CGAL_triangulation_precondition(fh->neighbor(i) == nb); - CGAL_triangulation_precondition(nb->neighbor(j) == fh); - CGAL_triangulation_precondition(fh->vertex(cw(i)) == nb->vertex(ccw(j))); + CGAL_precondition(fh->neighbor(i) == nb); + CGAL_precondition(nb->neighbor(j) == fh); + CGAL_precondition(fh->vertex(cw(i)) == nb->vertex(ccw(j))); return int_to_off(nb->offset(ccw(j))) - int_to_off(fh->offset(cw(i))); } @@ -975,8 +975,8 @@ public: /// Converts an offset to a bit pattern where bit1==offx and bit0==offy. int off_to_int(const Offset & off) const { - CGAL_triangulation_assertion( off.x() == 0 || off.x() == 1 ); - CGAL_triangulation_assertion( off.y() == 0 || off.y() == 1 ); + CGAL_assertion( off.x() == 0 || off.x() == 1 ); + CGAL_assertion( off.y() == 0 || off.y() == 1 ); int i = ((off.x() & 1) << 1) + (off.y() & 1); return i; } @@ -1018,9 +1018,9 @@ public: const std::vector& periodic_copies(const Vertex_handle v) const { - CGAL_triangulation_precondition(number_of_sheets() != make_array(1, 1) ); - CGAL_triangulation_precondition(_virtual_vertices.find(v) == _virtual_vertices.end()); - CGAL_triangulation_assertion(_virtual_vertices_reverse.find(v) != _virtual_vertices_reverse.end()); + CGAL_precondition(number_of_sheets() != make_array(1, 1) ); + CGAL_precondition(_virtual_vertices.find(v) == _virtual_vertices.end()); + CGAL_assertion(_virtual_vertices_reverse.find(v) != _virtual_vertices_reverse.end()); return _virtual_vertices_reverse.find(v)->second; } @@ -1044,9 +1044,9 @@ protected: // than sqrt(0.166) is fulfilled. if (_too_long_edge_counter == 0 && !is_1_cover()) { - CGAL_triangulation_expensive_assertion( is_valid() ); + CGAL_expensive_assertion( is_valid() ); this->convert_to_1_sheeted_covering(); - CGAL_triangulation_expensive_assertion( is_valid() ); + CGAL_expensive_assertion( is_valid() ); } } @@ -1218,7 +1218,7 @@ protected: /// Returns the offset such that (p, o) lies on the bounded side of the face f. Offset get_location_offset(Face_handle f, const Point &p, const Offset &o) const { - CGAL_triangulation_precondition( number_of_vertices() != 0 ); + CGAL_precondition( number_of_vertices() != 0 ); if (is_1_cover() && f->has_zero_offsets()) { @@ -1296,14 +1296,14 @@ protected: } } - CGAL_triangulation_assertion((std::min)((std::min)(off0[0], off1[0]), off2[0]) == 0); - CGAL_triangulation_assertion((std::min)((std::min)(off0[1], off1[1]), off2[1]) == 0); - CGAL_triangulation_assertion((0 <= off0[0]) && (off0[0] < 2)); - CGAL_triangulation_assertion((0 <= off1[0]) && (off1[0] < 2)); - CGAL_triangulation_assertion((0 <= off2[0]) && (off2[0] < 2)); - CGAL_triangulation_assertion((0 <= off0[1]) && (off0[1] < 2)); - CGAL_triangulation_assertion((0 <= off1[1]) && (off1[1] < 2)); - CGAL_triangulation_assertion((0 <= off2[1]) && (off2[1] < 2)); + CGAL_assertion((std::min)((std::min)(off0[0], off1[0]), off2[0]) == 0); + CGAL_assertion((std::min)((std::min)(off0[1], off1[1]), off2[1]) == 0); + CGAL_assertion((0 <= off0[0]) && (off0[0] < 2)); + CGAL_assertion((0 <= off1[0]) && (off1[0] < 2)); + CGAL_assertion((0 <= off2[0]) && (off2[0] < 2)); + CGAL_assertion((0 <= off0[1]) && (off0[1] < 2)); + CGAL_assertion((0 <= off1[1]) && (off1[1] < 2)); + CGAL_assertion((0 <= off2[1]) && (off2[1] < 2)); int o0i = ((off0[0] & 1) << 1) + (off0[1] & 1); int o1i = ((off1[0] & 1) << 1) + (off1[1] & 1); @@ -1326,11 +1326,11 @@ protected: } bool has_self_edges(Face_handle fh) const { - CGAL_triangulation_assertion((fh->vertex(0) != fh->vertex(1)) || - (fh->offset(0) != fh->offset(1))); - CGAL_triangulation_assertion((fh->vertex(0) != fh->vertex(2)) || - (fh->offset(0) != fh->offset(2))); - CGAL_triangulation_assertion((fh->vertex(1) != fh->vertex(2)) || + CGAL_assertion((fh->vertex(0) != fh->vertex(1)) || + (fh->offset(0) != fh->offset(1))); + CGAL_assertion((fh->vertex(0) != fh->vertex(2)) || + (fh->offset(0) != fh->offset(2))); + CGAL_assertion((fh->vertex(1) != fh->vertex(2)) || (fh->offset(1) != fh->offset(2))); return ((fh->vertex(0) == fh->vertex(1)) || (fh->vertex(0) == fh->vertex(2)) || @@ -1408,7 +1408,7 @@ Periodic_2_triangulation_2::Periodic_2_triangulation_2( , _domain(domain) , _too_long_edge_counter(0) { - CGAL_triangulation_precondition(_domain.xmax() - _domain.xmin() == + CGAL_precondition(_domain.xmax() - _domain.xmin() == _domain.ymax() - _domain.ymin()); set_domain(_domain); } @@ -1470,7 +1470,7 @@ copy_multiple_covering(const Periodic_2_triangulation_2 & tr) vlist.push_back(vit); _virtual_vertices_reverse.insert( std::make_pair(vit, std::vector(8))); - CGAL_triangulation_assertion(_virtual_vertices_reverse.find(vit) + CGAL_assertion(_virtual_vertices_reverse.find(vit) ->second.size() == 8); } } @@ -1491,7 +1491,7 @@ copy_multiple_covering(const Periodic_2_triangulation_2 & tr) std::make_pair(*vlist_it, off))); _virtual_vertices_reverse.find(*vlist_it) ->second[3 * off[0] + off[1] - 1] = vit2; - CGAL_triangulation_assertion(get_offset(vit2) == off); + CGAL_assertion(get_offset(vit2) == off); } } // Cleanup vertex offsets @@ -1533,7 +1533,7 @@ copy_multiple_covering(const Periodic_2_triangulation_2 & tr) Vertex_handle v_no = eit->first->vertex(i); if (squared_distance(p1, p2) > _edge_length_threshold) { - CGAL_triangulation_assertion( + CGAL_assertion( find(_too_long_edges[v_no].begin(), _too_long_edges[v_no].end(), edge_to_add.second) == _too_long_edges[v_no].end()); @@ -1562,7 +1562,7 @@ void Periodic_2_triangulation_2::copy_triangulation( copy_multiple_covering(tr); } CGAL_assertion(_too_long_edge_counter == tr._too_long_edge_counter); - CGAL_triangulation_expensive_postcondition(*this == tr); + CGAL_expensive_postcondition(*this == tr); } template @@ -1628,7 +1628,7 @@ bool Periodic_2_triangulation_2::is_valid(Face_handle fh, bool /*verbos std::cerr << "Offset: " << o << std::endl; } std::cerr << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); } return result; @@ -1638,7 +1638,7 @@ template bool Periodic_2_triangulation_2::is_valid(bool verbose, int level) const { bool result = _tds.is_valid(verbose, level); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); if (dimension() == 2) { @@ -1667,36 +1667,36 @@ bool Periodic_2_triangulation_2::is_valid(bool verbose, int level) cons } } } - CGAL_triangulation_assertion(result); + CGAL_assertion(result); // Check for the right number of simplices int copies = number_of_sheets()[0] * number_of_sheets()[1]; result &= (number_of_stored_vertices() == copies * number_of_vertices()); result &= (number_of_stored_edges() == copies * number_of_edges()); result &= (number_of_stored_faces() == copies * number_of_faces()); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); // check number of euler characteristic. This cannot be done by the Tds // which does not know the genus result &= (number_of_stored_vertices() - number_of_stored_edges() + number_of_stored_faces() == 0); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); result &= !has_self_edges(); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); // Edges should not be longer than 1 periodicity for (Face_iterator fit = faces_begin(); fit != faces_end(); ++fit) { result &= is_valid(fit, verbose, level); } - CGAL_triangulation_assertion(result); + CGAL_assertion(result); result &= is_1_cover() == _virtual_vertices.empty(); result &= is_1_cover() == _virtual_vertices_reverse.empty(); result &= (_virtual_vertices.size() == (number_of_sheets()[0] * number_of_sheets()[1] - 1) * _virtual_vertices_reverse.size()); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); for (Virtual_vertex_map_it it = _virtual_vertices.begin(); it != _virtual_vertices.end(); ++it) @@ -1722,7 +1722,7 @@ bool Periodic_2_triangulation_2::is_valid(bool verbose, int level) cons result &= false; } } - CGAL_triangulation_assertion(result); + CGAL_assertion(result); for (Virtual_vertex_reverse_map_it it = _virtual_vertices_reverse.begin(); it != _virtual_vertices_reverse.end(); ++it) @@ -1755,20 +1755,20 @@ bool Periodic_2_triangulation_2::is_valid_too_long_edges(bool verbose, bool result = true; result &= is_1_cover() == _too_long_edges.empty(); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); size_t too_long_edges = 0; for (Too_long_edges_map_it it = _too_long_edges.begin(); it != _too_long_edges.end(); ++it) { too_long_edges += it->second.size(); } - CGAL_triangulation_assertion(result); + CGAL_assertion(result); if (_too_long_edge_counter != too_long_edges) { if (verbose) std::cout << "Too long edge counter is incorrect: " << _too_long_edge_counter << " != " << too_long_edges << std::endl; result = false; } - CGAL_triangulation_assertion(result); + CGAL_assertion(result); /// Expensive check whether the right too long edges are in the list if (is_1_cover()) @@ -1781,7 +1781,7 @@ bool Periodic_2_triangulation_2::is_valid_too_long_edges(bool verbose, Point p2 = construct_point(vh2->point(), get_offset(eit->first, cw(eit->second))); result &= (!edge_is_too_long(p1, p2)); } - CGAL_triangulation_assertion(result); + CGAL_assertion(result); } else { @@ -1797,7 +1797,7 @@ bool Periodic_2_triangulation_2::is_valid_too_long_edges(bool verbose, if (&*vh2 < &*vh1) std::swap(vh1, vh2); - CGAL_triangulation_assertion(&*vh1 < &*vh2); + CGAL_assertion(&*vh1 < &*vh2); bool too_long = edge_is_too_long(p1, p2); if (too_long != edge_is_too_long(p2, p1)) @@ -1805,7 +1805,7 @@ bool Periodic_2_triangulation_2::is_valid_too_long_edges(bool verbose, if (verbose) std::cout << "Long edge criterion not symmetric c(v1,v2) != c(v2,v1)" << std::endl; result = false; } - CGAL_triangulation_assertion(result); + CGAL_assertion(result); Too_long_edges_map_it it = _too_long_edges.find(vh1); if (it == _too_long_edges.end()) @@ -1816,7 +1816,7 @@ bool Periodic_2_triangulation_2::is_valid_too_long_edges(bool verbose, result = false; } result &= !too_long; - CGAL_triangulation_assertion(result); + CGAL_assertion(result); } else { @@ -1829,7 +1829,7 @@ bool Periodic_2_triangulation_2::is_valid_too_long_edges(bool verbose, if (verbose) std::cout << "2. Too long edge not in the data structure" << std::endl; result = false; } - CGAL_triangulation_assertion(result); + CGAL_assertion(result); } else { @@ -1838,7 +1838,7 @@ bool Periodic_2_triangulation_2::is_valid_too_long_edges(bool verbose, if (verbose) std::cout << "Edge is not too long, but contained in the data structure" << std::endl; result = false; } - CGAL_triangulation_assertion(result); + CGAL_assertion(result); } } } @@ -1849,7 +1849,7 @@ bool Periodic_2_triangulation_2::is_valid_too_long_edges(bool verbose, std::cout << "Counts do not match: " << _too_long_edge_counter << " != " << too_long_edges << std::endl; result = false; } - CGAL_triangulation_assertion(result); + CGAL_assertion(result); } return result; @@ -1926,9 +1926,9 @@ void Periodic_2_triangulation_2::flip(Face_handle f, int i) vh2_offset = it_vh2->second.second; } - CGAL_triangulation_assertion( + CGAL_assertion( virtual_vertices_reverse().find(vh1) != virtual_vertices_reverse().end()); - CGAL_triangulation_assertion( + CGAL_assertion( virtual_vertices_reverse().find(vh2) != virtual_vertices_reverse().end()); const std::vector &v1s = virtual_vertices_reverse().find(vh1)->second; @@ -1972,11 +1972,11 @@ void Periodic_2_triangulation_2::flip(Face_handle f, int i) template void Periodic_2_triangulation_2::flip_single_edge(Face_handle f, int i) { - CGAL_triangulation_precondition(f != Face_handle()); - CGAL_triangulation_precondition(i == 0 || i == 1 || i == 2); - CGAL_triangulation_precondition(dimension() == 2); + CGAL_precondition(f != Face_handle()); + CGAL_precondition(i == 0 || i == 1 || i == 2); + CGAL_precondition(dimension() == 2); - CGAL_triangulation_precondition(flippable(f, i)); + CGAL_precondition(flippable(f, i)); if (!is_1_cover()) remove_too_long_edge(f, i); @@ -2012,7 +2012,7 @@ void Periodic_2_triangulation_2::flip_single_edge(Face_handle f, int i) } else { - CGAL_triangulation_assertion(nb_offset.x() == -1); + CGAL_assertion(nb_offset.x() == -1); CGAL_assertion((offsets[3] & 2) == 0); offsets[3] |= 2; } @@ -2028,20 +2028,20 @@ void Periodic_2_triangulation_2::flip_single_edge(Face_handle f, int i) } else { - CGAL_triangulation_assertion(nb_offset.y() == -1); + CGAL_assertion(nb_offset.y() == -1); CGAL_assertion((offsets[3] & 1) == 0); offsets[3] |= 1; } } CGAL_assertion((offsets[0] & offsets[1] & offsets[2] & offsets[3]) == 0); - CGAL_triangulation_assertion_code(Vertex_handle vh = f->vertex(i)); - CGAL_triangulation_assertion_code(Vertex_handle vh_ccw = f->vertex(ccw(i))); + CGAL_assertion_code(Vertex_handle vh = f->vertex(i)); + CGAL_assertion_code(Vertex_handle vh_ccw = f->vertex(ccw(i))); _tds.flip(f, i); // Combinatorial checks - CGAL_triangulation_assertion(vh == f->vertex(i)); - CGAL_triangulation_assertion(vh_ccw == f->vertex(ccw(i))); - CGAL_triangulation_assertion(f->vertex(i) == nb->vertex(cw(nb_index))); - CGAL_triangulation_assertion(f->vertex(cw(i)) == nb->vertex(nb_index)); + CGAL_assertion(vh == f->vertex(i)); + CGAL_assertion(vh_ccw == f->vertex(ccw(i))); + CGAL_assertion(f->vertex(i) == nb->vertex(cw(nb_index))); + CGAL_assertion(f->vertex(cw(i)) == nb->vertex(nb_index)); // Restore the offsets int new_off[3]; @@ -2065,7 +2065,7 @@ void Periodic_2_triangulation_2::remove_from_virtual_copies(Vertex_handle v) { typename Virtual_vertex_reverse_map::iterator rev_it = _virtual_vertices_reverse.find(v); - CGAL_triangulation_assertion(rev_it != _virtual_vertices_reverse.end()); + CGAL_assertion(rev_it != _virtual_vertices_reverse.end()); const std::vector &virtual_copies = rev_it->second; for (size_t i = 0; i < virtual_copies.size(); ++i) @@ -2176,16 +2176,14 @@ Gt, Tds >::insert_first(const Point& p) _tds.set_dimension(2); // create the base for too_long_edges; - CGAL_triangulation_assertion(_too_long_edges.empty() ); - CGAL_triangulation_assertion(_too_long_edge_counter == 0); + CGAL_assertion(_too_long_edges.empty() ); + CGAL_assertion(_too_long_edge_counter == 0); // Insert all vertices as the first vertex in the _too_long_edges list - int k = 0; std::list empty_list; for (Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++vit) { _too_long_edges[vit] = empty_list; - k++; } // Insert all edges as all edges are too long @@ -2224,14 +2222,14 @@ Periodic_2_triangulation_2::insert_in_edge(const Point& p, const Offset // Insert in edge calls an insert_in_face and a flip. // Therefore there is no need to update the too_long_edges bookkeeping directly. - CGAL_triangulation_assertion(number_of_vertices() != 0); - CGAL_triangulation_assertion((!is_1_cover()) || (o == Offset())); + CGAL_assertion(number_of_vertices() != 0); + CGAL_assertion((!is_1_cover()) || (o == Offset())); // Backup of the neighbor and its relative offset Face_handle nb = f->neighbor(i); int j = nb->index(f); - CGAL_triangulation_assertion_code(Offset current_offset = get_location_offset(f, p, o)); - CGAL_triangulation_assertion + CGAL_assertion_code(Offset current_offset = get_location_offset(f, p, o)); + CGAL_assertion (orientation(f->vertex(cw(i))->point(), p, f->vertex(ccw(i))->point(), get_offset(f, cw(i)), combine_offsets(o, current_offset), get_offset(f, ccw(i))) == COLLINEAR && collinear_between(f->vertex(cw(i))->point(), p, f->vertex(ccw(i))->point(), @@ -2256,9 +2254,9 @@ Periodic_2_triangulation_2::insert_in_face(const Point& p, const Offset Face_handle f, Vertex_handle vh) { - CGAL_triangulation_assertion(f != Face_handle()); - CGAL_triangulation_assertion(number_of_vertices() != 0); - CGAL_triangulation_assertion((!is_1_cover()) || (o == Offset())); + CGAL_assertion(f != Face_handle()); + CGAL_assertion(number_of_vertices() != 0); + CGAL_assertion((!is_1_cover()) || (o == Offset())); const bool simplicity_criterion = f->has_zero_offsets() && o.is_zero(); @@ -2269,21 +2267,21 @@ Periodic_2_triangulation_2::insert_in_face(const Point& p, const Offset Face_handle nb[3]; int nb_index[3]; int offsets[3]; - CGAL_triangulation_assertion_code( Vertex_handle vertices[3]; ) + CGAL_assertion_code( Vertex_handle vertices[3]; ) if (!simplicity_criterion) { // Choose the periodic copy of tester.point() that is inside c. current_off = get_location_offset(f, p, o); - CGAL_triangulation_assertion(oriented_side(f, p, combine_offsets(o, current_off)) != ON_NEGATIVE_SIDE); + CGAL_assertion(oriented_side(f, p, combine_offsets(o, current_off)) != ON_NEGATIVE_SIDE); for (int i = 0; i < 3; ++i) { nb[i] = f->neighbor(i); nb_index[i] = nb[i]->index(f); offsets[i] = f->offset(i); - CGAL_triangulation_assertion_code( vertices[i] = f->vertex(i); ); + CGAL_assertion_code( vertices[i] = f->vertex(i); ); } } @@ -2301,8 +2299,8 @@ Periodic_2_triangulation_2::insert_in_face(const Point& p, const Offset Face_handle new_face = nb[i]->neighbor(nb_index[i]); int v_index = new_face->index(v); - CGAL_triangulation_assertion(new_face->vertex(ccw(v_index)) == vertices[ccw(i)]); - CGAL_triangulation_assertion(new_face->vertex(cw(v_index)) == vertices[cw(i)]); + CGAL_assertion(new_face->vertex(ccw(v_index)) == vertices[ccw(i)]); + CGAL_assertion(new_face->vertex(cw(v_index)) == vertices[cw(i)]); new_offsets[v_index] = v_offset; new_offsets[ccw(v_index)] = offsets[ccw(i)]; @@ -2330,9 +2328,9 @@ template typename Periodic_2_triangulation_2::Vertex_handle Periodic_2_triangulation_2::insert(const Point &p, Face_handle start) { - CGAL_triangulation_assertion((_domain.xmin() <= p.x()) && + CGAL_assertion((_domain.xmin() <= p.x()) && (p.x() < _domain.xmax())); - CGAL_triangulation_assertion((_domain.ymin() <= p.y()) && + CGAL_assertion((_domain.ymin() <= p.y()) && (p.y() < _domain.ymax())); if (number_of_stored_vertices() == 0) @@ -2383,9 +2381,9 @@ Periodic_2_triangulation_2::insert(const Point& p, } // vstart should be non-virtual, but should have virtual copies - CGAL_triangulation_assertion(_virtual_vertices.find(vstart) + CGAL_assertion(_virtual_vertices.find(vstart) == _virtual_vertices.end()); - CGAL_triangulation_assertion(_virtual_vertices_reverse.find(vstart) + CGAL_assertion(_virtual_vertices_reverse.find(vstart) != _virtual_vertices_reverse.end()); } @@ -2455,7 +2453,7 @@ Gt, Tds >::insert(const Point& p, const Offset &o, Locate_type lt, } default: { - CGAL_triangulation_assertion(false); // locate step failed + CGAL_assertion(false); // locate step failed return Vertex_handle(); } } @@ -2744,7 +2742,7 @@ bool Periodic_2_triangulation_2::compare_walks(const Point& p, std::cerr << std::endl; } - CGAL_triangulation_assertion(b); + CGAL_assertion(b); return b; } @@ -2959,9 +2957,9 @@ typename Periodic_2_triangulation_2::Face_handle Periodic_2_triangulati Gt, Tds >::locate(const Point& p, const Offset &o, Locate_type& lt, int& li, Face_handle start) const { - CGAL_triangulation_assertion((_domain.xmin() <= p.x()) && + CGAL_assertion((_domain.xmin() <= p.x()) && (p.x() < _domain.xmax())); - CGAL_triangulation_assertion((_domain.ymin() <= p.y()) && + CGAL_assertion((_domain.ymin() <= p.y()) && (p.y() < _domain.ymax())); if (dimension() <= 0) @@ -3000,7 +2998,7 @@ void Periodic_2_triangulation_2::convert_to_1_sheeted_covering() { if (is_1_cover()) return; - CGAL_triangulation_expensive_assertion(is_triangulation_in_1_sheet()); + CGAL_expensive_assertion(is_triangulation_in_1_sheet()); bool to_delete, has_simplifiable_offset; Virtual_vertex_map_it vvmit; @@ -3087,16 +3085,16 @@ void Periodic_2_triangulation_2::convert_to_1_sheeted_covering() // The vector from nb to the "original" periodic copy of nb, that is // the copy that will not be deleted. Offset difference_offset(x, y); - CGAL_triangulation_assertion( !difference_offset.is_null() ); + CGAL_assertion( !difference_offset.is_null() ); // We now have to find the "original" periodic copy of nb from // its vertices. Therefore, we first have to find the vertices. for (int j = 0; j < 3; j++) { - CGAL_triangulation_assertion( (off[j] - difference_offset)[0] >= 0); - CGAL_triangulation_assertion( (off[j] - difference_offset)[1] >= 0); - CGAL_triangulation_assertion( (off[j] - difference_offset)[0] < 3); - CGAL_triangulation_assertion( (off[j] - difference_offset)[1] < 3); + CGAL_assertion( (off[j] - difference_offset)[0] >= 0); + CGAL_assertion( (off[j] - difference_offset)[1] >= 0); + CGAL_assertion( (off[j] - difference_offset)[0] < 3); + CGAL_assertion( (off[j] - difference_offset)[1] < 3); // find the Vertex_handles of the vertices of the "original" // periodic copy of nb. If the vertex is inside the original @@ -3151,19 +3149,19 @@ void Periodic_2_triangulation_2::convert_to_1_sheeted_covering() off[i] = Offset(); get_vertex(it, i, vert[i], off[i]); it->set_vertex(i, vert[i]); - CGAL_triangulation_assertion(vert[i]->point()[0] < _domain.xmax()); - CGAL_triangulation_assertion(vert[i]->point()[1] < _domain.ymax()); - CGAL_triangulation_assertion(vert[i]->point()[0] >= _domain.xmin()); - CGAL_triangulation_assertion(vert[i]->point()[1] >= _domain.ymin()); + CGAL_assertion(vert[i]->point()[0] < _domain.xmax()); + CGAL_assertion(vert[i]->point()[1] < _domain.ymax()); + CGAL_assertion(vert[i]->point()[0] >= _domain.xmin()); + CGAL_assertion(vert[i]->point()[1] >= _domain.ymin()); // redirect also the face pointer of the vertex. it->vertex(i)->set_face(it); } // Set the offsets. set_offsets(it, off[0], off[1], off[2]); - CGAL_triangulation_assertion( int_to_off(it->offset(0)) == off[0] ); - CGAL_triangulation_assertion( int_to_off(it->offset(1)) == off[1] ); - CGAL_triangulation_assertion( int_to_off(it->offset(2)) == off[2] ); + CGAL_assertion( int_to_off(it->offset(0)) == off[0] ); + CGAL_assertion( int_to_off(it->offset(1)) == off[1] ); + CGAL_assertion( int_to_off(it->offset(2)) == off[2] ); } } @@ -3196,7 +3194,7 @@ void Periodic_2_triangulation_2::convert_to_1_sheeted_covering() { if (_virtual_vertices.count(vit) != 0) { - CGAL_triangulation_assertion( _virtual_vertices.count( vit ) == 1 ); + CGAL_assertion( _virtual_vertices.count( vit ) == 1 ); vertices_to_delete.push_back(vit); } } @@ -3213,7 +3211,7 @@ void Periodic_2_triangulation_2::convert_to_1_sheeted_covering() _too_long_edge_counter = 0; _too_long_edges.clear(); - CGAL_triangulation_assertion(is_1_cover()); + CGAL_assertion(is_1_cover()); } template @@ -3221,7 +3219,7 @@ void Periodic_2_triangulation_2::convert_to_9_sheeted_covering() { if (_cover == make_array(3, 3)) return; - CGAL_triangulation_precondition(is_1_cover()); + CGAL_precondition(is_1_cover()); // Create 9 copies of each vertex and write virtual_vertices and // virtual_vertices_reverse @@ -3299,7 +3297,7 @@ void Periodic_2_triangulation_2::convert_to_9_sheeted_covering() for (int i = 0; i < 3; i++) { vvrmit[i] = _virtual_vertices_reverse.find((*fit)->vertex(i)); - CGAL_triangulation_assertion( + CGAL_assertion( vvrmit[i] != _virtual_vertices_reverse.end()); vvoff[i] = int_to_off((*fit)->offset(i)); } @@ -3313,7 +3311,7 @@ void Periodic_2_triangulation_2::convert_to_9_sheeted_covering() int o_i = ((n + 1) / 3 + vvoff[i].x() + 3) % 3; int o_j = ((n + 1) + vvoff[i].y() + 3) % 3; int n_c = 3 * o_i + o_j - 1; - CGAL_triangulation_assertion(n_c >= -1); + CGAL_assertion(n_c >= -1); if (n_c == -1) vvh[i] = (*fit)->vertex(i); else @@ -3333,13 +3331,13 @@ void Periodic_2_triangulation_2::convert_to_9_sheeted_covering() { Virtual_vertex_reverse_map_it vvrmit = _virtual_vertices_reverse.find( (*fit)->vertex(i)); - CGAL_triangulation_assertion(vvrmit != _virtual_vertices_reverse.end()); + CGAL_assertion(vvrmit != _virtual_vertices_reverse.end()); Offset vvoff = int_to_off((*fit)->offset(i)); if (!vvoff.is_null()) { int n_f = 3 * vvoff.x() + vvoff.y() - 1; - CGAL_triangulation_assertion(n_f >= 0); - CGAL_triangulation_assertion(static_cast(n_f) < vvrmit->second.size()); + CGAL_assertion(n_f >= 0); + CGAL_assertion(static_cast(n_f) < vvrmit->second.size()); (*fit)->set_vertex(i, vvrmit->second[n_f]); } } @@ -3350,14 +3348,14 @@ void Periodic_2_triangulation_2::convert_to_9_sheeted_covering() for (typename std::list::iterator fit = original_faces.begin(); fit != original_faces.end(); ++fit, ++oit) { - CGAL_triangulation_assertion( oit != off_nb.end() ); + CGAL_assertion( oit != off_nb.end() ); VCRMIT c_cp = virtual_faces_reverse.find(*fit); - CGAL_triangulation_assertion(c_cp != virtual_faces_reverse.end()); + CGAL_assertion(c_cp != virtual_faces_reverse.end()); for (int i = 0; i < 3; i++) { Face_handle fit_nb = (*fit)->neighbor(i); VCRMIT c_cp_nb = virtual_faces_reverse.find(fit_nb); - CGAL_triangulation_assertion(c_cp_nb != virtual_faces_reverse.end()); + CGAL_assertion(c_cp_nb != virtual_faces_reverse.end()); Offset nboff = (*oit)[i]; for (int n = 0; n < 8; n++) { @@ -3372,16 +3370,16 @@ void Periodic_2_triangulation_2::convert_to_9_sheeted_covering() } if (n_nb == -1) { - CGAL_triangulation_assertion(fit_nb->has_vertex(c_cp->second[n]->vertex(ccw(i))) ); - CGAL_triangulation_assertion(fit_nb->has_vertex(c_cp->second[n]->vertex( cw(i))) ); + CGAL_assertion(fit_nb->has_vertex(c_cp->second[n]->vertex(ccw(i))) ); + CGAL_assertion(fit_nb->has_vertex(c_cp->second[n]->vertex( cw(i))) ); c_cp->second[n]->set_neighbor(i, fit_nb); } else { - CGAL_triangulation_assertion(n_nb >= 0); - CGAL_triangulation_assertion(static_cast(n_nb) <= c_cp_nb->second.size()); - CGAL_triangulation_assertion(c_cp_nb->second[n_nb]->has_vertex(c_cp->second[n]->vertex(ccw(i))) ); - CGAL_triangulation_assertion(c_cp_nb->second[n_nb]->has_vertex(c_cp->second[n]->vertex( cw(i))) ); + CGAL_assertion(n_nb >= 0); + CGAL_assertion(static_cast(n_nb) <= c_cp_nb->second.size()); + CGAL_assertion(c_cp_nb->second[n_nb]->has_vertex(c_cp->second[n]->vertex(ccw(i))) ); + CGAL_assertion(c_cp_nb->second[n_nb]->has_vertex(c_cp->second[n]->vertex( cw(i))) ); c_cp->second[n]->set_neighbor(i, c_cp_nb->second[n_nb]); } } @@ -3393,7 +3391,7 @@ void Periodic_2_triangulation_2::convert_to_9_sheeted_covering() for (typename std::list::iterator fit = original_faces.begin(); fit != original_faces.end(); ++fit, ++oit) { - CGAL_triangulation_assertion( oit != off_nb.end() ); + CGAL_assertion( oit != off_nb.end() ); for (int i = 0; i < 3; i++) { Offset nboff = (*oit)[i]; @@ -3401,14 +3399,14 @@ void Periodic_2_triangulation_2::convert_to_9_sheeted_covering() { Face_handle fit_nb = (*fit)->neighbor(i); VCRMIT c_cp_nb = virtual_faces_reverse.find(fit_nb); - CGAL_triangulation_assertion(c_cp_nb != virtual_faces_reverse.end()); + CGAL_assertion(c_cp_nb != virtual_faces_reverse.end()); int o_i = (3 - nboff.x()) % 3; int o_j = (3 - nboff.y()) % 3; int n_nb = 3 * o_i + o_j - 1; - CGAL_triangulation_assertion(n_nb >= 0); - CGAL_triangulation_assertion(static_cast(n_nb) <= c_cp_nb->second.size()); - CGAL_triangulation_assertion(c_cp_nb->second[n_nb]->has_vertex((*fit)->vertex(ccw(i))) ); - CGAL_triangulation_assertion(c_cp_nb->second[n_nb]->has_vertex((*fit)->vertex( cw(i))) ); + CGAL_assertion(n_nb >= 0); + CGAL_assertion(static_cast(n_nb) <= c_cp_nb->second.size()); + CGAL_assertion(c_cp_nb->second[n_nb]->has_vertex((*fit)->vertex(ccw(i))) ); + CGAL_assertion(c_cp_nb->second[n_nb]->has_vertex((*fit)->vertex( cw(i))) ); (*fit)->set_neighbor(i, c_cp_nb->second[n_nb]); } } @@ -3428,7 +3426,7 @@ void Periodic_2_triangulation_2::convert_to_9_sheeted_covering() != original_faces.end(); ++fit) { VCRMIT c_cp = virtual_faces_reverse.find(*fit); - CGAL_triangulation_assertion( c_cp != virtual_faces_reverse.end()); + CGAL_assertion( c_cp != virtual_faces_reverse.end()); Offset off[3]; for (int i = 0; i < 3; i++) off[i] = int_to_off((*fit)->offset(i)); @@ -3445,8 +3443,8 @@ void Periodic_2_triangulation_2::convert_to_9_sheeted_covering() { off_cp[i] = Offset((o_i == 2) ? off[i].x() : 0, (o_j == 2) ? off[i].y() : 0); - CGAL_triangulation_assertion(off_cp[i].x() == 0 || off_cp[i].x() == 1); - CGAL_triangulation_assertion(off_cp[i].y() == 0 || off_cp[i].y() == 1); + CGAL_assertion(off_cp[i].x() == 0 || off_cp[i].x() == 1); + CGAL_assertion(off_cp[i].y() == 0 || off_cp[i].y() == 1); } set_offsets(c_cp->second[n], off_cp[0], off_cp[1], off_cp[2]); } @@ -3458,25 +3456,23 @@ void Periodic_2_triangulation_2::convert_to_9_sheeted_covering() { //This statement does not seem to have any effect set_offsets(*fit, 0, 0, 0); - CGAL_triangulation_assertion((*fit)->offset(0) == 0); - CGAL_triangulation_assertion((*fit)->offset(1) == 0); - CGAL_triangulation_assertion((*fit)->offset(2) == 0); + CGAL_assertion((*fit)->offset(0) == 0); + CGAL_assertion((*fit)->offset(1) == 0); + CGAL_assertion((*fit)->offset(2) == 0); } _cover = make_array(3, 3); // Set up too long edges data structure - int i = 0; for (Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++vit) { _too_long_edges[vit] = std::list(); - ++i; } _too_long_edge_counter = find_too_long_edges(_too_long_edges); - CGAL_triangulation_expensive_assertion(is_valid()); + CGAL_expensive_assertion(is_valid()); - CGAL_triangulation_assertion(!is_1_cover()); + CGAL_assertion(!is_1_cover()); } // iterate over all edges and store the ones that are longer than @@ -3547,17 +3543,17 @@ inline void Periodic_2_triangulation_2::get_vertex(Vertex_handle vh_i, // if vh_i is not contained in virtual_vertices, then it is in the // original domain. vh = vh_i; - CGAL_triangulation_assertion(vh != Vertex_handle()); + CGAL_assertion(vh != Vertex_handle()); } else { // otherwise it has to be looked up as well as its offset. vh = it->second.first; off += it->second.second; - CGAL_triangulation_assertion(vh->point().x() < _domain.xmax()); - CGAL_triangulation_assertion(vh->point().y() < _domain.ymax()); - CGAL_triangulation_assertion(vh->point().x() >= _domain.xmin()); - CGAL_triangulation_assertion(vh->point().y() >= _domain.ymin()); + CGAL_assertion(vh->point().x() < _domain.xmax()); + CGAL_assertion(vh->point().y() < _domain.ymax()); + CGAL_assertion(vh->point().x() >= _domain.xmin()); + CGAL_assertion(vh->point().y() >= _domain.ymin()); } } @@ -3575,7 +3571,7 @@ GT, Tds >::get_face(const Vertex_handle* vh) const Face_circulator done(fc); do { - CGAL_triangulation_assertion( + CGAL_assertion( fc->vertex(0) == vh[2] || fc->vertex(1) == vh[2] || fc->vertex(2) == vh[2]); @@ -3591,7 +3587,7 @@ GT, Tds >::get_face(const Vertex_handle* vh) const } while (++fc != done); - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return Face_handle(); } @@ -3599,7 +3595,7 @@ template Bounded_side Periodic_2_triangulation_2::side_of_face(const Point &q, const Offset &off, Face_handle f, Locate_type <, int &li) const { - CGAL_triangulation_precondition(number_of_vertices() != 0); + CGAL_precondition(number_of_vertices() != 0); Orientation o0, o1, o2; o0 = o1 = o2 = ZERO; @@ -3607,7 +3603,7 @@ Bounded_side Periodic_2_triangulation_2::side_of_face(const Point &q, if ((cumm_off == 0) && is_1_cover()) { - CGAL_triangulation_assertion(off == Offset()); + CGAL_assertion(off == Offset()); const Point &p0 = f->vertex(0)->point(); const Point &p1 = f->vertex(1)->point(); @@ -3629,7 +3625,7 @@ Bounded_side Periodic_2_triangulation_2::side_of_face(const Point &q, p[i] = &(f->vertex(i)->point()); offs[i] = get_offset(f, i); } - CGAL_triangulation_assertion(orientation(*p[0], *p[1], *p[2], + CGAL_assertion(orientation(*p[0], *p[1], *p[2], offs[0], offs[1], offs[2]) == POSITIVE); bool found = false; for (int i = 0; (i < 4) && (!found); i++) @@ -3681,7 +3677,7 @@ Bounded_side Periodic_2_triangulation_2::side_of_face(const Point &q, default: { // impossible : cannot be on 3 edges for a real triangle - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return ON_BOUNDARY; } } @@ -3753,7 +3749,7 @@ Bounded_side Periodic_2_triangulation_2::bounded_side(const Point &p0, { // return position of point p with respect to triangle p0p1p2 - CGAL_triangulation_precondition( orientation(p0, p1, p2) != COLLINEAR); + CGAL_precondition( orientation(p0, p1, p2) != COLLINEAR); Orientation o1 = orientation(p0, p1, p); Orientation o2 = orientation(p1, p2, p); @@ -3796,7 +3792,7 @@ Bounded_side Periodic_2_triangulation_2::bounded_side(const Point &p0, const Offset &o1, const Offset &o2, const Offset &o) const { // return position of point p with respect to triangle p0p1p2 - CGAL_triangulation_precondition( orientation(p0, p1, p2, o0, o1, o2) != COLLINEAR); + CGAL_precondition( orientation(p0, p1, p2, o0, o1, o2) != COLLINEAR); Orientation orient1 = orientation(p0, p1, p, o0, o1, o); Orientation orient2 = orientation(p1, p2, p, o1, o2, o); Orientation orient3 = orientation(p2, p0, p, o2, o0, o); @@ -3995,7 +3991,7 @@ void Periodic_2_triangulation_2::insert_too_long_edge(Face_handle f, in } else { - CGAL_triangulation_precondition(&*vh2 < &*vh1); + CGAL_precondition(&*vh2 < &*vh1); if (edge_is_too_long(p2, p1) && (find(_too_long_edges[vh2].begin(), _too_long_edges[vh2].end(), vh1) == _too_long_edges[vh2].end())) { @@ -4039,7 +4035,7 @@ void Periodic_2_triangulation_2::remove_too_long_edges_in_star( } else { - CGAL_triangulation_precondition(&*vh2 < &*vh); + CGAL_precondition(&*vh2 < &*vh); if (edge_is_too_long(p1, p2) && (find(_too_long_edges[vh2].begin(), _too_long_edges[vh2].end(), vh) != _too_long_edges[vh2].end())) @@ -4190,14 +4186,14 @@ Periodic_2_triangulation_2::save(std::ostream& os) const << Offset(0, 0) << std::endl; else os << it->point() << Offset(0, 0); - CGAL_triangulation_assertion(_virtual_vertices_reverse.find(it) + CGAL_assertion(_virtual_vertices_reverse.find(it) != _virtual_vertices_reverse.end()); vv = _virtual_vertices_reverse.find(it)->second; - CGAL_triangulation_assertion(vv.size() == 8); + CGAL_assertion(vv.size() == 8); for (std::size_t j = 0; j < vv.size(); j++) { vvit = _virtual_vertices.find(vv[j]); - CGAL_triangulation_assertion(vvit != _virtual_vertices.end()); + CGAL_assertion(vvit != _virtual_vertices.end()); V[vv[j]] = i++; if (IO::is_ascii(os)) os << vv[j]->point() << std::endl @@ -4206,7 +4202,7 @@ Periodic_2_triangulation_2::save(std::ostream& os) const } } } - CGAL_triangulation_postcondition(i == _cover[0]*_cover[1]*n); + CGAL_postcondition(i == _cover[0]*_cover[1]*n); Unique_hash_map F(0, _tds.number_of_faces()); int inum = 0; @@ -4299,7 +4295,7 @@ Periodic_2_triangulation_2::load(std::istream& is) // the faces by the indices of their vertices in the preceding list // of vertices, plus the non combinatorial information on each face // the neighbors of each face by their index in the preceding list of face - CGAL_triangulation_precondition(is.good()); + CGAL_precondition(is.good()); clear(); @@ -4321,7 +4317,7 @@ Periodic_2_triangulation_2::load(std::istream& is) } std::cout << "Line:" << __LINE__ << " cx:" << cx << " cy:" << cy << " n:" << n << std::endl; - CGAL_triangulation_assertion((n / (cx * cy))*cx*cy == n); + CGAL_assertion((n / (cx * cy))*cx*cy == n); tds().set_dimension((n == 0 ? -2 : 2)); _domain = domain; @@ -4434,19 +4430,17 @@ Periodic_2_triangulation_2::load(std::istream& is) for (std::size_t j = 0 ; j < m; j++) is >> *(F[j]); - int i = 0; for (Vertex_iterator vi = vertices_begin(); vi != vertices_end(); ++vi) { _too_long_edges[vi] = std::list(); - ++i; } _edge_length_threshold = FT(0.166) * (_domain.xmax() - _domain.xmin()) * (_domain.xmax() - _domain.xmin()); _too_long_edge_counter = find_too_long_edges(_too_long_edges); - CGAL_triangulation_expensive_assertion( is_valid() ); + CGAL_expensive_assertion( is_valid() ); return is; } @@ -4472,11 +4466,11 @@ test_next(const Periodic_2_triangulation_2 &t1, // Returns false if an inequality has been found. // Precondition: c1, c2 have been registered as well as their 4 vertices. - CGAL_triangulation_precondition(t1.number_of_vertices() != 0); - CGAL_triangulation_precondition(Cmap[c1] == c2); - CGAL_triangulation_precondition(Vmap.find(c1->vertex(0)) != Vmap.end()); - CGAL_triangulation_precondition(Vmap.find(c1->vertex(1)) != Vmap.end()); - CGAL_triangulation_precondition(Vmap.find(c1->vertex(2)) != Vmap.end()); + CGAL_precondition(t1.number_of_vertices() != 0); + CGAL_precondition(Cmap[c1] == c2); + CGAL_precondition(Vmap.find(c1->vertex(0)) != Vmap.end()); + CGAL_precondition(Vmap.find(c1->vertex(1)) != Vmap.end()); + CGAL_precondition(Vmap.find(c1->vertex(2)) != Vmap.end()); typedef Periodic_2_triangulation_2 Tr1; typedef Periodic_2_triangulation_2 Tr2; diff --git a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_face_base_2.h b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_face_base_2.h index 5935bd8980b..c2e8d60557a 100644 --- a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_face_base_2.h +++ b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_face_base_2.h @@ -16,7 +16,7 @@ #include -#include +#include #include #include #include @@ -64,7 +64,7 @@ public: /// Periodic functions int offset(int i) const { - CGAL_triangulation_precondition( i >= 0 && i < 3 ); + CGAL_precondition( i >= 0 && i < 3 ); return ((_off >> 2 * i) & 3); } bool has_zero_offsets() const diff --git a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_hierarchy_2.h b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_hierarchy_2.h index 91ddd875383..c3df3a7274d 100644 --- a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_hierarchy_2.h +++ b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_hierarchy_2.h @@ -455,13 +455,13 @@ typename Periodic_2_triangulation_hierarchy_2::Vertex_handle Periodic_2_triangulation_hierarchy_2:: move_if_no_collision(Vertex_handle v, const Point &p) { - CGAL_triangulation_precondition(v != Vertex_handle()); + CGAL_precondition(v != Vertex_handle()); Vertex_handle old, ret; for (int l = 0; l < m_maxlevel; ++l) { Vertex_handle u = v->up(); - CGAL_triangulation_assertion(hierarchy[l]->is_valid()); + CGAL_assertion(hierarchy[l]->is_valid()); Vertex_handle w = hierarchy[l]->move_if_no_collision(v, p); if (l == 0) { @@ -491,13 +491,13 @@ typename Periodic_2_triangulation_hierarchy_2::Vertex_handle Periodic_2_triangulation_hierarchy_2:: move_point(Vertex_handle v, const Point &p) { - CGAL_triangulation_precondition(v != Vertex_handle()); + CGAL_precondition(v != Vertex_handle()); Vertex_handle old, ret; for (int l = 0; l < m_maxlevel; ++l) { Vertex_handle u = v->up(); - CGAL_triangulation_assertion(hierarchy[l]->is_valid()); + CGAL_assertion(hierarchy[l]->is_valid()); Vertex_handle w = hierarchy[l]->move_point(v, p); if (l == 0) { diff --git a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_iterators_2.h b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_iterators_2.h index 7e101966af8..afa1a55fce5 100644 --- a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_iterators_2.h +++ b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_iterators_2.h @@ -15,7 +15,7 @@ #include -#include +#include #include #include @@ -95,7 +95,7 @@ public: increment_domain(); break; default: - CGAL_triangulation_assertion(false); + CGAL_assertion(false); }; return *this; } @@ -138,7 +138,7 @@ public: bool operator==(const Periodic_triangle_iterator& ti) const { // We are only allowed to compare iterators of the same type. - CGAL_triangulation_assertion(_it == ti._it); + CGAL_assertion(_it == ti._it); return _t == ti._t && pos == ti.pos && _off == ti._off; } @@ -208,7 +208,7 @@ private: void increment_domain() { int off = get_drawing_offsets(); - CGAL_triangulation_assertion(_off <= off); + CGAL_assertion(_off <= off); if (_off == off) { _off = 0; @@ -290,18 +290,18 @@ private: get_edge_offsets(off0, off1, off2); else { - CGAL_triangulation_assertion(_it == T::STORED_COVER_DOMAIN); + CGAL_assertion(_it == T::STORED_COVER_DOMAIN); off0 = _t->int_to_off(pos->offset(0)); off1 = _t->int_to_off(pos->offset(1)); off2 = _t->int_to_off(pos->offset(2)); } - CGAL_triangulation_assertion(off0.x() == 0 || off0.x() == 1); - CGAL_triangulation_assertion(off0.y() == 0 || off0.y() == 1); - CGAL_triangulation_assertion(off1.x() == 0 || off1.x() == 1); - CGAL_triangulation_assertion(off1.y() == 0 || off1.y() == 1); - CGAL_triangulation_assertion(off2.x() == 0 || off2.x() == 1); - CGAL_triangulation_assertion(off2.y() == 0 || off2.y() == 1); + CGAL_assertion(off0.x() == 0 || off0.x() == 1); + CGAL_assertion(off0.y() == 0 || off0.y() == 1); + CGAL_assertion(off1.x() == 0 || off1.x() == 1); + CGAL_assertion(off1.y() == 0 || off1.y() == 1); + CGAL_assertion(off2.x() == 0 || off2.x() == 1); + CGAL_assertion(off2.y() == 0 || off2.y() == 1); int offx = ( ((off0.x() == 0 && off1.x() == 0 && off2.x() == 0) @@ -317,7 +317,7 @@ private: Periodic_triangle construct_periodic_triangle() const { - CGAL_triangulation_assertion(pos != typename T::Face_handle()); + CGAL_assertion(pos != typename T::Face_handle()); Offset off0, off1, off2; get_edge_offsets(off0, off1, off2); Offset transl_off = Offset((((_off >> 1) & 1) == 1 ? -1 : 0), @@ -414,7 +414,7 @@ public: increment_domain(); break; default: - CGAL_triangulation_assertion(false); + CGAL_assertion(false); }; return *this; } @@ -457,7 +457,7 @@ public: bool operator==(const Periodic_segment_iterator& ti) const { // We are only allowed to compare iterators of the same type. - CGAL_triangulation_assertion(_it == ti._it); + CGAL_assertion(_it == ti._it); return _t == ti._t && pos == ti.pos && _off == ti._off; } @@ -524,7 +524,7 @@ private: void increment_domain() { int off = get_drawing_offsets(); - CGAL_triangulation_assertion(_off <= off); + CGAL_assertion(_off <= off); if (_off == off) { _off = 0; @@ -601,14 +601,14 @@ private: get_edge_offsets(off0, off1); else { - CGAL_triangulation_assertion(_it == T::STORED_COVER_DOMAIN); + CGAL_assertion(_it == T::STORED_COVER_DOMAIN); off0 = _t->int_to_off(pos->first->offset(_t->cw(pos->second))); off1 = _t->int_to_off(pos->first->offset(_t->ccw(pos->second))); } Offset diff_off = off0 - off1; - CGAL_triangulation_assertion(diff_off.x() >= -1 || diff_off.x() <= 1); - CGAL_triangulation_assertion(diff_off.y() >= -1 || diff_off.y() <= 1); + CGAL_assertion(diff_off.x() >= -1 || diff_off.x() <= 1); + CGAL_assertion(diff_off.y() >= -1 || diff_off.y() <= 1); return( 2 * (diff_off.x() == 0 ? 0 : 1) + (diff_off.y() == 0 ? 0 : 1)); @@ -616,7 +616,7 @@ private: Periodic_segment construct_periodic_segment() const { - CGAL_triangulation_assertion(pos->first != typename T::Face_handle()); + CGAL_assertion(pos->first != typename T::Face_handle()); Offset off0, off1; get_edge_offsets(off0, off1); Offset transl_off = Offset((((_off >> 1) & 1) == 1 ? -1 : 0), @@ -708,7 +708,7 @@ public: while (pos != _t->vertices_end() && !is_canonical()); break; default: - CGAL_triangulation_assertion(false); + CGAL_assertion(false); }; return *this; } @@ -730,7 +730,7 @@ public: while (pos != _t->vertices_begin() && !is_canonical()); break; default: - CGAL_triangulation_assertion(false); + CGAL_assertion(false); }; return *this; } @@ -752,7 +752,7 @@ public: bool operator==(const Periodic_point_iterator& pi) const { // We are only allowed to compare iterators of the same type. - CGAL_triangulation_assertion(_it == pi._it); + CGAL_assertion(_it == pi._it); return _t == pi._t && pos == pi.pos; } @@ -795,7 +795,7 @@ private: Periodic_point construct_periodic_point() const { - CGAL_triangulation_assertion(pos != typename T::Vertex_handle()); + CGAL_assertion(pos != typename T::Vertex_handle()); Offset off = _t->get_offset(pos); return std::make_pair(pos->point(), off); } diff --git a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_traits_2.h b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_traits_2.h index b6c6796dc00..b0ae5b190c2 100644 --- a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_traits_2.h +++ b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_traits_2.h @@ -20,7 +20,6 @@ #include #include -#include namespace CGAL { diff --git a/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/CGAL/make_periodic_3_mesh_3.h b/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/CGAL/make_periodic_3_mesh_3.h deleted file mode 100644 index d6e097fc9e6..00000000000 --- a/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/CGAL/make_periodic_3_mesh_3.h +++ /dev/null @@ -1,149 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgPeriodic3Mesh3Functions - -The function `make_periodic_3_mesh_3()` is a 3D periodic mesh generator. -It produces simplicial meshes which discretize 3D periodic domains. - -The periodic mesh generation algorithm is a Delaunay refinement process -followed by an optimization phase. The criteria driving the Delaunay refinement -process may be tuned to achieve the user needs with respect to -the size of mesh elements, the accuracy of boundaries approximation, -etc. - -The optimization phase is a sequence of optimization processes, -amongst the following available optimizers: an ODT-smoothing, -a Lloyd smoothing, a sliver perturber, and a sliver exuder. -Each optimization process can be activated or not, according to the user requirements -and available time. -By default, only the perturber and the exuder are activated. -Note that the benefits of the exuder will be lost if the mesh -is further refined afterward, and that ODT-smoothing, Lloyd-smoothing, -and sliver perturber should never be called after the sliver exuder. -In the case of further refinement, only the sliver exuder can be used. - -The function outputs the mesh to an object which provides iterators to -traverse the resulting mesh data structure or can be written to a file -(see \ref Periodic_3_mesh_3_section_examples ). - -\tparam C3T3 is required to be a model of the concept -`MeshComplex_3InTriangulation_3`. This is the return type. -The type `C3T3` is in particular required to provide a nested type -`C3T3::Triangulation` for the 3D periodic triangulation -embedding the periodic mesh. The vertex and cell base classes of the -triangulation `C3T3::Triangulation` are required to be models of the -concepts `MeshVertexBase_3` and `Periodic_3TriangulationDSVertexBase_3`, and of -the concepts `MeshCellBase_3` and `Periodic_3TriangulationDSCellBase_3`, respectively. - -\tparam MD is required to be a model of the concept `Periodic_3MeshDomain_3`, -or of the refined concept `Periodic_3MeshDomainWithFeatures_3` if the domain has corners -and curve segments that need to be accurately represented in the mesh. -The argument `domain` is the sole link through which the domain -to be discretized is known by the mesh generation algorithm. - -\tparam MC is required to be a model of the concept -`MeshCriteria_3`, or a model of the refined concept `MeshCriteriaWithFeatures_3` if the domain has exposed features. -The argument `criteria` of type `MC` specifies the size and shape -requirements for mesh tetrahedra and surface facets. These criteria -form the rules which drive the refinement process. All mesh elements -satisfy those criteria at the end of the refinement process. -In addition, if the domain has features, the argument -`criteria` provides a sizing field to guide the discretization -of 1-dimensional exposed features. - -\cgalHeading{Named Parameters} - -- `features` allows -the user to specify whether 0 and 1-dimensional features have to be -taken into account or not -when the domain is a model of `Periodic_3MeshDomainWithFeatures_3`. -The type `Features` of this parameter is an internal undescribed type. -The library provides functions to construct appropriate values of that type. -
      -
    • \link parameters::features() `parameters::features(domain)` \endlink -sets `features` according to the domain, -i.e.\ 0 and 1-dimensional features are taken into account if `domain` is a -`Periodic_3MeshDomainWithFeatures_3`. This is the default behavior -if parameter `features` is not specified. -
    • `parameters::no_features()` prevents the representation -of 0 and 1-dimensional features in the mesh. -
    - -The four additional parameters are optimization parameters. -They control which optimization processes are performed -and allow the user to tune the parameters of the optimization processes. -Individual optimization parameters are not described here as they are -internal types (see instead the documentation page of each optimizer). -For each optimization algorithm, there exist two global functions -that allow to enable or disable the optimizer: - -- `lloyd`: `parameters::lloyd()` and `parameters::no_lloyd()` are designed to -trigger or not a call to `lloyd_optimize_periodic_3_mesh_3()` function and to set the -parameters of this optimizer. If one parameter is not set, the default value of -`lloyd_optimize_periodic_3_mesh_3()` is used for this parameter. - -- `ODT`: `parameters::odt()` and `parameters::no_odt()` are designed to -trigger or not a call to `odt_optimize_periodic_3_mesh_3` function and -to set the parameters of this optimizer. -If one parameter is not set, the default value of -`odt_optimize_periodic_3_mesh_3()` is used for this parameter. - -- `perturb`: `parameters::perturb()` and `parameters::no_perturb()` are designed to -trigger or not a call to `perturb_periodic_3_mesh_3` function and -to set the parameters of this optimizer. If one parameter is not set, the default value of -`CGAL::perturb_periodic_3_mesh_3` is used for this parameter, except for the time bound which is set to be -equal to the refinement CPU time. - -- `exude`: `parameters::exude()` and `parameters::no_exude()` are designed to -trigger or not a call to `exude_periodic_3_mesh_3()` function and to override to set the -parameters of this optimizer. If one parameter is not set, the default value of -`exude_periodic_3_mesh_3()` is used for this parameter, except for the time bound which is set to be -equal to the refinement CPU time. - -The optimization parameters can be passed in an arbitrary order. If one parameter -is not passed, its default value is used. The default values are -`no_lloyd()`, `no_odt()`, `perturb()` and `exude()`. - -Note that whatever may be the optimization processes activated, -they are always launched in the order that is a suborder -of the following (see user manual for further - details): *ODT-smoother*, *Lloyd-smoother*, *perturb*, *exude*. - -Beware that optimization of the mesh is obtained -by perturbing mesh vertices and modifying the mesh connectivity -and that this has an impact -on the strict compliance to the refinement criteria. -Though a strict compliance to mesh criteria -is guaranteed at the end of the Delaunay refinement, this may no longer be true after -some optimization processes. Also beware that the default behavior does involve some -optimization processes. - -\sa `refine_periodic_3_mesh_3()` -\sa `make_mesh_3()` - -\sa `parameters::features()` -\sa `parameters::no_features()` -\sa `exude_periodic_3_mesh_3()` -\sa `perturb_periodic_3_mesh_3()` -\sa `lloyd_optimize_periodic_3_mesh_3()` -\sa `odt_optimize_periodic_3_mesh_3()` -\sa `parameters::exude()` -\sa `parameters::no_exude()` -\sa `parameters::perturb()` -\sa `parameters::no_perturb()` -\sa `parameters::lloyd()` -\sa `parameters::no_lloyd()` -\sa `parameters::odt()` -\sa `parameters::no_odt()` -*/ - -template -C3T3 make_periodic_3_mesh_3(const MD& domain, - const MC& criteria, - parameters::internal::Features_options features = parameters::features(domain), - parameters::internal::Lloyd_options lloyd = parameters::no_lloyd(), - parameters::internal::Odt_options odt = parameters::no_odt(), - parameters::internal::Perturb_options perturb = parameters::perturb(), - parameters::internal::Exude_options exude = parameters::exude()); -} /* namespace CGAL */ diff --git a/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/CGAL/optimize_periodic_3_mesh_3.h b/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/CGAL/optimize_periodic_3_mesh_3.h deleted file mode 100644 index af1e2224ca8..00000000000 --- a/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/CGAL/optimize_periodic_3_mesh_3.h +++ /dev/null @@ -1,83 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgPeriodic3Mesh3Functions - -The function `lloyd_optimize_periodic_3_mesh_3()` is a periodic mesh optimization -process based on the minimization of a global energy function. - -This function directly calls `lloyd_optimize_mesh_3()`, but is provided for convenience. -Further information can be found on the documentation of the function `lloyd_optimize_mesh_3()`. - -\note This function requires the \ref thirdpartyEigen library. -*/ -template -CGAL::Mesh_optimization_return_code -lloyd_optimize_periodic_3_mesh_3(C3T3& c3t3, - const MD& domain, - double parameters::time_limit=0, - std::size_t parameters::max_iteration_number=0, - double parameters::convergence=0.02, - double parameters::freeze_bound = 0.01, - bool parameters::do_freeze=true); - - -/*! -\ingroup PkgPeriodic3Mesh3Functions - -The function `odt_optimize_periodic_3_mesh_3()` is a periodic mesh optimization -process based on the minimization of a global energy function. - -This function directly calls `odt_optimize_mesh_3()`, but is provided for convenience. -Further information can be found on the documentation of the function `odt_optimize_mesh_3()`. -*/ -template -Mesh_optimization_return_code -odt_optimize_periodic_3_mesh_3(C3T3& c3t3, - const MD& domain, - double parameters::time_limit=0, - std::size_t parameters::max_iteration_number=0, - double parameters::convergence=0.02, - double parameters::freeze_bound = 0.01, - bool parameters::do_freeze=true); - -/*! -\ingroup PkgPeriodic3Mesh3Functions - -The function `perturb_periodic_3_mesh_3()` is a mesh optimizer that -improves the quality of a Delaunay mesh by changing the positions of some vertices of the mesh. - -This function directly calls `perturb_mesh_3()`, but is provided for convenience. -Further information can be found on the documentation of the function `perturb_mesh_3()`. -*/ -template -CGAL::Mesh_optimization_return_code -perturb_periodic_3_mesh_3(C3T3& c3t3, - const MD& domain, - double parameters::time_limit=0, - double parameters::sliver_bound=0); - -/*! -\ingroup PkgPeriodic3Mesh3Functions - -The function `exude_periodic_3_mesh_3()` performs a sliver exudation process -on a periodic Delaunay mesh. - -The sliver exudation process consists in optimizing the weights of vertices -of the periodic weighted Delaunay triangulation in such a way that slivers disappear -and the quality of the mesh improves. - -\warning This optimizer modifies the weight of vertices of the periodic triangulation -and, if called, must be the last optimizer to be called. If the mesh is refined after -this optimization has been performed, all improvements will be lost. - -This function directly calls `exude_mesh_3()`, but is provided for convenience. -Further information can be found on the documentation of the function `exude_mesh_3()`. -*/ -template -CGAL::Mesh_optimization_return_code -exude_periodic_3_mesh_3(C3T3& c3t3, - double parameters::time_limit=0, - double parameters::sliver_bound=0); - -} /* namespace CGAL */ diff --git a/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/CGAL/refine_periodic_3_mesh_3.h b/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/CGAL/refine_periodic_3_mesh_3.h deleted file mode 100644 index ea2d35cc1bf..00000000000 --- a/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/CGAL/refine_periodic_3_mesh_3.h +++ /dev/null @@ -1,142 +0,0 @@ -namespace CGAL { - -/*! -\ingroup PkgPeriodic3Mesh3Functions - -The function `refine_periodic_3_mesh_3()` is a 3D periodic -mesh generator. It produces periodic simplicial meshes which discretize -3D periodic domains. - -The periodic mesh generation algorithm is a Delaunay refinement process -followed by an optimization phase. -The criteria driving the Delaunay refinement -process may be tuned to achieve the user needs with respect to -the size of mesh elements, the accuracy of boundaries approximation, etc. - -The optimization phase is a sequence of optimization processes, -amongst the following available optimizers: an ODT-smoothing, -a Lloyd smoothing, a sliver perturber, and a sliver exuder. -Each optimization process can be activated or not, according to the user requirements -and available time. -By default, only the perturber and the exuder are activated. -Note that the benefits of the exuder will be lost if the mesh -is further refined afterward. - -\attention The function template `refine_periodic_3_mesh_3()` may be used -to refine a previously computed mesh, e.g.: -\code{.cpp} -C3T3 c3t3 = CGAL::make_periodic_3_mesh_3(domain,criteria); - -CGAL::refine_periodic_3_mesh_3(c3t3, domain, new_criteria); -\endcode - -\attention Note that the triangulation must form at all times a simplicial complex within -a single copy of the domain (see Sections \ref P3Triangulation3secspace and \ref P3Triangulation3secintro -of the manual of 3D periodic triangulations). It is the responsability of the user to provide -a triangulation that satisfies this condition when calling the refinement -function `refine_periodic_3_mesh_3`. The underlying triangulation of a mesh -complex obtained through `make_periodic_3_mesh_3()` or `refine_periodic_3_mesh_3()` -will always satisfy this condition. - -\tparam C3T3 is required to be a model of the concept `MeshComplex_3InTriangulation_3`. -The argument `c3t3` is passed by reference as this object is modified -by the refinement process. As the refinement process only adds points -to the triangulation, all vertices of the triangulation of `c3t3` remain in the -mesh during the refinement process. The object `c3t3` can be used to insert -specific points in the domain to ensure that they will be contained in the -final triangulation. -The type `C3T3` is in particular required to provide a nested type -`C3T3::Triangulation` for the 3D periodic triangulation -embedding the periodic mesh. The vertex and cell base classes of the -triangulation `C3T3::Triangulation` are required to be models of the -concepts `MeshVertexBase_3` and `Periodic_3TriangulationDSVertexBase_3`, and of -the concepts `MeshCellBase_3` and `Periodic_3TriangulationDSCellBase_3`, respectively. - -\tparam MD is required to be a model of -the concept `Periodic_3MeshDomain_3` or of the refined concept -`Periodic_3MeshDomainWithFeatures_3` if 0 and 1-dimensional features -of the input complex have to be accurately represented in the mesh. -The argument `domain` is the sole link through which the domain -to be discretized is known by the mesh generation algorithm. - -\tparam MC has to be a model of the concept `MeshCriteria_3`, -or a model of the refined concept `MeshCriteriaWithFeatures_3` if the domain -has exposed features. The argument `criteria` of type `MC` specifies the -size and shape requirements for mesh tetrahedra and surface facets. These criteria -form the rules which drive the refinement process. All mesh elements -satisfy those criteria at the end of the refinement process. -In addition, if the domain has features, the argument `criteria` provides -a sizing field to guide the discretization of 1-dimensional exposed features. - -The four additional parameters are optimization parameters. -They control which optimization processes are performed -and allow the user to tune the parameters of the optimization processes. -Individual optimization parameters are not described here as they are -internal types (see instead the documentation page of each optimizer). -For each optimization algorithm, there exist two global functions -that allow to enable or disable the optimizer: - -\cgalHeading{Named Parameters} -- `lloyd` `parameters::lloyd()` and `parameters::no_lloyd()` are designed to -trigger or not a call to `lloyd_optimize_periodic_3_mesh_3()` function and to set the -parameters of this optimizer. If one parameter is not set, the default value of -`lloyd_optimize_periodic_3_mesh_3()` is used for this parameter. - -- `ODT` `parameters::odt()` and `parameters::no_odt()` are designed to -trigger or not a call to `odt_optimize_periodic_3_mesh_3()` function and -to set the parameters of this optimizer. -If one parameter is not set, the default value of -`odt_optimize_periodic_3_mesh_3()` is used for this parameter. - -- `perturb` `parameters::perturb()` and `parameters::no_perturb()` -are designed to trigger or not a call to `perturb_periodic_3_mesh_3()` function and -to set the parameters of this optimizer. If one parameter is not set, the default value of -`perturb_periodic_3_mesh_3()` is used for this parameter, except for the time bound which is set to be -equal to the refinement CPU time. - -- `exude` `parameters::exude()` and `parameters::no_exude()` are designed to -trigger or not a call to `exude_periodic_3_mesh_3()` function and to override to set the -parameters of this optimizer. If one parameter is not set, the default value of -`exude_periodic_3_mesh_3()` is used for this parameter, except for the time bound which is set to be -equal to the refinement CPU time. - -The optimization parameters can be passed in arbitrary order. If one parameter -is not passed, its default value is used. The default values are -`no_lloyd()`, `no_odt()`, `perturb()` and `exude()`. -Note that whatever may be the optimization processes activated, -they are always launched in the order that is a suborder -of the following (see user manual for further -details): *ODT-smoother*, *Lloyd-smoother*, *perturber*, and *exuder*. - -Beware that optimization of the mesh is obtained by perturbing mesh vertices -and modifying the mesh connectivity and that this has an impact on the strict -compliance to the refinement criteria. Though a strict compliance to mesh criteria -is guaranteed at the end of the Delaunay refinement, this may no longer be true after -some optimization processes. Also beware that the default behavior does involve some -optimization processes. - -\sa `make_periodic_3_mesh_3()` -\sa `refine_mesh_3()` -\sa `exude_periodic_3_mesh_3()` -\sa `perturb_periodic_3_mesh_3()` -\sa `lloyd_optimize_periodic_3_mesh_3()` -\sa `odt_optimize_periodic_3_mesh_3()` -\sa `parameters::exude` -\sa `parameters::no_exude` -\sa `parameters::perturb` -\sa `parameters::no_perturb` -\sa `parameters::lloyd` -\sa `parameters::no_lloyd` -\sa `parameters::odt` -\sa `parameters::no_odt` -*/ -template -void refine_periodic_3_mesh_3(C3T3& c3t3, - const MD& mesh_domain, - const MC& mesh_criteria, - parameters::internal::Lloyd_options lloyd = parameters::no_lloyd(), - parameters::internal::Odt_options odt = parameters::no_odt(), - parameters::internal::Perturb_options perturb = parameters::perturb(), - parameters::internal::Exude_options exude = parameters::exude()); - -} /* namespace CGAL */ diff --git a/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/Doxyfile.in b/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/Doxyfile.in index d49050978bf..64d22001a23 100644 --- a/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/Doxyfile.in +++ b/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/Doxyfile.in @@ -1,5 +1,9 @@ @INCLUDE = ${CGAL_DOC_PACKAGE_DEFAULTS} +INPUT += \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/make_periodic_3_mesh_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/refine_periodic_3_mesh_3.h \ + ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/optimize_periodic_3_mesh_3.h PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - 3D Periodic Mesh Generation" EXTRACT_ALL = false HIDE_UNDOC_CLASSES = true diff --git a/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/Periodic_3_mesh_3.txt b/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/Periodic_3_mesh_3.txt index 5d1380e5950..701fa394146 100644 --- a/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/Periodic_3_mesh_3.txt +++ b/Periodic_3_mesh_3/doc/Periodic_3_mesh_3/Periodic_3_mesh_3.txt @@ -250,29 +250,24 @@ for further information. \section Periodic_3_mesh_3_section_interface Interface +As of \cgal 5.6, this package uses \ref bgl_namedparameters to set parameters. More details are provided in \ref FromBoostNPtoCGALNP. + \subsection Periodic_3_mesh_3TheGlobalFunctions The Global Functions A periodic 3D mesh generation process is launched through a call to one of the two following functions: \code{.cpp} -template +template C3T3 make_periodic_3_mesh_3(const PeriodicMeshDomain& domain, const MeshCriteria& criteria, - parameters::internal::Features_options features = parameters::features(domain), - parameters::internal::Lloyd_options lloyd = parameters::no_lloyd(), - parameters::internal::Odt_options odt = parameters::no_odt(), - parameters::internal::Perturb_options perturb = parameters::perturb(), - parameters::internal::Exude_options exude = parameters::exude()); + const NamedParameters& np); -template +template void refine_periodic_3_mesh_3(C3T3& c3t3, const PeriodicMeshDomain& domain, const MeshCriteria& criteria, - parameters::internal::Lloyd_options lloyd = parameters::no_lloyd(), - parameters::internal::Odt_options odt = parameters::no_odt(), - parameters::internal::Perturb_options perturb = parameters::perturb(), - parameters::internal::Exude_options exude = parameters::exude()); + const NamedParameters& np); \endcode The function `make_periodic_3_mesh_3()` generates from scratch a periodic mesh @@ -444,7 +439,7 @@ These (purely visual) issues disappear when considering multiple copies together \subsection Periodic_3_mesh_33DDomainsImplicitIsosurfaces 3D Periodic Domains Bounded by Implicit Isosurfaces The following code produces a 3D periodic mesh for a domain whose boundary surface is an isosurface defined by an implicit function. -Note the use of named parameters (from the Boost library) in the +Note the use of named parameters in the constructor of the `Mesh_criteria` instance. \cgalFigureRef{Periodic_3_mesh_3Periodic_implicit_shape} shows the resulting mesh. diff --git a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_multi_domain.cpp b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_multi_domain.cpp index 0b57091170c..bdb3320e240 100644 --- a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_multi_domain.cpp +++ b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_multi_domain.cpp @@ -41,7 +41,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; typedef CGAL::Mesh_criteria_3 Periodic_mesh_criteria; // To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; // Implicit functions FT sphere_function(const Point& p) @@ -78,11 +78,11 @@ int main(int argc, char** argv) Multi_domain_wrapper multi_domain_function(funcs, vps); Periodic_mesh_domain domain(multi_domain_function, canonical_cube); - Periodic_mesh_criteria criteria(facet_angle = 30, - facet_size = 0.04, - facet_distance = 0.025, - cell_radius_edge_ratio = 2., - cell_size = 0.04); + Periodic_mesh_criteria criteria(params::facet_angle(30) + .facet_size(0.04) + .facet_distance(0.025) + .cell_radius_edge_ratio(2.) + .cell_size(0.04)); // Mesh generation C3t3 c3t3 = CGAL::make_periodic_3_mesh_3(domain, criteria); diff --git a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_shape.cpp b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_shape.cpp index 895f16c3e36..c742bc2d4cf 100644 --- a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_shape.cpp +++ b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_shape.cpp @@ -34,7 +34,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; typedef CGAL::Mesh_criteria_3 Periodic_mesh_criteria; // To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; // Implicit function FT schwarz_p(const Point& p) @@ -61,11 +61,11 @@ int main(int argc, char** argv) const Periodic_mesh_domain domain = Periodic_mesh_domain::create_implicit_mesh_domain(schwarz_p, canonical_cube); - const Periodic_mesh_criteria criteria(facet_angle = 30, - facet_size = 0.035 * min_span, - facet_distance = 0.025 * min_span, - cell_radius_edge_ratio = 2., - cell_size = 0.05 * min_span); + Periodic_mesh_criteria criteria(params::facet_angle(30) + .facet_size(0.035 * min_span) + .facet_distance(0.025 * min_span) + .cell_radius_edge_ratio(2.) + .cell_size(0.05 * min_span)); // Mesh generation C3t3 c3t3 = CGAL::make_periodic_3_mesh_3(domain, criteria); diff --git a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_shape_with_features.cpp b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_shape_with_features.cpp index 680b0153c95..0be891eaa35 100644 --- a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_shape_with_features.cpp +++ b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_shape_with_features.cpp @@ -45,7 +45,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3< typedef CGAL::Mesh_criteria_3 Periodic_mesh_criteria; // To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; // Implicit function static const FT cx = 0.51, cy = 0.51, cz = 0.5; @@ -91,11 +91,11 @@ int main(int argc, char** argv) Periodic_function(cone_function, canonical_cube), canonical_cube); // Mesh criteria - Periodic_mesh_criteria criteria(edge_size = 0.02 * domain_size, - facet_angle = 0.05 * domain_size, - facet_size = 0.02 * domain_size, - cell_radius_edge_ratio = 2, - cell_size = 0.5); + Periodic_mesh_criteria criteria(params::edge_size(0.02 * domain_size) + .facet_angle(30) + .facet_size(0.02 * domain_size) + .cell_radius_edge_ratio(2) + .cell_size(0.5 * domain_size)); // Create the features that we want to preserve Polylines polylines; @@ -108,14 +108,18 @@ int main(int argc, char** argv) domain.add_corner(Point(0.51, 0.51, 0.5)); // Mesh generation WITHOUT feature preservation (and no optimizers) - C3t3 c3t3 = CGAL::make_periodic_3_mesh_3(domain, criteria, no_features(), - no_exude(), no_perturb()); + C3t3 c3t3 = CGAL::make_periodic_3_mesh_3(domain, criteria, + params::no_features(). + no_exude(). + no_perturb()); std::ofstream medit_file("output_implicit_shape_without_protection.mesh"); CGAL::IO::output_periodic_mesh_to_medit(medit_file, c3t3, number_of_copies_in_output); // Mesh generation WITH feature preservation (and no optimizers) - C3t3 c3t3_bis = CGAL::make_periodic_3_mesh_3(domain, criteria, features(), - no_exude(), no_perturb()); + C3t3 c3t3_bis = CGAL::make_periodic_3_mesh_3(domain, criteria, + params::features(). + no_exude(). + no_perturb()); std::ofstream medit_file_bis("output_implicit_shape_with_protection.mesh"); CGAL::IO::output_periodic_mesh_to_medit(medit_file_bis, c3t3_bis, number_of_copies_in_output); diff --git a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_shape_with_optimizers.cpp b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_shape_with_optimizers.cpp index 3d2c42a4c4e..3aee4a2c6c7 100644 --- a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_shape_with_optimizers.cpp +++ b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_shape_with_optimizers.cpp @@ -34,7 +34,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; typedef CGAL::Mesh_criteria_3 Periodic_mesh_criteria; // To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; // Implicit function FT double_p(const Point& p) @@ -62,35 +62,37 @@ int main(int argc, char** argv) Periodic_mesh_domain domain = Periodic_mesh_domain::create_implicit_mesh_domain(double_p, canonical_cube); - Periodic_mesh_criteria criteria(facet_angle = 30, - facet_size = 0.05 * domain_size, - facet_distance = 0.025 * domain_size, - cell_radius_edge_ratio = 2., - cell_size = 0.05); + Periodic_mesh_criteria criteria(params::facet_angle(30) + .facet_size(0.05 * domain_size) + .facet_distance(0.025 * domain_size) + .cell_radius_edge_ratio(2.) + .cell_size(0.05 * domain_size)); // Mesh generation with optimizers C3t3 c3t3 = CGAL::make_periodic_3_mesh_3(domain, criteria, - odt(convergence=0.03, freeze_bound=0.02, time_limit=30), - lloyd(max_iteration_number=10), - perturb(sliver_bound=10, time_limit=30), - exude(sliver_bound=10, time_limit=0)); + params::odt(params::convergence(0.03).freeze_bound(0.02).time_limit(30)), + params::lloyd(params::max_iteration_number(10)), + params::perturb(params::sliver_bound(10).time_limit(30)), + params::exude(params::sliver_bound(10).time_limit(0))); std::ofstream medit_file("output_implicit_shape_optimized.mesh"); CGAL::IO::output_periodic_mesh_to_medit(medit_file, c3t3); // Below, the mesh generation and the optimizations are done in several calls C3t3 c3t3_bis = CGAL::make_periodic_3_mesh_3(domain, criteria, - no_odt(), no_lloyd(), - no_perturb(), no_exude()); + params::no_odt(). + no_lloyd(). + no_perturb(). + no_exude()); std::ofstream medit_file_bis("output_implicit_shape_non-optimized.mesh"); CGAL::IO::output_periodic_mesh_to_medit(medit_file_bis, c3t3_bis); // Now, call each optimizer with its global function - CGAL::odt_optimize_periodic_3_mesh_3(c3t3_bis, domain, convergence=0.03, freeze_bound=0.02, time_limit=30); - CGAL::lloyd_optimize_periodic_3_mesh_3(c3t3_bis, domain, max_iteration_number=10); - CGAL::perturb_periodic_3_mesh_3(c3t3_bis, domain, sliver_bound=10, time_limit=30); - CGAL::exude_periodic_3_mesh_3(c3t3_bis, sliver_bound=10, time_limit=0); + CGAL::odt_optimize_periodic_3_mesh_3(c3t3_bis, domain, params::convergence(0.03).freeze_bound(0.02).time_limit(30)); + CGAL::lloyd_optimize_periodic_3_mesh_3(c3t3_bis, domain, params::max_iteration_number(10)); + CGAL::perturb_periodic_3_mesh_3(c3t3_bis, domain, params::sliver_bound(10).time_limit(30)); + CGAL::exude_periodic_3_mesh_3(c3t3_bis, params::sliver_bound(10).time_limit(0)); std::ofstream medit_file_ter("output_implicit_shape_two_steps.mesh"); CGAL::IO::output_periodic_mesh_to_medit(medit_file_ter, c3t3_bis, number_of_copies_in_output); diff --git a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_shape_with_subdomains.cpp b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_shape_with_subdomains.cpp index 8de56fad9a7..183e5e1674a 100644 --- a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_shape_with_subdomains.cpp +++ b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_implicit_shape_with_subdomains.cpp @@ -36,7 +36,7 @@ typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; typedef CGAL::Mesh_criteria_3 Periodic_mesh_criteria; // To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; // Function FT schwarz_p(const Point& p) @@ -67,11 +67,11 @@ int main(int argc, char** argv) size.set_size(0.1, volume_dimension, domain.index_from_subdomain_index(2)); // exterior size.set_size(0.03, volume_dimension, domain.index_from_subdomain_index(1)); // interior - Periodic_mesh_criteria criteria(facet_angle = 30., - facet_size = 0.05, - facet_distance = 0.025, - cell_radius_edge_ratio = 2., - cell_size = size); + Periodic_mesh_criteria criteria(params::facet_angle(30.) + .facet_size(0.05) + .facet_distance(0.025) + .cell_radius_edge_ratio(2.) + .cell_size(size)); // Mesh generation C3t3 c3t3 = CGAL::make_periodic_3_mesh_3(domain, criteria); diff --git a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_periodic_polyhedral_domain.cpp b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_periodic_polyhedral_domain.cpp index 2d34f596cd8..ab64f708265 100644 --- a/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_periodic_polyhedral_domain.cpp +++ b/Periodic_3_mesh_3/examples/Periodic_3_mesh_3/mesh_periodic_polyhedral_domain.cpp @@ -94,7 +94,7 @@ using C3t3 = CGAL::Mesh_complex_3_in_triangulation_3; using Periodic_mesh_criteria = CGAL::Mesh_criteria_3; // To avoid verbose function and named parameters call -using namespace CGAL::parameters; +namespace params = CGAL::parameters; // An arbitrary, simple polyhedral shape void generate_periodic_diamond(const Point& origin, // bottom, front, left point of the canonical domain @@ -173,12 +173,12 @@ int main(int argc, char** argv) // Insert the features in the domain // domain.add_features(polylines.begin(), polylines.end()); // @tmp - Periodic_mesh_criteria criteria(edge_size = 1 * min_span, - facet_angle = 30, - facet_size = 0.035 * min_span, - facet_distance = 0.025 * min_span, - cell_radius_edge_ratio = 2., - cell_size = 0.05 * min_span); + Periodic_mesh_criteria criteria(params::edge_size(min_span) + .facet_angle(30) + .facet_size(0.035 * min_span) + .facet_distance(0.025 * min_span) + .cell_radius_edge_ratio(2.) + .cell_size(0.05 * min_span)); // Mesh generation C3t3 c3t3 = CGAL::make_periodic_3_mesh_3(domain, criteria); diff --git a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h index ad7d4aec65b..ae2995f1041 100644 --- a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h +++ b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_3/Protect_edges_sizing_field.h @@ -206,8 +206,8 @@ private: Vertex_handle get_vertex_corner_from_point(const Bare_point& p, const Index& p_index) const; - /// Insert point(p,w) into the triangulation and set its dimension to \c dim - /// and its index to \c index. + /// Insert point(p,w) into the triangulation and set its dimension to `dim` + /// and its index to `index`. /// The handle of the newly created vertex is returned. template Vertex_handle insert_point(const Bare_point& p, @@ -218,8 +218,8 @@ private: const bool special_ball); /** - * Insert point(p,w) into the triangulation and set its dimension to \c dim and - * its index to \c index. + * Insert point(p,w) into the triangulation and set its dimension to `dim` and + * its index to `index`. * The handle of the newly created vertex is returned. * * This function also ensures that `point(p,w)` will not be inside a @@ -236,11 +236,11 @@ private: const Curve_index_container& curve_indices, ErasedVeOutIt out); - /// Insert balls between the points identified by the handles \c vp and \c vq - /// on the curve identified by \c curve_index. + /// Insert balls between the points identified by the handles `vp` and `vq` + /// on the curve identified by `curve_index`. /// - /// \param orientation Orientation of the curve segment between \c vp and - /// \c vq, given the orientation of the curve of index \c curve_index + /// \param orientation Orientation of the curve segment between `vp` and + /// `vq`, given the orientation of the curve of index `curve_index` template ErasedVeOutIt insert_balls(const Vertex_handle& vp, const Vertex_handle& vq, @@ -263,25 +263,25 @@ private: const Curve_index& curve_index, ErasedVeOutIt out); - /// Return `true` if the balls of \c va and \c vb intersect, and (va,vb) is not + /// Return `true` if the balls of `va` and `vb` intersect, and `(va,vb)` is not /// an edge of the complex. bool non_adjacent_but_intersect(const Vertex_handle& va, const Vertex_handle& vb) const; - /// Return `true` if the balls of \c va and \c vb intersect. + /// Return `true` if the balls of `va` and `vb` intersect. bool do_balls_intersect(const Vertex_handle& va, const Vertex_handle& vb) const; - /// Change the size of the ball of the vertex \c v. + /// Change the size of the ball of the vertex `v`. bool change_ball_size(Vertex_handle& v, const FT squared_size, const bool special_ball = false); /// Return `true` if balls of v1 and v2 intersect "enough". - /// \param orientation Orientation of the curve segment between \c v1 and - /// \c v2, given the orientation of the curve of index - /// \c curve_index + /// \param orientation Orientation of the curve segment between `v1` and + /// `v2`, given the orientation of the curve of index + /// `curve_index` /// \pre `c3t3.curve_index(v1, v2) == curve_index` bool is_sampling_dense_enough(const Vertex_handle& v1, const Vertex_handle& v2, @@ -292,17 +292,17 @@ private: /// of those vertices is ok. If not, fix it. void check_and_repopulate_edges(); - /// Check if the vertex \c v is well sampled, and if its not the case, fix it. + /// Check if the vertex `v` is well sampled, and if its not the case, fix it. /// Fill `out` with deleted vertices during this process. The value type of `out` /// is `Vertex_handle`. template ErasedVeOutIt check_and_fix_vertex_along_edge(const Vertex_handle& v, ErasedVeOutIt out); - /// Given two vertices \c start and \c next inserted on the curve with - /// index \c curve_index, return `CGAL::POSITIVE` if the curve arc from - /// \c start to \c next is oriented in the same orientation as the curve - /// segment with index \c curve_index, or `CGAL::NEGATIVE` otherwise. + /// Given two vertices `start` and `next inserted` on the curve with + /// index `curve_index`, return `CGAL::POSITIVE` if the curve arc from + /// `start` to `next` is oriented in the same orientation as the curve + /// segment with index `curve_index`, or `CGAL::NEGATIVE` otherwise. /// /// \pre `c3t3.curve_index(v1, v2) == curve_index` CGAL::Orientation @@ -310,13 +310,13 @@ private: const Vertex_handle& next, Curve_index curve_index) const; - /// Walk along the edge from \c start, following the direction \c start to - /// \c next, and fills \c out with the vertices which do not fulfill + /// Walk along the edge from `start`, following the direction `start` to + /// `next`, and fills `out` with the vertices which do not fulfill /// the sampling conditions. /// - /// \param orientation Orientation of the curve segment between \c v1 and - /// \c v2, given the orientation of the curve of index - /// \c curve_index + /// \param orientation Orientation of the curve segment between `v1` and + /// `v2`, given the orientation of the curve of index + /// `curve_index` /// /// \pre `c3t3.curve_index(v1, v2) == curve_index` template @@ -327,8 +327,8 @@ private: const CGAL::Orientation orientation, ErasedVeOutIt out) const; - /// Return the next vertex along edge, i.e the vertex after \c start, following - /// the direction from \c previous to \c start. + /// Return the next vertex along edge, i.e the vertex after `start`, following + /// the direction from `previous` to `start`. /// \pre (previous,start) is in c3t3 /// \pre `c3t3.curve_index(start, previous) == curve_index` Vertex_handle @@ -337,12 +337,12 @@ private: const Curve_index& curve_index) const; /// Replace the vertices between ]begin,last[ with new vertices, along the curve - /// identified by \c curve_index. + /// identified by `curve_index`. /// The value type of `InputIterator` is `Vertex_handle`. /// - /// \param orientation Orientation of the curve segment between \c begin and - /// \c last, given the orientation of the curve of index - /// \c curve_index + /// \param orientation Orientation of the curve segment between `begin` and + /// `last`, given the orientation of the curve of index + /// `curve_index` /// template ErasedVeOutIt repopulate(InputIterator begin, @@ -358,33 +358,33 @@ private: const CGAL::Orientation orientation, ErasedVeOutIt out); - /// Check if the size of \c v2 is compatible (i.e. greater) with the linear - /// interpolation of the sizes of \c v1 and \c v3. + /// Check if the size of `v2` is compatible (i.e. greater) with the linear + /// interpolation of the sizes of `v1` and `v3`. bool is_sizing_field_correct(const Vertex_handle& v1, const Vertex_handle& v2, const Vertex_handle& v3, const Curve_index& index, const CGAL::Orientation orientation) const; - /// Repopulate all incident curves around the corner \c v. - /// \pre \c v is a corner of c3t3 + /// Repopulate all incident curves around the corner `v`. + /// \pre `v` is a corner of c3t3 template ErasedVeOutIt repopulate_edges_around_corner(const Vertex_handle& v, ErasedVeOutIt out); - /// Return `true` if the edge with index \c curve_index is already treated. + /// Return `true` if the edge with index `curve_index` is already treated. bool is_treated(const Curve_index& curve_index) const { return (treated_edges_.find(curve_index) != treated_edges_.end()); } - /// Set the edge with index \c curve_index as treated. + /// Set the edge with index `curve_index` as treated. void set_treated(const Curve_index& curve_index) { treated_edges_.insert(curve_index); } - /// Compute the Euclidean distance between the bare points \c and \c q. + /// Compute the Euclidean distance between the bare points `p` and `q`. FT compute_distance(const Bare_point& p, const Bare_point& q) const { // No need to call min_squared_distance() because 'p' and 'q' have been @@ -401,7 +401,7 @@ private: return compute_distance(pa, pb); } - /// Compute the Euclidean distance between the bare points of \c va and \c vb. + /// Compute the Euclidean distance between the bare points of `va` and `vb`. FT compute_distance(const Vertex_handle& va, const Vertex_handle& vb) const { typename Gt::Construct_point_3 cp = @@ -413,7 +413,7 @@ private: return CGAL::sqrt(c3t3_.triangulation().min_squared_distance(cp(wpa), cp(wpb))); } - /// Return the radius of the ball of vertex \c v. + /// Return the radius of the ball of vertex `v`. FT get_radius(const Vertex_handle& v) const { typename Gt::Compute_weight_3 cw = diff --git a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_triangulation_3.h b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_triangulation_3.h index 84ee0a8144d..7b3eefe9105 100644 --- a/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_triangulation_3.h +++ b/Periodic_3_mesh_3/include/CGAL/Periodic_3_mesh_triangulation_3.h @@ -711,8 +711,8 @@ public: const Facet* /* this_facet_must_be_in_the_cz */ = nullptr, bool* /* the_facet_is_in_its_cz */ = nullptr) const { - CGAL_triangulation_precondition(could_lock_zone == nullptr); - CGAL_triangulation_precondition(number_of_vertices() != 0); + CGAL_precondition(could_lock_zone == nullptr); + CGAL_precondition(number_of_vertices() != 0); clear_v_offsets(); diff --git a/Periodic_3_mesh_3/include/CGAL/make_periodic_3_mesh_3.h b/Periodic_3_mesh_3/include/CGAL/make_periodic_3_mesh_3.h index 2ce97b04f39..452152ca7fe 100644 --- a/Periodic_3_mesh_3/include/CGAL/make_periodic_3_mesh_3.h +++ b/Periodic_3_mesh_3/include/CGAL/make_periodic_3_mesh_3.h @@ -26,11 +26,9 @@ #include #include -#include #include #include - -#include +#include #include #include @@ -195,56 +193,187 @@ struct C3t3_initializer // make_periodic_3_mesh_3 stuff // ----------------------------------- -// Manual redirections -// boost::parameter can't handle make_periodic_3_mesh_3 return_type alone... -template -C3T3 make_periodic_3_mesh_3(const MD& md, const MC& mc, const T& ...t) +/*! + * \ingroup PkgPeriodic3Mesh3Functions + * + * The function `make_periodic_3_mesh_3()` is a 3D periodic mesh generator. + * It produces simplicial meshes which discretize 3D periodic domains. + * The periodic mesh generation algorithm is a Delaunay refinement process + * followed by an optimization phase. The criteria driving the Delaunay refinement + * process may be tuned to achieve the user needs with respect to + * the size of mesh elements, the accuracy of boundaries approximation, + * etc. + * The optimization phase is a sequence of optimization processes, + * amongst the following available optimizers: an ODT-smoothing, + * a Lloyd smoothing, a sliver perturber, and a sliver exuder. + * Each optimization process can be activated or not, according to the user requirements + * and available time. + * By default, only the perturber and the exuder are activated. + * Note that the benefits of the exuder will be lost if the mesh + * is further refined afterward, and that ODT-smoothing, Lloyd-smoothing, + * and sliver perturber should never be called after the sliver exuder. + * In the case of further refinement, only the sliver exuder can be used. + * The function outputs the mesh to an object which provides iterators to + * traverse the resulting mesh data structure or can be written to a file + * (see \ref Periodic_3_mesh_3_section_examples ). + * + * + * \tparam C3T3 is required to be a model of + * the concept `MeshComplex_3InTriangulation_3`. This is the return type. + * The type `C3T3` is in particular required to provide a nested type + * `C3T3::Triangulation` for the 3D triangulation + * embedding the mesh. The vertex and cell base classes of the + * triangulation `C3T3::Triangulation` are required to be models of the + * concepts `MeshVertexBase_3` and `MeshCellBase_3` + * respectively. + * + * \tparam MD is required to be a model of + * the concept `MeshDomain_3`, or of the refined concept + * `MeshDomainWithFeatures_3` + * if the domain has corners and curves that need to be accurately represented in the mesh. + * The argument `domain` + * is the sole link through which the domain + * to be discretized is known by the mesh generation algorithm. + * + * \tparam MC has to be a model of the concept + * `MeshCriteria_3`, or a model of the refined concept `MeshCriteriaWithFeatures_3` if the domain has exposed features. + * The argument `criteria` of type `MC` specifies the + * size and shape requirements for mesh tetrahedra + * and surface facets. These criteria + * form the rules which drive the refinement process. All mesh elements + * satisfy those criteria at the end of the refinement process. + * In addition, if the domain has features, the argument + * `criteria` provides a sizing field to guide the discretization + * of 1-dimensional exposed features. + * + * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * + * \param domain the domain to be discretized + * \param criteria the criteria + * \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + * + * \cgalNamedParamsBegin + * \cgalParamSectionBegin{Feature preservation options} + * \cgalParamDescription{If the domain is a model of `MeshDomainWithFeatures_3`, 0 and 1-dimensional features can be + * taken into account while generating the mesh. The following two named parameters control + * this option: + *
      + *
    • \link parameters::features() `parameters::features(domain)` \endlink + *
    • `parameters::no_features()` + *
    } + * \cgalParamDefault{`parameters::features(domain)`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{Topological options (manifoldness)} + * \cgalParamDescription{In order to drive the meshing algorithm and ensure that the output mesh follows a desired topological criterion, + * three named parameters control this option: + *
      + *
    • `parameters::manifold()` + *
    • `parameters::manifold_with_boundary()` + *
    • `parameters::non_manifold()` + *
    + * Note that the meshing algorithm cannot generate a manifold surface if the input surface is not manifold.} + * \cgalParamDefault{`parameters::non_manifold()`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{Lloyd optimization} + * \cgalParamDescription{`lloyd_optimize_mesh_3()` can optionally be called after the meshing process. + * Two named parameters control this behavior: + *
      + *
    • `parameters::no_lloyd()` + *
    • `parameters::lloyd_optimize_mesh_3()` + *
    } + * \cgalParamDefault{`parameters::no_lloyd()`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{ODT optimization} + * \cgalParamDescription{`odt_optimize_mesh_3()` can optionally be called after the meshing process. + * Two named parameters control this behavior: + *
      + *
    • `parameters::no_odt()` + *
    • `parameters::odt()` + *
    } + * \cgalParamDefault{`parameters::no_odt()`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{Mesh perturbation} + * \cgalParamDescription{`perturb_mesh_3()` can optionally be called after the meshing process. + * Two named parameters control this behavior: + *
      + *
    • `parameters::no_perturb()` + *
    • `parameters::perturb()` + *
    } + * \cgalParamDefault{`parameters::perturb()`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{Mesh exudation} + * \cgalParamDescription{`exude_mesh_3()` can optionally be called after the meshing process. + * Two named parameters control this behavior: + *
      + *
    • `parameters::exude()` + *
    • `parameters::no_exude()` + *
    } + * \cgalParamDefault{`parameters::exude()`} + * \cgalParamSectionEnd + * \cgalNamedParamsEnd + * + * The optimization parameters can be passed in an arbitrary order. If one parameter + * is not passed, its default value is used. The default values are + * `no_lloyd()`, `no_odt()`, `perturb()` and `exude()`. + * + * Note that regardless of which optimization processes are activated, + * they are always launched in the order that is a suborder + * of the following (see user manual for further + * details): *ODT-smoother*, *Lloyd-smoother*, *perturber*, and *exuder*. + * + * Beware that optimization of the mesh is obtained + * by perturbing mesh vertices and modifying the mesh connectivity + * and that this has an impact + * on the strict compliance to the refinement criteria. + * Though a strict compliance to mesh criteria + * is guaranteed at the end of the Delaunay refinement, this may no longer be true after + * some optimization processes. Also beware that the default behavior does involve some + * optimization processes. + * + * \sa `refine_periodic_3_mesh_3()` + * \sa `make_mesh_3()` + * \sa `exude_mesh_3()` + * \sa `perturb_mesh_3()` + * \sa `lloyd_optimize_mesh_3()` + * \sa `odt_optimize_mesh_3()` + */ +template +C3T3 make_periodic_3_mesh_3(MeshDomain& domain, MeshCriteria& criteria, const CGAL_NP_CLASS& np = parameters::default_values()) { + using parameters::choose_parameter; + using parameters::get_parameter; C3T3 c3t3; - make_periodic_3_mesh_3_bp(c3t3,md,mc,t...); + parameters::internal::Exude_options exude_param = choose_parameter(get_parameter(np, internal_np::exude_options_param), parameters::exude().v); + parameters::internal::Perturb_options perturb_param = choose_parameter(get_parameter(np, internal_np::perturb_options_param), parameters::perturb().v); + parameters::internal::Odt_options odt_param = choose_parameter(get_parameter(np, internal_np::odt_options_param), parameters::no_odt().v); + parameters::internal::Lloyd_options lloyd_param = choose_parameter(get_parameter(np, internal_np::lloyd_options_param), parameters::no_lloyd().v); + parameters::internal::Features_options features_param = choose_parameter(get_parameter(np, internal_np::features_options_param), parameters::features(domain).v); + parameters::internal::Mesh_3_options mesh_options_param = choose_parameter(get_parameter(np, internal_np::mesh_param), parameters::internal::Mesh_3_options()); + parameters::internal::Manifold_options manifold_options_param = choose_parameter(get_parameter(np, internal_np::manifold_param), parameters::internal::Manifold_options()); + + make_periodic_3_mesh_3_impl(c3t3, domain, criteria, + exude_param, perturb_param, odt_param, lloyd_param, + features_param.features(), mesh_options_param, + manifold_options_param); return c3t3; } -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable:4003) // not enough actual parameters for macro -#endif -// see -CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS - -BOOST_PARAMETER_FUNCTION( - (void), - make_periodic_3_mesh_3_bp, - parameters::tag, - (required (in_out(c3t3),*) (domain,*) (criteria,*) ) // nondeduced - (deduced - (optional - (features_param, (parameters::internal::Features_options), parameters::features(domain)) - (exude_param, (parameters::internal::Exude_options), parameters::exude()) - (perturb_param, (parameters::internal::Perturb_options), parameters::perturb()) - (odt_param, (parameters::internal::Odt_options), parameters::no_odt()) - (lloyd_param, (parameters::internal::Lloyd_options), parameters::no_lloyd()) - (mesh_options_param, (parameters::internal::Mesh_3_options), - parameters::internal::Mesh_3_options()) - (manifold_options_param, (parameters::internal::Manifold_options), - parameters::internal::Manifold_options()) - ) - ) - ) +#ifndef DOXYGEN_RUNNING +// Overload handling parameters passed with operator= +template +C3T3 make_periodic_3_mesh_3(MeshDomain& domain, MeshCriteria& criteria, + const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) { - make_periodic_3_mesh_3_impl(c3t3, domain, criteria, - exude_param, perturb_param, odt_param, lloyd_param, - features_param.features(), mesh_options_param, - manifold_options_param); + return make_periodic_3_mesh_3(domain, criteria, internal_np::combine_named_parameters(np1, np2, nps...)); } -CGAL_PRAGMA_DIAG_POP -#if defined(BOOST_MSVC) -# pragma warning(pop) -#endif /** * @brief This function meshes the domain defined by mesh_traits @@ -252,7 +381,7 @@ CGAL_PRAGMA_DIAG_POP * * @param domain the domain to be discretized * @param criteria the criteria - * @param exude if it is set to \c true, an exudation step will be done at + * @param exude if it is set to `true`, an exudation step will be done at * the end of the Delaunay refinement process * * @return The mesh as a C3T3 object @@ -274,19 +403,19 @@ void make_periodic_3_mesh_3_impl(C3T3& c3t3, // Initialize c3t3 Periodic_3_mesh_3::internal::C3t3_initializer< C3T3, MeshDomain, MeshCriteria, - Mesh_3::internal::has_Has_features::value>()(c3t3, - domain, - criteria, - with_features, - mesh_options); + internal::has_Has_features::value>()(c3t3, + domain, + criteria, + with_features, + mesh_options); // Build mesher and launch refinement process refine_periodic_3_mesh_3(c3t3, domain, criteria, - exude, perturb, odt, lloyd, - parameters::no_reset_c3t3(), // do not reset c3t3 as we just created it - mesh_options, manifold_options); + parameters::exude_options = exude, parameters::perturb_options = perturb, parameters::odt_options = odt, + parameters::lloyd_options = lloyd, parameters::no_reset_c3t3(), // do not reset c3t3 as we just created it + parameters::mesh_options = mesh_options, parameters::manifold_option = manifold_options); } - +#endif //DOXYGEN_RUNNING } // end namespace CGAL #endif // CGAL_PERIODIC_3_MESH_3_MAKE_PERIODIC_3_MESH_3_H diff --git a/Periodic_3_mesh_3/include/CGAL/optimize_periodic_3_mesh_3.h b/Periodic_3_mesh_3/include/CGAL/optimize_periodic_3_mesh_3.h index 8b3d75cbfe4..0a7c1e5ef4c 100644 --- a/Periodic_3_mesh_3/include/CGAL/optimize_periodic_3_mesh_3.h +++ b/Periodic_3_mesh_3/include/CGAL/optimize_periodic_3_mesh_3.h @@ -19,106 +19,191 @@ #define CGAL_OPTIMIZE_PERIODIC_3_MESH_3_H #include - +#include #include namespace CGAL { - -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable:4003) // not enough actual parameters for macro -#endif - -// see -CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS - // ---------------------------------- pertuber --------------------------------- - -BOOST_PARAMETER_FUNCTION( - (Mesh_optimization_return_code), - perturb_periodic_3_mesh_3, - parameters::tag, - (required (in_out(c3t3),*) (domain,*)) - (optional - (time_limit_, *, 0) - (sliver_bound_, *, parameters::default_values_for_mesh_3::perturb_sliver_bound) - (sliver_criterion_, *, parameters::default_values_for_mesh_3::default_sliver_criterion(c3t3, sliver_bound_)) - (perturbation_vector_, *, default_perturbation_vector(c3t3,domain,sliver_criterion_)) - ) -) +/*! + * \ingroup PkgPeriodic3Mesh3Functions + * + * The function `perturb_periodic_3_mesh_3()` is a mesh optimizer that + * improves the quality of a Delaunay mesh by changing the positions of some vertices of the mesh. + * + * This function directly calls `perturb_mesh_3()`, but is provided for convenience. + * Further information can be found in the documentation of the function `perturb_mesh_3()`. + */ +template +Mesh_optimization_return_code perturb_periodic_3_mesh_3(C3T3& c3t3, MeshDomain& domain, const CGAL_NP_CLASS& np = parameters::default_values()) { - CGAL_USE(sliver_bound_); - return perturb_mesh_3_impl(c3t3, domain, time_limit_, sliver_criterion_, - perturbation_vector_); + using parameters::choose_parameter; + using parameters::get_parameter; + double time_limit = choose_parameter(get_parameter(np,internal_np::maximum_running_time),parameters::default_values_for_mesh_3::time_limit); + auto sliver_bound = choose_parameter(get_parameter(np,internal_np::lower_sliver_bound), parameters::default_values_for_mesh_3::perturb_sliver_bound); + auto sliver_criterion = choose_parameter(get_parameter(np, internal_np::sliver_criteria), parameters::default_values_for_mesh_3::default_sliver_criterion(c3t3,sliver_bound)); + auto perturbation_vector = choose_parameter(get_parameter(np,internal_np::perturb_vector), default_perturbation_vector(c3t3,domain,sliver_criterion)); + return perturb_mesh_3_impl(c3t3, domain, time_limit, sliver_criterion, perturbation_vector); +} + +// Overload handling parameters passed with operator= +template +Mesh_optimization_return_code perturb_periodic_3_mesh_3(C3T3& c3t3, MeshDomain& domain, + const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) +{ + return perturb_periodic_3_mesh_3(c3t3,domain, internal_np::combine_named_parameters(np1, np2, nps...)); +} +// Overload handling parameters passed with operator= +template +Mesh_optimization_return_code perturb_periodic_3_mesh_3(const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) +{ + return perturb_periodic_3_mesh_3(internal_np::combine_named_parameters(np1, np2, nps...)); } // ---------------------------------- exuder ----------------------------------- - -BOOST_PARAMETER_FUNCTION( - (Mesh_optimization_return_code), - exude_periodic_3_mesh_3, - parameters::tag, - (required (in_out(c3t3),*)) - (optional - (time_limit_, *, 0) - (sliver_bound_, *, parameters::default_values_for_mesh_3::exude_sliver_bound) - ) -) +/*! + * \ingroup PkgPeriodic3Mesh3Functions + * + * The function `exude_periodic_3_mesh_3()` performs a sliver exudation process + * on a periodic Delaunay mesh. + * + * The sliver exudation process consists in optimizing the weights of vertices + * of the periodic weighted Delaunay triangulation in such a way that slivers disappear + * and the quality of the mesh improves. + * + * \warning This optimizer modifies the weight of vertices of the periodic triangulation + * and, if called, must be the last optimizer to be called. If the mesh is refined after + * this optimization has been performed, all improvements will be lost. + * + * This function directly calls `exude_mesh_3()`, but is provided for convenience. + * Further information can be found in the documentation of the function `exude_mesh_3()`. + */ +template +Mesh_optimization_return_code exude_periodic_3_mesh_3(C3T3& c3t3,const CGAL_NP_CLASS& np = parameters::default_values()) { - return exude_mesh_3_impl(c3t3, time_limit_, sliver_bound_); + using parameters::choose_parameter; + using parameters::get_parameter; + double time_limit=choose_parameter(get_parameter(np,internal_np::maximum_running_time),0); + double sliver_bound= choose_parameter(get_parameter(np,internal_np::lower_sliver_bound),parameters::default_values_for_mesh_3::exude_sliver_bound); + return exude_mesh_3_impl(c3t3,time_limit,sliver_bound); +} +// Overload handling parameters passed with operator= +template +Mesh_optimization_return_code exude_periodic_3_mesh_3(C3T3& c3t3, + const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) +{ + return exude_periodic_3_mesh_3(c3t3,internal_np::combine_named_parameters(np1, np2, nps...)); +} +// Overload handling parameters passed with operator= +template +Mesh_optimization_return_code exude_periodic_3_mesh_3(const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) +{ + return exude_periodic_3_mesh_3(internal_np::combine_named_parameters(np1, np2, nps...)); } -// ------------------------------ odt optimizer -------------------------------- -BOOST_PARAMETER_FUNCTION( - (Mesh_optimization_return_code), - odt_optimize_periodic_3_mesh_3, - parameters::tag, - (required (in_out(c3t3),*) (domain,*)) - (optional - (time_limit_, *, 0) - (max_iteration_number_, *, 0) - (convergence_, *, parameters::default_values_for_mesh_3::odt_convergence_ratio) - (freeze_bound_, *, parameters::default_values_for_mesh_3::odt_freeze_ratio) - (do_freeze_, *, parameters::default_values_for_mesh_3::do_freeze) - ) -) +// ------------------------------ odt optimizer -------------------------------- +/*! + * \ingroup PkgPeriodic3Mesh3Functions + * + * The function `odt_optimize_periodic_3_mesh_3()` is a periodic mesh optimization + * process based on the minimization of a global energy function. + * + * This function directly calls `odt_optimize_mesh_3()`, but is provided for convenience. + * Further information can be found in the documentation of the function `odt_optimize_mesh_3()`. + */ +template +Mesh_optimization_return_code odt_optimize_periodic_3_mesh_3(C3T3& c3t3, MeshDomain& domain, const CGAL_NP_CLASS& np = parameters::default_values()) { - return odt_optimize_mesh_3_impl(c3t3, domain, - time_limit_, max_iteration_number_, - convergence_, freeze_bound_, do_freeze_); + using parameters::choose_parameter; + using parameters::get_parameter; + double time_limit=choose_parameter(get_parameter(np,internal_np::maximum_running_time),0); + std::size_t max_iteration_number=choose_parameter(get_parameter(np,internal_np::number_of_iterations),0); + double convergence=choose_parameter(get_parameter(np,internal_np::convergence_ratio),0.02); + double freeze_bound=choose_parameter(get_parameter(np,internal_np::vertex_freeze_bound),0.01); + bool do_freeze=choose_parameter(get_parameter(np,internal_np::freeze),true); + return odt_optimize_mesh_3_impl(c3t3, domain, time_limit, max_iteration_number, convergence, freeze_bound, do_freeze); +} + +// Overload handling parameters passed with operator= +template +Mesh_optimization_return_code odt_optimize_periodic_3_mesh_3(C3T3& c3t3, MeshDomain& domain, + const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) +{ + return odt_optimize_periodic_3_mesh_3(c3t3, domain, internal_np::combine_named_parameters(np1, np2, nps...)); +} +// Overload handling parameters passed with operator= +template +Mesh_optimization_return_code odt_optimize_periodic_3_mesh_3(const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) +{ + return odt_optimize_periodic_3_mesh_3(internal_np::combine_named_parameters(np1, np2, nps...)); } // ------------------------------- lloyd optimizer ----------------------------- - -BOOST_PARAMETER_FUNCTION( - (Mesh_optimization_return_code), - lloyd_optimize_periodic_3_mesh_3, - parameters::tag, - (required (in_out(c3t3),*) (domain,*)) - (optional - (time_limit_, *, 0) - (max_iteration_number_, *, 0) - (convergence_, *, parameters::default_values_for_mesh_3::lloyd_convergence_ratio) - (freeze_bound_, *, parameters::default_values_for_mesh_3::lloyd_freeze_ratio) - (do_freeze_, *, parameters::default_values_for_mesh_3::do_freeze) - ) -) +/*! + * \ingroup PkgPeriodic3Mesh3Functions + * + * The function `lloyd_optimize_periodic_3_mesh_3()` is a periodic mesh optimization + * process based on the minimization of a global energy function. + * + * This function directly calls `lloyd_optimize_mesh_3()`, but is provided for convenience. + * Further information can be found in the documentation of the function `lloyd_optimize_mesh_3()`. + * + * \note This function requires the \ref thirdpartyEigen library. +*/ +template +Mesh_optimization_return_code lloyd_optimize_periodic_3_mesh_3(C3T3& c3t3, MeshDomain& domain,const CGAL_NP_CLASS& np = parameters::default_values()) { - return lloyd_optimize_mesh_3_impl(c3t3, domain, - time_limit_, max_iteration_number_, - convergence_, freeze_bound_, do_freeze_); + using parameters::choose_parameter; + using parameters::get_parameter; + std::size_t max_iterations = choose_parameter(get_parameter(np, internal_np::number_of_iterations), 0); + const double convergence_ratio = choose_parameter(get_parameter(np, internal_np::convergence_ratio), 0.02); + const double freeze_bound = choose_parameter(get_parameter(np, internal_np::vertex_freeze_bound), 0.001); + const double time_limit = choose_parameter(get_parameter(np, internal_np::maximum_running_time), 0.); + bool do_freeze = choose_parameter(get_parameter(np,internal_np::freeze),true); + return lloyd_optimize_mesh_3_impl(c3t3, domain, time_limit, max_iterations, convergence_ratio, freeze_bound, do_freeze); } -CGAL_PRAGMA_DIAG_POP - -#if defined(BOOST_MSVC) -# pragma warning(pop) -#endif +// Overload handling parameters passed with operator= +template +Mesh_optimization_return_code lloyd_optimize_periodic_3_mesh_3(C3T3& c3t3,MeshDomain& domain, + const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) +{ + return lloyd_optimize_periodic_3_mesh_3(c3t3,domain, internal_np::combine_named_parameters(np1, np2, nps...)); +} } // namespace CGAL diff --git a/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h b/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h index 3751c7a3c54..de17e9cf2c8 100644 --- a/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h +++ b/Periodic_3_mesh_3/include/CGAL/refine_periodic_3_mesh_3.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include @@ -167,51 +167,208 @@ bool project_points(C3T3& c3t3, } // namespace internal -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable:4003) // not enough actual parameters for macro -#endif - -// see -CGAL_PRAGMA_DIAG_PUSH -// see -CGAL_IGNORE_BOOST_PARAMETER_NAME_WARNINGS - -BOOST_PARAMETER_FUNCTION( - (void), - refine_periodic_3_mesh_3, - parameters::tag, - (required (in_out(c3t3),*) (domain,*) (criteria,*) ) // nondeduced - (deduced - (optional - (exude_param, (parameters::internal::Exude_options), parameters::no_exude()) // another default parameter distinct from Mesh_3 - (perturb_param, (parameters::internal::Perturb_options), parameters::no_perturb()) // another default parameter distinct from Mesh_3 - (odt_param, (parameters::internal::Odt_options), parameters::no_odt()) - (lloyd_param, (parameters::internal::Lloyd_options), parameters::no_lloyd()) - (reset_param, (parameters::Reset), parameters::reset_c3t3()) - (mesh_options_param, (parameters::internal::Mesh_3_options), - parameters::internal::Mesh_3_options()) - (manifold_options_param, (parameters::internal::Manifold_options), - parameters::internal::Manifold_options()) - ) - ) -) +/*! + * \ingroup PkgPeriodic3Mesh3Functions + * + * The function `refine_periodic_3_mesh_3()` is a 3D periodic + * mesh generator. It produces periodic simplicial meshes which discretize + * 3D periodic domains. + * + * The periodic mesh generation algorithm is a Delaunay refinement process + * followed by an optimization phase. + * The criteria driving the Delaunay refinement + * process may be tuned to achieve the user needs with respect to + * the size of mesh elements, the accuracy of boundaries approximation, etc. + * + * The optimization phase is a sequence of optimization processes, + * amongst the following available optimizers: an ODT-smoothing, + * a Lloyd smoothing, a sliver perturber, and a sliver exuder. + * Each optimization process can be activated or not, according to the user requirements + * and available time. + * By default, only the perturber and the exuder are activated. + * Note that the benefits of the exuder will be lost if the mesh + * is further refined afterward. + * + * \attention The function template `refine_periodic_3_mesh_3()` may be used + * to refine a previously computed mesh, e.g.: + * \code{.cpp} + * C3T3 c3t3 = CGAL::make_periodic_3_mesh_3(domain,criteria); + * + * CGAL::refine_periodic_3_mesh_3(c3t3, domain, new_criteria); + * \endcode + * + * \attention Note that the triangulation must form at all times a simplicial complex within + * a single copy of the domain (see Sections \ref P3Triangulation3secspace and \ref P3Triangulation3secintro + * of the manual of 3D periodic triangulations). It is the responsability of the user to provide + * a triangulation that satisfies this condition when calling the refinement + * function `refine_periodic_3_mesh_3`. The underlying triangulation of a mesh + * complex obtained through `make_periodic_3_mesh_3()` or `refine_periodic_3_mesh_3()` + * will always satisfy this condition. + * + * + * \tparam C3T3 is required to be a model of + * the concept + * `MeshComplex_3InTriangulation_3`. + * The argument `c3t3` is passed by + * reference as this object is modified by the refinement process. As the + * refinement process only adds points to the triangulation, all + * vertices of the triangulation of `c3t3` remain in the + * mesh during the refinement process. Object `c3t3` can be used to insert + * specific points in the domain to ensure that they will be contained in the + * final triangulation. + * The type `C3T3` is in particular required to provide a nested type + * `C3T3::Triangulation` for the 3D triangulation + * embedding the mesh. The vertex and cell base classes of the + * triangulation `C3T3::Triangulation` are required to be models of the + * concepts `MeshVertexBase_3` and `MeshCellBase_3` + * respectively. + * + * \tparam MD is required to be a model of + * the concept `Periodic_3MeshDomain_3` or of the refined concept + * `Periodic_3MeshDomainWithFeatures_3` if 0 and 1-dimensional features + * of the input complex have to be accurately represented in the mesh. + * The argument `domain` is the sole link through which the domain + * to be discretized is known by the mesh generation algorithm. + * + * \tparam MC is required to be a model of the concept + * `MeshCriteria_3`, or a model of the refined concept `MeshCriteriaWithFeatures_3` + * if the domain has exposed features. The argument `criteria` of + * type `MC` specifies the + * size and shape requirements for mesh tetrahedra + * and surface facets. These criteria + * form the rules which drive the refinement process. All mesh elements + * satisfy those criteria at the end of the refinement process. + * In addition, if the domain has features, the argument + * `criteria` provides a sizing field to guide the discretization + * of 1-dimensional exposed features. + * + * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters + * + * \param c3t3 the mesh to be refined. + * \param domain the domain to be discretized + * \param criteria the criteria + * \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below: + * + * The following four parameters are optional optimization parameters. + * They control which optimization processes are performed + * and allow the user to tune the parameters of the optimization processes. + * Individual optimization parameters are not described here as they are + * internal types (see instead the documentation page of each optimizer). + * For each optimization algorithm, there exist two global functions + * that allow to enable or disable the optimizer: + * + * \cgalNamedParamsBegin + * \cgalParamSectionBegin{Topological options (manifoldness)} + * \cgalParamDescription{In order to drive the meshing algorithm and ensure that the output mesh follows a desired topological criterion, + * three named parameters control this option: + *
      + *
    • `parameters::manifold()` + *
    • `parameters::manifold_with_boundary()` + *
    • `parameters::non_manifold()` + *
    + * Note that the meshing algorithm cannot generate a manifold surface if the input surface is not manifold.} + * \cgalParamDefault{`parameters::non_manifold()`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{Lloyd optimization} + * \cgalParamDescription{`lloyd_optimize_mesh_3()` can optionally be called after the meshing process. + * Two named parameters control this behavior: + *
      + *
    • `parameters::no_lloyd()` + *
    • `parameters::lloyd_optimize_mesh_3()` + *
    } + * \cgalParamDefault{`parameters::no_lloyd()`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{ODT optimization} + * \cgalParamDescription{`odt_optimize_mesh_3()` can optionally be called after the meshing process. + * Two named parameters control this behavior: + *
      + *
    • `parameters::no_odt()` + *
    • `parameters::odt()` + *
    } + * \cgalParamDefault{`parameters::no_odt()`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{Mesh perturbation} + * \cgalParamDescription{`perturb_mesh_3()` can optionally be called after the meshing process. + * Two named parameters control this behavior: + *
      + *
    • `parameters::no_perturb()` + *
    • `parameters::perturb()` + *
    } + * \cgalParamDefault{`parameters::perturb()`} + * \cgalParamSectionEnd + * \cgalParamSectionBegin{Mesh exudation} + * \cgalParamDescription{`exude_mesh_3()` can optionally be called after the meshing process. + * Two named parameters control this behavior: + *
      + *
    • `parameters::exude()` + *
    • `parameters::no_exude()` + *
    } + * \cgalParamDefault{`parameters::exude()`} + * \cgalParamSectionEnd + * \cgalNamedParamsEnd + * + * The optimization parameters can be passed in arbitrary order. If one parameter + * is not passed, its default value is used. The default values are + * `no_lloyd()`, `no_odt()`, `perturb()` and `exude()`. + * Note that whatever may be the optimization processes activated, + * they are always launched in the order that is a suborder + * of the following (see user manual for further + * details): *ODT-smoother*, *Lloyd-smoother*, *perturber*, and *exuder*. + * + * Beware that optimization of the mesh is obtained + * by perturbing mesh vertices and modifying the mesh connectivity + * and that this has an impact + * on the strict compliance to the refinement criteria. + * Though a strict compliance to mesh criteria + * is guaranteed at the end of the Delaunay refinement, this may no longer be true after + * some optimization processes. Also beware that the default behavior does involve some + * optimization processes. + * + * \sa `make_periodic_3_mesh_3()` + * \sa `refine_mesh_3()` + * \sa `exude_periodic_3_mesh_3()` + * \sa `perturb_periodic_3_mesh_3()` + * \sa `lloyd_optimize_periodic_3_mesh_3()` + * \sa `odt_optimize_periodic_3_mesh_3()` + */ +template +void refine_periodic_3_mesh_3(C3T3& c3t3, MeshDomain& domain, MeshCriteria& criteria, const CGAL_NP_CLASS& np = parameters::default_values()) { - return refine_periodic_3_mesh_3_impl(c3t3, domain, criteria, + using parameters::choose_parameter; + using parameters::get_parameter; + parameters::internal::Exude_options exude_param = choose_parameter(get_parameter(np, internal_np::exude_options_param), parameters::exude().v); + parameters::internal::Perturb_options perturb_param = choose_parameter(get_parameter(np, internal_np::perturb_options_param), parameters::perturb().v); + parameters::internal::Odt_options odt_param = choose_parameter(get_parameter(np, internal_np::odt_options_param), parameters::no_odt().v); + parameters::internal::Lloyd_options lloyd_param = choose_parameter(get_parameter(np, internal_np::lloyd_options_param), parameters::no_lloyd().v); + bool reset = choose_parameter(get_parameter(np, internal_np::do_reset_c3t3), false); + parameters::internal::Mesh_3_options mesh_options_param = choose_parameter(get_parameter(np, internal_np::mesh_param), parameters::internal::Mesh_3_options()); + parameters::internal::Manifold_options manifold_options_param = choose_parameter(get_parameter(np, internal_np::manifold_param), parameters::internal::Manifold_options()); + + return refine_periodic_3_mesh_3_impl(c3t3, + domain, + criteria, exude_param, perturb_param, odt_param, lloyd_param, - reset_param(), + reset, mesh_options_param, manifold_options_param); } -CGAL_PRAGMA_DIAG_POP - -#if defined(BOOST_MSVC) -# pragma warning(pop) -#endif +#ifndef DOXYGEN_RUNNING +// Overload handling parameters passed with operator= +template +void refine_periodic_3_mesh_3(C3T3& c3t3, MeshDomain& domain, MeshCriteria& criteria, + const CGAL_NP_CLASS_1& np1, + const CGAL_NP_CLASS_2& np2, + const NP& ... nps) +{ + return refine_periodic_3_mesh_3(c3t3, domain, criteria, internal_np::combine_named_parameters(np1, np2, nps...)); +} /** * @brief This function refines the mesh c3t3 wrt domain & criteria @@ -219,11 +376,11 @@ CGAL_PRAGMA_DIAG_POP * @param c3t3 the mesh to be refined. * @param domain the domain to be discretized * @param criteria the criteria - * @param exude if \c true, an exudation step will be done at + * @param exude if `true`, an exudation step will be done at * the end of the Delaunay refinement process - * @param perturb if \c true, an explicit vertex perturbation step will be + * @param perturb if `true`, an explicit vertex perturbation step will be * done at the end of refinement process - * @param reset_c3t3 if \c true, a new C3T3 will be construct from param c3t3. + * @param reset_c3t3 if `true`, a new C3T3 will be construct from param c3t3. * The new c3t3 keeps only the vertices (as NON-weighted points with their * dimension and Index) of the triangulation. That allows to refine a mesh * which has been exuded. @@ -343,6 +500,7 @@ void refine_periodic_3_mesh_3_impl(C3T3& c3t3, CGAL_expensive_postcondition(c3t3.triangulation().is_valid()); CGAL_expensive_postcondition(c3t3.is_valid()); } +#endif //DOXYGEN_RUNNING } // end namespace CGAL diff --git a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/Scene.h b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/Scene.h index 6173cd701a0..eed30ec2d3b 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/Scene.h +++ b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/Scene.h @@ -62,8 +62,8 @@ struct Scene { y = (y < d.ymin() ? y+d.ymax()-d.ymin() : (y >= d.ymax() ? y-d.ymax()+d.ymin() : y)); - CGAL_triangulation_postcondition((d.xmin()<=x)&&(xfirst->vertex(i); if(squared_distance(p1,p2) > edge_length_threshold) { - CGAL_triangulation_assertion(find(too_long_edges[v_no].begin(), - too_long_edges[v_no].end(), - edge_to_add.second) == too_long_edges[v_no].end()); + CGAL_assertion(find(too_long_edges[v_no].begin(), + too_long_edges[v_no].end(), + edge_to_add.second) == too_long_edges[v_no].end()); too_long_edges[v_no].push_back(edge_to_add.second); ++too_long_edge_counter; } @@ -316,8 +316,8 @@ public: void create_initial_triangulation() { // create the base for too_long_edges; - CGAL_triangulation_assertion( too_long_edges.empty() ); - CGAL_triangulation_assertion(too_long_edge_counter == 0); + CGAL_assertion( too_long_edges.empty() ); + CGAL_assertion(too_long_edge_counter == 0); for(Vertex_iterator vit = vertices_begin(); vit !=vertices_end(); ++vit ) too_long_edges[vit] = std::list();; @@ -374,7 +374,7 @@ public: template void insert_too_long_edges(Vertex_handle v, const CellIt begin, const CellIt end) { - CGAL_triangulation_precondition(number_of_vertices() != 0); + CGAL_precondition(number_of_vertices() != 0); // add newly added edges to too_long_edges, if necessary. Point p1,p2; std::pair< Vertex_handle, Vertex_handle > edge_to_add; @@ -389,7 +389,7 @@ public: if(&*((*it)->vertex(j)) > &*((*it)->vertex(k))) continue; // make the offsets canonical (wrt. to some notion) // add to too_long_edges, if not yet added and if "too long" - CGAL_triangulation_precondition( + CGAL_precondition( &*((*it)->vertex(j))< &*((*it)->vertex(k))); edge_to_add = std::make_pair((*it)->vertex(j), (*it)->vertex(k)); @@ -906,7 +906,7 @@ typename Periodic_3_Delaunay_triangulation_3::Vertex_handle Periodic_3_Delaunay_triangulation_3::nearest_vertex_in_cell( const Cell_handle& c, const Point& p, const Offset& o) const { - CGAL_triangulation_precondition(number_of_vertices() != 0); + CGAL_precondition(number_of_vertices() != 0); Vertex_handle nearest = c->vertex(0); for(int i=1; i<4; i++) { nearest = (compare_distance(p,nearest->point(),c->vertex(i)->point(), @@ -925,7 +925,7 @@ typename Periodic_3_Delaunay_triangulation_3::Vertex_handle Periodic_3_Delaunay_triangulation_3:: move_point(Vertex_handle v, const Point& p) { - CGAL_triangulation_expensive_precondition(is_vertex(v)); + CGAL_expensive_precondition(is_vertex(v)); remove(v); return insert(p); } @@ -944,7 +944,7 @@ void Periodic_3_Delaunay_triangulation_3::remove(Vertex_handle v) Cover_manager cover_manager(*this); Base::remove(v, remover, ct, cover_manager); - CGAL_triangulation_expensive_assertion(is_valid()); + CGAL_expensive_assertion(is_valid()); } // Undocumented function that tries to remove 'v' but only does so if removal @@ -955,7 +955,7 @@ bool Periodic_3_Delaunay_triangulation_3:: remove_if_no_cover_change(Vertex_handle v) { - CGAL_triangulation_precondition(this->is_1_cover()); + CGAL_precondition(this->is_1_cover()); // Since we are in a 1-sheet configuration, we can call directly periodic_remove() // and don't need the conflict tester. The rest is copied from above. @@ -976,8 +976,8 @@ remove_if_no_cover_change(Vertex_handle v) return false; // removing would cause a cover change } - CGAL_triangulation_expensive_postcondition(is_valid()); - CGAL_triangulation_postcondition(this->is_1_cover()); + CGAL_expensive_postcondition(is_valid()); + CGAL_postcondition(this->is_1_cover()); return true; // successfully removed the vertex } @@ -990,7 +990,7 @@ Periodic_3_Delaunay_triangulation_3::find_conflicts( const Point& p, Cell_handle c, OutputIteratorBoundaryFacets bfit, OutputIteratorCells cit, OutputIteratorInternalFacets ifit) const { - CGAL_triangulation_precondition(number_of_vertices() != 0); + CGAL_precondition(number_of_vertices() != 0); std::vector facets; facets.reserve(64); @@ -1088,7 +1088,7 @@ _side_of_sphere(const Cell_handle& c, const Point& q, // 2 iterations are enough (cf paper) for(int i=4; i>2; --i) { if(points[i] == &pts[4]) { - CGAL_triangulation_assertion(orientation(p0, p1, p2, p3, o0, o1, o2, o3) + CGAL_assertion(orientation(p0, p1, p2, p3, o0, o1, o2, o3) == POSITIVE); // since p0 p1 p2 p3 are non coplanar and positively oriented return ON_UNBOUNDED_SIDE; @@ -1112,7 +1112,7 @@ _side_of_sphere(const Cell_handle& c, const Point& q, } } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return ON_UNBOUNDED_SIDE; } @@ -1120,7 +1120,7 @@ template < class Gt, class Tds > bool Periodic_3_Delaunay_triangulation_3:: is_Gabriel(const Cell_handle c, int i) const { - CGAL_triangulation_precondition(number_of_vertices() != 0); + CGAL_precondition(number_of_vertices() != 0); typename Geom_traits::Side_of_bounded_sphere_3 side_of_bounded_sphere = geom_traits().side_of_bounded_sphere_3_object(); @@ -1291,7 +1291,7 @@ public: bool test_initial_cell(Cell_handle c, const Offset &off) const { if(!(operator()(c, off))) - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return true; } @@ -1330,11 +1330,11 @@ public: inline void hide_point(Cell_handle, const Point &) { } inline void hide(Point &, Cell_handle ) const { - CGAL_triangulation_assertion(false); + CGAL_assertion(false); } inline void do_hide(const Point &, Cell_handle ) const { - CGAL_triangulation_assertion(false); + CGAL_assertion(false); } template < class Tester > inline bool replace_vertex(const Point &, Vertex_handle , @@ -1454,7 +1454,7 @@ operator>> (std::istream& is, Periodic_3_Delaunay_triangulation_3 &tr) tr.compute_too_long_edges(); - CGAL_triangulation_expensive_assertion( tr.is_valid() ); + CGAL_expensive_assertion( tr.is_valid() ); return is; } diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_offset_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_offset_3.h index ca7124d8688..d1b13b8e804 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_offset_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_offset_3.h @@ -17,7 +17,7 @@ #include #include -#include +#include #include namespace CGAL { @@ -46,13 +46,13 @@ public: int &operator[](int i) { if (i==0) return _offx; if (i==1) return _offy; - CGAL_triangulation_assertion(i==2); + CGAL_assertion(i==2); return _offz; } int operator[](int i) const { if (i==0) return _offx; if (i==1) return _offy; - CGAL_triangulation_assertion(i==2); + CGAL_assertion(i==2); return _offz; } void operator+=(const Periodic_3_offset_3 &other) { diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h index 65ff47224f3..d59967f0055 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h @@ -250,8 +250,8 @@ public: if(!is_1_cover()) insert_cells_with_too_big_orthoball(tr.cells_begin(), tr.cells_end()); - CGAL_triangulation_expensive_postcondition(*this == tr); - CGAL_triangulation_expensive_postcondition(is_valid()); + CGAL_expensive_postcondition(*this == tr); + CGAL_expensive_postcondition(is_valid()); } Periodic_3_regular_triangulation_3 operator=(Periodic_3_regular_triangulation_3 tr) @@ -269,7 +269,7 @@ public: void create_initial_triangulation() { - CGAL_triangulation_assertion( cells_with_too_big_orthoball.empty() ); + CGAL_assertion( cells_with_too_big_orthoball.empty() ); for(Cell_iterator iter = cells_begin(), end_iter = cells_end(); iter != end_iter; ++iter) cells_with_too_big_orthoball.insert(iter); @@ -412,8 +412,8 @@ public: Conflict_tester tester(point, this); Point_hider hider(this); Cover_manager cover_manager(*this); - CGAL_triangulation_precondition(point.weight() >= 0); - CGAL_triangulation_precondition_msg + CGAL_precondition(point.weight() >= 0); + CGAL_precondition_msg ( point.weight() < orthosphere_radius_threshold , "point.weight() < 1/64 * domain_size * domain_size" @@ -428,8 +428,8 @@ public: Conflict_tester tester(point, this); Point_hider hider(this); Cover_manager cover_manager(*this); - CGAL_triangulation_precondition(point.weight() >= 0); - CGAL_triangulation_precondition_msg + CGAL_precondition(point.weight() >= 0); + CGAL_precondition_msg ( point.weight() < orthosphere_radius_threshold, "point.weight() < 1/64 * domain_size * domain_size" @@ -444,7 +444,7 @@ public: if(first == last) return 0; - CGAL_triangulation_precondition_code + CGAL_precondition_code ( bool precondition_is_satisfied = true; for(InputIterator pc_first = first, pc_last = last; pc_first != pc_last; ++pc_first) @@ -457,7 +457,7 @@ public: } ) - CGAL_triangulation_precondition_msg + CGAL_precondition_msg ( precondition_is_satisfied, "0 <= point.weight() < 1/64 * domain_size * domain_size" @@ -555,7 +555,7 @@ public: insert(*hi); } - CGAL_triangulation_expensive_postcondition(is_valid()); + CGAL_expensive_postcondition(is_valid()); } // Undocumented function that tries to remove 'v' but only does so if removal @@ -563,7 +563,7 @@ public: // \pre the triangulation is 1-sheeted bool remove_if_no_cover_change(Vertex_handle v) { - CGAL_triangulation_precondition(this->is_1_cover()); + CGAL_precondition(this->is_1_cover()); // Since we are in a 1-sheet configuration, we can call directly periodic_remove() // and don't need the conflict tester. The rest is copied from above. @@ -591,8 +591,8 @@ public: insert(*hi); } - CGAL_triangulation_expensive_postcondition(is_valid()); - CGAL_triangulation_postcondition(this->is_1_cover()); + CGAL_expensive_postcondition(is_valid()); + CGAL_postcondition(this->is_1_cover()); return true; // successfully removed the vertex } @@ -648,7 +648,7 @@ public: Oriented_side power_side_of_oriented_power_sphere(const Weighted_point &p, const Weighted_point &q) const { - CGAL_triangulation_precondition(this->equal(p, q)); + CGAL_precondition(this->equal(p, q)); return geom_traits().power_side_of_oriented_power_sphere_3_object()(p, q); } Oriented_side power_side_of_oriented_power_sphere(const Weighted_point &p, const Weighted_point &q, @@ -700,7 +700,7 @@ public: const Offset& o3 = this->get_offset(c,3); const Offset& oq = offset; - CGAL_triangulation_precondition( orientation(p0, p1, p2, p3, o0, o1, o2, o3) == POSITIVE ); + CGAL_precondition( orientation(p0, p1, p2, p3, o0, o1, o2, o3) == POSITIVE ); Oriented_side os = ON_NEGATIVE_SIDE; os = power_side_of_oriented_power_sphere(p0, p1, p2, p3, q, o0, o1, o2, o3, oq); @@ -721,7 +721,7 @@ public: // of the determinant has non null coefficient. for(int i=4; i>1; --i) { if(points[i] == &pts[4]) { - CGAL_triangulation_assertion(orientation(p0, p1, p2, p3, o0, o1, o2, o3) + CGAL_assertion(orientation(p0, p1, p2, p3, o0, o1, o2, o3) == POSITIVE); // since p0 p1 p2 p3 are non coplanar and positively oriented return ON_UNBOUNDED_SIDE; @@ -745,7 +745,7 @@ public: } } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return ON_UNBOUNDED_SIDE; } @@ -802,12 +802,12 @@ public: CGAL_precondition(CGAL::abs(move.z()) < domain().zmax() - domain().zmin() ); // 'new_position' must be canonical - CGAL_triangulation_precondition(new_position.x() < domain().xmax()); - CGAL_triangulation_precondition(new_position.y() < domain().ymax()); - CGAL_triangulation_precondition(new_position.z() < domain().zmax()); - CGAL_triangulation_precondition(new_position.x() >= domain().xmin()); - CGAL_triangulation_precondition(new_position.y() >= domain().ymin()); - CGAL_triangulation_precondition(new_position.z() >= domain().zmin()); + CGAL_precondition(new_position.x() < domain().xmax()); + CGAL_precondition(new_position.y() < domain().ymax()); + CGAL_precondition(new_position.z() < domain().zmax()); + CGAL_precondition(new_position.x() >= domain().xmin()); + CGAL_precondition(new_position.y() >= domain().ymin()); + CGAL_precondition(new_position.z() >= domain().zmin()); if(new_position == v->point()) return; @@ -936,9 +936,9 @@ public: std::cout << "moved v to " << v->point() << std::endl; #endif - CGAL_triangulation_precondition(!(v->point().x() < domain().xmin()) && v->point().x() < domain().xmax()); - CGAL_triangulation_precondition(!(v->point().y() < domain().ymin()) && v->point().y() < domain().ymax()); - CGAL_triangulation_precondition(!(v->point().z() < domain().zmin()) && v->point().z() < domain().zmax()); + CGAL_precondition(!(v->point().x() < domain().xmin()) && v->point().x() < domain().xmax()); + CGAL_precondition(!(v->point().y() < domain().ymin()) && v->point().y() < domain().ymax()); + CGAL_precondition(!(v->point().z() < domain().zmin()) && v->point().z() < domain().zmax()); } Weighted_point point(const Periodic_weighted_point& pp) const @@ -968,12 +968,12 @@ public: Vertex_handle nearest_power_vertex(const Bare_point& p, Cell_handle start) const { - CGAL_triangulation_precondition(p.x() < domain().xmax()); - CGAL_triangulation_precondition(p.y() < domain().ymax()); - CGAL_triangulation_precondition(p.z() < domain().zmax()); - CGAL_triangulation_precondition(p.x() >= domain().xmin()); - CGAL_triangulation_precondition(p.y() >= domain().ymin()); - CGAL_triangulation_precondition(p.z() >= domain().zmin()); + CGAL_precondition(p.x() < domain().xmax()); + CGAL_precondition(p.y() < domain().ymax()); + CGAL_precondition(p.z() < domain().zmax()); + CGAL_precondition(p.x() >= domain().xmin()); + CGAL_precondition(p.y() >= domain().ymin()); + CGAL_precondition(p.z() >= domain().zmin()); if(number_of_vertices() == 0) return Vertex_handle(); @@ -1067,7 +1067,7 @@ public: bool is_Gabriel(Cell_handle c, int i) const { - CGAL_triangulation_precondition(number_of_vertices() != 0); + CGAL_precondition(number_of_vertices() != 0); typename Geom_traits::Power_side_of_bounded_power_sphere_3 side_of_bounded_power_sphere = geom_traits().power_side_of_bounded_power_sphere_3_object(); @@ -1102,7 +1102,7 @@ public: bool is_Gabriel(Cell_handle c, int i, int j) const { - CGAL_triangulation_precondition(number_of_vertices() != 0); + CGAL_precondition(number_of_vertices() != 0); typename Geom_traits::Power_side_of_bounded_power_sphere_3 side_of_bounded_power_sphere = geom_traits().power_side_of_bounded_power_sphere_3_object(); @@ -1186,12 +1186,12 @@ public: // offsets to find the minimum Offset get_min_dist_offset_general(const Bare_point& p, const Vertex_handle vh) const { - CGAL_triangulation_precondition(p.x() < domain().xmax()); - CGAL_triangulation_precondition(p.y() < domain().ymax()); - CGAL_triangulation_precondition(p.z() < domain().zmax()); - CGAL_triangulation_precondition(p.x() >= domain().xmin()); - CGAL_triangulation_precondition(p.y() >= domain().ymin()); - CGAL_triangulation_precondition(p.z() >= domain().zmin()); + CGAL_precondition(p.x() < domain().xmax()); + CGAL_precondition(p.y() < domain().ymax()); + CGAL_precondition(p.z() < domain().zmax()); + CGAL_precondition(p.x() >= domain().xmin()); + CGAL_precondition(p.y() >= domain().ymin()); + CGAL_precondition(p.z() >= domain().zmin()); Offset min_off = Offset(0,0,0); @@ -1215,7 +1215,7 @@ public: Vertex_handle nearest_vertex_in_cell(const Cell_handle& c, const Bare_point& p, const Offset & o) const { - CGAL_triangulation_precondition(number_of_vertices() != 0); + CGAL_precondition(number_of_vertices() != 0); Vertex_handle nearest = c->vertex(0); for(int i=1; i<4; i++) { @@ -1384,7 +1384,7 @@ public: OutputIteratorBoundaryFacets bfit, OutputIteratorCells cit, OutputIteratorInternalFacets ifit) const { - CGAL_triangulation_precondition(number_of_vertices() != 0); + CGAL_precondition(number_of_vertices() != 0); std::vector facets; facets.reserve(64); @@ -1671,12 +1671,12 @@ public: // inline void hide(Weighted_point&, Cell_handle ) const // useless? // { -// CGAL_triangulation_assertion(false); +// CGAL_assertion(false); // } // // inline void do_hide(const Weighted_point&, Cell_handle ) const // useless? // { -// CGAL_triangulation_assertion(false); +// CGAL_assertion(false); // } // template < class Tester > @@ -1755,7 +1755,7 @@ operator>> (std::istream& is, Periodic_3_regular_triangulation_3& tr) tr.insert_cells_with_too_big_orthoball(tr.cells_begin(), tr.cells_end()); - CGAL_triangulation_expensive_assertion( tr.is_valid() ); + CGAL_expensive_assertion( tr.is_valid() ); return is; } diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index 63933dc48b0..3d1247a89e0 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -31,10 +31,10 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -282,8 +282,8 @@ public: else copy_multiple_covering(tr); - CGAL_triangulation_expensive_postcondition(*this == tr); - CGAL_triangulation_expensive_postcondition(is_valid()); + CGAL_expensive_postcondition(*this == tr); + CGAL_expensive_postcondition(is_valid()); } virtual ~Periodic_3_triangulation_3() {} @@ -308,7 +308,7 @@ public: { vlist.push_back(vit); virtual_vertices_reverse.insert(std::make_pair(vit,std::vector(26))); - CGAL_triangulation_assertion(virtual_vertices_reverse.find(vit)->second.size() == 26); + CGAL_assertion(virtual_vertices_reverse.find(vit)->second.size() == 26); } } @@ -324,7 +324,7 @@ public: Offset off = vit2->offset(); virtual_vertices.insert(std::make_pair(vit2, std::make_pair(*vlist_it,off))); virtual_vertices_reverse.find(*vlist_it)->second[9*off[0]+3*off[1]+off[2]-1] = vit2; - CGAL_triangulation_assertion(get_offset(vit2) == off); + CGAL_assertion(get_offset(vit2) == off); } } @@ -404,9 +404,9 @@ public: } const std::vector& periodic_copies(const Vertex_handle v) const { - CGAL_triangulation_precondition(number_of_sheets() != CGAL::make_array(1,1,1)); - CGAL_triangulation_precondition(virtual_vertices.find(v) == virtual_vertices.end()); - CGAL_triangulation_assertion( + CGAL_precondition(number_of_sheets() != CGAL::make_array(1,1,1)); + CGAL_precondition(virtual_vertices.find(v) == virtual_vertices.end()); + CGAL_assertion( virtual_vertices_reverse.find(v) != virtual_vertices_reverse.end()); return virtual_vertices_reverse.find(v)->second; } @@ -472,9 +472,9 @@ public: // Offset converters int off_to_int(const Offset& off) const { - CGAL_triangulation_assertion( off.x() == 0 || off.x() == 1 ); - CGAL_triangulation_assertion( off.y() == 0 || off.y() == 1 ); - CGAL_triangulation_assertion( off.z() == 0 || off.z() == 1 ); + CGAL_assertion( off.x() == 0 || off.x() == 1 ); + CGAL_assertion( off.y() == 0 || off.y() == 1 ); + CGAL_assertion( off.z() == 0 || off.z() == 1 ); int i = ((off.x()&1)<<2) + ((off.y()&1)<<1) + ((off.z()&1)); return i; } @@ -523,24 +523,24 @@ public: } } - CGAL_triangulation_assertion((std::min)((std::min)(off0[0],off1[0]), + CGAL_assertion((std::min)((std::min)(off0[0],off1[0]), (std::min)(off2[0],off3[0])) == 0); - CGAL_triangulation_assertion((std::min)((std::min)(off0[1],off1[1]), + CGAL_assertion((std::min)((std::min)(off0[1],off1[1]), (std::min)(off2[1],off3[1])) == 0); - CGAL_triangulation_assertion((std::min)((std::min)(off0[2],off1[2]), + CGAL_assertion((std::min)((std::min)(off0[2],off1[2]), (std::min)(off2[2],off3[2])) == 0); - CGAL_triangulation_assertion((0 <= off0[0]) && (off0[0] < 2)); - CGAL_triangulation_assertion((0 <= off1[0]) && (off1[0] < 2)); - CGAL_triangulation_assertion((0 <= off2[0]) && (off2[0] < 2)); - CGAL_triangulation_assertion((0 <= off3[0]) && (off3[0] < 2)); - CGAL_triangulation_assertion((0 <= off0[1]) && (off0[1] < 2)); - CGAL_triangulation_assertion((0 <= off1[1]) && (off1[1] < 2)); - CGAL_triangulation_assertion((0 <= off2[1]) && (off2[1] < 2)); - CGAL_triangulation_assertion((0 <= off3[1]) && (off3[1] < 2)); - CGAL_triangulation_assertion((0 <= off0[2]) && (off0[2] < 2)); - CGAL_triangulation_assertion((0 <= off1[2]) && (off1[2] < 2)); - CGAL_triangulation_assertion((0 <= off2[2]) && (off2[2] < 2)); - CGAL_triangulation_assertion((0 <= off3[2]) && (off3[2] < 2)); + CGAL_assertion((0 <= off0[0]) && (off0[0] < 2)); + CGAL_assertion((0 <= off1[0]) && (off1[0] < 2)); + CGAL_assertion((0 <= off2[0]) && (off2[0] < 2)); + CGAL_assertion((0 <= off3[0]) && (off3[0] < 2)); + CGAL_assertion((0 <= off0[1]) && (off0[1] < 2)); + CGAL_assertion((0 <= off1[1]) && (off1[1] < 2)); + CGAL_assertion((0 <= off2[1]) && (off2[1] < 2)); + CGAL_assertion((0 <= off3[1]) && (off3[1] < 2)); + CGAL_assertion((0 <= off0[2]) && (off0[2] < 2)); + CGAL_assertion((0 <= off1[2]) && (off1[2] < 2)); + CGAL_assertion((0 <= off2[2]) && (off2[2] < 2)); + CGAL_assertion((0 <= off3[2]) && (off3[2] < 2)); int o0i = ((off0[0]&1)<<2)+((off0[1]&1)<<1)+(off0[2]&1); int o1i = ((off1[0]&1)<<2)+((off1[1]&1)<<1)+(off1[2]&1); @@ -821,9 +821,9 @@ public: } Periodic_segment periodic_segment(const Cell_handle c, int i, int j) const { - CGAL_triangulation_precondition( i != j ); - CGAL_triangulation_precondition( number_of_vertices() != 0 ); - CGAL_triangulation_precondition( i >= 0 && i <= 3 && j >= 0 && j <= 3 ); + CGAL_precondition( i != j ); + CGAL_precondition( number_of_vertices() != 0 ); + CGAL_precondition( i >= 0 && i <= 3 && j >= 0 && j <= 3 ); return CGAL::make_array(std::make_pair(c->vertex(i)->point(), get_offset(c,i)), std::make_pair(c->vertex(j)->point(), get_offset(c,j))); } @@ -879,8 +879,8 @@ public: } Periodic_triangle periodic_triangle(const Cell_handle c, int i) const { - CGAL_triangulation_precondition( number_of_vertices() != 0 ); - CGAL_triangulation_precondition( i >= 0 && i <= 3 ); + CGAL_precondition( number_of_vertices() != 0 ); + CGAL_precondition( i >= 0 && i <= 3 ); if( (i&1)==0 ) return CGAL::make_array(std::make_pair(c->vertex((i+2)&3)->point(), get_offset(c,(i+2)&3)), std::make_pair(c->vertex((i+1)&3)->point(), get_offset(c,(i+1)&3)), @@ -951,7 +951,7 @@ public: Periodic_tetrahedron periodic_tetrahedron(const Cell_handle c) const { - CGAL_triangulation_precondition( number_of_vertices() != 0 ); + CGAL_precondition( number_of_vertices() != 0 ); return CGAL::make_array(std::make_pair(c->vertex(0)->point(), get_offset(c,0)), std::make_pair(c->vertex(1)->point(), get_offset(c,1)), std::make_pair(c->vertex(2)->point(), get_offset(c,2)), @@ -1350,21 +1350,21 @@ protected: std::vector double_vertices; Locate_type lt = Locate_type(); int li=0, lj=0; - CGAL_triangulation_assertion_code( Locate_type lta = Locate_type(); ) - CGAL_triangulation_assertion_code( int ia = 0; ) - CGAL_triangulation_assertion_code( int ja = 0; ) + CGAL_assertion_code( Locate_type lta = Locate_type(); ) + CGAL_assertion_code( int ia = 0; ) + CGAL_assertion_code( int ja = 0; ) Cell_handle hint; while(begin!=end) { tester.set_point(*begin); Offset lo; hint = periodic_locate(*begin, Offset(), lo, lt, li, lj, start); - CGAL_triangulation_assertion_code( if(number_of_vertices() != 0) { ); - CGAL_triangulation_assertion(side_of_cell( + CGAL_assertion_code( if(number_of_vertices() != 0) { ); + CGAL_assertion(side_of_cell( *begin,Offset(), hint, lta, ia, ja) != ON_UNBOUNDED_SIDE); - CGAL_triangulation_assertion(lta == lt); - CGAL_triangulation_assertion(ia == li); - CGAL_triangulation_assertion(ja == lj); - CGAL_triangulation_assertion_code( } + CGAL_assertion(lta == lt); + CGAL_assertion(ia == li); + CGAL_assertion(ja == lj); + CGAL_assertion_code( } ); new_vertex = insert_in_conflict(*begin,lt,hint,li,lj,tester,hider, cover_manager); @@ -1417,7 +1417,7 @@ protected: typename Virtual_vertex_reverse_map::iterator origin_it = this->virtual_vertices_reverse.find(vh); std::vector& copies = origin_it->second; typename std::vector::iterator copy_iter = std::find(copies.begin(), copies.end(), vertex_handle); - CGAL_triangulation_assertion(copy_iter != copies.end()); + CGAL_assertion(copy_iter != copies.end()); copies.erase(copy_iter); if(copies.empty()) virtual_vertices_reverse.erase(origin_it); @@ -1425,8 +1425,8 @@ protected: return; } - CGAL_triangulation_assertion(this->virtual_vertices.find(vertex_handle) == this->virtual_vertices.end()); - CGAL_triangulation_assertion(this->virtual_vertices_reverse.find(vertex_handle) == this->virtual_vertices_reverse.end()); + CGAL_assertion(this->virtual_vertices.find(vertex_handle) == this->virtual_vertices.end()); + CGAL_assertion(this->virtual_vertices_reverse.find(vertex_handle) == this->virtual_vertices_reverse.end()); } public: @@ -1761,7 +1761,7 @@ protected: Periodic_point_3 periodic_circumcenter(Cell_handle c, ConstructCircumcenter construct_circumcenter) const { - CGAL_triangulation_precondition(c != Cell_handle()); + CGAL_precondition(c != Cell_handle()); Point_3 p = construct_circumcenter(c->vertex(0)->point(), c->vertex(1)->point(), c->vertex(2)->point(), c->vertex(3)->point(), @@ -1821,7 +1821,7 @@ protected: bool canonical_dual_segment(Cell_handle c, int i, Periodic_segment_3& ps, ConstructCircumcenter construct_circumcenter) const { - CGAL_triangulation_precondition(c != Cell_handle()); + CGAL_precondition(c != Cell_handle()); Offset off = neighbor_offset(c,i,c->neighbor(i)); Periodic_point_3 p1 = periodic_circumcenter(c, construct_circumcenter); Periodic_point_3 p2 = periodic_circumcenter(c->neighbor(i), construct_circumcenter); @@ -1880,7 +1880,7 @@ protected: template Stream& draw_dual(Stream& os, ConstructCircumcenter construct_circumcenter) const { - CGAL_triangulation_assertion_code( unsigned int i = 0; ) + CGAL_assertion_code( unsigned int i = 0; ) for(Facet_iterator fit = facets_begin(), end = facets_end(); fit != end; ++fit) { if(!is_canonical(*fit)) @@ -1889,11 +1889,11 @@ protected: Periodic_segment_3 pso; canonical_dual_segment(fit->first, fit->second, pso, construct_circumcenter); Segment so = construct_segment(pso); - CGAL_triangulation_assertion_code ( ++i; ) + CGAL_assertion_code ( ++i; ) os << so.source() << '\n'; os << so.target() << '\n'; } - CGAL_triangulation_assertion( i == number_of_facets() ); + CGAL_assertion( i == number_of_facets() ); return os; } @@ -1989,9 +1989,9 @@ protected: z = (z < d.zmin() ? z+d.zmax()-d.zmin() : (z >= d.zmax() ? z-d.zmax()+d.zmin() : z)); - CGAL_triangulation_postcondition((d.xmin()<=x)&&(xneighbor(0)->neighbor( + CGAL_postcondition(start!=Cell_handle()); + CGAL_assertion(start->neighbor(0)->neighbor( start->neighbor(0)->index(start))==start); - CGAL_triangulation_assertion(start->neighbor(1)->neighbor( + CGAL_assertion(start->neighbor(1)->neighbor( start->neighbor(1)->index(start))==start); - CGAL_triangulation_assertion(start->neighbor(2)->neighbor( + CGAL_assertion(start->neighbor(2)->neighbor( start->neighbor(2)->index(start))==start); - CGAL_triangulation_assertion(start->neighbor(3)->neighbor( + CGAL_assertion(start->neighbor(3)->neighbor( start->neighbor(3)->index(start))==start); // We implement the remembering visibility/stochastic walk. @@ -2182,7 +2182,7 @@ try_next_cell: continue; } - CGAL_triangulation_assertion(next->neighbor(next->index(c)) == c); + CGAL_assertion(next->neighbor(next->index(c)) == c); // We temporarily put p at i's place in pts. const Point* backup = pts[i]; @@ -2252,7 +2252,7 @@ try_next_cell: break; default: // the point cannot lie on four facets - CGAL_triangulation_assertion(false); + CGAL_assertion(false); } lo = off_query; @@ -2273,7 +2273,7 @@ inexact_periodic_locate(const Point& p, const Offset& o_p, if(number_of_vertices() == 0) { return Cell_handle(); } - CGAL_triangulation_assertion(number_of_vertices() != 0); + CGAL_assertion(number_of_vertices() != 0); if(start == Cell_handle()) { start = cells_begin(); @@ -2290,14 +2290,14 @@ inexact_periodic_locate(const Point& p, const Offset& o_p, off_query += Offset(0,0,1); } - CGAL_triangulation_postcondition(start!=Cell_handle()); - CGAL_triangulation_assertion(start->neighbor(0)->neighbor( + CGAL_postcondition(start!=Cell_handle()); + CGAL_assertion(start->neighbor(0)->neighbor( start->neighbor(0)->index(start))==start); - CGAL_triangulation_assertion(start->neighbor(1)->neighbor( + CGAL_assertion(start->neighbor(1)->neighbor( start->neighbor(1)->index(start))==start); - CGAL_triangulation_assertion(start->neighbor(2)->neighbor( + CGAL_assertion(start->neighbor(2)->neighbor( start->neighbor(2)->index(start))==start); - CGAL_triangulation_assertion(start->neighbor(3)->neighbor( + CGAL_assertion(start->neighbor(3)->neighbor( start->neighbor(3)->index(start))==start); // We implement the remembering visibility/stochastic walk. @@ -2395,14 +2395,14 @@ inline Bounded_side Periodic_3_triangulation_3::side_of_cell( const Point& q, const Offset& off, Cell_handle c, Locate_type& lt, int& i, int& j) const { - CGAL_triangulation_precondition( number_of_vertices() != 0 ); + CGAL_precondition( number_of_vertices() != 0 ); Orientation o0,o1,o2,o3; o0 = o1 = o2 = o3 = ZERO; int cumm_off = c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3); if((cumm_off == 0) && (is_1_cover())) { - CGAL_triangulation_assertion(off == Offset()); + CGAL_assertion(off == Offset()); const Point& p0 = c->vertex(0)->point(); const Point& p1 = c->vertex(1)->point(); const Point& p2 = c->vertex(2)->point(); @@ -2422,7 +2422,7 @@ inline Bounded_side Periodic_3_triangulation_3::side_of_cell( p[i] = &(c->vertex(i)->point()); offs[i] = get_offset(c,i); } - CGAL_triangulation_assertion(orientation(*p[0], *p[1], *p[2], *p[3], + CGAL_assertion(orientation(*p[0], *p[1], *p[2], *p[3], offs[0], offs[1], offs[2], offs[3]) == POSITIVE); bool found=false; for(int i=0; (i<8)&&(!found); i++) { @@ -2492,7 +2492,7 @@ inline Bounded_side Periodic_3_triangulation_3::side_of_cell( default: { // impossible : cannot be on 4 facets for a real tetrahedron - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return ON_BOUNDARY; } } @@ -2524,10 +2524,10 @@ Periodic_3_triangulation_3::periodic_insert( Locate_type /*lt*/, Cell_handle c, const Conflict_tester& tester, Point_hider& hider, CoverManager& cover_manager, Vertex_handle vh) { - CGAL_triangulation_precondition(number_of_vertices() != 0); - CGAL_triangulation_assertion_code( + CGAL_precondition(number_of_vertices() != 0); + CGAL_assertion_code( Locate_type lt_assert; int i_assert; int j_assert;); - CGAL_triangulation_precondition(side_of_cell(tester.point(),o, c, + CGAL_precondition(side_of_cell(tester.point(),o, c, lt_assert, i_assert, j_assert) != ON_UNBOUNDED_SIDE); tester.set_offset(o); @@ -2536,7 +2536,7 @@ Periodic_3_triangulation_3::periodic_insert( bool found = false; Offset current_off = get_location_offset(tester, c, found); - CGAL_triangulation_assertion(side_of_cell(tester.point(), + CGAL_assertion(side_of_cell(tester.point(), combine_offsets(o,current_off),c,lt_assert,i_assert,j_assert) != ON_UNBOUNDED_SIDE); @@ -2596,7 +2596,7 @@ Periodic_3_triangulation_3::periodic_insert( v_offsets.clear(); if(vh != Vertex_handle()) { -// CGAL_triangulation_assertion(virtual_vertices.find(v) == virtual_vertices.end()); +// CGAL_assertion(virtual_vertices.find(v) == virtual_vertices.end()); virtual_vertices[v] = Virtual_vertex(vh,o); virtual_vertices_reverse[vh].push_back(v); } @@ -2642,8 +2642,8 @@ Periodic_3_triangulation_3::create_initial_triangulation(const Point& p) virtual_vertices_reverse[vir_vertices[0][0][0]].push_back( vir_vertices[i][j][k]); } - CGAL_triangulation_assertion(vir_vertices[i][j][k] != Vertex_handle()); - CGAL_triangulation_assertion(vir_vertices[0][0][0]->point() == p); + CGAL_assertion(vir_vertices[i][j][k] != Vertex_handle()); + CGAL_assertion(vir_vertices[0][0][0]->point() == p); } } } @@ -2656,7 +2656,7 @@ Periodic_3_triangulation_3::create_initial_triangulation(const Point& p) // 6 cells per 'cube' cells[i][j][k][l] = _tds.create_cell(); for(int n=0; n<4; n++) - CGAL_triangulation_assertion(cells[i][j][k][l] != Cell_handle()); + CGAL_assertion(cells[i][j][k][l] != Cell_handle()); } } } @@ -2784,8 +2784,8 @@ find_conflicts(Cell_handle d, const Offset& current_off, OutputIteratorCells, OutputIteratorInternalFacets> it) const { - CGAL_triangulation_precondition( number_of_vertices() != 0 ); - CGAL_triangulation_precondition( tester(d, current_off) ); + CGAL_precondition( number_of_vertices() != 0 ); + CGAL_precondition( tester(d, current_off) ); std::stack > cell_stack; cell_stack.push(std::make_pair(d,current_off)); @@ -2852,11 +2852,11 @@ inline typename Periodic_3_triangulation_3::Vertex_handle Periodic_3_triangulation_3::insert_in_conflict(const Point& p, Locate_type lt, Cell_handle c, int li, int lj, const Conflict_tester& tester, Point_hider& hider, CoverManager& cover_manager) { - CGAL_triangulation_assertion((domain().xmin() <= p.x()) + CGAL_assertion((domain().xmin() <= p.x()) && (p.x() < domain().xmax())); - CGAL_triangulation_assertion((domain().ymin() <= p.y()) + CGAL_assertion((domain().ymin() <= p.y()) && (p.y() < domain().ymax())); - CGAL_triangulation_assertion((domain().zmin() <= p.z()) + CGAL_assertion((domain().zmin() <= p.z()) && (p.z() < domain().zmax())); if(number_of_vertices() == 0) { @@ -2877,14 +2877,14 @@ Periodic_3_triangulation_3::insert_in_conflict(const Point& p, vstart = c->vertex(0); else vstart = vvmit->second.first; - CGAL_triangulation_assertion(virtual_vertices.find(vstart) + CGAL_assertion(virtual_vertices.find(vstart) == virtual_vertices.end()); - CGAL_triangulation_assertion(virtual_vertices_reverse.find(vstart) + CGAL_assertion(virtual_vertices_reverse.find(vstart) != virtual_vertices_reverse.end()); } - CGAL_triangulation_assertion( number_of_vertices() != 0 ); - CGAL_triangulation_expensive_assertion(is_valid()); + CGAL_assertion( number_of_vertices() != 0 ); + CGAL_expensive_assertion(is_valid()); hider.set_original_cube(true); Vertex_handle vh = periodic_insert(p, Offset(), lt, c, tester, hider, cover_manager); if(is_1_cover()) { @@ -2906,14 +2906,14 @@ Periodic_3_triangulation_3::insert_in_conflict(const Point& p, } } } - CGAL_triangulation_expensive_assertion(is_valid()); + CGAL_expensive_assertion(is_valid()); // Fall back to 1-cover if the criterion that the longest edge is shorter // than sqrt(0.166) is fulfilled. if( cover_manager.can_be_converted_to_1_sheet() ) { - CGAL_triangulation_expensive_assertion(is_valid()); + CGAL_expensive_assertion(is_valid()); convert_to_1_sheeted_covering(); - CGAL_triangulation_expensive_assertion( is_valid() ); + CGAL_expensive_assertion( is_valid() ); } return vh; } @@ -2921,17 +2921,17 @@ Periodic_3_triangulation_3::insert_in_conflict(const Point& p, /// tests if two vertices of one cell are just periodic copies of each other template < class GT, class TDS > inline bool Periodic_3_triangulation_3::has_self_edges(Cell_handle c) const { - CGAL_triangulation_assertion((c->vertex(0) != c->vertex(1)) || + CGAL_assertion((c->vertex(0) != c->vertex(1)) || (c->offset(0) != c->offset(1))); - CGAL_triangulation_assertion((c->vertex(0) != c->vertex(2)) || + CGAL_assertion((c->vertex(0) != c->vertex(2)) || (c->offset(0) != c->offset(2))); - CGAL_triangulation_assertion((c->vertex(0) != c->vertex(3)) || + CGAL_assertion((c->vertex(0) != c->vertex(3)) || (c->offset(0) != c->offset(3))); - CGAL_triangulation_assertion((c->vertex(1) != c->vertex(2)) || + CGAL_assertion((c->vertex(1) != c->vertex(2)) || (c->offset(1) != c->offset(2))); - CGAL_triangulation_assertion((c->vertex(1) != c->vertex(3)) || + CGAL_assertion((c->vertex(1) != c->vertex(3)) || (c->offset(1) != c->offset(3))); - CGAL_triangulation_assertion((c->vertex(2) != c->vertex(3)) || + CGAL_assertion((c->vertex(2) != c->vertex(3)) || (c->offset(2) != c->offset(3))); return ((c->vertex(0) == c->vertex(1)) || (c->vertex(0) == c->vertex(2)) || @@ -2967,8 +2967,8 @@ is_valid(bool verbose, int level) const iter_2 != end_iter_2; ++iter_2) { - CGAL_triangulation_assertion(virtual_vertices.find(*iter_2) != virtual_vertices.end()); - CGAL_triangulation_assertion(virtual_vertices.at(*iter_2).first == iter->first); + CGAL_assertion(virtual_vertices.find(*iter_2) != virtual_vertices.end()); + CGAL_assertion(virtual_vertices.at(*iter_2).first == iter->first); } } } @@ -2977,10 +2977,10 @@ is_valid(bool verbose, int level) const for(Cell_iterator cit = cells_begin(); cit != cells_end(); ++cit) { CGAL_assertion(cit != Cell_handle()); for(int i=0; i<4; i++) { - CGAL_triangulation_assertion(cit != cit->neighbor(i)); + CGAL_assertion(cit != cit->neighbor(i)); for(int j=i+1; j<4; j++) { - CGAL_triangulation_assertion(cit->neighbor(i) != cit->neighbor(j)); - CGAL_triangulation_assertion(cit->vertex(i) != cit->vertex(j)); + CGAL_assertion(cit->neighbor(i) != cit->neighbor(j)); + CGAL_assertion(cit->vertex(i) != cit->vertex(j)); } } // Check positive orientation: @@ -3111,15 +3111,15 @@ remove(Vertex_handle v, PointRemover& r, Conflict_tester& t, CoverManager& cover } Virtual_vertex_map_it vvmit = virtual_vertices.find(v); if(vvmit != virtual_vertices.end()) v = vvmit->second.first; - CGAL_triangulation_assertion(virtual_vertices_reverse.find(v) + CGAL_assertion(virtual_vertices_reverse.find(v) != virtual_vertices_reverse.end()); vhrem = virtual_vertices_reverse.find(v)->second; virtual_vertices_reverse.erase(v); - CGAL_triangulation_assertion(vhrem.size()==26); + CGAL_assertion(vhrem.size()==26); for(int i=0; i<26; i++) { periodic_remove(vhrem[i],r, cover_manager); virtual_vertices.erase(vhrem[i]); - CGAL_triangulation_expensive_assertion(is_valid()); + CGAL_expensive_assertion(is_valid()); } periodic_remove(v,r, cover_manager); } @@ -3175,7 +3175,7 @@ periodic_remove(Vertex_handle v, make_hole(v, outer_map, hole); - CGAL_triangulation_assertion(outer_map.size()==hole.size()); + CGAL_assertion(outer_map.size()==hole.size()); if(!is_1_cover()) { cover_manager.delete_unsatisfying_elements(hole.begin(), hole.end()); @@ -3217,16 +3217,16 @@ periodic_remove(Vertex_handle v, for(unsigned int i=0; i < vertices.size(); i++) { typedef typename Point_remover::Triangulation_R3::Point TRPoint; - CGAL_triangulation_assertion( + CGAL_assertion( get_offset(vertices[i]) + combine_offsets(Offset(), vh_off_map[vertices[i]]) == combine_offsets(get_offset(vertices[i]),vh_off_map[vertices[i]])); TRPoint trp = std::make_pair(vertices[i]->point(), combine_offsets( get_offset(vertices[i]), vh_off_map[vertices[i]]) ); VertexE_handle vh = remover.tmp.insert(trp, ch); vmap[vh] = vertices[i]; - CGAL_triangulation_assertion(vmap.is_defined(vh)); + CGAL_assertion(vmap.is_defined(vh)); } - CGAL_triangulation_assertion(remover.tmp.number_of_vertices() != 0); + CGAL_assertion(remover.tmp.number_of_vertices() != 0); // Construct the set of vertex triples of tmp // We reorient the vertex triple so that it matches those from outer_map @@ -3269,7 +3269,7 @@ periodic_remove(Vertex_handle v, typename Vertex_triple_FacetE_map::iterator iit = inner_map.find(o_vt_f_pair.first); - CGAL_triangulation_assertion(iit != inner_map.end()); + CGAL_assertion(iit != inner_map.end()); typename Vertex_triple_FacetE_map::value_type i_vt_f_pair = *iit; CellE_handle i_ch = i_vt_f_pair.second.first; unsigned int i_i = i_vt_f_pair.second.second; @@ -3288,7 +3288,7 @@ periodic_remove(Vertex_handle v, if(cover_manager.update_cover_data_during_management(new_ch, new_cells, abort_if_cover_change)) { - CGAL_triangulation_expensive_postcondition(_tds.is_valid()); + CGAL_expensive_postcondition(_tds.is_valid()); return false; // removing would cause / has caused a cover change } @@ -3337,7 +3337,7 @@ periodic_remove(Vertex_handle v, _tds.delete_vertex(v); _tds.delete_cells(hole.begin(), hole.end()); - CGAL_triangulation_expensive_assertion(is_valid()); + CGAL_expensive_assertion(is_valid()); return true; // sucessfully removed the vertex } @@ -3450,17 +3450,17 @@ Periodic_3_triangulation_3::convert_to_1_sheeted_covering() // The vector from nb to the "original" periodic copy of nb, that is // the copy that will not be deleted. Offset difference_offset(x,y,z); - CGAL_triangulation_assertion( !difference_offset.is_null() ); + CGAL_assertion( !difference_offset.is_null() ); // We now have to find the "original" periodic copy of nb from // its vertices. Therefore, we first have to find the vertices. for( int j = 0; j < 4; j++ ) { - CGAL_triangulation_assertion( (off[j]-difference_offset)[0] >= 0); - CGAL_triangulation_assertion( (off[j]-difference_offset)[1] >= 0); - CGAL_triangulation_assertion( (off[j]-difference_offset)[2] >= 0); - CGAL_triangulation_assertion( (off[j]-difference_offset)[0] < 3); - CGAL_triangulation_assertion( (off[j]-difference_offset)[1] < 3); - CGAL_triangulation_assertion( (off[j]-difference_offset)[2] < 3); + CGAL_assertion( (off[j]-difference_offset)[0] >= 0); + CGAL_assertion( (off[j]-difference_offset)[1] >= 0); + CGAL_assertion( (off[j]-difference_offset)[2] >= 0); + CGAL_assertion( (off[j]-difference_offset)[0] < 3); + CGAL_assertion( (off[j]-difference_offset)[1] < 3); + CGAL_assertion( (off[j]-difference_offset)[2] < 3); // find the Vertex_handles of the vertices of the "original" // periodic copy of nb. If the vertex is inside the original @@ -3512,22 +3512,22 @@ Periodic_3_triangulation_3::convert_to_1_sheeted_covering() off[i] = Offset(); get_vertex( it, i, vert[i], off[i]); it->set_vertex( i, vert[i]); - CGAL_triangulation_assertion(vert[i]->point()[0] < domain().xmax()); - CGAL_triangulation_assertion(vert[i]->point()[1] < domain().ymax()); - CGAL_triangulation_assertion(vert[i]->point()[2] < domain().zmax()); - CGAL_triangulation_assertion(vert[i]->point()[0] >= domain().xmin()); - CGAL_triangulation_assertion(vert[i]->point()[1] >= domain().ymin()); - CGAL_triangulation_assertion(vert[i]->point()[2] >= domain().zmin()); + CGAL_assertion(vert[i]->point()[0] < domain().xmax()); + CGAL_assertion(vert[i]->point()[1] < domain().ymax()); + CGAL_assertion(vert[i]->point()[2] < domain().zmax()); + CGAL_assertion(vert[i]->point()[0] >= domain().xmin()); + CGAL_assertion(vert[i]->point()[1] >= domain().ymin()); + CGAL_assertion(vert[i]->point()[2] >= domain().zmin()); // redirect also the cell pointer of the vertex. it->vertex(i)->set_cell(it); } // Set the offsets. set_offsets(it, off[0], off[1], off[2], off[3] ); - CGAL_triangulation_assertion( int_to_off(it->offset(0)) == off[0] ); - CGAL_triangulation_assertion( int_to_off(it->offset(1)) == off[1] ); - CGAL_triangulation_assertion( int_to_off(it->offset(2)) == off[2] ); - CGAL_triangulation_assertion( int_to_off(it->offset(3)) == off[3] ); + CGAL_assertion( int_to_off(it->offset(0)) == off[0] ); + CGAL_assertion( int_to_off(it->offset(1)) == off[1] ); + CGAL_assertion( int_to_off(it->offset(2)) == off[2] ); + CGAL_assertion( int_to_off(it->offset(3)) == off[3] ); } } @@ -3559,7 +3559,7 @@ Periodic_3_triangulation_3::convert_to_1_sheeted_covering() for( Vertex_iterator vit = all_vertices_begin(); vit != all_vertices_end(); ++vit ) { if( virtual_vertices.count( vit ) != 0 ) { - CGAL_triangulation_assertion( virtual_vertices.count( vit ) == 1 ); + CGAL_assertion( virtual_vertices.count( vit ) == 1 ); vertices_to_delete.push_back( vit ); } } @@ -3578,7 +3578,7 @@ Periodic_3_triangulation_3::convert_to_27_sheeted_covering() if(_cover == CGAL::make_array(3,3,3)) return; - CGAL_triangulation_precondition(is_1_cover()); + CGAL_precondition(is_1_cover()); // Create 27 copies of each vertex and write virtual_vertices and // virtual_vertices_reverse @@ -3646,7 +3646,7 @@ Periodic_3_triangulation_3::convert_to_27_sheeted_covering() Offset vvoff[4]; for(int i=0; i<4; i++) { vvrmit[i] = virtual_vertices_reverse.find((*cit)->vertex(i)); - CGAL_triangulation_assertion( + CGAL_assertion( vvrmit[i] != virtual_vertices_reverse.end()); vvoff[i] = int_to_off((*cit)->offset(i)); } @@ -3659,7 +3659,7 @@ Periodic_3_triangulation_3::convert_to_27_sheeted_covering() int o_j = ((n+1)/3+vvoff[i].y()+3)%3; int o_k = ((n+1)+vvoff[i].z()+3)%3; int n_c = 9*o_i+3*o_j+o_k-1; - CGAL_triangulation_assertion(n_c >= -1); + CGAL_assertion(n_c >= -1); if(n_c == -1) vvh[i] = (*cit)->vertex(i); else vvh[i] = vvrmit[i]->second[n_c]; } @@ -3675,12 +3675,12 @@ Periodic_3_triangulation_3::convert_to_27_sheeted_covering() for(int i=0; i<4; i++) { Virtual_vertex_reverse_map_it vvrmit = virtual_vertices_reverse.find((*cit)->vertex(i)); - CGAL_triangulation_assertion(vvrmit != virtual_vertices_reverse.end()); + CGAL_assertion(vvrmit != virtual_vertices_reverse.end()); Offset vvoff = int_to_off((*cit)->offset(i)); if(!vvoff.is_null()) { int n_c = 9*vvoff.x()+3*vvoff.y()+vvoff.z()-1; - CGAL_triangulation_assertion(n_c >= 0); - CGAL_triangulation_assertion(static_cast(n_c) + CGAL_assertion(n_c >= 0); + CGAL_assertion(static_cast(n_c) < vvrmit->second.size()); (*cit)->set_vertex(i,vvrmit->second[n_c]); } @@ -3691,13 +3691,13 @@ Periodic_3_triangulation_3::convert_to_27_sheeted_covering() typename std::list >::iterator oit = off_nb.begin(); for(typename std::list::iterator cit = original_cells.begin(); cit != original_cells.end(); ++cit, ++oit) { - CGAL_triangulation_assertion( oit != off_nb.end() ); + CGAL_assertion( oit != off_nb.end() ); VCRMIT c_cp = virtual_cells_reverse.find(*cit); - CGAL_triangulation_assertion(c_cp != virtual_cells_reverse.end()); + CGAL_assertion(c_cp != virtual_cells_reverse.end()); for(int i=0; i<4; i++) { Cell_handle cit_nb = (*cit)->neighbor(i); VCRMIT c_cp_nb = virtual_cells_reverse.find(cit_nb); - CGAL_triangulation_assertion(c_cp_nb != virtual_cells_reverse.end()); + CGAL_assertion(c_cp_nb != virtual_cells_reverse.end()); Offset nboff = (*oit)[i]; for(int n=0; n<26; n++) { int n_nb; @@ -3709,23 +3709,23 @@ Periodic_3_triangulation_3::convert_to_27_sheeted_covering() n_nb = 9*o_i+3*o_j+o_k-1; } if(n_nb == -1) { - CGAL_triangulation_assertion(cit_nb->has_vertex( + CGAL_assertion(cit_nb->has_vertex( c_cp->second[n]->vertex((i+1)%4)) ); - CGAL_triangulation_assertion(cit_nb->has_vertex( + CGAL_assertion(cit_nb->has_vertex( c_cp->second[n]->vertex((i+2)%4)) ); - CGAL_triangulation_assertion(cit_nb->has_vertex( + CGAL_assertion(cit_nb->has_vertex( c_cp->second[n]->vertex((i+3)%4)) ); c_cp->second[n]->set_neighbor(i,cit_nb); } else { - CGAL_triangulation_assertion(n_nb >= 0); - CGAL_triangulation_assertion(static_cast(n_nb) + CGAL_assertion(n_nb >= 0); + CGAL_assertion(static_cast(n_nb) <= c_cp_nb->second.size()); - CGAL_triangulation_assertion(c_cp_nb->second[n_nb] + CGAL_assertion(c_cp_nb->second[n_nb] ->has_vertex(c_cp->second[n]->vertex((i+1)%4)) ); - CGAL_triangulation_assertion(c_cp_nb->second[n_nb] + CGAL_assertion(c_cp_nb->second[n_nb] ->has_vertex(c_cp->second[n]->vertex((i+2)%4)) ); - CGAL_triangulation_assertion(c_cp_nb->second[n_nb] + CGAL_assertion(c_cp_nb->second[n_nb] ->has_vertex(c_cp->second[n]->vertex((i+3)%4)) ); c_cp->second[n]->set_neighbor(i,c_cp_nb->second[n_nb]); } @@ -3737,25 +3737,25 @@ Periodic_3_triangulation_3::convert_to_27_sheeted_covering() oit = off_nb.begin(); for(typename std::list::iterator cit = original_cells.begin(); cit != original_cells.end(); ++cit, ++oit) { - CGAL_triangulation_assertion( oit != off_nb.end() ); + CGAL_assertion( oit != off_nb.end() ); for(int i=0; i<4; i++) { Offset nboff = (*oit)[i]; if(!nboff.is_null()) { Cell_handle cit_nb = (*cit)->neighbor(i); VCRMIT c_cp_nb = virtual_cells_reverse.find(cit_nb); - CGAL_triangulation_assertion(c_cp_nb != virtual_cells_reverse.end()); + CGAL_assertion(c_cp_nb != virtual_cells_reverse.end()); int o_i = (3-nboff.x())%3; int o_j = (3-nboff.y())%3; int o_k = (3-nboff.z())%3; int n_nb = 9*o_i+3*o_j+o_k-1; - CGAL_triangulation_assertion(n_nb >= 0); - CGAL_triangulation_assertion(static_cast(n_nb) + CGAL_assertion(n_nb >= 0); + CGAL_assertion(static_cast(n_nb) <= c_cp_nb->second.size()); - CGAL_triangulation_assertion(c_cp_nb->second[n_nb] + CGAL_assertion(c_cp_nb->second[n_nb] ->has_vertex((*cit)->vertex((i+1)%4)) ); - CGAL_triangulation_assertion(c_cp_nb->second[n_nb] + CGAL_assertion(c_cp_nb->second[n_nb] ->has_vertex((*cit)->vertex((i+2)%4)) ); - CGAL_triangulation_assertion(c_cp_nb->second[n_nb] + CGAL_assertion(c_cp_nb->second[n_nb] ->has_vertex((*cit)->vertex((i+3)%4)) ); (*cit)->set_neighbor(i,c_cp_nb->second[n_nb]); } @@ -3773,7 +3773,7 @@ Periodic_3_triangulation_3::convert_to_27_sheeted_covering() for(typename std::list::iterator cit = original_cells.begin(); cit != original_cells.end(); ++cit) { VCRMIT c_cp = virtual_cells_reverse.find(*cit); - CGAL_triangulation_assertion( c_cp != virtual_cells_reverse.end()); + CGAL_assertion( c_cp != virtual_cells_reverse.end()); Offset off[4]; for(int i=0; i<4; i++) off[i] = int_to_off((*cit)->offset(i)); @@ -3794,9 +3794,9 @@ Periodic_3_triangulation_3::convert_to_27_sheeted_covering() off_cp[i] = Offset((o_i==2)?off[i].x():0, (o_j==2)?off[i].y():0, (o_k==2)?off[i].z():0); - CGAL_triangulation_assertion(off_cp[i].x() == 0 || off_cp[i].x() == 1); - CGAL_triangulation_assertion(off_cp[i].y() == 0 || off_cp[i].y() == 1); - CGAL_triangulation_assertion(off_cp[i].z() == 0 || off_cp[i].z() == 1); + CGAL_assertion(off_cp[i].x() == 0 || off_cp[i].x() == 1); + CGAL_assertion(off_cp[i].y() == 0 || off_cp[i].y() == 1); + CGAL_assertion(off_cp[i].z() == 0 || off_cp[i].z() == 1); } set_offsets(c_cp->second[n],off_cp[0],off_cp[1],off_cp[2],off_cp[3]); } @@ -3807,14 +3807,14 @@ Periodic_3_triangulation_3::convert_to_27_sheeted_covering() cit != original_cells.end(); ++cit) { //This statement does not seem to have any effect set_offsets(*cit, 0,0,0,0); - CGAL_triangulation_assertion((*cit)->offset(0) == 0); - CGAL_triangulation_assertion((*cit)->offset(1) == 0); - CGAL_triangulation_assertion((*cit)->offset(2) == 0); - CGAL_triangulation_assertion((*cit)->offset(3) == 0); + CGAL_assertion((*cit)->offset(0) == 0); + CGAL_assertion((*cit)->offset(1) == 0); + CGAL_assertion((*cit)->offset(2) == 0); + CGAL_assertion((*cit)->offset(3) == 0); } _cover = CGAL::make_array(3,3,3); - CGAL_triangulation_expensive_assertion(is_valid()); + CGAL_expensive_assertion(is_valid()); update_cover_data_after_converting_to_27_sheeted_covering(); } @@ -3846,7 +3846,7 @@ Periodic_3_triangulation_3::get_cell(const Vertex_handle* vh) const incident_cells(vh[3],std::back_inserter(cells)); for( typename std::vector::iterator it = cells.begin(); it != cells.end(); it++ ) { - CGAL_triangulation_assertion( + CGAL_assertion( (*it)->vertex(0) == vh[3] || (*it)->vertex(1) == vh[3] ||(*it)->vertex(2) == vh[3] || (*it)->vertex(3) == vh[3]); for( int j=0; j<3; j++ ) { @@ -3860,7 +3860,7 @@ Periodic_3_triangulation_3::get_cell(const Vertex_handle* vh) const return (*it); } } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return Cell_handle(); } @@ -3875,12 +3875,12 @@ inline typename Periodic_3_triangulation_3::Offset Periodic_3_triangulation_3::get_location_offset( const Conflict_tester& tester, Cell_handle c) const { - CGAL_triangulation_precondition( number_of_vertices() != 0 ); + CGAL_precondition( number_of_vertices() != 0 ); int cumm_off = c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3); if(cumm_off == 0) { // default case: - CGAL_triangulation_assertion(tester(c, Offset())); + CGAL_assertion(tester(c, Offset())); return Offset(); } else { // Main idea seems to just test all possibilities. @@ -3892,7 +3892,7 @@ Periodic_3_triangulation_3::get_location_offset( } } } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return Offset(); } @@ -3902,7 +3902,7 @@ inline typename Periodic_3_triangulation_3::Offset Periodic_3_triangulation_3::get_location_offset( const Conflict_tester& tester, Cell_handle c, bool& found) const { - CGAL_triangulation_precondition( number_of_vertices() != 0 ); + CGAL_precondition( number_of_vertices() != 0 ); found = false; @@ -3938,8 +3938,8 @@ Periodic_3_triangulation_3::neighbor_offset( Cell_handle ch, int i, Cell_handle nb) const { // Redundance in the signature! - CGAL_triangulation_precondition(ch->neighbor(i) == nb); - CGAL_triangulation_precondition(nb->neighbor(nb->index(ch)) == ch); + CGAL_precondition(ch->neighbor(i) == nb); + CGAL_precondition(nb->neighbor(nb->index(ch)) == ch); Vertex_handle vertex_ch; int index_ch, index_nb; @@ -3984,17 +3984,17 @@ inline void Periodic_3_triangulation_3::get_vertex( // if 'vh_i' is not contained in virtual_vertices, then it is in // the original domain. vh = vh_i; - CGAL_triangulation_assertion(vh != Vertex_handle()); + CGAL_assertion(vh != Vertex_handle()); } else { // otherwise it has to be looked up as well as its offset. vh = it->second.first; off += it->second.second; - CGAL_triangulation_assertion(vh->point().x() < domain().xmax()); - CGAL_triangulation_assertion(vh->point().y() < domain().ymax()); - CGAL_triangulation_assertion(vh->point().z() < domain().zmax()); - CGAL_triangulation_assertion(vh->point().x() >= domain().xmin()); - CGAL_triangulation_assertion(vh->point().y() >= domain().ymin()); - CGAL_triangulation_assertion(vh->point().z() >= domain().zmin()); + CGAL_assertion(vh->point().x() < domain().xmax()); + CGAL_assertion(vh->point().y() < domain().ymax()); + CGAL_assertion(vh->point().z() < domain().zmax()); + CGAL_assertion(vh->point().x() >= domain().xmin()); + CGAL_assertion(vh->point().y() >= domain().ymin()); + CGAL_assertion(vh->point().z() >= domain().zmin()); } } @@ -4013,7 +4013,7 @@ operator>> (std::istream& is, Periodic_3_triangulation_3& tr) // of vertices, plus the non combinatorial information on each cell // the neighbors of each cell by their index in the preceding list of cells { - CGAL_triangulation_precondition(is.good()); + CGAL_precondition(is.good()); typedef Periodic_3_triangulation_3 Triangulation; typedef typename Triangulation::size_type size_type; @@ -4041,7 +4041,7 @@ operator>> (std::istream& is, Periodic_3_triangulation_3& tr) read(is,n); } - CGAL_triangulation_assertion((n/(cx*cy*cz))*cx*cy*cz == n); + CGAL_assertion((n/(cx*cy*cz))*cx*cy*cz == n); tr.tds().set_dimension((n==0?-2:3)); tr._gt.set_domain(domain); @@ -4099,7 +4099,7 @@ operator>> (std::istream& is, Periodic_3_triangulation_3& tr) for(std::size_t j=0; j < m; j++) is >> *(C[j]); - CGAL_triangulation_expensive_assertion( tr.is_valid() ); + CGAL_expensive_assertion( tr.is_valid() ); return is; } @@ -4173,13 +4173,13 @@ operator<< (std::ostream& os,const Periodic_3_triangulation_3& tr) os << it->point() << std::endl << Offset(0,0,0) << std::endl; else os << it->point() << Offset(0,0,0); - CGAL_triangulation_assertion(tr.virtual_vertices_reverse.find(it) + CGAL_assertion(tr.virtual_vertices_reverse.find(it) != tr.virtual_vertices_reverse.end()); vv = tr.virtual_vertices_reverse.find(it)->second; - CGAL_triangulation_assertion(vv.size() == 26); + CGAL_assertion(vv.size() == 26); for(std::size_t j=0; jpoint() << std::endl @@ -4188,7 +4188,7 @@ operator<< (std::ostream& os,const Periodic_3_triangulation_3& tr) } } } - CGAL_triangulation_postcondition(i == tr.number_of_sheets()[0] * + CGAL_postcondition(i == tr.number_of_sheets()[0] * tr.number_of_sheets()[1] * tr.number_of_sheets()[2] * n); @@ -4261,12 +4261,12 @@ test_next(const Periodic_3_triangulation_3& t1, queue.pop_back(); // Precondition: c1, c2 have been registered as well as their 4 vertices. - CGAL_triangulation_precondition(t1.number_of_vertices() != 0); - CGAL_triangulation_precondition(Cmap[c1] == c2); - CGAL_triangulation_precondition(Vmap.find(c1->vertex(0)) != Vmap.end()); - CGAL_triangulation_precondition(Vmap.find(c1->vertex(1)) != Vmap.end()); - CGAL_triangulation_precondition(Vmap.find(c1->vertex(2)) != Vmap.end()); - CGAL_triangulation_precondition(Vmap.find(c1->vertex(3)) != Vmap.end()); + CGAL_precondition(t1.number_of_vertices() != 0); + CGAL_precondition(Cmap[c1] == c2); + CGAL_precondition(Vmap.find(c1->vertex(0)) != Vmap.end()); + CGAL_precondition(Vmap.find(c1->vertex(1)) != Vmap.end()); + CGAL_precondition(Vmap.find(c1->vertex(2)) != Vmap.end()); + CGAL_precondition(Vmap.find(c1->vertex(3)) != Vmap.end()); for(int i=0; i <= 3; ++i) { Cell_handle1 n1 = c1->neighbor(i); diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h index fa256044b3f..128cb4038d0 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h @@ -16,7 +16,6 @@ #include #include -#include #include namespace CGAL { diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Periodic_3_triangulation_iterators_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Periodic_3_triangulation_iterators_3.h index af4192ea47f..947b8b553e5 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Periodic_3_triangulation_iterators_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3/internal/Periodic_3_triangulation_iterators_3.h @@ -16,7 +16,7 @@ #include -#include +#include #include #include @@ -86,7 +86,7 @@ public: increment_domain(); break; default: - CGAL_triangulation_assertion(false); + CGAL_assertion(false); }; return *this; } @@ -122,7 +122,7 @@ public: bool operator==(const Periodic_tetrahedron_iterator& ti) const { - CGAL_triangulation_assertion(_it == ti._it); + CGAL_assertion(_it == ti._it); return _t == ti._t && pos == ti.pos && _off == ti._off; } @@ -196,7 +196,7 @@ private: // copies into account. void increment_domain() { int off = get_drawing_offsets(); - CGAL_triangulation_assertion(_off <= off); + CGAL_assertion(_off <= off); if (_off == off) { _off = 0; do { ++pos; } while (_it == T::UNIQUE_COVER_DOMAIN @@ -264,25 +264,25 @@ private: if (_it == T::UNIQUE_COVER_DOMAIN) get_edge_offsets(off0,off1,off2,off3); else { - CGAL_triangulation_assertion(_it == T::STORED_COVER_DOMAIN); + CGAL_assertion(_it == T::STORED_COVER_DOMAIN); off0 = _t->int_to_off(pos->offset(0)); off1 = _t->int_to_off(pos->offset(1)); off2 = _t->int_to_off(pos->offset(2)); off3 = _t->int_to_off(pos->offset(3)); } - CGAL_triangulation_assertion(off0.x() == 0 || off0.x() == 1); - CGAL_triangulation_assertion(off0.y() == 0 || off0.y() == 1); - CGAL_triangulation_assertion(off0.z() == 0 || off0.z() == 1); - CGAL_triangulation_assertion(off1.x() == 0 || off1.x() == 1); - CGAL_triangulation_assertion(off1.y() == 0 || off1.y() == 1); - CGAL_triangulation_assertion(off1.z() == 0 || off1.z() == 1); - CGAL_triangulation_assertion(off2.x() == 0 || off2.x() == 1); - CGAL_triangulation_assertion(off2.y() == 0 || off2.y() == 1); - CGAL_triangulation_assertion(off2.z() == 0 || off2.z() == 1); - CGAL_triangulation_assertion(off3.x() == 0 || off3.x() == 1); - CGAL_triangulation_assertion(off3.y() == 0 || off3.y() == 1); - CGAL_triangulation_assertion(off3.z() == 0 || off3.z() == 1); + CGAL_assertion(off0.x() == 0 || off0.x() == 1); + CGAL_assertion(off0.y() == 0 || off0.y() == 1); + CGAL_assertion(off0.z() == 0 || off0.z() == 1); + CGAL_assertion(off1.x() == 0 || off1.x() == 1); + CGAL_assertion(off1.y() == 0 || off1.y() == 1); + CGAL_assertion(off1.z() == 0 || off1.z() == 1); + CGAL_assertion(off2.x() == 0 || off2.x() == 1); + CGAL_assertion(off2.y() == 0 || off2.y() == 1); + CGAL_assertion(off2.z() == 0 || off2.z() == 1); + CGAL_assertion(off3.x() == 0 || off3.x() == 1); + CGAL_assertion(off3.y() == 0 || off3.y() == 1); + CGAL_assertion(off3.z() == 0 || off3.z() == 1); int offx = ( ((off0.x() == 0 && off1.x() == 0 && off2.x() == 0 && off3.x() == 0) @@ -301,7 +301,7 @@ private: } Periodic_tetrahedron construct_periodic_tetrahedron() const { - CGAL_triangulation_assertion(pos != typename T::Cell_handle()); + CGAL_assertion(pos != typename T::Cell_handle()); Offset off0, off1, off2, off3; get_edge_offsets(off0, off1, off2, off3); Offset transl_off = Offset((((_off>>2)&1)==1 ? -1:0), @@ -392,7 +392,7 @@ public: increment_domain(); break; default: - CGAL_triangulation_assertion(false); + CGAL_assertion(false); }; return *this; } @@ -428,7 +428,7 @@ public: bool operator==(const Periodic_triangle_iterator& ti) const { - CGAL_triangulation_assertion(_it == ti._it); + CGAL_assertion(_it == ti._it); return _t == ti._t && pos == ti.pos && _off == ti._off; } @@ -499,7 +499,7 @@ private: // copies into account. void increment_domain() { int off = get_drawing_offsets(); - CGAL_triangulation_assertion(_off <= off); + CGAL_assertion(_off <= off); if (_off == off) { _off = 0; do { ++pos; } while (_it == T::UNIQUE_COVER_DOMAIN @@ -567,21 +567,21 @@ private: if (_it == T::UNIQUE_COVER_DOMAIN) get_edge_offsets(off0,off1,off2); else { - CGAL_triangulation_assertion(_it == T::STORED_COVER_DOMAIN); + CGAL_assertion(_it == T::STORED_COVER_DOMAIN); off0 = _t->int_to_off(pos->first->offset((pos->second+1)&3)); off1 = _t->int_to_off(pos->first->offset((pos->second+2)&3)); off2 = _t->int_to_off(pos->first->offset((pos->second+3)&3)); } - CGAL_triangulation_assertion(off0.x() == 0 || off0.x() == 1); - CGAL_triangulation_assertion(off0.y() == 0 || off0.y() == 1); - CGAL_triangulation_assertion(off0.z() == 0 || off0.z() == 1); - CGAL_triangulation_assertion(off1.x() == 0 || off1.x() == 1); - CGAL_triangulation_assertion(off1.y() == 0 || off1.y() == 1); - CGAL_triangulation_assertion(off1.z() == 0 || off1.z() == 1); - CGAL_triangulation_assertion(off2.x() == 0 || off2.x() == 1); - CGAL_triangulation_assertion(off2.y() == 0 || off2.y() == 1); - CGAL_triangulation_assertion(off2.z() == 0 || off2.z() == 1); + CGAL_assertion(off0.x() == 0 || off0.x() == 1); + CGAL_assertion(off0.y() == 0 || off0.y() == 1); + CGAL_assertion(off0.z() == 0 || off0.z() == 1); + CGAL_assertion(off1.x() == 0 || off1.x() == 1); + CGAL_assertion(off1.y() == 0 || off1.y() == 1); + CGAL_assertion(off1.z() == 0 || off1.z() == 1); + CGAL_assertion(off2.x() == 0 || off2.x() == 1); + CGAL_assertion(off2.y() == 0 || off2.y() == 1); + CGAL_assertion(off2.z() == 0 || off2.z() == 1); int offx = ( ((off0.x() == 0 && off1.x() == 0 && off2.x() == 0) || (off0.x() == 1 && off1.x() == 1 && off2.x() == 1)) ? 0 : 1); @@ -594,7 +594,7 @@ private: } Periodic_triangle construct_periodic_triangle() const { - CGAL_triangulation_assertion(pos->first != typename T::Cell_handle()); + CGAL_assertion(pos->first != typename T::Cell_handle()); Offset off0, off1, off2; get_edge_offsets(off0, off1, off2); Offset transl_off = Offset((((_off>>2)&1)==1 ? -1:0), @@ -682,7 +682,7 @@ public: increment_domain(); break; default: - CGAL_triangulation_assertion(false); + CGAL_assertion(false); }; return *this; } @@ -718,7 +718,7 @@ public: bool operator==(const Periodic_segment_iterator& ti) const { - CGAL_triangulation_assertion(_it == ti._it); + CGAL_assertion(_it == ti._it); return _t == ti._t && pos == ti.pos && _off == ti._off; } @@ -785,7 +785,7 @@ private: // copies into account. void increment_domain() { int off = get_drawing_offsets(); - CGAL_triangulation_assertion(_off <= off); + CGAL_assertion(_off <= off); if (_off == off) { _off = 0; do { ++pos; } while (_it == T::UNIQUE_COVER_DOMAIN @@ -841,15 +841,15 @@ private: if (_it == T::UNIQUE_COVER_DOMAIN) get_edge_offsets(off0,off1); else { - CGAL_triangulation_assertion(_it == T::STORED_COVER_DOMAIN); + CGAL_assertion(_it == T::STORED_COVER_DOMAIN); off0 = _t->int_to_off(pos->first->offset(pos->second)); off1 = _t->int_to_off(pos->first->offset(pos->third)); } Offset diff_off = off0 - off1; - CGAL_triangulation_assertion(diff_off.x() >= -1 || diff_off.x() <= 1); - CGAL_triangulation_assertion(diff_off.y() >= -1 || diff_off.y() <= 1); - CGAL_triangulation_assertion(diff_off.z() >= -1 || diff_off.z() <= 1); + CGAL_assertion(diff_off.x() >= -1 || diff_off.x() <= 1); + CGAL_assertion(diff_off.y() >= -1 || diff_off.y() <= 1); + CGAL_assertion(diff_off.z() >= -1 || diff_off.z() <= 1); return( 4*(diff_off.x() == 0 ? 0:1) + 2*(diff_off.y() == 0 ? 0:1) @@ -857,7 +857,7 @@ private: } Periodic_segment construct_periodic_segment() const { - CGAL_triangulation_assertion(pos->first != typename T::Cell_handle()); + CGAL_assertion(pos->first != typename T::Cell_handle()); Offset off0, off1; get_edge_offsets(off0, off1); Offset transl_off = Offset((((_off>>2)&1)==1 ? -1:0), @@ -939,7 +939,7 @@ public: do { ++pos; } while (pos != _t->vertices_end() && !is_canonical()); break; default: - CGAL_triangulation_assertion(false); + CGAL_assertion(false); }; return *this; } @@ -955,7 +955,7 @@ public: do { --pos; } while (pos != _t->vertices_begin() && !is_canonical()); break; default: - CGAL_triangulation_assertion(false); + CGAL_assertion(false); }; return *this; } @@ -976,7 +976,7 @@ public: bool operator==(const Periodic_point_iterator& pi) const { - CGAL_triangulation_assertion(_it == pi._it); + CGAL_assertion(_it == pi._it); return _t == pi._t && pos == pi.pos; } @@ -1017,7 +1017,7 @@ private: } Periodic_point construct_periodic_point() const { - CGAL_triangulation_assertion(pos != typename T::Vertex_handle()); + CGAL_assertion(pos != typename T::Vertex_handle()); Offset off = _t->get_offset(pos); return std::make_pair(pos->point(),off); } diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_ds_cell_base_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_ds_cell_base_3.h index 9316615fafc..742ea50691d 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_ds_cell_base_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_ds_cell_base_3.h @@ -21,7 +21,7 @@ #include #include -#include +#include #include namespace CGAL { @@ -63,7 +63,7 @@ public: const Vertex_handle& vertex(int i) const { - CGAL_triangulation_precondition( i >= 0 && i <= 3 ); + CGAL_precondition( i >= 0 && i <= 3 ); CGAL_assume( i >= 0 && i <= 3 ); return V[i]; } @@ -87,13 +87,13 @@ public: if (v == V[0]) { return 0; } if (v == V[1]) { return 1; } if (v == V[2]) { return 2; } - CGAL_triangulation_assertion( v == V[3] ); + CGAL_assertion( v == V[3] ); return 3; } const Cell_handle& neighbor(int i) const { - CGAL_triangulation_precondition( i >= 0 && i <= 3); + CGAL_precondition( i >= 0 && i <= 3); return N[i]; } @@ -116,13 +116,13 @@ public: if (n == N[0]) return 0; if (n == N[1]) return 1; if (n == N[2]) return 2; - CGAL_triangulation_assertion( n == N[3] ); + CGAL_assertion( n == N[3] ); return 3; } int offset(int i) const { - CGAL_triangulation_precondition( i >= 0 && i <= 3 ); + CGAL_precondition( i >= 0 && i <= 3 ); return ((off>>3*i)&7); } @@ -130,13 +130,13 @@ public: void set_vertex(int i, const Vertex_handle& v) { - CGAL_triangulation_precondition( i >= 0 && i <= 3); + CGAL_precondition( i >= 0 && i <= 3); V[i] = v; } void set_neighbor(int i, const Cell_handle& n) { - CGAL_triangulation_precondition( i >= 0 && i <= 3); + CGAL_precondition( i >= 0 && i <= 3); N[i] = n; } @@ -170,7 +170,7 @@ public: void set_offset(const Vertex_handle vh, int o) { - CGAL_triangulation_precondition(has_vertex(vh)); + CGAL_precondition(has_vertex(vh)); int vhi = index(vh); unsigned int offo[3] = {static_cast((o&1)), @@ -247,7 +247,7 @@ public: // TODO: Get rid of this flag! Used in convert_to_1_sheeted_covering. // Either use the conflict flag or a std::map. void set_additional_flag(unsigned char f) { - CGAL_triangulation_assertion(f < 4); + CGAL_assertion(f < 4); _additional_flag = f; } unsigned char get_additional_flag() const { diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_hierarchy_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_hierarchy_3.h index 5a46a8839b3..b3e6b28a413 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_hierarchy_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_hierarchy_3.h @@ -396,7 +396,7 @@ void Periodic_3_triangulation_hierarchy_3:: remove(Vertex_handle v) { - CGAL_triangulation_precondition(v != Vertex_handle()); + CGAL_precondition(v != Vertex_handle()); CGAL_expensive_precondition(is_vertex(v)); for (int l = 0; l < maxlevel; ++l) { Vertex_handle u = v->up(); @@ -412,12 +412,12 @@ typename Periodic_3_triangulation_hierarchy_3::Vertex_handle Periodic_3_triangulation_hierarchy_3:: move_point(Vertex_handle v, const Point & p) { - CGAL_triangulation_precondition(v != Vertex_handle()); + CGAL_precondition(v != Vertex_handle()); Vertex_handle old, ret; for (int l = 0; l < maxlevel; ++l) { Vertex_handle u = v->up(); - CGAL_triangulation_assertion(hierarchy[l]->is_valid()); + CGAL_assertion(hierarchy[l]->is_valid()); Vertex_handle w = hierarchy[l]->move_point(v, p); if (l == 0) { ret = w; diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_traits_3.h index 3dd20ea6fae..f9c96b8eb5c 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_traits_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_traits_3.h @@ -22,7 +22,6 @@ #include #include -#include namespace CGAL { diff --git a/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_2.h b/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_2.h index f08eb4316ae..25cb1d77c6f 100644 --- a/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_2.h +++ b/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_Delaunay_triangulation_2.h @@ -165,15 +165,11 @@ public: spatial_sort(points.begin(), points.end(), geom_traits()); Face_handle f; - int cnt = 0; - int cnt_good = 0; for(typename std::vector::const_iterator p=points.begin(), end = points.end(); p != end; ++p) { - ++cnt; Vertex_handle v = insert(*p, f); if(v != Vertex_handle()) { - ++cnt_good; f = v->face(); } } @@ -271,7 +267,7 @@ public: Point get_dummy_point(int i) const { - CGAL_triangulation_precondition(0 <= i && i <= static_cast(dummy_points.size())); + CGAL_precondition(0 <= i && i <= static_cast(dummy_points.size())); return dummy_points[i](); } @@ -543,7 +539,7 @@ remove(Vertex_handle v) int nidx = 0; if(nbf->neighbor(1) == nb) nidx = 1; if(nbf->neighbor(2) == nb) nidx = 2; - CGAL_triangulation_assertion(nbf->neighbor(nidx) == nb); + CGAL_assertion(nbf->neighbor(nidx) == nb); bdry_nbrs.insert(Edge_neighbor(e, Neighbor_pair(nbf, nidx))); bdry_verts.push_back(nb->vertex(ccw(idx))); @@ -596,8 +592,6 @@ remove(Vertex_handle v) Nbr_history failsafe; - int internb = 0; - int bdrynb = 0; for(std::size_t i=0; ineighbor(nbidx), nbf->neighbor(nbidx)->index(nbf)); - CGAL_triangulation_assertion(side1.first->neighbor(side1.second) == side2.first); - CGAL_triangulation_assertion(side2.first->neighbor(side2.second) == side1.first); + CGAL_assertion(side1.first->neighbor(side1.second) == side2.first); + CGAL_assertion(side2.first->neighbor(side2.second) == side1.first); Nbr_pair hist(side1, side2); failsafe.push_back(hist); tds().set_adjacency(nbf, nbidx, new_f[i], k); - bdrynb++; break; } } @@ -641,7 +634,6 @@ remove(Vertex_handle v) new_f[i]->vertex(cw(k)) == new_f[l]->vertex(ccw(j))) { tds().set_adjacency(new_f[i], k, new_f[l], j); - internb++; break; } } @@ -680,7 +672,7 @@ remove(Vertex_handle v) tds().delete_face(new_f[rit]); } - CGAL_triangulation_assertion(this->is_valid(true)); + CGAL_assertion(this->is_valid(true)); return false; } @@ -712,7 +704,7 @@ remove(Vertex_handle v) tds().delete_vertex(v); - CGAL_triangulation_assertion(this->is_valid(true)); + CGAL_assertion(this->is_valid(true)); return true; } diff --git a/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_2.h b/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_2.h index 76879a19464..29a8bba10fa 100644 --- a/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_2.h +++ b/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_2.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include @@ -110,7 +110,7 @@ public: Periodic_4_hyperbolic_triangulation_2(const Periodic_4_hyperbolic_triangulation_2& tr) : _gt(tr.geom_traits()) { - CGAL_triangulation_expensive_postcondition(*this == tr); + CGAL_expensive_postcondition(*this == tr); } Periodic_4_hyperbolic_triangulation_2& operator=(Periodic_4_hyperbolic_triangulation_2 tr) @@ -175,7 +175,7 @@ public: Periodic_point periodic_point(const Face_handle c, int i) const { - CGAL_triangulation_precondition(i >= 0 && i <= 2); + CGAL_precondition(i >= 0 && i <= 2); return std::make_pair(c->vertex(i)->point(), c->translation(i)); } @@ -194,8 +194,8 @@ public: Periodic_segment periodic_segment(const Face_handle c, int i, int j) const { - CGAL_triangulation_precondition(i != j); - CGAL_triangulation_precondition((i >= 0 && i <= 2) && (j >= 0 && j <= 2)); + CGAL_precondition(i != j); + CGAL_precondition((i >= 0 && i <= 2) && (j >= 0 && j <= 2)); return periodic_segment(c->vertex(i)->point(), c->vertex(j)->point(), c->translation(i), c->translation(j)); } @@ -263,14 +263,14 @@ public: Hyperbolic_segment construct_hyperbolic_segment(const Face_handle & fh, int idx) const { - CGAL_triangulation_precondition(idx >= 0 && idx <= 2); + CGAL_precondition(idx >= 0 && idx <= 2); return construct_hyperbolic_segment(fh->vertex(ccw(idx))->point(), fh->vertex(cw(idx))->point(), fh->translation(ccw(idx)), fh->translation(cw(idx))); } Hyperbolic_segment construct_hyperbolic_segment(const std::pair & edge) const { - CGAL_triangulation_precondition(edge.second >= 0 && edge.second <= 2); + CGAL_precondition(edge.second >= 0 && edge.second <= 2); return construct_hyperbolic_segment(edge.first, ccw(edge.second)); } @@ -523,7 +523,7 @@ public: Hyperbolic_translation neighbor_translation(const Face_handle fh, int i) const { - CGAL_triangulation_precondition(i >= 0 && i <= 2); + CGAL_precondition(i >= 0 && i <= 2); int myi = ccw(i); Hyperbolic_translation myof = fh->translation(myi); @@ -645,9 +645,9 @@ inline bool Periodic_4_hyperbolic_triangulation_2:: has_self_edges(typename TDS::Face_handle c) const { - CGAL_triangulation_assertion((c->vertex(0) != c->vertex(1)) || (c->translation(0) != c->translation(1))); - CGAL_triangulation_assertion((c->vertex(0) != c->vertex(2)) || (c->translation(0) != c->translation(2))); - CGAL_triangulation_assertion((c->vertex(1) != c->vertex(2)) || (c->translation(1) != c->translation(2))); + CGAL_assertion((c->vertex(0) != c->vertex(1)) || (c->translation(0) != c->translation(1))); + CGAL_assertion((c->vertex(0) != c->vertex(2)) || (c->translation(0) != c->translation(2))); + CGAL_assertion((c->vertex(1) != c->vertex(2)) || (c->translation(1) != c->translation(2))); return ((c->vertex(0) == c->vertex(1)) || (c->vertex(0) == c->vertex(2)) || @@ -691,11 +691,11 @@ is_valid(bool verbose) const { { for(int i=0; i<3; ++i) { - CGAL_triangulation_assertion(cit != cit->neighbor(i)); + CGAL_assertion(cit != cit->neighbor(i)); for(int j=i+1; j<3; ++j) { - CGAL_triangulation_assertion(cit->neighbor(i) != cit->neighbor(j)); - CGAL_triangulation_assertion(cit->vertex(i) != cit->vertex(j)); + CGAL_assertion(cit->neighbor(i) != cit->neighbor(j)); + CGAL_assertion(cit->vertex(i) != cit->vertex(j)); } } @@ -735,9 +735,9 @@ is_valid(bool verbose) const { if(!error) { - CGAL_triangulation_assertion(!has_self_edges()); - CGAL_triangulation_assertion(!has_cycles_length_2()); - CGAL_triangulation_assertion(_tds.number_of_vertices() + _tds.number_of_faces() + 2 == _tds.number_of_edges()); + CGAL_assertion(!has_self_edges()); + CGAL_assertion(!has_cycles_length_2()); + CGAL_assertion(_tds.number_of_vertices() + _tds.number_of_faces() + 2 == _tds.number_of_edges()); return true; } else @@ -990,8 +990,8 @@ hyperbolic_periodic_locate(const Point& p, Point np0 = construct_point(construct_point(nf->vertex(0)->point(), nf->translation(0)) , tr); Point np1 = construct_point(construct_point(nf->vertex(1)->point(), nf->translation(1)) , tr); Point np2 = construct_point(construct_point(nf->vertex(2)->point(), nf->translation(2)) , tr); - CGAL_triangulation_assertion_code(Oriented_side os1 = side_of_hyperbolic_triangle(np0, np1, np2, p, lt, li)); - CGAL_triangulation_assertion(os1 == ON_POSITIVE_SIDE); + CGAL_assertion_code(Oriented_side os1 = side_of_hyperbolic_triangle(np0, np1, np2, p, lt, li)); + CGAL_assertion(os1 == ON_POSITIVE_SIDE); lo = tr; return nf; } diff --git a/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_2/internal/Periodic_4_hyperbolic_triangulation_dummy_14.h b/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_2/internal/Periodic_4_hyperbolic_triangulation_dummy_14.h index 7092e12ab6a..8d4ae64f0bb 100644 --- a/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_2/internal/Periodic_4_hyperbolic_triangulation_dummy_14.h +++ b/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_2/internal/Periodic_4_hyperbolic_triangulation_dummy_14.h @@ -251,7 +251,7 @@ insert_dummy_points(bool rational) for(Face_iterator fit = tds().faces_begin(); fit != tds().faces_end(); ++fit) this->make_canonical(fit); - CGAL_triangulation_assertion(is_valid(true)); + CGAL_assertion(is_valid(true)); return ret; } @@ -260,4 +260,3 @@ insert_dummy_points(bool rational) } // namespace CGAL #endif // CGAL_PERIODIC_4_HYPERBOLIC_TRIANGULATION_DUMMY_14_H - diff --git a/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_face_base_2.h b/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_face_base_2.h index 8f625a81e4a..23b0972241b 100644 --- a/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_face_base_2.h +++ b/Periodic_4_hyperbolic_triangulation_2/include/CGAL/Periodic_4_hyperbolic_triangulation_face_base_2.h @@ -17,7 +17,6 @@ #include #include -#include #include namespace CGAL { @@ -73,13 +72,13 @@ public: Hyperbolic_translation translation(int i) const { - CGAL_triangulation_precondition(i >= 0 && i <= 2); + CGAL_precondition(i >= 0 && i <= 2); return o[i]; } void set_translation(const int& k, const Hyperbolic_translation& new_o) { - CGAL_triangulation_precondition(k >= 0 && k <= 2); + CGAL_precondition(k >= 0 && k <= 2); o[k] = new_o; } diff --git a/Point_set_3/include/CGAL/Point_set_3.h b/Point_set_3/include/CGAL/Point_set_3.h index 74b731a0d31..304cf589d5f 100644 --- a/Point_set_3/include/CGAL/Point_set_3.h +++ b/Point_set_3/include/CGAL/Point_set_3.h @@ -48,23 +48,23 @@ namespace CGAL { two particular properties that are hard coded by this class: the coordinates of the points and the normal vectors. - The coordinates of a point can be access using the index of the + The coordinates of a point can be accessed using the index of the point and the member function `point()`. This property is always present. The normal vector of a point can be accessed using the index of the point and the `normal()` method. This property must be explicitly created. All properties can be accessed as a range using the methods - `points()`, `normals()`, and `range()` for points coordinates, + `points()`, `normals()`, and `range()` for point coordinates, normal vectors, and other properties respectively. - Removing a point with properties is achieved by moving its `Index` + Removing a point with properties is achieved by moving its index at the end of the container and keeping track of the number of removed elements. A garbage collection method must be called to really remove it from memory. For convenience, all functions of the package \ref - PkgPointSetProcessing3 automatically creates the right named + PkgPointSetProcessing3 automatically create the right named parameters if called with a `CGAL::Point_set_3` object as argument. diff --git a/Point_set_processing_3/include/CGAL/IO/read_las_points.h b/Point_set_processing_3/include/CGAL/IO/read_las_points.h index 0fafe579ba8..0d034a6bcb1 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_las_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_las_points.h @@ -18,7 +18,6 @@ #include #include -#include #include #include diff --git a/Point_set_processing_3/include/CGAL/IO/read_off_points.h b/Point_set_processing_3/include/CGAL/IO/read_off_points.h index e50db48ca36..e002a834c5f 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_off_points.h @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h index 5ecedc40b68..282ad59d4a3 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h @@ -19,7 +19,6 @@ #include #include #include -#include #include #include diff --git a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h index a420f5068b7..caf7e062a5e 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_xyz_points.h @@ -16,7 +16,6 @@ #include #include -#include #include #include #include diff --git a/Point_set_processing_3/include/CGAL/IO/write_las_points.h b/Point_set_processing_3/include/CGAL/IO/write_las_points.h index 234255d599b..d7d719d3978 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_las_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_las_points.h @@ -21,8 +21,8 @@ #include #include #include -#include #include +#include #include #include @@ -193,7 +193,7 @@ bool write_LAS_with_properties(std::ostream& os, ///< output stream. LAS_property::Z> point_property, ///< property handler for points PropertyHandler&& ... properties) ///< parameter pack of property handlers { - CGAL_point_set_processing_precondition(points.begin() != points.end()); + CGAL_precondition(points.begin() != points.end()); if(!os) { diff --git a/Point_set_processing_3/include/CGAL/IO/write_off_points.h b/Point_set_processing_3/include/CGAL/IO/write_off_points.h index 5be867b5ecf..0be0e4183a3 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_off_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_off_points.h @@ -20,8 +20,8 @@ #include #include #include -#include #include +#include #include #include @@ -50,7 +50,7 @@ bool write_OFF_PSP(std::ostream& os, PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); - CGAL_point_set_processing_precondition(points.begin() != points.end()); + CGAL_precondition(points.begin() != points.end()); if(!os) { diff --git a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h index 7da025f7640..6dca998ae72 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_ply_points.h @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include @@ -111,7 +111,7 @@ template #include -#include +#include #include #include @@ -51,7 +51,7 @@ bool write_XYZ_PSP(std::ostream& os, PointMap point_map = NP_helper::get_const_point_map(points, np); NormalMap normal_map = NP_helper::get_normal_map(points, np); - CGAL_point_set_processing_precondition(points.begin() != points.end()); + CGAL_precondition(points.begin() != points.end()); if(!os) { diff --git a/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Neighbor_query.h b/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Neighbor_query.h index 282aa89afe1..6bd7481e096 100644 --- a/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Neighbor_query.h +++ b/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Neighbor_query.h @@ -18,7 +18,6 @@ #include #include #include -#include #include diff --git a/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Rich_grid.h b/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Rich_grid.h index 14db499896d..b29d1c24b4c 100644 --- a/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Rich_grid.h +++ b/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Rich_grid.h @@ -16,7 +16,7 @@ #include -#include +#include #include #include #include @@ -454,7 +454,7 @@ void compute_ball_neighbors_one_self( CGAL::Bbox_3 bbox, ///< bounding box const typename Kernel::FT radius) { - CGAL_point_set_processing_precondition(radius > 0); + CGAL_precondition(radius > 0); for (unsigned int i = 0; i < points.size(); ++i) { diff --git a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h index 86fa5d23b19..396d9cdb0e0 100644 --- a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include @@ -72,8 +72,8 @@ compute_denoise_projection( typename Kernel::FT sharpness_angle ///< control sharpness(0-90) ) { - CGAL_point_set_processing_precondition(radius > 0); - CGAL_point_set_processing_precondition(sharpness_angle > 0 + CGAL_precondition(radius > 0); + CGAL_precondition(sharpness_angle > 0 && sharpness_angle < 90); // basic geometric types @@ -286,8 +286,8 @@ bilateral_smooth_point_set( const std::function& callback = choose_parameter(get_parameter(np, internal_np::callback), std::function()); - CGAL_point_set_processing_precondition(points.begin() != points.end()); - CGAL_point_set_processing_precondition(k > 1); + CGAL_precondition(points.begin() != points.end()); + CGAL_precondition(k > 1); // types for K nearest neighbors search structure typedef Point_set_processing_3::internal::Neighbor_query Neighbor_query; diff --git a/Point_set_processing_3/include/CGAL/cluster_point_set.h b/Point_set_processing_3/include/CGAL/cluster_point_set.h index 55b56ec8881..c79cd850df1 100644 --- a/Point_set_processing_3/include/CGAL/cluster_point_set.h +++ b/Point_set_processing_3/include/CGAL/cluster_point_set.h @@ -169,7 +169,7 @@ std::size_t cluster_point_set (PointRange& points, // precondition: at least one element in the container. // to fix: should have at least three distinct points // but this is costly to check - CGAL_point_set_processing_precondition(points.begin() != points.end()); + CGAL_precondition(points.begin() != points.end()); // If no radius is given, init with 1% of bbox diagonal if (neighbor_radius < 0) diff --git a/Point_set_processing_3/include/CGAL/compute_average_spacing.h b/Point_set_processing_3/include/CGAL/compute_average_spacing.h index 3b9c0f206c6..750bc40ae23 100644 --- a/Point_set_processing_3/include/CGAL/compute_average_spacing.h +++ b/Point_set_processing_3/include/CGAL/compute_average_spacing.h @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -177,10 +176,10 @@ compute_average_spacing( // precondition: at least one element in the container. // to fix: should have at least three distinct points // but this is costly to check - CGAL_point_set_processing_precondition(points.begin() != points.end()); + CGAL_precondition(points.begin() != points.end()); // precondition: at least 2 nearest neighbors - CGAL_point_set_processing_precondition(k >= 2); + CGAL_precondition(k >= 2); // Instanciate a KD-tree search. Neighbor_query neighbor_query (points, point_map); diff --git a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h index 507418d45b8..bf4b589d788 100644 --- a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h +++ b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include #include @@ -147,8 +147,8 @@ update_new_point( typedef typename rich_grid_internal::Rich_point Rich_point; CGAL_assertion_code( unsigned int size = static_cast(rich_point_set.size()) ); - CGAL_point_set_processing_precondition(father_index < size); - CGAL_point_set_processing_precondition(mother_index < size); + CGAL_precondition(father_index < size); + CGAL_precondition(mother_index < size); // 1, get neighbor information from the two "parent points" Rich_point& new_v = rich_point_set[new_point_index]; @@ -386,16 +386,16 @@ edge_aware_upsample_point_set( typename PointRange::const_iterator end = points.end(); // preconditions - CGAL_point_set_processing_precondition(begin != end); - CGAL_point_set_processing_precondition(sharpness_angle >= 0 - &&sharpness_angle <= 90); - CGAL_point_set_processing_precondition(edge_sensitivity >= 0 - &&edge_sensitivity <= 1); + CGAL_precondition(begin != end); + CGAL_precondition(sharpness_angle >= 0 + &&sharpness_angle <= 90); + CGAL_precondition(edge_sensitivity >= 0 + &&edge_sensitivity <= 1); edge_sensitivity *= 10; // just project [0, 1] to [0, 10]. std::size_t number_of_input = std::distance(begin, end); - CGAL_point_set_processing_precondition(number_of_output_points > number_of_input); + CGAL_precondition(number_of_output_points > number_of_input); const unsigned int nb_neighbors = 6; // 1 ring @@ -424,7 +424,7 @@ edge_aware_upsample_point_set( rich_point_set[i].index = i; bbox += rich_point_set[i].pt.bbox(); - CGAL_point_set_processing_precondition(rich_point_set[i].normal.squared_length() > 1e-10); + CGAL_precondition(rich_point_set[i].normal.squared_length() > 1e-10); } // compute neighborhood diff --git a/Point_set_processing_3/include/CGAL/estimate_scale.h b/Point_set_processing_3/include/CGAL/estimate_scale.h index 3bb7db74e5a..91e66704aff 100644 --- a/Point_set_processing_3/include/CGAL/estimate_scale.h +++ b/Point_set_processing_3/include/CGAL/estimate_scale.h @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/Point_set_processing_3/include/CGAL/grid_simplify_point_set.h b/Point_set_processing_3/include/CGAL/grid_simplify_point_set.h index 86cfca10156..d5d05d3a0ac 100644 --- a/Point_set_processing_3/include/CGAL/grid_simplify_point_set.h +++ b/Point_set_processing_3/include/CGAL/grid_simplify_point_set.h @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include #include @@ -66,7 +66,7 @@ public: Hash_epsilon_points_3 (double epsilon, PointMap p_map) : m_epsilon (epsilon), point_map(p_map) { - CGAL_point_set_processing_precondition(epsilon > 0); + CGAL_precondition(epsilon > 0); } std::size_t operator() (const Point_3& a) const @@ -96,7 +96,7 @@ public: Equal_epsilon_points_3 (const double& epsilon, PointMap p_map) : m_epsilon (epsilon), point_map(p_map) { - CGAL_point_set_processing_precondition(epsilon > 0); + CGAL_precondition(epsilon > 0); } bool operator() (const Point_3& a, const Point_3& b) const @@ -155,7 +155,7 @@ public: internal::Equal_epsilon_points_3(epsilon, point_map)) , min_points_per_cell (min_points_per_cell) { - CGAL_point_set_processing_precondition(epsilon > 0); + CGAL_precondition(epsilon > 0); } bool insert (const Point_3& p) @@ -249,7 +249,7 @@ grid_simplify_point_set( // actual type of input points typedef typename std::iterator_traits::value_type Enriched_point; - CGAL_point_set_processing_precondition(epsilon > 0); + CGAL_precondition(epsilon > 0); if (min_points_per_cell == 1) { diff --git a/Point_set_processing_3/include/CGAL/hierarchy_simplify_point_set.h b/Point_set_processing_3/include/CGAL/hierarchy_simplify_point_set.h index 2d6c60c9245..4d44c8e3e21 100644 --- a/Point_set_processing_3/include/CGAL/hierarchy_simplify_point_set.h +++ b/Point_set_processing_3/include/CGAL/hierarchy_simplify_point_set.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -210,8 +210,8 @@ namespace CGAL { typedef typename std::list::iterator cluster_iterator; CGAL_precondition (points.begin() != points.end()); - CGAL_point_set_processing_precondition (size > 0); - CGAL_point_set_processing_precondition (var_max > 0.0); + CGAL_precondition (size > 0); + CGAL_precondition (var_max > 0.0); // The first cluster is the whole input point set clusters_stack.push_front (cluster (std::list(), Point (0., 0., 0.))); diff --git a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h index 516b2671bdd..30a7f34d48c 100644 --- a/Point_set_processing_3/include/CGAL/jet_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/jet_estimate_normals.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -215,10 +215,10 @@ jet_estimate_normals( // precondition: at least one element in the container. // to fix: should have at least three distinct points // but this is costly to check - CGAL_point_set_processing_precondition(points.begin() != points.end()); + CGAL_precondition(points.begin() != points.end()); // precondition: at least 2 nearest neighbors - CGAL_point_set_processing_precondition(k >= 2 || neighbor_radius > FT(0)); + CGAL_precondition(k >= 2 || neighbor_radius > FT(0)); std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE_STREAM << (memory >> 20) << " Mb allocated\n"; diff --git a/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h b/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h index 9c6b34b93c3..4f6f308c274 100644 --- a/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/jet_smooth_point_set.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -218,10 +218,10 @@ jet_smooth_point_set( // precondition: at least one element in the container. // to fix: should have at least three distinct points // but this is costly to check - CGAL_point_set_processing_precondition(points.begin() != points.end()); + CGAL_precondition(points.begin() != points.end()); // precondition: at least 2 nearest neighbors - CGAL_point_set_processing_precondition(k >= 2); + CGAL_precondition(k >= 2); // Instanciate a KD-tree search. Neighbor_query neighbor_query (points, point_map); diff --git a/Point_set_processing_3/include/CGAL/mst_orient_normals.h b/Point_set_processing_3/include/CGAL/mst_orient_normals.h index 909dc37a63d..2a284b2e859 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include @@ -184,7 +184,7 @@ struct Propagate_normal_orientation : m_source(source), m_angle_max(angle_max) { // Precondition: 0 < angle_max <= PI/2 - CGAL_point_set_processing_precondition(0 < angle_max && angle_max <= CGAL_PI/2.); + CGAL_precondition(0 < angle_max && angle_max <= CGAL_PI/2.); } template @@ -265,7 +265,7 @@ mst_find_source( typedef typename boost::property_traits::reference Vector_ref; // Precondition: at least one element in the container - CGAL_point_set_processing_precondition(first != beyond); + CGAL_precondition(first != beyond); // Find top point ForwardIterator top_point = first; @@ -337,7 +337,7 @@ create_riemannian_graph( typedef typename boost::property_map::type Riemannian_graph_weight_map; // Precondition: at least 2 nearest neighbors - CGAL_point_set_processing_precondition(k >= 2); + CGAL_precondition(k >= 2); // Number of input points const std::size_t num_input_points = points.size(); @@ -363,7 +363,7 @@ create_riemannian_graph( for (ForwardIterator it = points.begin(); it != points.end(); it++) { typename Riemannian_graph::vertex_descriptor v = add_vertex(riemannian_graph); - CGAL_point_set_processing_assertion(v == get(index_map,it)); + CGAL_assertion(v == get(index_map,it)); riemannian_graph[v].input_point = it; } @@ -395,7 +395,7 @@ create_riemannian_graph( boost::tie(e, inserted) = add_edge(vertex(it_index, riemannian_graph), vertex(neighbor_index, riemannian_graph), riemannian_graph); - CGAL_point_set_processing_assertion(inserted); + CGAL_assertion(inserted); // -> -> // Computes edge weight = 1 - | normal1 * normal2 | @@ -417,7 +417,7 @@ create_riemannian_graph( boost::tie(e, inserted) = add_edge(vertex(it_index, riemannian_graph), vertex(source_point_index, riemannian_graph), riemannian_graph); - CGAL_point_set_processing_assertion(inserted); + CGAL_assertion(inserted); riemannian_graph_weight_map[e] = 0.; } @@ -475,7 +475,7 @@ create_mst_graph( typedef internal::MST_graph MST_graph; // Precondition: at least one element in the container. - CGAL_point_set_processing_precondition(first != beyond); + CGAL_precondition(first != beyond); // Number of input points const std::size_t num_input_points = num_vertices(riemannian_graph) - 1; @@ -511,13 +511,13 @@ create_mst_graph( // 1.56 and 1.57: // https://svn.boost.org/trac/boost/ticket/10382 typename MST_graph::vertex_descriptor v = add_vertex(mst_graph); - CGAL_point_set_processing_assertion(v == get(index_map,it)); + CGAL_assertion(v == get(index_map,it)); mst_graph[v].input_point = it; mst_graph[v].is_oriented = false; } typename MST_graph::vertex_descriptor v = add_vertex(mst_graph); - CGAL_point_set_processing_assertion(v == source_point_index); + CGAL_assertion(v == source_point_index); mst_graph[v].is_oriented = true; // add edges @@ -526,7 +526,7 @@ create_mst_graph( if (i != predecessor[i]) { // check that bi-directed graph is useless - CGAL_point_set_processing_assertion(predecessor[predecessor[i]] != i); + CGAL_assertion(predecessor[predecessor[i]] != i); add_edge(vertex(predecessor[i], mst_graph), vertex(i, mst_graph), @@ -655,10 +655,10 @@ mst_orient_normals( typedef MST_graph MST_graph; // Precondition: at least one element in the container. - CGAL_point_set_processing_precondition(points.begin() != points.end()); + CGAL_precondition(points.begin() != points.end()); // Precondition: at least 2 nearest neighbors - CGAL_point_set_processing_precondition(k >= 2); + CGAL_precondition(k >= 2); std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE_STREAM << (memory >> 20) << " Mb allocated\n"; diff --git a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h index 8447ae952ff..4d5e04b9491 100644 --- a/Point_set_processing_3/include/CGAL/pca_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/pca_estimate_normals.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include @@ -186,10 +186,10 @@ pca_estimate_normals( // precondition: at least one element in the container. // to fix: should have at least three distinct points // but this is costly to check - CGAL_point_set_processing_precondition(points.begin() != points.end()); + CGAL_precondition(points.begin() != points.end()); // precondition: at least 2 nearest neighbors - CGAL_point_set_processing_precondition(k >= 2); + CGAL_precondition(k >= 2); std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE_STREAM << (memory >> 20) << " Mb allocated\n"; diff --git a/Point_set_processing_3/include/CGAL/point_set_processing_assertions.h b/Point_set_processing_3/include/CGAL/point_set_processing_assertions.h deleted file mode 100644 index e5b85b5f3ef..00000000000 --- a/Point_set_processing_3/include/CGAL/point_set_processing_assertions.h +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) 2007 INRIA (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Geert-Jan Giezeman, Sven Schoenherr, Laurent Saboret -// -// Generated from script create_assertions.sh - - -/// \cond SKIP_IN_MANUAL - -/// @file point_set_processing_assertions.h -/// Define checking macros for the Point_set_processing_3 package - -// Note that this header file is intentionnaly not protected with a -// macro (as ). Calling it a second time with another value -// for CGAL_NO_ASSERTIONS for example must make a difference. - -#include - -// macro definitions -// ================= -// assertions -// ---------- - -#undef CGAL_point_set_processing_assertion -#undef CGAL_point_set_processing_assertion_msg -#undef CGAL_point_set_processing_assertion_code - -#if defined(CGAL_POINT_SET_PROCESSING_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) -# define CGAL_point_set_processing_assertion(EX) (static_cast(0)) - -#include - -# define CGAL_point_set_processing_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_point_set_processing_assertion_code(CODE) -#else -# define CGAL_point_set_processing_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_point_set_processing_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_point_set_processing_assertion_code(CODE) CODE -# define CGAL_point_set_processing_assertions 1 -#endif // CGAL_POINT_SET_PROCESSING_NO_ASSERTIONS - - -#undef CGAL_point_set_processing_exactness_assertion -#undef CGAL_point_set_processing_exactness_assertion_msg -#undef CGAL_point_set_processing_exactness_assertion_code - -#if defined(CGAL_POINT_SET_PROCESSING_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_point_set_processing_exactness_assertion(EX) (static_cast(0)) -# define CGAL_point_set_processing_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_point_set_processing_exactness_assertion_code(CODE) -#else -# define CGAL_point_set_processing_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_point_set_processing_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_point_set_processing_exactness_assertion_code(CODE) CODE -# define CGAL_point_set_processing_exactness_assertions 1 -#endif // CGAL_POINT_SET_PROCESSING_NO_ASSERTIONS - - -#undef CGAL_point_set_processing_expensive_assertion -#undef CGAL_point_set_processing_expensive_assertion_msg -#undef CGAL_point_set_processing_expensive_assertion_code - -#if defined(CGAL_POINT_SET_PROCESSING_NO_ASSERTIONS) \ - || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_point_set_processing_expensive_assertion(EX) (static_cast(0)) -# define CGAL_point_set_processing_expensive_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_point_set_processing_expensive_assertion_code(CODE) -#else -# define CGAL_point_set_processing_expensive_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_point_set_processing_expensive_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_point_set_processing_expensive_assertion_code(CODE) CODE -# define CGAL_point_set_processing_expensive_assertions 1 -#endif // CGAL_POINT_SET_PROCESSING_NO_ASSERTIONS - - -#undef CGAL_point_set_processing_expensive_exactness_assertion -#undef CGAL_point_set_processing_expensive_exactness_assertion_msg -#undef CGAL_point_set_processing_expensive_exactness_assertion_code - -#if defined(CGAL_POINT_SET_PROCESSING_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_point_set_processing_expensive_exactness_assertion(EX) (static_cast(0)) -# define CGAL_point_set_processing_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_point_set_processing_expensive_exactness_assertion_code(CODE) -#else -# define CGAL_point_set_processing_expensive_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_point_set_processing_expensive_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_point_set_processing_expensive_exactness_assertion_code(CODE) CODE -# define CGAL_point_set_processing_expensive_exactness_assertions 1 -#endif // CGAL_POINT_SET_PROCESSING_NO_ASSERTIONS - - -// preconditions -// ------------- - -#undef CGAL_point_set_processing_precondition -#undef CGAL_point_set_processing_precondition_msg -#undef CGAL_point_set_processing_precondition_code - -#if defined(CGAL_POINT_SET_PROCESSING_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) -# define CGAL_point_set_processing_precondition(EX) (static_cast(0)) -# define CGAL_point_set_processing_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_point_set_processing_precondition_code(CODE) -#else -# define CGAL_point_set_processing_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_point_set_processing_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_point_set_processing_precondition_code(CODE) CODE -# define CGAL_point_set_processing_preconditions 1 -#endif // CGAL_POINT_SET_PROCESSING_NO_PRECONDITIONS - - -#undef CGAL_point_set_processing_exactness_precondition -#undef CGAL_point_set_processing_exactness_precondition_msg -#undef CGAL_point_set_processing_exactness_precondition_code - -#if defined(CGAL_POINT_SET_PROCESSING_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_point_set_processing_exactness_precondition(EX) (static_cast(0)) -# define CGAL_point_set_processing_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_point_set_processing_exactness_precondition_code(CODE) -#else -# define CGAL_point_set_processing_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_point_set_processing_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_point_set_processing_exactness_precondition_code(CODE) CODE -# define CGAL_point_set_processing_exactness_preconditions 1 -#endif // CGAL_POINT_SET_PROCESSING_NO_PRECONDITIONS - - -#undef CGAL_point_set_processing_expensive_precondition -#undef CGAL_point_set_processing_expensive_precondition_msg -#undef CGAL_point_set_processing_expensive_precondition_code - -#if defined(CGAL_POINT_SET_PROCESSING_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_point_set_processing_expensive_precondition(EX) (static_cast(0)) -# define CGAL_point_set_processing_expensive_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_point_set_processing_expensive_precondition_code(CODE) -#else -# define CGAL_point_set_processing_expensive_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_point_set_processing_expensive_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_point_set_processing_expensive_precondition_code(CODE) CODE -# define CGAL_point_set_processing_expensive_preconditions 1 -#endif // CGAL_POINT_SET_PROCESSING_NO_PRECONDITIONS - - -#undef CGAL_point_set_processing_expensive_exactness_precondition -#undef CGAL_point_set_processing_expensive_exactness_precondition_msg -#undef CGAL_point_set_processing_expensive_exactness_precondition_code - -#if defined(CGAL_POINT_SET_PROCESSING_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_point_set_processing_expensive_exactness_precondition(EX) (static_cast(0)) -# define CGAL_point_set_processing_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_point_set_processing_expensive_exactness_precondition_code(CODE) -#else -# define CGAL_point_set_processing_expensive_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_point_set_processing_expensive_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_point_set_processing_expensive_exactness_precondition_code(CODE) CODE -# define CGAL_point_set_processing_expensive_exactness_preconditions 1 -#endif // CGAL_POINT_SET_PROCESSING_NO_PRECONDITIONS - - -// postconditions -// -------------- - -#undef CGAL_point_set_processing_postcondition -#undef CGAL_point_set_processing_postcondition_msg -#undef CGAL_point_set_processing_postcondition_code - -#if defined(CGAL_POINT_SET_PROCESSING_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) -# define CGAL_point_set_processing_postcondition(EX) (static_cast(0)) -# define CGAL_point_set_processing_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_point_set_processing_postcondition_code(CODE) -#else -# define CGAL_point_set_processing_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_point_set_processing_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_point_set_processing_postcondition_code(CODE) CODE -# define CGAL_point_set_processing_postconditions 1 -#endif // CGAL_POINT_SET_PROCESSING_NO_POSTCONDITIONS - - -#undef CGAL_point_set_processing_exactness_postcondition -#undef CGAL_point_set_processing_exactness_postcondition_msg -#undef CGAL_point_set_processing_exactness_postcondition_code - -#if defined(CGAL_POINT_SET_PROCESSING_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_point_set_processing_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_point_set_processing_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_point_set_processing_exactness_postcondition_code(CODE) -#else -# define CGAL_point_set_processing_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_point_set_processing_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_point_set_processing_exactness_postcondition_code(CODE) CODE -# define CGAL_point_set_processing_exactness_postconditions 1 -#endif // CGAL_POINT_SET_PROCESSING_NO_POSTCONDITIONS - - -#undef CGAL_point_set_processing_expensive_postcondition -#undef CGAL_point_set_processing_expensive_postcondition_msg -#undef CGAL_point_set_processing_expensive_postcondition_code - -#if defined(CGAL_POINT_SET_PROCESSING_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_point_set_processing_expensive_postcondition(EX) (static_cast(0)) -# define CGAL_point_set_processing_expensive_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_point_set_processing_expensive_postcondition_code(CODE) -#else -# define CGAL_point_set_processing_expensive_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_point_set_processing_expensive_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_point_set_processing_expensive_postcondition_code(CODE) CODE -# define CGAL_point_set_processing_expensive_postconditions 1 -#endif // CGAL_POINT_SET_PROCESSING_NO_POSTCONDITIONS - - -#undef CGAL_point_set_processing_expensive_exactness_postcondition -#undef CGAL_point_set_processing_expensive_exactness_postcondition_msg -#undef CGAL_point_set_processing_expensive_exactness_postcondition_code - -#if defined(CGAL_POINT_SET_PROCESSING_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_point_set_processing_expensive_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_point_set_processing_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_point_set_processing_expensive_exactness_postcondition_code(CODE) -#else -# define CGAL_point_set_processing_expensive_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_point_set_processing_expensive_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_point_set_processing_expensive_exactness_postcondition_code(CODE) CODE -# define CGAL_point_set_processing_expensive_exactness_postconditions 1 -#endif // CGAL_POINT_SET_PROCESSING_NO_POSTCONDITIONS - - -// warnings -// -------- - -#undef CGAL_point_set_processing_warning -#undef CGAL_point_set_processing_warning_msg -#undef CGAL_point_set_processing_warning_code - -#if defined(CGAL_POINT_SET_PROCESSING_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) -# define CGAL_point_set_processing_warning(EX) (static_cast(0)) -# define CGAL_point_set_processing_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_point_set_processing_warning_code(CODE) -#else -# define CGAL_point_set_processing_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_point_set_processing_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_point_set_processing_warning_code(CODE) CODE -# define CGAL_point_set_processing_warnings 1 -#endif // CGAL_POINT_SET_PROCESSING_NO_WARNINGS - - -#undef CGAL_point_set_processing_exactness_warning -#undef CGAL_point_set_processing_exactness_warning_msg -#undef CGAL_point_set_processing_exactness_warning_code - -#if defined(CGAL_POINT_SET_PROCESSING_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_point_set_processing_exactness_warning(EX) (static_cast(0)) -# define CGAL_point_set_processing_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_point_set_processing_exactness_warning_code(CODE) -#else -# define CGAL_point_set_processing_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_point_set_processing_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_point_set_processing_exactness_warning_code(CODE) CODE -# define CGAL_point_set_processing_exactness_warnings 1 -#endif // CGAL_POINT_SET_PROCESSING_NO_WARNINGS - - -#undef CGAL_point_set_processing_expensive_warning -#undef CGAL_point_set_processing_expensive_warning_msg -#undef CGAL_point_set_processing_expensive_warning_code - -#if defined(CGAL_POINT_SET_PROCESSING_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_point_set_processing_expensive_warning(EX) (static_cast(0)) -# define CGAL_point_set_processing_expensive_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_point_set_processing_expensive_warning_code(CODE) -#else -# define CGAL_point_set_processing_expensive_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_point_set_processing_expensive_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_point_set_processing_expensive_warning_code(CODE) CODE -# define CGAL_point_set_processing_expensive_warnings 1 -#endif // CGAL_POINT_SET_PROCESSING_NO_WARNINGS - - -#undef CGAL_point_set_processing_expensive_exactness_warning -#undef CGAL_point_set_processing_expensive_exactness_warning_msg -#undef CGAL_point_set_processing_expensive_exactness_warning_code - -#if defined(CGAL_POINT_SET_PROCESSING_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_point_set_processing_expensive_exactness_warning(EX) (static_cast(0)) -# define CGAL_point_set_processing_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_point_set_processing_expensive_exactness_warning_code(CODE) -#else -# define CGAL_point_set_processing_expensive_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_point_set_processing_expensive_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_point_set_processing_expensive_exactness_warning_code(CODE) CODE -# define CGAL_point_set_processing_expensive_exactness_warnings 1 -#endif // CGAL_POINT_SET_PROCESSING_NO_WARNINGS - -/// \endcond diff --git a/Point_set_processing_3/include/CGAL/radial_orient_normals.h b/Point_set_processing_3/include/CGAL/radial_orient_normals.h index 9c6ca92e71b..56c87840822 100644 --- a/Point_set_processing_3/include/CGAL/radial_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/radial_orient_normals.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include @@ -72,7 +72,7 @@ radial_orient_normals( typedef typename Kernel::FT FT; // Precondition: at least one element in the container. - CGAL_point_set_processing_precondition(first != beyond); + CGAL_precondition(first != beyond); // Find points barycenter. // Note: We should use CGAL::centroid() from PCA component. diff --git a/Point_set_processing_3/include/CGAL/random_simplify_point_set.h b/Point_set_processing_3/include/CGAL/random_simplify_point_set.h index 50e71a2dc62..7d1f767b342 100644 --- a/Point_set_processing_3/include/CGAL/random_simplify_point_set.h +++ b/Point_set_processing_3/include/CGAL/random_simplify_point_set.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include @@ -53,7 +53,7 @@ random_simplify_point_set( PointRange& points, double removed_percentage) { - CGAL_point_set_processing_precondition(removed_percentage >= 0 && removed_percentage <= 100); + CGAL_precondition(removed_percentage >= 0 && removed_percentage <= 100); // Random shuffle CGAL::cpp98::random_shuffle (points.begin(), points.end()); diff --git a/Point_set_processing_3/include/CGAL/remove_outliers.h b/Point_set_processing_3/include/CGAL/remove_outliers.h index 2b28e1e4c7b..0a2697120b6 100644 --- a/Point_set_processing_3/include/CGAL/remove_outliers.h +++ b/Point_set_processing_3/include/CGAL/remove_outliers.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include @@ -206,12 +206,12 @@ remove_outliers( // precondition: at least one element in the container. // to fix: should have at least three distinct points // but this is costly to check - CGAL_point_set_processing_precondition(points.begin() != points.end()); + CGAL_precondition(points.begin() != points.end()); // precondition: at least 2 nearest neighbors - CGAL_point_set_processing_precondition(k >= 2); + CGAL_precondition(k >= 2); - CGAL_point_set_processing_precondition(threshold_percent >= 0 && threshold_percent <= 100); + CGAL_precondition(threshold_percent >= 0 && threshold_percent <= 100); Neighbor_query neighbor_query (points, point_map); diff --git a/Point_set_processing_3/include/CGAL/scanline_orient_normals.h b/Point_set_processing_3/include/CGAL/scanline_orient_normals.h index 02f956f2416..62c0ea1f76d 100644 --- a/Point_set_processing_3/include/CGAL/scanline_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/scanline_orient_normals.h @@ -20,6 +20,7 @@ #include #include +#include #include @@ -545,6 +546,8 @@ void scanline_orient_normals (PointRange& points, const NamedParameters& np = pa std::cerr << nb_scanlines << " scanline(s) identified (mean length = " << std::size_t(points.size() / double(nb_scanlines)) << " point(s))" << std::endl; +#else + CGAL_USE(nb_scanlines); #endif } diff --git a/Point_set_processing_3/include/CGAL/structure_point_set.h b/Point_set_processing_3/include/CGAL/structure_point_set.h index 598f0553d86..f2d9bd447c3 100644 --- a/Point_set_processing_3/include/CGAL/structure_point_set.h +++ b/Point_set_processing_3/include/CGAL/structure_point_set.h @@ -19,7 +19,6 @@ #include #include -#include #include #include diff --git a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h index 5b69f3ef0f9..bf7a7f5225c 100644 --- a/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h +++ b/Point_set_processing_3/include/CGAL/vcm_estimate_normals.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include diff --git a/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h b/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h index 7e4b86cdebe..41412051408 100644 --- a/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h +++ b/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include @@ -105,7 +105,7 @@ compute_update_sample_point( const std::vector& sample_densities ///< ) { - CGAL_point_set_processing_precondition(radius > 0); + CGAL_precondition(radius > 0); bool is_original_densities_empty = original_densities.empty(); bool is_sample_densities_empty = sample_densities.empty(); @@ -231,7 +231,7 @@ compute_density_weight_for_original_point( const typename Kernel::FT radius ///< neighbor radius square ) { - CGAL_point_set_processing_precondition(radius > 0); + CGAL_precondition(radius > 0); // basic geometric types typedef typename Kernel::Point_3 Point; @@ -465,9 +465,9 @@ wlop_simplify_and_regularize_point_set( // precondition: at least one element in the container. // to fix: should have at least three distinct points // but this is costly to check - CGAL_point_set_processing_precondition(points.begin() != points.end()); - CGAL_point_set_processing_precondition(select_percentage >= 0 - && select_percentage <= 100); + CGAL_precondition(points.begin() != points.end()); + CGAL_precondition(select_percentage >= 0 + && select_percentage <= 100); // Random shuffle CGAL::cpp98::random_shuffle (points.begin(), points.end()); @@ -507,7 +507,7 @@ wlop_simplify_and_regularize_point_set( #endif } - CGAL_point_set_processing_precondition(radius > 0); + CGAL_precondition(radius > 0); // Initiate a KD-tree search for original points std::vector original_treeElements; diff --git a/Poisson_surface_reconstruction_3/include/CGAL/Poisson_reconstruction_function.h b/Poisson_surface_reconstruction_3/include/CGAL/Poisson_reconstruction_function.h index b329573c042..bd0281cd9d7 100644 --- a/Poisson_surface_reconstruction_3/include/CGAL/Poisson_reconstruction_function.h +++ b/Poisson_surface_reconstruction_3/include/CGAL/Poisson_reconstruction_function.h @@ -38,7 +38,7 @@ #endif #include #include -#include +#include #include #include #include @@ -823,7 +823,7 @@ private: double D; if(!solver.linear_solver(A, B, X, D)) return false; - CGAL_surface_reconstruction_points_assertion(D == 1.0); + CGAL_assertion(D == 1.0); duration_solve = (clock() - time_init)/CLOCKS_PER_SEC; CGAL_TRACE_STREAM << " Solve sparse linear system: done (" << duration_solve << "sec.)\n"; @@ -1129,7 +1129,7 @@ private: if(voronoi_points.size() < 3) { - CGAL_surface_reconstruction_points_assertion(false); + CGAL_assertion(false); return 0.0; } diff --git a/Poisson_surface_reconstruction_3/include/CGAL/Reconstruction_triangulation_3.h b/Poisson_surface_reconstruction_3/include/CGAL/Reconstruction_triangulation_3.h index 7dd6a245aa3..9f605978f7c 100644 --- a/Poisson_surface_reconstruction_3/include/CGAL/Reconstruction_triangulation_3.h +++ b/Poisson_surface_reconstruction_3/include/CGAL/Reconstruction_triangulation_3.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include diff --git a/Poisson_surface_reconstruction_3/include/CGAL/poisson_refine_triangulation.h b/Poisson_surface_reconstruction_3/include/CGAL/poisson_refine_triangulation.h index 14d91140b5e..04a712e080f 100644 --- a/Poisson_surface_reconstruction_3/include/CGAL/poisson_refine_triangulation.h +++ b/Poisson_surface_reconstruction_3/include/CGAL/poisson_refine_triangulation.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include namespace CGAL { @@ -212,7 +212,7 @@ unsigned int poisson_refine_triangulation( { // Convergence is guaranteed if radius_edge_ratio_bound >= 1.0 - CGAL_surface_reconstruction_points_precondition(radius_edge_ratio_bound >= 1.0); + CGAL_precondition(radius_edge_ratio_bound >= 1.0); // Mesher_level types typedef Poisson_mesh_cell_criteria_3< diff --git a/Poisson_surface_reconstruction_3/include/CGAL/surface_reconstruction_points_assertions.h b/Poisson_surface_reconstruction_3/include/CGAL/surface_reconstruction_points_assertions.h deleted file mode 100644 index 67bc3df7f1a..00000000000 --- a/Poisson_surface_reconstruction_3/include/CGAL/surface_reconstruction_points_assertions.h +++ /dev/null @@ -1,347 +0,0 @@ -// Copyright (c) 2007 INRIA (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Geert-Jan Giezeman, Sven Schoenherr, Laurent Saboret -// -// Generated from script create_assertions.sh - -/// \cond SKIP_IN_MANUAL - -/// @file surface_reconstruction_points_assertions.h -/// Define checking macros for the Poisson_surface_reconstruction_3 package - -// Note that this header file is intentionnaly not protected with a -// macro (as ). Calling it a second time with another value -// for CGAL_NO_ASSERTIONS for example must make a difference. - -#include - -// macro definitions -// ================= -// assertions -// ---------- - -#undef CGAL_surface_reconstruction_points_assertion -#undef CGAL_surface_reconstruction_points_assertion_msg -#undef CGAL_surface_reconstruction_points_assertion_code - -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) -# define CGAL_surface_reconstruction_points_assertion(EX) (static_cast(0)) - -#include - -# define CGAL_surface_reconstruction_points_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_surface_reconstruction_points_assertion_code(CODE) -#else -# define CGAL_surface_reconstruction_points_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_surface_reconstruction_points_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_surface_reconstruction_points_assertion_code(CODE) CODE -# define CGAL_surface_reconstruction_points_assertions 1 -#endif // CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_ASSERTIONS - - -#undef CGAL_surface_reconstruction_points_exactness_assertion -#undef CGAL_surface_reconstruction_points_exactness_assertion_msg -#undef CGAL_surface_reconstruction_points_exactness_assertion_code - -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_surface_reconstruction_points_exactness_assertion(EX) (static_cast(0)) -# define CGAL_surface_reconstruction_points_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_surface_reconstruction_points_exactness_assertion_code(CODE) -#else -# define CGAL_surface_reconstruction_points_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_surface_reconstruction_points_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_surface_reconstruction_points_exactness_assertion_code(CODE) CODE -# define CGAL_surface_reconstruction_points_exactness_assertions 1 -#endif // CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_ASSERTIONS - - -#undef CGAL_surface_reconstruction_points_expensive_assertion -#undef CGAL_surface_reconstruction_points_expensive_assertion_msg -#undef CGAL_surface_reconstruction_points_expensive_assertion_code - -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_ASSERTIONS) \ - || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_surface_reconstruction_points_expensive_assertion(EX) (static_cast(0)) -# define CGAL_surface_reconstruction_points_expensive_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_surface_reconstruction_points_expensive_assertion_code(CODE) -#else -# define CGAL_surface_reconstruction_points_expensive_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_surface_reconstruction_points_expensive_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_surface_reconstruction_points_expensive_assertion_code(CODE) CODE -# define CGAL_surface_reconstruction_points_expensive_assertions 1 -#endif // CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_ASSERTIONS - - -#undef CGAL_surface_reconstruction_points_expensive_exactness_assertion -#undef CGAL_surface_reconstruction_points_expensive_exactness_assertion_msg -#undef CGAL_surface_reconstruction_points_expensive_exactness_assertion_code - -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_surface_reconstruction_points_expensive_exactness_assertion(EX) (static_cast(0)) -# define CGAL_surface_reconstruction_points_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_surface_reconstruction_points_expensive_exactness_assertion_code(CODE) -#else -# define CGAL_surface_reconstruction_points_expensive_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_surface_reconstruction_points_expensive_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_surface_reconstruction_points_expensive_exactness_assertion_code(CODE) CODE -# define CGAL_surface_reconstruction_points_expensive_exactness_assertions 1 -#endif // CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_ASSERTIONS - - -// preconditions -// ------------- - -#undef CGAL_surface_reconstruction_points_precondition -#undef CGAL_surface_reconstruction_points_precondition_msg -#undef CGAL_surface_reconstruction_points_precondition_code - -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) -# define CGAL_surface_reconstruction_points_precondition(EX) (static_cast(0)) -# define CGAL_surface_reconstruction_points_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_surface_reconstruction_points_precondition_code(CODE) -#else -# define CGAL_surface_reconstruction_points_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_surface_reconstruction_points_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_surface_reconstruction_points_precondition_code(CODE) CODE -# define CGAL_surface_reconstruction_points_preconditions 1 -#endif // CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_PRECONDITIONS - - -#undef CGAL_surface_reconstruction_points_exactness_precondition -#undef CGAL_surface_reconstruction_points_exactness_precondition_msg -#undef CGAL_surface_reconstruction_points_exactness_precondition_code - -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_surface_reconstruction_points_exactness_precondition(EX) (static_cast(0)) -# define CGAL_surface_reconstruction_points_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_surface_reconstruction_points_exactness_precondition_code(CODE) -#else -# define CGAL_surface_reconstruction_points_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_surface_reconstruction_points_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_surface_reconstruction_points_exactness_precondition_code(CODE) CODE -# define CGAL_surface_reconstruction_points_exactness_preconditions 1 -#endif // CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_PRECONDITIONS - - -#undef CGAL_surface_reconstruction_points_expensive_precondition -#undef CGAL_surface_reconstruction_points_expensive_precondition_msg -#undef CGAL_surface_reconstruction_points_expensive_precondition_code - -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_surface_reconstruction_points_expensive_precondition(EX) (static_cast(0)) -# define CGAL_surface_reconstruction_points_expensive_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_surface_reconstruction_points_expensive_precondition_code(CODE) -#else -# define CGAL_surface_reconstruction_points_expensive_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_surface_reconstruction_points_expensive_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_surface_reconstruction_points_expensive_precondition_code(CODE) CODE -# define CGAL_surface_reconstruction_points_expensive_preconditions 1 -#endif // CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_PRECONDITIONS - - -#undef CGAL_surface_reconstruction_points_expensive_exactness_precondition -#undef CGAL_surface_reconstruction_points_expensive_exactness_precondition_msg -#undef CGAL_surface_reconstruction_points_expensive_exactness_precondition_code - -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_surface_reconstruction_points_expensive_exactness_precondition(EX) (static_cast(0)) -# define CGAL_surface_reconstruction_points_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_surface_reconstruction_points_expensive_exactness_precondition_code(CODE) -#else -# define CGAL_surface_reconstruction_points_expensive_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_surface_reconstruction_points_expensive_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_surface_reconstruction_points_expensive_exactness_precondition_code(CODE) CODE -# define CGAL_surface_reconstruction_points_expensive_exactness_preconditions 1 -#endif // CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_PRECONDITIONS - - -// postconditions -// -------------- - -#undef CGAL_surface_reconstruction_points_postcondition -#undef CGAL_surface_reconstruction_points_postcondition_msg -#undef CGAL_surface_reconstruction_points_postcondition_code - -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) -# define CGAL_surface_reconstruction_points_postcondition(EX) (static_cast(0)) -# define CGAL_surface_reconstruction_points_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_surface_reconstruction_points_postcondition_code(CODE) -#else -# define CGAL_surface_reconstruction_points_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_surface_reconstruction_points_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_surface_reconstruction_points_postcondition_code(CODE) CODE -# define CGAL_surface_reconstruction_points_postconditions 1 -#endif // CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_POSTCONDITIONS - - -#undef CGAL_surface_reconstruction_points_exactness_postcondition -#undef CGAL_surface_reconstruction_points_exactness_postcondition_msg -#undef CGAL_surface_reconstruction_points_exactness_postcondition_code - -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_surface_reconstruction_points_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_surface_reconstruction_points_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_surface_reconstruction_points_exactness_postcondition_code(CODE) -#else -# define CGAL_surface_reconstruction_points_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_surface_reconstruction_points_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_surface_reconstruction_points_exactness_postcondition_code(CODE) CODE -# define CGAL_surface_reconstruction_points_exactness_postconditions 1 -#endif // CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_POSTCONDITIONS - - -#undef CGAL_surface_reconstruction_points_expensive_postcondition -#undef CGAL_surface_reconstruction_points_expensive_postcondition_msg -#undef CGAL_surface_reconstruction_points_expensive_postcondition_code - -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_surface_reconstruction_points_expensive_postcondition(EX) (static_cast(0)) -# define CGAL_surface_reconstruction_points_expensive_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_surface_reconstruction_points_expensive_postcondition_code(CODE) -#else -# define CGAL_surface_reconstruction_points_expensive_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_surface_reconstruction_points_expensive_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_surface_reconstruction_points_expensive_postcondition_code(CODE) CODE -# define CGAL_surface_reconstruction_points_expensive_postconditions 1 -#endif // CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_POSTCONDITIONS - - -#undef CGAL_surface_reconstruction_points_expensive_exactness_postcondition -#undef CGAL_surface_reconstruction_points_expensive_exactness_postcondition_msg -#undef CGAL_surface_reconstruction_points_expensive_exactness_postcondition_code - -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_surface_reconstruction_points_expensive_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_surface_reconstruction_points_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_surface_reconstruction_points_expensive_exactness_postcondition_code(CODE) -#else -# define CGAL_surface_reconstruction_points_expensive_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_surface_reconstruction_points_expensive_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_surface_reconstruction_points_expensive_exactness_postcondition_code(CODE) CODE -# define CGAL_surface_reconstruction_points_expensive_exactness_postconditions 1 -#endif // CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_POSTCONDITIONS - - -// warnings -// -------- - -#undef CGAL_surface_reconstruction_points_warning -#undef CGAL_surface_reconstruction_points_warning_msg -#undef CGAL_surface_reconstruction_points_warning_code - -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) -# define CGAL_surface_reconstruction_points_warning(EX) (static_cast(0)) -# define CGAL_surface_reconstruction_points_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_surface_reconstruction_points_warning_code(CODE) -#else -# define CGAL_surface_reconstruction_points_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_surface_reconstruction_points_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_surface_reconstruction_points_warning_code(CODE) CODE -# define CGAL_surface_reconstruction_points_warnings 1 -#endif // CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_WARNINGS - - -#undef CGAL_surface_reconstruction_points_exactness_warning -#undef CGAL_surface_reconstruction_points_exactness_warning_msg -#undef CGAL_surface_reconstruction_points_exactness_warning_code - -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_surface_reconstruction_points_exactness_warning(EX) (static_cast(0)) -# define CGAL_surface_reconstruction_points_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_surface_reconstruction_points_exactness_warning_code(CODE) -#else -# define CGAL_surface_reconstruction_points_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_surface_reconstruction_points_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_surface_reconstruction_points_exactness_warning_code(CODE) CODE -# define CGAL_surface_reconstruction_points_exactness_warnings 1 -#endif // CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_WARNINGS - - -#undef CGAL_surface_reconstruction_points_expensive_warning -#undef CGAL_surface_reconstruction_points_expensive_warning_msg -#undef CGAL_surface_reconstruction_points_expensive_warning_code - -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_surface_reconstruction_points_expensive_warning(EX) (static_cast(0)) -# define CGAL_surface_reconstruction_points_expensive_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_surface_reconstruction_points_expensive_warning_code(CODE) -#else -# define CGAL_surface_reconstruction_points_expensive_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_surface_reconstruction_points_expensive_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_surface_reconstruction_points_expensive_warning_code(CODE) CODE -# define CGAL_surface_reconstruction_points_expensive_warnings 1 -#endif // CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_WARNINGS - - -#undef CGAL_surface_reconstruction_points_expensive_exactness_warning -#undef CGAL_surface_reconstruction_points_expensive_exactness_warning_msg -#undef CGAL_surface_reconstruction_points_expensive_exactness_warning_code - -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_surface_reconstruction_points_expensive_exactness_warning(EX) (static_cast(0)) -# define CGAL_surface_reconstruction_points_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_surface_reconstruction_points_expensive_exactness_warning_code(CODE) -#else -# define CGAL_surface_reconstruction_points_expensive_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_surface_reconstruction_points_expensive_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_surface_reconstruction_points_expensive_exactness_warning_code(CODE) CODE -# define CGAL_surface_reconstruction_points_expensive_exactness_warnings 1 -#endif // CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_WARNINGS - -/// \endcond diff --git a/Polygon/doc/Polygon/PackageDescription.txt b/Polygon/doc/Polygon/PackageDescription.txt index e5c9d156714..1d48e74493c 100644 --- a/Polygon/doc/Polygon/PackageDescription.txt +++ b/Polygon/doc/Polygon/PackageDescription.txt @@ -40,10 +40,6 @@ \cgalPkgShortInfoEnd \cgalPkgDescriptionEnd -\cgalCRPSection{Assertions} - -The assertion flags for the polygons and polygon operations use -`POLYGON` in their names (e.g., `CGAL_POLYGON_NO_ASSERTIONS`). \cgalClassifedRefPages diff --git a/Polygon/include/CGAL/Polygon_2.h b/Polygon/include/CGAL/Polygon_2.h index be5ca8c9ef0..e4305cccfed 100644 --- a/Polygon/include/CGAL/Polygon_2.h +++ b/Polygon/include/CGAL/Polygon_2.h @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -370,7 +371,7 @@ class Polygon_2 { /// `p.is_simple()`. Bounded_side bounded_side(const Point_2& value) const { - CGAL_polygon_precondition(is_simple()); + CGAL_precondition(is_simple()); return bounded_side_2(d_container.begin(), d_container.end(), value, traits); } diff --git a/Polygon/include/CGAL/Polygon_2/Polygon_2_algorithms_impl.h b/Polygon/include/CGAL/Polygon_2/Polygon_2_algorithms_impl.h index 8338ce335a2..400c2a2e7a7 100644 --- a/Polygon/include/CGAL/Polygon_2/Polygon_2_algorithms_impl.h +++ b/Polygon/include/CGAL/Polygon_2/Polygon_2_algorithms_impl.h @@ -166,7 +166,7 @@ ForwardIterator left_vertex_2(ForwardIterator first, ForwardIterator last, const PolygonTraits&traits) { - CGAL_polygon_precondition(first != last); + CGAL_precondition(first != last); internal::Polygon_2::Compare_vertices less(traits.less_xy_2_object()); return std::min_element(first, last, less); @@ -182,7 +182,7 @@ ForwardIterator right_vertex_2(ForwardIterator first, ForwardIterator last, const PolygonTraits &traits) { - CGAL_polygon_precondition(first != last); + CGAL_precondition(first != last); internal::Polygon_2::Compare_vertices less(traits.less_xy_2_object()); return std::max_element(first, last, less); @@ -198,7 +198,7 @@ ForwardIterator top_vertex_2(ForwardIterator first, ForwardIterator last, const PolygonTraits&traits) { - CGAL_polygon_precondition(first != last); + CGAL_precondition(first != last); return std::max_element(first, last, traits.less_yx_2_object()); } @@ -212,7 +212,7 @@ ForwardIterator bottom_vertex_2(ForwardIterator first, ForwardIterator last, const PolygonTraits&traits) { - CGAL_polygon_precondition(first != last); + CGAL_precondition(first != last); return std::min_element(first, last, traits.less_yx_2_object()); } @@ -325,7 +325,7 @@ Oriented_side oriented_side_2(ForwardIterator first, const Traits& traits) { Orientation o = orientation_2(first, last, traits); - CGAL_polygon_assertion(o != COLLINEAR); + CGAL_assertion(o != COLLINEAR); Bounded_side b = bounded_side_2(first, last, point, traits); switch (b) { @@ -507,7 +507,7 @@ Orientation orientation_2(ForwardIterator first, ForwardIterator last, const Traits& traits) { - CGAL_polygon_precondition(is_simple_2(first, last, traits)); + CGAL_precondition(is_simple_2(first, last, traits)); ForwardIterator i = left_vertex_2(first, last, traits); diff --git a/Polygon/include/CGAL/Polygon_2/Polygon_2_edge_circulator.h b/Polygon/include/CGAL/Polygon_2/Polygon_2_edge_circulator.h index ba7dfdecb12..b7c6c10b94b 100644 --- a/Polygon/include/CGAL/Polygon_2/Polygon_2_edge_circulator.h +++ b/Polygon/include/CGAL/Polygon_2/Polygon_2_edge_circulator.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include namespace CGAL { #ifndef DOXYGEN_RUNNING //to avoid conflicts @@ -57,7 +57,7 @@ class Polygon_2_const_edge_circulator { : first_vertex(f) {} bool operator==( std::nullptr_t CGAL_assertion_code(p) ) const { - CGAL_polygon_assertion( p == 0); + CGAL_assertion( p == 0); return (first_vertex == 0); } diff --git a/Polygon/include/CGAL/Polygon_2/Polygon_2_impl.h b/Polygon/include/CGAL/Polygon_2/Polygon_2_impl.h index ce0714af873..8ba11273428 100644 --- a/Polygon/include/CGAL/Polygon_2/Polygon_2_impl.h +++ b/Polygon/include/CGAL/Polygon_2/Polygon_2_impl.h @@ -41,7 +41,6 @@ bool operator==( const Polygon_2 &x, return true; typedef typename Traits_P::Equal_2 Equal_2; typedef typename Traits_P::Point_2 Point_2; -// CGAL_polygon_precondition( (x.size() != 0) || (y.size() != 0)); if ((x.size() == 0) && (y.size() == 0)) return true; if (x.size() != y.size()) return false; diff --git a/Polygon/include/CGAL/Polygon_2/Polygon_2_simplicity.h b/Polygon/include/CGAL/Polygon_2/Polygon_2_simplicity.h index 0d77320370f..5e93c02bf43 100644 --- a/Polygon/include/CGAL/Polygon_2/Polygon_2_simplicity.h +++ b/Polygon/include/CGAL/Polygon_2/Polygon_2_simplicity.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include @@ -220,9 +220,9 @@ template bool Less_segments:: less_than_in_tree(Vertex_index new_edge, Vertex_index tree_edge) const { - CGAL_polygon_precondition( + CGAL_precondition( m_vertex_data->edges[tree_edge.as_int()].is_in_tree); - CGAL_polygon_precondition( + CGAL_precondition( !m_vertex_data->edges[new_edge.as_int()].is_in_tree); Vertex_index left, mid, right; m_vertex_data->left_and_right_index(left, right, tree_edge); @@ -323,20 +323,20 @@ insertion_event(Tree *tree, Vertex_index prev_vt, std::pair result; if (left_turn) { result = tree->insert(prev_vt); - // CGAL_polygon_assertion(result.second) + // CGAL_assertion(result.second) td_prev.tree_it = result.first; td_prev.is_in_tree = true; result = tree->insert(mid_vt); - // CGAL_polygon_assertion(result.second) + // CGAL_assertion(result.second) td_mid.tree_it = result.first; td_mid.is_in_tree = true; } else { result = tree->insert(mid_vt); - // CGAL_polygon_assertion(result.second) + // CGAL_assertion(result.second) td_mid.tree_it = result.first; td_mid.is_in_tree = true; result = tree->insert(prev_vt); - // CGAL_polygon_assertion(result.second) + // CGAL_assertion(result.second) td_prev.tree_it = result.first; td_prev.is_in_tree = true; } @@ -369,7 +369,7 @@ replacement_event(Tree *tree, Vertex_index cur_edge, Vertex_index next_edge) // check if continuation point is on the right side of neighbor segments typedef typename Tree::iterator It; Edge_data &td = edges[cur_edge.as_int()]; - CGAL_polygon_assertion(td.is_in_tree); + CGAL_assertion(td.is_in_tree); It cur_seg = td.tree_it; Vertex_index cur_vt = (td.is_left_to_right) ? next_edge : cur_edge; if (cur_seg != tree->begin()) { diff --git a/Polygon/include/CGAL/Polygon_2/polygon_assertions.h b/Polygon/include/CGAL/Polygon_2/polygon_assertions.h deleted file mode 100644 index 47711d72fef..00000000000 --- a/Polygon/include/CGAL/Polygon_2/polygon_assertions.h +++ /dev/null @@ -1,366 +0,0 @@ -// Copyright (c) 1997 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. -// -// This file is part of CGAL (www.cgal.org) -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Geert-Jan Giezeman, Sven Schoenherr -// -// Generated from script create_assertions.sh - - -// Note that this header file is intentionnaly not protected with a -// macro (as ). Calling it a second time with another value -// for CGAL_NO_ASSERTIONS for example must make a difference. - -#include - -// macro definitions -// ================= -// assertions -// ---------- - -#undef CGAL_polygon_assertion -#undef CGAL_polygon_assertion_msg -#undef CGAL_polygon_assertion_code - - -#ifndef CGAL_POLYGON_ASSERTIONS_H -#define CGAL_POLYGON_ASSERTIONS_H -#if defined(CGAL_POLYGON_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) -namespace CGAL{ -inline void set_use_polygon_assertions(bool){} -inline bool get_use_polygon_assertions(){return true;} -} -#else -#include -namespace CGAL{ -inline bool& get_use_polygon_assertions() -{ - CGAL_STATIC_THREAD_LOCAL_VARIABLE(bool, b, true); - return b; -} -inline void set_use_polygon_assertions(bool b) -{ - get_use_polygon_assertions() = b; -} -} -#endif -#endif // CGAL_POLYGON_ASSERTIONS_H - -#if defined(CGAL_POLYGON_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) -# define CGAL_polygon_assertion(EX) (static_cast(0)) -# define CGAL_polygon_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_polygon_assertion_code(CODE) -#else -# define CGAL_polygon_assertion(EX) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_polygon_assertion_msg(EX,MSG) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_polygon_assertion_code(CODE) CODE -# define CGAL_polygon_assertions 1 -#endif // CGAL_POLYGON_NO_ASSERTIONS - - -#undef CGAL_polygon_exactness_assertion -#undef CGAL_polygon_exactness_assertion_msg -#undef CGAL_polygon_exactness_assertion_code - -#if defined(CGAL_POLYGON_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_polygon_exactness_assertion(EX) (static_cast(0)) -# define CGAL_polygon_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_polygon_exactness_assertion_code(CODE) -#else -# define CGAL_polygon_exactness_assertion(EX) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_polygon_exactness_assertion_msg(EX,MSG) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_polygon_exactness_assertion_code(CODE) CODE -# define CGAL_polygon_exactness_assertions 1 -#endif // CGAL_POLYGON_NO_ASSERTIONS - - -#undef CGAL_polygon_expensive_assertion -#undef CGAL_polygon_expensive_assertion_msg -#undef CGAL_polygon_expensive_assertion_code - -#if defined(CGAL_POLYGON_NO_ASSERTIONS) \ - || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_polygon_expensive_assertion(EX) (static_cast(0)) -# define CGAL_polygon_expensive_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_polygon_expensive_assertion_code(CODE) -#else -# define CGAL_polygon_expensive_assertion(EX) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_polygon_expensive_assertion_msg(EX,MSG) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_polygon_expensive_assertion_code(CODE) CODE -# define CGAL_polygon_expensive_assertions 1 -#endif // CGAL_POLYGON_NO_ASSERTIONS - - -#undef CGAL_polygon_expensive_exactness_assertion -#undef CGAL_polygon_expensive_exactness_assertion_msg -#undef CGAL_polygon_expensive_exactness_assertion_code - -#if defined(CGAL_POLYGON_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_polygon_expensive_exactness_assertion(EX) (static_cast(0)) -# define CGAL_polygon_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_polygon_expensive_exactness_assertion_code(CODE) -#else -# define CGAL_polygon_expensive_exactness_assertion(EX) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_polygon_expensive_exactness_assertion_msg(EX,MSG) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_polygon_expensive_exactness_assertion_code(CODE) CODE -# define CGAL_polygon_expensive_exactness_assertions 1 -#endif // CGAL_POLYGON_NO_ASSERTIONS - - -// preconditions -// ------------- - -#undef CGAL_polygon_precondition -#undef CGAL_polygon_precondition_msg -#undef CGAL_polygon_precondition_code - -#if defined(CGAL_POLYGON_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) -# define CGAL_polygon_precondition(EX) (static_cast(0)) -# define CGAL_polygon_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_polygon_precondition_code(CODE) -#else -# define CGAL_polygon_precondition(EX) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_polygon_precondition_msg(EX,MSG) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_polygon_precondition_code(CODE) CODE -# define CGAL_polygon_preconditions 1 -#endif // CGAL_POLYGON_NO_PRECONDITIONS - - -#undef CGAL_polygon_exactness_precondition -#undef CGAL_polygon_exactness_precondition_msg -#undef CGAL_polygon_exactness_precondition_code - -#if defined(CGAL_POLYGON_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_polygon_exactness_precondition(EX) (static_cast(0)) -# define CGAL_polygon_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_polygon_exactness_precondition_code(CODE) -#else -# define CGAL_polygon_exactness_precondition(EX) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_polygon_exactness_precondition_msg(EX,MSG) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_polygon_exactness_precondition_code(CODE) CODE -# define CGAL_polygon_exactness_preconditions 1 -#endif // CGAL_POLYGON_NO_PRECONDITIONS - - -#undef CGAL_polygon_expensive_precondition -#undef CGAL_polygon_expensive_precondition_msg -#undef CGAL_polygon_expensive_precondition_code - -#if defined(CGAL_POLYGON_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_polygon_expensive_precondition(EX) (static_cast(0)) -# define CGAL_polygon_expensive_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_polygon_expensive_precondition_code(CODE) -#else -# define CGAL_polygon_expensive_precondition(EX) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_polygon_expensive_precondition_msg(EX,MSG) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_polygon_expensive_precondition_code(CODE) CODE -# define CGAL_polygon_expensive_preconditions 1 -#endif // CGAL_POLYGON_NO_PRECONDITIONS - - -#undef CGAL_polygon_expensive_exactness_precondition -#undef CGAL_polygon_expensive_exactness_precondition_msg -#undef CGAL_polygon_expensive_exactness_precondition_code - -#if defined(CGAL_POLYGON_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_polygon_expensive_exactness_precondition(EX) (static_cast(0)) -# define CGAL_polygon_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_polygon_expensive_exactness_precondition_code(CODE) -#else -# define CGAL_polygon_expensive_exactness_precondition(EX) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_polygon_expensive_exactness_precondition_msg(EX,MSG) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_polygon_expensive_exactness_precondition_code(CODE) CODE -# define CGAL_polygon_expensive_exactness_preconditions 1 -#endif // CGAL_POLYGON_NO_PRECONDITIONS - - -// postconditions -// -------------- - -#undef CGAL_polygon_postcondition -#undef CGAL_polygon_postcondition_msg -#undef CGAL_polygon_postcondition_code - -#if defined(CGAL_POLYGON_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) -# define CGAL_polygon_postcondition(EX) (static_cast(0)) -# define CGAL_polygon_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_polygon_postcondition_code(CODE) -#else -# define CGAL_polygon_postcondition(EX) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_polygon_postcondition_msg(EX,MSG) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_polygon_postcondition_code(CODE) CODE -# define CGAL_polygon_postconditions 1 -#endif // CGAL_POLYGON_NO_POSTCONDITIONS - - -#undef CGAL_polygon_exactness_postcondition -#undef CGAL_polygon_exactness_postcondition_msg -#undef CGAL_polygon_exactness_postcondition_code - -#if defined(CGAL_POLYGON_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_polygon_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_polygon_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_polygon_exactness_postcondition_code(CODE) -#else -# define CGAL_polygon_exactness_postcondition(EX) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_polygon_exactness_postcondition_msg(EX,MSG) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_polygon_exactness_postcondition_code(CODE) CODE -# define CGAL_polygon_exactness_postconditions 1 -#endif // CGAL_POLYGON_NO_POSTCONDITIONS - - -#undef CGAL_polygon_expensive_postcondition -#undef CGAL_polygon_expensive_postcondition_msg -#undef CGAL_polygon_expensive_postcondition_code - -#if defined(CGAL_POLYGON_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_polygon_expensive_postcondition(EX) (static_cast(0)) -# define CGAL_polygon_expensive_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_polygon_expensive_postcondition_code(CODE) -#else -# define CGAL_polygon_expensive_postcondition(EX) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_polygon_expensive_postcondition_msg(EX,MSG) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_polygon_expensive_postcondition_code(CODE) CODE -# define CGAL_polygon_expensive_postconditions 1 -#endif // CGAL_POLYGON_NO_POSTCONDITIONS - - -#undef CGAL_polygon_expensive_exactness_postcondition -#undef CGAL_polygon_expensive_exactness_postcondition_msg -#undef CGAL_polygon_expensive_exactness_postcondition_code - -#if defined(CGAL_POLYGON_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_polygon_expensive_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_polygon_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_polygon_expensive_exactness_postcondition_code(CODE) -#else -# define CGAL_polygon_expensive_exactness_postcondition(EX) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_polygon_expensive_exactness_postcondition_msg(EX,MSG) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_polygon_expensive_exactness_postcondition_code(CODE) CODE -# define CGAL_polygon_expensive_exactness_postconditions 1 -#endif // CGAL_POLYGON_NO_POSTCONDITIONS - - -// warnings -// -------- - -#undef CGAL_polygon_warning -#undef CGAL_polygon_warning_msg -#undef CGAL_polygon_warning_code - -#if defined(CGAL_POLYGON_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) -# define CGAL_polygon_warning(EX) (static_cast(0)) -# define CGAL_polygon_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_polygon_warning_code(CODE) -#else -# define CGAL_polygon_warning(EX) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_polygon_warning_msg(EX,MSG) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_polygon_warning_code(CODE) CODE -# define CGAL_polygon_warnings 1 -#endif // CGAL_POLYGON_NO_WARNINGS - - -#undef CGAL_polygon_exactness_warning -#undef CGAL_polygon_exactness_warning_msg -#undef CGAL_polygon_exactness_warning_code - -#if defined(CGAL_POLYGON_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_polygon_exactness_warning(EX) (static_cast(0)) -# define CGAL_polygon_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_polygon_exactness_warning_code(CODE) -#else -# define CGAL_polygon_exactness_warning(EX) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_polygon_exactness_warning_msg(EX,MSG) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_polygon_exactness_warning_code(CODE) CODE -# define CGAL_polygon_exactness_warnings 1 -#endif // CGAL_POLYGON_NO_WARNINGS - - -#undef CGAL_polygon_expensive_warning -#undef CGAL_polygon_expensive_warning_msg -#undef CGAL_polygon_expensive_warning_code - -#if defined(CGAL_POLYGON_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_polygon_expensive_warning(EX) (static_cast(0)) -# define CGAL_polygon_expensive_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_polygon_expensive_warning_code(CODE) -#else -# define CGAL_polygon_expensive_warning(EX) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_polygon_expensive_warning_msg(EX,MSG) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_polygon_expensive_warning_code(CODE) CODE -# define CGAL_polygon_expensive_warnings 1 -#endif // CGAL_POLYGON_NO_WARNINGS - - -#undef CGAL_polygon_expensive_exactness_warning -#undef CGAL_polygon_expensive_exactness_warning_msg -#undef CGAL_polygon_expensive_exactness_warning_code - -#if defined(CGAL_POLYGON_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_polygon_expensive_exactness_warning(EX) (static_cast(0)) -# define CGAL_polygon_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_polygon_expensive_exactness_warning_code(CODE) -#else -# define CGAL_polygon_expensive_exactness_warning(EX) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_polygon_expensive_exactness_warning_msg(EX,MSG) \ - ((!get_use_polygon_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_polygon_expensive_exactness_warning_code(CODE) CODE -# define CGAL_polygon_expensive_exactness_warnings 1 -#endif // CGAL_POLYGON_NO_WARNINGS diff --git a/Polygon/include/CGAL/Polygon_2_algorithms.h b/Polygon/include/CGAL/Polygon_2_algorithms.h index 5c836466c11..8233269217a 100644 --- a/Polygon/include/CGAL/Polygon_2_algorithms.h +++ b/Polygon/include/CGAL/Polygon_2_algorithms.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include /// namespace CGAL { diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt index 08e11df647d..e7345cd3c4c 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt @@ -59,7 +59,7 @@ of the graph concepts defined in the package \ref PkgBGLRef. Using common graph enables having common input/output functions for all the models of these concepts. The page \ref PkgBGLIOFct provides an exhaustive description of the available I/O functions. In addition, this package offers the function `CGAL::Polygon_mesh_processing::IO::read_polygon_mesh()`, -which can perform some reparation if the input data do not represent a manifold surface. +which can perform some repairing if the input data do not represent a manifold surface. **************************************** \section PMPMeshing Meshing diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_mesh_union_progress.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_mesh_union_progress.cpp index 8b49c843d29..67c2c3615fe 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_mesh_union_progress.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_mesh_union_progress.cpp @@ -105,6 +105,7 @@ struct Visitor : public PMP::Corefinement::Default_visitor { std::shared_ptr sptr; + mutable std::size_t tf_counter = 0; Visitor() : sptr(std::make_shared()) @@ -124,15 +125,16 @@ struct Visitor : std::cout << "Visitor::end_filtering_intersections() at " << sptr->time() << " sec." << std::endl; } - void start_triangulating_faces(std::size_t tf)const + void start_triangulating_faces(std::size_t tf) const { std::cout << "Visitor::start_triangulation() with " << tf << " faces at " << sptr->time() << " sec." << std::endl; sptr->start_triangulating_faces(tf); + tf_counter = 0; } - void face_triangulation(std::size_t i) const + void triangulating_faces_step() const { - sptr->face_triangulation(i); + sptr->face_triangulation(tf_counter++); } void end_triangulating_faces()const @@ -140,7 +142,7 @@ struct Visitor : std::cout << "Visitor::end_triangulating_faces() at " << sptr->time() << " sec." << std::endl; } - void start_coplanar_faces(std::size_t i) const + void start_handling_intersection_of_coplanar_faces(std::size_t i) const { sptr->start_coplanar_faces(i); } @@ -150,12 +152,12 @@ struct Visitor : sptr->intersection_of_coplanar_faces_step(); } - void end_coplanar_faces() const + void end_handling_intersection_of_coplanar_faces() const { std::cout << "Visitor::end_coplanar_faces() at " << sptr->time() << " sec." << std::endl; } - void start_intersection_points(std::size_t i) const + void start_handling_edge_face_intersections(std::size_t i) const { sptr->start_intersection_points(i); } @@ -165,7 +167,7 @@ struct Visitor : sptr->edge_face_intersections_step(); } - void end_intersection_points() const + void end_handling_edge_face_intersections() const { std::cout << "Visitor::end_intersection_points() at " << sptr->time() << " sec." << std::endl; } diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/repair_polygon_soup_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/repair_polygon_soup_example.cpp index 13da122a884..e58267d6da7 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/repair_polygon_soup_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/repair_polygon_soup_example.cpp @@ -84,9 +84,9 @@ int main(int, char**) polygons.push_back({0,1,2,3,4,3,2,1}); #endif - std::cout << "Before reparation, the soup has " << points.size() << " vertices and " << polygons.size() << " faces" << std::endl; + std::cout << "Before repairing, the soup has " << points.size() << " vertices and " << polygons.size() << " faces" << std::endl; PMP::repair_polygon_soup(points, polygons, CGAL::parameters::geom_traits(Array_traits())); - std::cout << "After reparation, the soup has " << points.size() << " vertices and " << polygons.size() << " faces" << std::endl; + std::cout << "After repairing, the soup has " << points.size() << " vertices and " << polygons.size() << " faces" << std::endl; Mesh mesh; PMP::orient_polygon_soup(points, polygons); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/bbox.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/bbox.h index a4d199871cb..96e61d7bb67 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/bbox.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/bbox.h @@ -179,6 +179,8 @@ namespace CGAL { using parameters::choose_parameter; using parameters::get_parameter; + CGAL_precondition(is_valid_edge_descriptor(ed, pmesh)); + typename GetVertexPointMap::const_type vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), get_const_property_map(CGAL::vertex_point, pmesh)); @@ -234,6 +236,8 @@ namespace CGAL { using parameters::choose_parameter; using parameters::get_parameter; + CGAL_precondition(is_valid_face_descriptor(fd, pmesh)); + typename GetVertexPointMap::const_type vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), get_const_property_map(CGAL::vertex_point, pmesh)); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h index 3e10ac976f2..47dd64b4f36 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h @@ -89,6 +89,8 @@ void sum_normals(const PM& pmesh, typedef typename boost::property_traits::reference Point_ref; + CGAL_precondition(is_valid_face_descriptor(f, pmesh)); + halfedge_descriptor he = halfedge(f, pmesh); vertex_descriptor v = source(he, pmesh); vertex_descriptor the = target(he,pmesh); @@ -172,6 +174,8 @@ compute_face_normal(typename boost::graph_traits::face_descriptor f using parameters::choose_parameter; using parameters::get_parameter; + CGAL_precondition(is_valid_face_descriptor(f, pmesh)); + typedef typename GetGeomTraits::type GT; GT traits = choose_parameter(get_parameter(np, internal_np::geom_traits)); @@ -665,6 +669,8 @@ compute_vertex_normal(typename boost::graph_traits::vertex_descript using parameters::is_default_parameter; using parameters::get_parameter; + CGAL_precondition(is_valid_vertex_descriptor(v, pmesh)); + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::face_descriptor face_descriptor; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h index d98734581d7..525f020a342 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h @@ -32,9 +32,6 @@ #include #include -#include -#include - #include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/detect_features.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/detect_features.h index b45fe3989ad..f8ade3bed27 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/detect_features.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/detect_features.h @@ -57,6 +57,8 @@ is_sharp(const typename boost::graph_traits::halfedge_descriptor h, typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + CGAL_precondition(is_valid_halfedge_descriptor(h, pmesh)); + if(is_border_edge(h, pmesh)) return false; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h index 12a09222bdb..d02ef3a9023 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h @@ -76,7 +76,7 @@ namespace internal { do not suffice to solve constructed linear system. Note that if the vertex range to which fairing is applied contains all the vertices of the triangle mesh, - fairing does not fail, but the mesh gets shrinked to `CGAL::ORIGIN`. + fairing does not fail, but the mesh gets shrunk to `CGAL::ORIGIN`. @tparam TriangleMesh a model of `FaceGraph` and `MutableFaceGraph` @tparam VertexRange a range of vertex descriptors of `TriangleMesh`, model of `Range`. diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index 8c7b8702366..79b7f260e69 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -1068,15 +1068,15 @@ public: if (!used_to_clip_a_surface && !used_to_classify_patches && (!is_tm1_closed || !is_tm2_closed)) { //make sure there is no ambiguity in tm1 - if( (patch_status_was_not_already_set[0] && previous_bitvalue[0]!=is_patch_inside_tm2[patch_id_p1] ) || - (patch_status_was_not_already_set[1] && previous_bitvalue[1]!=is_patch_inside_tm2[patch_id_p2] ) ) + if( (!patch_status_was_not_already_set[0] && previous_bitvalue[0]!=is_patch_inside_tm2.test(patch_id_p1) ) || + (!patch_status_was_not_already_set[1] && previous_bitvalue[1]!=is_patch_inside_tm2.test(patch_id_p2) ) ) { impossible_operation.set(); return true; } //make sure there is no ambiguity in tm2 - if( (patch_status_was_not_already_set[2] && previous_bitvalue[2]!=is_patch_inside_tm2[patch_id_q1] ) || - (patch_status_was_not_already_set[3] && previous_bitvalue[3]!=is_patch_inside_tm2[patch_id_q2] ) ) + if( (!patch_status_was_not_already_set[2] && previous_bitvalue[2]!=is_patch_inside_tm1.test(patch_id_q1) ) || + (!patch_status_was_not_already_set[3] && previous_bitvalue[3]!=is_patch_inside_tm1.test(patch_id_q2) ) ) { impossible_operation.set(); return true; @@ -1091,6 +1091,15 @@ public: patch_status_not_set_tm2.reset(patch_id_q1); patch_status_not_set_tm2.reset(patch_id_q2); + // restore initial state, needed when checking in `inconsistent_classification()` + if (!is_tm1_closed || !is_tm2_closed) + { + is_patch_inside_tm2.reset(patch_id_p1); + is_patch_inside_tm2.reset(patch_id_p2); + is_patch_inside_tm1.reset(patch_id_q1); + is_patch_inside_tm1.reset(patch_id_q2); + } + #ifdef CGAL_COREFINEMENT_POLYHEDRA_DEBUG #warning: Factorize the orientation predicates. #endif //CGAL_COREFINEMENT_POLYHEDRA_DEBUG diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index 0dc2f54f2b4..837d16467e8 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -405,7 +405,9 @@ namespace internal { } //split long edges +#ifdef CGAL_PMP_REMESHING_VERBOSE unsigned int nb_splits = 0; +#endif while (!long_edges.empty()) { //the edge with longest length @@ -420,7 +422,9 @@ namespace internal { // propagate the constrained status put(ecmap_, edge(hnew, mesh_), get(ecmap_, edge(he, mesh_))); CGAL_assertion(he == next(hnew, mesh_)); +#ifdef CGAL_PMP_REMESHING_VERBOSE ++nb_splits; +#endif //move refinement point vertex_descriptor vnew = target(hnew, mesh_); @@ -497,7 +501,9 @@ namespace internal { } //split long edges +#ifdef CGAL_PMP_REMESHING_VERBOSE unsigned int nb_splits = 0; +#endif while (!long_edges.empty()) { //the edge with longest length @@ -524,8 +530,9 @@ namespace internal { halfedge_descriptor hnew = CGAL::Euler::split_edge(he, mesh_); CGAL_assertion(he == next(hnew, mesh_)); put(ecmap_, edge(hnew, mesh_), get(ecmap_, edge(he, mesh_)) ); +#ifdef CGAL_PMP_REMESHING_VERBOSE ++nb_splits; - +#endif //move refinement point vertex_descriptor vnew = target(hnew, mesh_); put(vpmap_, vnew, refinement_point); @@ -642,7 +649,9 @@ namespace internal { std::cout << "done." << std::endl; #endif +#ifdef CGAL_PMP_REMESHING_VERBOSE unsigned int nb_collapses = 0; +#endif while (!short_edges.empty()) { //the edge with shortest length @@ -779,8 +788,9 @@ namespace internal { vertex_descriptor vkept = CGAL::Euler::collapse_edge(e, mesh_, ecmap_); CGAL_assertion(is_valid(mesh_)); CGAL_assertion(vkept == vb);//is the constrained point still here +#ifdef CGAL_PMP_REMESHING_VERBOSE ++nb_collapses; - +#endif //fix constrained case CGAL_assertion((is_constrained(vkept) || is_corner(vkept) || is_on_patch_border(vkept)) == (is_va_constrained || is_vb_constrained || is_va_on_constrained_polyline || is_vb_on_constrained_polyline)); @@ -842,7 +852,9 @@ namespace internal { const double cap_threshold = std::cos(160. / 180 * CGAL_PI); +#ifdef CGAL_PMP_REMESHING_VERBOSE unsigned int nb_flips = 0; +#endif for(edge_descriptor e : edges(mesh_)) { //only the patch edges are allowed to be flipped @@ -906,8 +918,9 @@ namespace internal { put(degree, vc, vvc); put(degree, vd, vvd); +#ifdef CGAL_PMP_REMESHING_VERBOSE ++nb_flips; - +#endif #ifdef CGAL_PMP_REMESHING_VERBOSE_PROGRESS std::cout << "\r\t(" << nb_flips << " flips)"; std::cout.flush(); @@ -956,8 +969,9 @@ namespace internal { put(degree, vc, vvc); put(degree, vd, vvd); +#ifdef CGAL_PMP_REMESHING_VERBOSE --nb_flips; - +#endif CGAL_assertion_code(Halfedge_status s3 = status(he)); CGAL_assertion(s1 == s3); CGAL_assertion(!is_border(he, mesh_)); @@ -1635,8 +1649,6 @@ private: const double& sq_low, const bool collapse_constraints) { - CGAL_assertion_code(std::size_t nb_done = 0); - std::unordered_set degenerate_faces; for(halfedge_descriptor h : halfedges_around_target(halfedge(v, mesh_), mesh_)) @@ -1695,7 +1707,6 @@ private: continue; CGAL::Euler::flip_edge(hf, mesh_); - CGAL_assertion_code(++nb_done); done = true; //update status @@ -1891,6 +1902,11 @@ private: else if(is_an_isolated_constraint(h)) nb_isolated++; else CGAL_assertion(false); } + CGAL_USE(nb_border); + CGAL_USE(nb_mesh); + CGAL_USE(nb_patch); + CGAL_USE(nb_patch_border); + CGAL_USE(nb_isolated); } #ifdef CGAL_PMP_REMESHING_DEBUG diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/mesh_smoothing_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/mesh_smoothing_impl.h index 16f8de52d49..9f04800cea6 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/mesh_smoothing_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/mesh_smoothing_impl.h @@ -161,8 +161,9 @@ public: put(marks, e, false); for(edge_descriptor e : edge_range) put(marks, e, true); - +#ifdef CGAL_PMP_SMOOTHING_DEBUG int flipped_n = 0; +#endif while(!edge_range.empty()) { edge_descriptor e = edge_range.back(); @@ -172,8 +173,9 @@ public: if(should_be_flipped(e)) { +#ifdef CGAL_PMP_SMOOTHING_DEBUG ++flipped_n; - +#endif halfedge_descriptor h = halfedge(e, mesh_); #ifdef CGAL_PMP_SMOOTHING_DEBUG_PP diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h index 727c5f50109..54369aee910 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h @@ -103,7 +103,7 @@ private: { for(face_descriptor fd : faces) { - CGAL_assertion(fd != boost::graph_traits::null_face()); + CGAL_assertion(is_valid_face_descriptor(fd, pmesh)); vertex_descriptor vi = target(halfedge(fd,pmesh),pmesh); vertex_descriptor vj = target(next(halfedge(fd,pmesh),pmesh),pmesh); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h index 8c9c7042429..4bf778aca29 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h @@ -442,8 +442,8 @@ random_location_on_face(typename boost::graph_traits::face_descrip CGAL::Random& rnd = get_default_random()) { CGAL_USE(tm); - CGAL_precondition(CGAL::is_triangle_mesh(tm)); - CGAL_precondition(fd != boost::graph_traits::null_face()); + CGAL_precondition(is_valid_face_descriptor(fd, tm)); + CGAL_precondition(is_triangle(halfedge(fd, tm), tm)); // calling 'rnd.uniform real' with double in case FT comes from an EPECK kernel (which doesn't seem to work too well) FT u(rnd.uniform_real(0., 1.)); @@ -523,8 +523,8 @@ get_descriptor_from_location(const std::pair::null_face()); + CGAL_precondition(is_valid_face_descriptor(fd, tm)); + CGAL_precondition(is_triangle(halfedge(fd, tm), tm)); CGAL_precondition(is_in_face(loc, tm)); // the first barycentric coordinate corresponds to source(halfedge(fd, tm), tm) @@ -942,11 +942,10 @@ locate_vertex(typename boost::graph_traits::vertex_descriptor vd, } } - CGAL_postcondition(!CGAL::is_border(hd, tm)); // must find a 'real' face incident to 'vd' + CGAL_postcondition(!is_border(hd, tm)); // must find a 'real' face incident to 'vd' + CGAL_assertion(target(hd, tm) == vd); face_descriptor fd = face(hd, tm); - - CGAL_assertion(target(hd, tm) == vd); CGAL_assertion(fd != boost::graph_traits::null_face()); // isolated vertex @@ -989,7 +988,7 @@ locate_vertex(const typename boost::graph_traits::vertex_descripto const typename boost::graph_traits::face_descriptor fd, const TriangleMesh& tm) { - CGAL_precondition(fd != boost::graph_traits::null_face()); + CGAL_precondition(is_valid_vertex_descriptor(vd, tm) && is_valid_face_descriptor(fd, tm)); FT coords[3] = { FT(0), FT(0), FT(0) }; std::size_t vertex_local_index = vertex_index_in_face(vd, fd, tm); @@ -1121,14 +1120,14 @@ locate_in_face(const typename internal::Location_traits(get_parameter(np, internal_np::geom_traits)); FT snap_tolerance = choose_parameter(get_parameter(np, internal_np::snapping_tolerance), 0); - CGAL_precondition(fd != boost::graph_traits::null_face()); - vertex_descriptor vd0 = source(halfedge(fd, tm), tm); vertex_descriptor vd1 = target(halfedge(fd, tm), tm); vertex_descriptor vd2 = target(next(halfedge(fd, tm), tm), tm); @@ -1288,10 +1287,9 @@ locate_in_common_face(std::pair::face else if(const halfedge_descriptor* hd_ptr = boost::get(&dv)) { const halfedge_descriptor hd = *hd_ptr; - face_descriptor fd = face(hd, tm); - - if(fd != boost::graph_traits::null_face()) + if(!is_border(hd, tm)) { + face_descriptor fd = face(hd, tm); query_location = locate_in_face(query, fd, tm, np); internal::snap_location_to_border(query_location, tm, tolerance); // @tmp keep or not ? is_query_location_in_face = is_in_face(query_location, tm); @@ -1299,7 +1297,7 @@ locate_in_common_face(std::pair::face if(!is_query_location_in_face) { - fd = face(opposite(hd, tm), tm); + face_descriptor fd = face(opposite(hd, tm), tm); query_location = locate_in_face(query, fd, tm, np); is_query_location_in_face = is_in_face(query_location, tm); } @@ -1307,7 +1305,6 @@ locate_in_common_face(std::pair::face else { const face_descriptor fd = boost::get(dv); - CGAL_precondition(fd != boost::graph_traits::null_face()); query_location = locate_in_face(query, fd, tm, np); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h index 3141f2d2128..2340993b99d 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h @@ -112,7 +112,7 @@ edge_length(typename boost::graph_traits::halfedge_descriptor h, using parameters::choose_parameter; using parameters::get_parameter; - CGAL_precondition(boost::graph_traits::null_halfedge() != h); + CGAL_precondition(is_valid_halfedge_descriptor(h, pmesh)); typename GetVertexPointMap::const_type vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), @@ -132,6 +132,8 @@ edge_length(typename boost::graph_traits::edge_descriptor e, const PolygonMesh& pmesh, const NamedParameters& np = parameters::default_values()) { + CGAL_precondition(is_valid_edge_descriptor(e, pmesh)); + return edge_length(halfedge(e, pmesh), pmesh, np); } @@ -187,7 +189,7 @@ squared_edge_length(typename boost::graph_traits::halfedge_descript using parameters::choose_parameter; using parameters::get_parameter; - CGAL_precondition(boost::graph_traits::null_halfedge() != h); + CGAL_precondition(is_valid_halfedge_descriptor(h, pmesh)); typename GetVertexPointMap::const_type vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), @@ -208,6 +210,8 @@ squared_edge_length(typename boost::graph_traits::edge_descriptor e const PolygonMesh& pmesh, const NamedParameters& np = parameters::default_values()) { + CGAL_precondition(is_valid_edge_descriptor(e, pmesh)); + return squared_edge_length(halfedge(e, pmesh), pmesh, np); } @@ -415,7 +419,7 @@ face_area(typename boost::graph_traits::face_descriptor f, typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - CGAL_precondition(boost::graph_traits::null_face() != f); + CGAL_precondition(is_valid_face_descriptor(f, tmesh)); typename GetVertexPointMap::const_type vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), @@ -486,7 +490,7 @@ squared_face_area(typename boost::graph_traits::face_descriptor f, typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - CGAL_precondition(boost::graph_traits::null_face() != f); + CGAL_precondition(is_valid_face_descriptor(f, tmesh)); typename GetVertexPointMap::const_type vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), @@ -741,7 +745,7 @@ face_aspect_ratio(typename boost::graph_traits::face_descriptor f, const TriangleMesh& tmesh, const CGAL_NP_CLASS& np = parameters::default_values()) { - CGAL_precondition(f != boost::graph_traits::null_face()); + CGAL_precondition(is_valid_face_descriptor(f, tmesh)); CGAL_precondition(is_triangle(halfedge(f, tmesh), tmesh)); typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/merge_border_vertices.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/merge_border_vertices.h index 50b87830d8b..2bcd6f06ad0 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/merge_border_vertices.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/merge_border_vertices.h @@ -292,6 +292,8 @@ void merge_duplicated_vertices_in_boundary_cycle(typename boost::graph_traits::face_descriptor fd = - CGAL::Euler::add_face(vr, pmesh); - CGAL_assertion(fd != boost::graph_traits::null_face()); + typename boost::graph_traits::face_descriptor fd = CGAL::Euler::add_face(vr, pmesh); + CGAL_postcondition(is_valid_face_descriptor(fd, pmesh)); *i2f++ = std::make_pair(i, fd); } } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h index 6eedd767f62..90fd92adca4 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h @@ -1390,7 +1390,6 @@ bool remove_degenerate_edges(const EdgeRange& edge_range, typedef typename GetGeomTraits::type Traits; - std::size_t nb_deg_faces = 0; bool all_removed = false; bool some_removed = true; bool preserve_genus = choose_parameter(get_parameter(np, internal_np::preserve_genus), true); @@ -1425,7 +1424,6 @@ bool remove_degenerate_edges(const EdgeRange& edge_range, // remove edges that could also be set for removal if(face(h, tmesh) != GT::null_face()) { - ++nb_deg_faces; const edge_descriptor prev_e = edge(prev(h, tmesh), tmesh); degenerate_edges_to_remove.erase(prev_e); local_edge_range.erase(prev_e); @@ -1434,7 +1432,6 @@ bool remove_degenerate_edges(const EdgeRange& edge_range, if(face(opposite(h, tmesh), tmesh) != GT::null_face()) { - ++nb_deg_faces; const edge_descriptor prev_opp_e = edge(prev(opposite(h, tmesh), tmesh), tmesh); degenerate_edges_to_remove.erase(prev_opp_e); local_edge_range.erase(prev_opp_e); @@ -1473,7 +1470,6 @@ bool remove_degenerate_edges(const EdgeRange& edge_range, // remove edges that could also be set for removal if(face(h, tmesh) != GT::null_face()) { - ++nb_deg_faces; const edge_descriptor prev_e = edge(prev(h, tmesh), tmesh); degenerate_edges_to_remove.erase(prev_e); local_edge_range.erase(prev_e); @@ -1482,7 +1478,6 @@ bool remove_degenerate_edges(const EdgeRange& edge_range, if(face(opposite(h, tmesh), tmesh)!=GT::null_face()) { - ++nb_deg_faces; const edge_descriptor prev_opp_e = edge(prev(opposite(h, tmesh), tmesh), tmesh); degenerate_edges_to_remove.erase(prev_opp_e); local_edge_range.erase(prev_opp_e); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h index bee807468a2..e7cd58b3145 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_self_intersections.h @@ -251,7 +251,6 @@ FaceOutputIterator replace_faces_with_patch(const std::vector::null_face(); @@ -1581,7 +1579,6 @@ bool fill_hole_with_constraints(std::vector visited_faces; std::vector > patch; - int cc_counter = 0; for(face_descriptor f : cc_faces) { if(!visited_faces.insert(f).second) // already visited that face @@ -1593,7 +1590,6 @@ bool fill_hole_with_constraints(std::vector::edge_descript using parameters::get_parameter; using parameters::choose_parameter; + CGAL_precondition(is_valid_edge_descriptor(e, pm)); + typedef typename GetVertexPointMap::const_type VertexPointMap; VertexPointMap vpmap = choose_parameter(get_parameter(np, internal_np::vertex_point), get_const_property_map(vertex_point, pm)); @@ -190,11 +192,12 @@ bool is_degenerate_triangle_face(typename boost::graph_traits::fac const TriangleMesh& tm, const NamedParameters& np = parameters::default_values()) { - CGAL_precondition(CGAL::is_triangle(halfedge(f, tm), tm)); - using parameters::get_parameter; using parameters::choose_parameter; + CGAL_precondition(is_valid_face_descriptor(f, tm)); + CGAL_precondition(CGAL::is_triangle(halfedge(f, tm), tm)); + typedef typename GetVertexPointMap::const_type VertexPointMap; VertexPointMap vpmap = choose_parameter(get_parameter(np, internal_np::vertex_point), get_const_property_map(vertex_point, tm)); @@ -396,14 +399,14 @@ is_needle_triangle_face(typename boost::graph_traits::face_descrip const double threshold, const NamedParameters& np = parameters::default_values()) { - CGAL_precondition(threshold >= 1.); - CGAL_precondition(f != boost::graph_traits::null_face()); - CGAL_precondition(CGAL::is_triangle(halfedge(f, tm), tm)); + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; using parameters::get_parameter; using parameters::choose_parameter; - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + CGAL_precondition(is_valid_face_descriptor(f, tm)); + CGAL_precondition(CGAL::is_triangle(halfedge(f, tm), tm)); + CGAL_precondition(threshold >= 1.); typedef typename GetVertexPointMap::const_type VertexPointMap; VertexPointMap vpmap = choose_parameter(get_parameter(np, internal_np::vertex_point), @@ -545,15 +548,15 @@ is_cap_triangle_face(typename boost::graph_traits::face_descriptor const double threshold, const NamedParameters& np = parameters::default_values()) { - CGAL_precondition(f != boost::graph_traits::null_face()); - CGAL_precondition(CGAL::is_triangle(halfedge(f, tm), tm)); - CGAL_precondition(threshold >= -1.); - CGAL_precondition(threshold <= 0.); + typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; using parameters::get_parameter; using parameters::choose_parameter; - typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; + CGAL_precondition(is_valid_face_descriptor(f, tm)); + CGAL_precondition(CGAL::is_triangle(halfedge(f, tm), tm)); + CGAL_precondition(threshold >= -1.); + CGAL_precondition(threshold <= 0.); typedef typename GetVertexPointMap::const_type VertexPointMap; VertexPointMap vpmap = choose_parameter(get_parameter(np, internal_np::vertex_point), diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h index 9cb67d0cb4e..8f868eec20d 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h @@ -1063,7 +1063,7 @@ std::size_t stitch_boundary_cycle(const typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename std::pair halfedges_pair; - CGAL_precondition(h != boost::graph_traits::null_halfedge()); + CGAL_precondition(is_valid_halfedge_descriptor(h, pmesh)); CGAL_precondition(is_border(h, pmesh)); CGAL_precondition(is_valid(pmesh)); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangle.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangle.h index 78152388107..2a99d78fe00 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangle.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangle.h @@ -66,6 +66,8 @@ triangle(typename boost::graph_traits::face_descriptor fd, using CGAL::parameters::choose_parameter; using CGAL::parameters::get_parameter; + CGAL_precondition(is_valid_face_descriptor(fd, tmesh)); + typename GetVertexPointMap::const_type vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), get_const_property_map(CGAL::vertex_point, tmesh)); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h index 8b8cec2e239..2a268e7844c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h @@ -474,6 +474,8 @@ bool triangulate_face(typename boost::graph_traits::face_descriptor using parameters::choose_parameter; using parameters::get_parameter; + CGAL_precondition(is_valid_face_descriptor(f, pmesh)); + //VertexPointMap typedef typename GetVertexPointMap::type VPMap; VPMap vpmap = choose_parameter(get_parameter(np, internal_np::vertex_point), diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_hole.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_hole.h index 55dcacfff7f..f246500b49a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_hole.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_hole.h @@ -468,6 +468,8 @@ namespace Polygon_mesh_processing { using parameters::choose_parameter; using parameters::get_parameter_reference; + CGAL_precondition(is_valid_halfedge_descriptor(border_halfedge, pmesh)); + std::vector::vertex_descriptor> patch; face_out = triangulate_and_refine_hole (pmesh, border_halfedge, face_out, std::back_inserter(patch), np).first; diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/data-coref/floating_squares.off b/Polygon_mesh_processing/test/Polygon_mesh_processing/data-coref/floating_squares.off new file mode 100644 index 00000000000..86709d5e8ac --- /dev/null +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/data-coref/floating_squares.off @@ -0,0 +1,16 @@ +OFF +8 4 0 + +0 0 1 +1 0 1 +1 1 1 +0 1 1 +0 0 0 +1 0 0 +1 1 0 +0 1 0 +3 0 1 2 +3 2 3 0 +3 6 5 4 +3 4 7 6 + diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/data-coref/hexa.off b/Polygon_mesh_processing/test/Polygon_mesh_processing/data-coref/hexa.off new file mode 100644 index 00000000000..4bbb30354ec --- /dev/null +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/data-coref/hexa.off @@ -0,0 +1,24 @@ +OFF +8 12 0 + +0.75 0.75 -1 +0.25 0.75 -1 +0.25 0.25 -1 +0.75 0.25 -1 +0.75 0.25 1 +0.75 0.75 1 +0.25 0.75 1 +0.25 0.25 1 +3 4 5 6 +3 0 3 2 +3 1 2 7 +3 0 1 6 +3 3 0 5 +3 2 3 4 +3 6 7 4 +3 2 1 0 +3 7 6 1 +3 6 5 0 +3 5 4 3 +3 4 7 2 + diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/pmp_do_intersect_test.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/pmp_do_intersect_test.cpp index 93bdd0fbd01..e0696004418 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/pmp_do_intersect_test.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/pmp_do_intersect_test.cpp @@ -39,10 +39,8 @@ template int load_polylines(std::ifstream& input, std::vector >& points) { - int counter = 0; std::size_t n; while(input >> n) { - ++counter; std::vector new_polyline; points.push_back(new_polyline); std::vector&polyline = points.back(); diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cmd b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cmd index 99d70e20728..c11009e6559 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cmd +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_bool_op.cmd @@ -1,2 +1,3 @@ ${CGAL_DATA_DIR}/meshes/elephant.off ${CGAL_DATA_DIR}/meshes/sphere.off ALL 1 1 1 1 ${CGAL_DATA_DIR}/meshes/open_cube.off data-coref/incompatible_with_open_cube.off ALL 0 0 0 0 +data-coref/floating_squares.off data-coref/hexa.off ALL 1 1 1 1 diff --git a/Polyhedron/demo/Polyhedron/C3t3_type.h b/Polyhedron/demo/Polyhedron/C3t3_type.h index d666f6546b5..fe815264335 100644 --- a/Polyhedron/demo/Polyhedron/C3t3_type.h +++ b/Polyhedron/demo/Polyhedron/C3t3_type.h @@ -3,10 +3,7 @@ #include "config.h" #include "Plugins/Mesh_3/config_mesh_3.h" - -// include this to get #define BOOST_PARAMETER_MAX_ARITY 12 // as otherwise it gets set via inclusion of Polyhedron_3.h -#include #include #include "SMesh_type.h" diff --git a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Scene_movable_sm_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Scene_movable_sm_item.cpp index 4fd2bad9af2..96051a607c4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Scene_movable_sm_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Scene_movable_sm_item.cpp @@ -203,7 +203,7 @@ void Scene_movable_sm_item::invalidateOpenGLBuffers() CGAL::Three::Scene_item::ManipulatedFrame* Scene_movable_sm_item::manipulatedFrame() { return d->frame; } const CGAL::qglviewer::Vec& Scene_movable_sm_item::center() const { return d->center_; } Scene_movable_sm_item::~Scene_movable_sm_item() { delete d; Q_EMIT killed(); } -void Scene_movable_sm_item::setFMatrix(const GLdouble matrix[]) +void Scene_movable_sm_item::setFMatrix(const GLdouble matrix[16]) { for (int i=0; i<16; ++i) d->f_matrix.data()[i] = (float)matrix[i]; diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp index 999a81bc2cf..e35576fc98f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp @@ -60,12 +60,10 @@ #include #include #include -#include #include #include #include #include -#include #include #include 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 4361cd11e7c..f289245a996 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,6 @@ // 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 12 #include @@ -326,7 +325,7 @@ private: ltime.restart(); std::cout << " Running lloyd_optimize_mesh_2..." << std::flush; CGAL::lloyd_optimize_mesh_2(cdt, - CGAL::parameters::max_iteration_number = nb_iter); + CGAL::parameters::number_of_iterations(nb_iter)); std::cout << " done (" << ltime.elapsed() << " ms)" << std::endl; } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp index 7e3c14a54cd..7a889e4da14 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp @@ -337,9 +337,9 @@ struct Fake_CDT_3_cell_base : public Cb int constrained_facet[4]; bool _restoring[6]; int to_edge_index( int li, int lj ) const { - CGAL_triangulation_precondition( li >= 0 && li < 4 ); - CGAL_triangulation_precondition( lj >= 0 && lj < 4 ); - CGAL_triangulation_precondition( li != lj ); + CGAL_precondition( li >= 0 && li < 4 ); + CGAL_precondition( lj >= 0 && lj < 4 ); + CGAL_precondition( li != lj ); return ( li==0 || lj==0 ) ? li+lj-1 : li+lj; } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp index 72ef02c7c4c..f74562e6e58 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp @@ -65,7 +65,9 @@ #include #include #include +#include #endif + #include // Covariant return types don't work for scalar types and we cannot @@ -978,7 +980,8 @@ private Q_SLOTS: QString Io_image_plugin::nameFilters() const { return QString("Inrimage files (*.inr *.inr.gz) ;; " "Analyze files (*.hdr *.img *img.gz) ;; " - "Stanford Exploration Project files (*.H *.HH)"); + "Stanford Exploration Project files (*.H *.HH) ;; " + "NRRD image files (*.nrrd)"); } @@ -1011,7 +1014,33 @@ Io_image_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_scene) ok = true; QApplication::restoreOverrideCursor(); Image* image = new Image; - if(fileinfo.suffix() != "H" && fileinfo.suffix() != "HH" && + + //read a nrrd file + if (fileinfo.suffix() == "nrrd") + { +#ifdef CGAL_USE_VTK + vtkNew reader; + reader->SetFileName(fileinfo.filePath().toUtf8()); + reader->Update(); + auto vtk_image = reader->GetOutput(); + vtk_image->Print(std::cerr); + *image = CGAL::IO::read_vtk_image_data(vtk_image); // copy the image data +#else + CGAL::Three::Three::warning("You need VTK to read a NRRD file"); + delete image; + return QList(); +#endif + } + + //read a sep file + else if (fileinfo.suffix() == "H" || fileinfo.suffix() == "HH") + { + CGAL::SEP_to_ImageIO reader(fileinfo.filePath().toUtf8().data()); + *image = *reader.cgal_image(); + is_gray = true; + } + + else if(fileinfo.suffix() != "H" && fileinfo.suffix() != "HH" && !image->read(fileinfo.filePath().toUtf8())) { QMessageBox qmb(QMessageBox::NoIcon, @@ -1100,13 +1129,7 @@ Io_image_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_scene) return QList(); } } - //read a sep file - else if(fileinfo.suffix() == "H" || fileinfo.suffix() == "HH") - { - CGAL::SEP_to_ImageIO reader(fileinfo.filePath().toUtf8().data()); - *image = *reader.cgal_image(); - is_gray = true; - } + // Get display precision QDialog dialog; ui.setupUi(&dialog); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp index 6aa0571c8b9..ac61fa258e9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp @@ -374,27 +374,6 @@ boost::optional Mesh_3_plugin::get_items_or_return_error_string() const auto& image_item = image_mesh_items->image_item; item = image_item; features_protection_available = true; - - bool fit_wrdtp = true; - std::size_t img_wdim = image_item->image()->image()->wdim; - WORD_KIND img_wordKind = image_item->image()->image()->wordKind; - // check if the word type fits the hardcoded values in the plugin - if (image_item->isGray()) { - if (img_wordKind != WK_FLOAT) - fit_wrdtp = false; - else if (img_wdim != 4) - fit_wrdtp = false; - } else { - if (img_wordKind != WK_FIXED) - fit_wrdtp = false; - else if (img_wdim != 1) - fit_wrdtp = false; - } - if (!fit_wrdtp) { - return tr( - "Selected object can't be meshed because the image's word type is " - "not supported by this plugin."); - } } # endif diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp index fecc73c41ea..c4f59578610 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp @@ -248,7 +248,7 @@ Meshing_thread* cgal_code_mesh_3(const Implicit_function_interface* pfunction, pfunction->bbox().zmax()); namespace p = CGAL::parameters; Function_mesh_domain* p_domain = - new Function_mesh_domain(Function_wrapper(*pfunction), domain_bbox, 1e-7, + new Function_mesh_domain(p::function = Function_wrapper(*pfunction), p::bounding_object = domain_bbox, p::relative_error_bound = 1e-7, p::construct_surface_patch_index = [](int i, int j) { return (i * 1000 + j); } ); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h index d5249e256b9..8a7c309017c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h @@ -226,13 +226,13 @@ initialize(const Mesh_criteria& criteria, Mesh_fnt::Domain_tag) C3t3, Domain, Mesh_criteria, - CGAL::Mesh_3::internal::has_Has_features::value >() + CGAL::internal::has_Has_features::value >() (c3t3_, *domain_, criteria, p_.protect_features, p::mesh_3_options(p::pointer_to_stop_atomic_boolean = &stop_, - p::nonlinear_growth_of_balls = true)); + p::nonlinear_growth_of_balls = true).v); } template < typename D_, typename Tag > diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin_cgal_code.cpp b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin_cgal_code.cpp index 627afb7577b..0ceb091a78a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin_cgal_code.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin_cgal_code.cpp @@ -171,7 +171,7 @@ Optimizer_thread* cgal_code_optimization(Scene_c3t3_item& c3t3_item, p_function->bbox().zmax()); Function_mesh_domain* p_domain = - new Function_mesh_domain(Function_wrapper(*p_function), dom_bbox, 1e-7, + new Function_mesh_domain(CGAL::parameters::function = Function_wrapper(*p_function), CGAL::parameters::bounding_object = dom_bbox, CGAL::parameters::relative_error_bound = 1e-7, CGAL::parameters::construct_surface_patch_index = [](int i, int j) { return (i * 1000 + j); } ); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/config_mesh_3.h b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/config_mesh_3.h index 50aa90773b8..482e1f323fc 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/config_mesh_3.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/config_mesh_3.h @@ -1,8 +1,6 @@ #ifndef CGAL_DEMO_MESH_3_CONFIG_H #define CGAL_DEMO_MESH_3_CONFIG_H -#define BOOST_PARAMETER_MAX_ARITY 12 - // CGAL_MESH_3_PROTECTION_DEBUG: // - 1 : display debug messages // - 2 : dump file `polylines_graph.polylines.txt` and diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_widget.ui b/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_widget.ui index 5d276e0149d..5592bbbde5a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_widget.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_widget.ui @@ -934,7 +934,7 @@ QGroupBox::title { - 0 0 0 1 1 1 + 0 0 0 1 1 0 diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp index a806f73e76f..1cae60b9a70 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp @@ -299,12 +299,10 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionSnapBorders_triggered() std::vector remaining_cycles; CGAL::Polygon_mesh_processing::extract_boundary_cycles(tm, std::back_inserter(remaining_cycles)); - int tested=0, done=0; for (halfedge_descriptor hc : remaining_cycles) { if (next(next(hc,tm),tm)==prev(hc,tm)) { - ++tested; //get smallest halfedge halfedge_descriptor hm = hc; double min_l = CGAL::Polygon_mesh_processing::edge_length(hc, tm); @@ -335,7 +333,6 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionSnapBorders_triggered() std::array vr = { source(hm, tm), target(hm, tm), target(next(hm, tm), tm) }; CGAL::Euler::add_face(vr, tm); CGAL::Euler::collapse_edge(edge(hm, tm), tm); - ++done; } } } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp index c2150d90688..92568b3e193 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp @@ -753,7 +753,6 @@ public Q_SLOTS: return; } std::unordered_map is_selected_map; - int index = 0; for(fg_face_descriptor fh : faces(*selection_item->polyhedron())) { if(selection_item->selected_facets.find(fh) @@ -763,7 +762,6 @@ public Q_SLOTS: { is_selected_map[fh]=true; } - ++index; } CGAL::expand_face_selection_for_removal(selection_item->selected_facets, *selection_item->polyhedron(), diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp index 2f0c22a1d97..860cc2d66e9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp @@ -286,8 +286,8 @@ SMesh* cgal_off_meshing(QWidget*, Mesh_domain domain = Mesh_domain::create_implicit_mesh_domain - (offset_function(tm_ptr, offset_value), - Sphere_3(center, sqrad), + (p::function = offset_function(tm_ptr, offset_value), + p::bounding_object = Sphere_3(center, sqrad), p::relative_error_bound = 1e-7, p::construct_surface_patch_index = [](int i, int j) { return (i * 1000 + j); }); diff --git a/Polyhedron/demo/Polyhedron/Scene_nef_polyhedron_item.cpp b/Polyhedron/demo/Polyhedron/Scene_nef_polyhedron_item.cpp index 27ec846f35c..4e2294cdaa6 100644 --- a/Polyhedron/demo/Polyhedron/Scene_nef_polyhedron_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_nef_polyhedron_item.cpp @@ -189,7 +189,6 @@ Scene_nef_polyhedron_item_priv::mark_domains(CDT& ct, void Scene_nef_polyhedron_item_priv::compute_normals_and_vertices(void) const { QApplication::setOverrideCursor(Qt::WaitCursor); - int count = 0; positions_facets.resize(0); positions_points.resize(0); normals.resize(0); @@ -205,7 +204,6 @@ void Scene_nef_polyhedron_item_priv::compute_normals_and_vertices(void) const { if(f->is_twin()) continue; bool incident_volume_marked = f->incident_volume()->mark(); - count++; Nef_polyhedron::Vector_3 v = (incident_volume_marked? -1:1) * f->plane().orthogonal_vector(); P_traits cdt_traits(v); CDT cdt(cdt_traits); diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp index 8c093d7675f..ea21767f2da 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp @@ -461,7 +461,6 @@ void Scene_polyhedron_selection_item_priv::compute_temp_elements()const const CGAL::qglviewer::Vec offset = Three::mainViewer()->offset(); color_fixed_points.clear(); positions_fixed_points.clear(); - int i=0; constVPmap vpm = get(CGAL::vertex_point,*polyhedron()); @@ -487,7 +486,6 @@ void Scene_polyhedron_selection_item_priv::compute_temp_elements()const color_fixed_points.push_back(0.0); color_fixed_points.push_back(0.0); } - i++; } } @@ -509,10 +507,10 @@ void Scene_polyhedron_selection_item_priv::compute_temp_elements()const positions_temp_points.data(), static_cast(positions_temp_points.size()*sizeof(float))); -item->getPointContainer(Fixed_points)->allocate( - Pc::Vertices, - positions_fixed_points.data(), - static_cast(positions_fixed_points.size()*sizeof(float))); + item->getPointContainer(Fixed_points)->allocate( + Pc::Vertices, + positions_fixed_points.data(), + static_cast(positions_fixed_points.size()*sizeof(float))); item->getPointContainer(Fixed_points)->allocate( Pc::Colors, diff --git a/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp b/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp index 7dfc1825da6..966acaf34e4 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp @@ -602,12 +602,11 @@ void Scene_polylines_item::split_at_sharp_angles() typedef Polyline Bare_polyline; Polylines_container& bare_polylines = polylines; - int counter = 0; for(Bare_polyline_container::iterator bare_polyline_it = bare_polylines.begin(); bare_polyline_it != bare_polylines.end(); // the end changes - // during the loop - ++counter /* bare_polyline_it is incremented in the loop */) + // during the loop + /* bare_polyline_it is incremented in the loop */) { Bare_polyline_container::iterator current_polyline_it = bare_polyline_it; diff --git a/Polyhedron/demo/Polyhedron/Viewer.h b/Polyhedron/demo/Polyhedron/Viewer.h index 40af99fc098..357e8d52ec5 100644 --- a/Polyhedron/demo/Polyhedron/Viewer.h +++ b/Polyhedron/demo/Polyhedron/Viewer.h @@ -84,7 +84,7 @@ public: TextRenderer* textRenderer() Q_DECL_OVERRIDE; - void enableClippingBox(QVector4D box[]) Q_DECL_OVERRIDE; + void enableClippingBox(QVector4D box[6]) Q_DECL_OVERRIDE; void disableClippingBox() Q_DECL_OVERRIDE; void set2DSelectionMode(bool) Q_DECL_OVERRIDE; void setStaticImage(QImage image) Q_DECL_OVERRIDE; diff --git a/Polyhedron/include/CGAL/Polyhedron_3.h b/Polyhedron/include/CGAL/Polyhedron_3.h index 6505e960139..255bb786289 100644 --- a/Polyhedron/include/CGAL/Polyhedron_3.h +++ b/Polyhedron/include/CGAL/Polyhedron_3.h @@ -855,6 +855,10 @@ public: Facet_iterator facets_end() { return hds_.faces_end();} + // added for convenience + Facet_iterator faces_begin() { return hds_.faces_begin();} + Facet_iterator faces_end() { return hds_.faces_end();} + Facet_handles facet_handles() { return make_prevent_deref_range(facets_begin(), facets_end()); } @@ -886,6 +890,10 @@ public: Facet_const_iterator facets_begin() const { return hds_.faces_begin();} Facet_const_iterator facets_end() const { return hds_.faces_end();} + // added for convenience + Facet_const_iterator faces_begin() const { return hds_.faces_begin();} + Facet_const_iterator faces_end() const { return hds_.faces_end();} + Facet_const_handles facet_handles() const { return make_prevent_deref_range(facets_begin(), facets_end()); } diff --git a/Polytope_distance_d/doc/Polytope_distance_d/PackageDescription.txt b/Polytope_distance_d/doc/Polytope_distance_d/PackageDescription.txt index 0b4088ce277..aaecb2b37da 100644 --- a/Polytope_distance_d/doc/Polytope_distance_d/PackageDescription.txt +++ b/Polytope_distance_d/doc/Polytope_distance_d/PackageDescription.txt @@ -19,17 +19,12 @@ \cgalPkgShortInfoEnd \cgalPkgDescriptionEnd -\cgalCRPSection{Assertions} -The optimization code uses infix `OPTIMISATION` in the assertions, -e.g. defining the compiler flag -`CGAL_OPTIMISATION_NO_PRECONDITIONS` switches precondition -checking off, cf. Section \ref secchecks. \cgalClassifedRefPages \cgalCRPSection{All Furthest Neighbors} -- `CGAL::all_furthest_neighbors_2` +- `CGAL::all_furthest_neighbors_2()` - `AllFurthestNeighborsTraits_2` \cgalCRPSection{Width} @@ -48,4 +43,3 @@ checking off, cf. Section \ref secchecks. */ - diff --git a/Polytope_distance_d/include/CGAL/Polytope_distance_d.h b/Polytope_distance_d/include/CGAL/Polytope_distance_d.h index ede3b47aa92..e58d94539f9 100644 --- a/Polytope_distance_d/include/CGAL/Polytope_distance_d.h +++ b/Polytope_distance_d/include/CGAL/Polytope_distance_d.h @@ -473,7 +473,7 @@ public: // NOTE: an implicit conversion from ET to RT must be available! Point realizing_point_p( ) const - { CGAL_optimisation_precondition( is_finite()); + { CGAL_precondition( is_finite()); return tco.construct_point_d_object() ( ambient_dimension(), realizing_point_p_coordinates_begin(), @@ -481,7 +481,7 @@ public: Point realizing_point_q( ) const - { CGAL_optimisation_precondition( is_finite()); + { CGAL_precondition( is_finite()); return tco.construct_point_d_object() ( ambient_dimension(), realizing_point_q_coordinates_begin(), @@ -512,7 +512,7 @@ public: std::copy( p_first, p_last, std::back_inserter( p_points)); std::copy( q_first, q_last, std::back_inserter( q_points)); set_dimension(); - CGAL_optimisation_precondition_msg + CGAL_precondition_msg (check_dimension( p_points.begin(), p_points.end()) && check_dimension( q_points.begin(), q_points.end()), "Not all points have the same dimension."); @@ -527,7 +527,7 @@ public: p_points.clear(); std::copy( p_first, p_last, std::back_inserter( p_points)); set_dimension(); - CGAL_optimisation_precondition_msg + CGAL_precondition_msg (check_dimension( p_points.begin(), p_points.end()), "Not all points have the same dimension."); @@ -541,7 +541,7 @@ public: q_points.clear(); std::copy( q_first, q_last, std::back_inserter( q_points)); set_dimension(); - CGAL_optimisation_precondition_msg + CGAL_precondition_msg (check_dimension( q_points.begin(), q_points.end()), "Not all points have the same dimension."); @@ -551,7 +551,7 @@ public: void insert_p( const Point& p) { - CGAL_optimisation_precondition + CGAL_precondition ( ( ! is_finite()) || ( tco.access_dimension_d_object()( p) == d)); p_points.push_back( p); @@ -562,7 +562,7 @@ public: void insert_q( const Point& q) { - CGAL_optimisation_precondition + CGAL_precondition ( ( ! is_finite()) || ( tco.access_dimension_d_object()( q) == d)); q_points.push_back( q); @@ -575,12 +575,12 @@ public: insert( InputIterator1 p_first, InputIterator1 p_last, InputIterator2 q_first, InputIterator2 q_last) { - CGAL_optimisation_precondition_code(int old_r = static_cast(p_points.size())); - CGAL_optimisation_precondition_code(int old_s = static_cast(q_points.size())); + CGAL_precondition_code(int old_r = static_cast(p_points.size())); + CGAL_precondition_code(int old_s = static_cast(q_points.size())); p_points.insert( p_points.end(), p_first, p_last); q_points.insert( q_points.end(), q_first, q_last); set_dimension(); - CGAL_optimisation_precondition_msg + CGAL_precondition_msg (check_dimension( p_points.begin()+old_r, p_points.end()) && check_dimension( q_points.begin()+old_s, q_points.end()), "Not all points have the same dimension."); @@ -591,10 +591,10 @@ public: void insert_p( InputIterator p_first, InputIterator p_last) { - CGAL_optimisation_precondition_code(int old_r = static_cast(p_points.size())); + CGAL_precondition_code(int old_r = static_cast(p_points.size())); p_points.insert( p_points.end(), p_first, p_last); set_dimension(); - CGAL_optimisation_precondition_msg + CGAL_precondition_msg (check_dimension( p_points.begin()+old_r, p_points.end()), "Not all points have the same dimension."); compute_distance(); @@ -604,10 +604,10 @@ public: void insert_q( InputIterator q_first, InputIterator q_last) { - CGAL_optimisation_precondition_code( int old_s = static_cast(q_points.size())); + CGAL_precondition_code( int old_s = static_cast(q_points.size())); q_points.insert( q_points.end(), q_first, q_last); set_dimension(); - CGAL_optimisation_precondition_msg + CGAL_precondition_msg (check_dimension( q_points.begin()+old_s, q_points.end()), "Not all points have the same dimension."); compute_distance(); @@ -681,7 +681,7 @@ private: // construct program int n = 2 * d + static_cast(p_points.size() + q_points.size()); int m = d + 2; - CGAL_optimisation_precondition (p_points.size() > 0); + CGAL_precondition (p_points.size() > 0); QP qp (n, m, A_iterator (boost::counting_iterator(0), @@ -696,7 +696,7 @@ private: Quadratic_program_options options; options.set_pricing_strategy(pricing_strategy(NT())); solver = new Solver(qp, options); - CGAL_optimisation_assertion(solver->status() == QP_OPTIMAL); + CGAL_assertion(solver->status() == QP_OPTIMAL); // compute support and realizing points ET et_0 = 0; int r = static_cast(p_points.size()); @@ -773,8 +773,8 @@ is_valid( bool verbose, int level) const // compute normal vector ET_vector normal( d), diff( d); ET et_0 = 0, den = p_coords[d]; - CGAL_optimisation_assertion (den > et_0); - CGAL_optimisation_assertion (den == q_coords[d]); + CGAL_assertion (den > et_0); + CGAL_assertion (den == q_coords[d]); int i, j; for ( j = 0; j < d; ++j) normal[ j] = p_coords[ j] - q_coords[ j]; @@ -917,7 +917,7 @@ operator << ( std::ostream& os, break; default: - CGAL_optimisation_assertion_msg( false, + CGAL_assertion_msg( false, "CGAL::IO::get_mode( os) invalid!"); break; } diff --git a/Polytope_distance_d/include/CGAL/all_furthest_neighbors_2.h b/Polytope_distance_d/include/CGAL/all_furthest_neighbors_2.h index d2927f43d6b..4c2b6ae4039 100644 --- a/Polytope_distance_d/include/CGAL/all_furthest_neighbors_2.h +++ b/Polytope_distance_d/include/CGAL/all_furthest_neighbors_2.h @@ -16,7 +16,7 @@ #include -#include +#include #include #include #include @@ -53,8 +53,8 @@ public: Value operator()( int r, int c) const { - CGAL_optimisation_precondition(r >= 0 && r < number_of_rows()); - CGAL_optimisation_precondition(c >= 0 && c < number_of_columns()); + CGAL_precondition(r >= 0 && r < number_of_rows()); + CGAL_precondition(c >= 0 && c < number_of_columns()); if (c <= r) return Value(c - r); else if (c >= r + number_of_rows()) @@ -93,8 +93,8 @@ all_furthest_neighbors_2( RandomAccessIC points_begin, // check preconditions: int number_of_points( static_cast(iterator_distance( points_begin, points_end))); - CGAL_optimisation_precondition( number_of_points > 0); - CGAL_optimisation_expensive_precondition( + CGAL_precondition( number_of_points > 0); + CGAL_expensive_precondition( is_convex_2( points_begin, points_end, t)); // prepare random access container: @@ -125,7 +125,7 @@ all_furthest_neighbors_2( RandomAccessIC points_begin, RandomAccessIC points_end, OutputIterator o, const Traits& - CGAL_optimisation_expensive_precondition_code(t), + CGAL_expensive_precondition_code(t), std::random_access_iterator_tag) { typedef All_furthest_neighbor_matrix< @@ -135,8 +135,8 @@ all_furthest_neighbors_2( RandomAccessIC points_begin, // check preconditions: int number_of_points( static_cast(iterator_distance( points_begin, points_end))); - CGAL_optimisation_precondition( number_of_points > 0); - CGAL_optimisation_expensive_precondition( + CGAL_precondition( number_of_points > 0); + CGAL_expensive_precondition( is_convex_2( points_begin, points_end, t)); // compute maxima: diff --git a/SMDS_3/include/CGAL/SMDS_3/internal/indices_management.h b/SMDS_3/include/CGAL/SMDS_3/internal/indices_management.h index c5e450289a1..0e4e8901ce5 100644 --- a/SMDS_3/include/CGAL/SMDS_3/internal/indices_management.h +++ b/SMDS_3/include/CGAL/SMDS_3/internal/indices_management.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include @@ -52,7 +52,7 @@ struct Index_generator typedef Index type; }; -template ::value> +template ::value> struct Indices_tuple_generator { using type = std::tuple const T& get_index(const T& x) { return x; } template ::value> + bool has_feature = ::CGAL::internal::Has_features::value> struct Read_mesh_domain_index { // here we have has_feature==true @@ -180,7 +180,7 @@ struct Read_mesh_domain_index { // Read_mesh_domain_index template ::value> + bool has_feature = ::CGAL::internal::Has_features::value> struct Write_mesh_domain_index { // here we have has_feature==true diff --git a/SMDS_3/include/CGAL/Simplicial_mesh_cell_base_3.h b/SMDS_3/include/CGAL/Simplicial_mesh_cell_base_3.h index 15a4b1fd3eb..ee49f572236 100644 --- a/SMDS_3/include/CGAL/Simplicial_mesh_cell_base_3.h +++ b/SMDS_3/include/CGAL/Simplicial_mesh_cell_base_3.h @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -94,7 +93,7 @@ public: // ACCESS FUNCTIONS Vertex_handle vertex(int i) const { - CGAL_triangulation_precondition( i >= 0 && i <= 3 ); + CGAL_precondition( i >= 0 && i <= 3 ); return V[i]; } @@ -117,13 +116,13 @@ public: if (v == V[0]) { return 0; } if (v == V[1]) { return 1; } if (v == V[2]) { return 2; } - CGAL_triangulation_assertion( v == V[3] ); + CGAL_assertion( v == V[3] ); return 3; } Cell_handle neighbor(int i) const { - CGAL_triangulation_precondition( i >= 0 && i <= 3); + CGAL_precondition( i >= 0 && i <= 3); return N[i]; } @@ -146,15 +145,15 @@ public: if (n == N[0]) return 0; if (n == N[1]) return 1; if (n == N[2]) return 2; - CGAL_triangulation_assertion( n == N[3] ); + CGAL_assertion( n == N[3] ); return 3; } // SETTING void set_neighbor(int i, Cell_handle n) { - CGAL_triangulation_precondition( i >= 0 && i <= 3); - CGAL_triangulation_precondition( this != n.operator->() ); + CGAL_precondition( i >= 0 && i <= 3); + CGAL_precondition( this != n.operator->() ); N[i] = n; } @@ -166,10 +165,10 @@ public: void set_neighbors(Cell_handle n0, Cell_handle n1, Cell_handle n2, Cell_handle n3) { - CGAL_triangulation_precondition( this != n0.operator->() ); - CGAL_triangulation_precondition( this != n1.operator->() ); - CGAL_triangulation_precondition( this != n2.operator->() ); - CGAL_triangulation_precondition( this != n3.operator->() ); + CGAL_precondition( this != n0.operator->() ); + CGAL_precondition( this != n1.operator->() ); + CGAL_precondition( this != n2.operator->() ); + CGAL_precondition( this != n3.operator->() ); N[0] = n0; N[1] = n1; N[2] = n2; @@ -197,7 +196,7 @@ public: // but there's not much we can do for this now. void set_vertex(int i, Vertex_handle v) { - CGAL_triangulation_precondition( i >= 0 && i <= 3); + CGAL_precondition( i >= 0 && i <= 3); V[i] = v; } diff --git a/SMDS_3/test/SMDS_3/test_c3t3_extract_subdomains_boundaries.cpp b/SMDS_3/test/SMDS_3/test_c3t3_extract_subdomains_boundaries.cpp index 54c31079acf..851e8fe38c6 100644 --- a/SMDS_3/test/SMDS_3/test_c3t3_extract_subdomains_boundaries.cpp +++ b/SMDS_3/test/SMDS_3/test_c3t3_extract_subdomains_boundaries.cpp @@ -68,7 +68,7 @@ int main() v.push_back(f1); v.push_back(f2); // Domain (Warning: Sphere_3 constructor uses square radius !) - Mesh_domain domain(Function_wrapper(v), K::Sphere_3(CGAL::ORIGIN, 5.*5.), 1e-6); + Mesh_domain domain(CGAL::parameters::function = Function_wrapper(v), CGAL::parameters::bounding_object = K::Sphere_3(CGAL::ORIGIN, 5.*5.), relative_error_bound = 1e-6); // Set mesh criteria Facet_criteria facet_criteria(30, 0.2, 0.02); // angle, size, approximation diff --git a/STL_Extension/doc/STL_Extension/CGAL/Multiset.h b/STL_Extension/doc/STL_Extension/CGAL/Multiset.h index a892f2f7702..a81cabb29ea 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/Multiset.h +++ b/STL_Extension/doc/STL_Extension/CGAL/Multiset.h @@ -69,12 +69,6 @@ less-than operator (`operator<`). \tparam Allocator the allocator type. `CGAL_ALLOCATOR` is used by default. -\cgalHeading{Assertions} - -The assertion and precondition flags for the `Multiset` class -use `MULTISET` in their names (i.e., `CGAL_MULTISET_NO_ASSERTIONS` and -`CGAL_MULTISET_NO_PRECONDITIONS`). - \cgalHeading{Implementation} `Multiset` uses a proprietary implementation of a red-black tree diff --git a/STL_Extension/doc/STL_Extension/CGAL/algorithm.h b/STL_Extension/doc/STL_Extension/CGAL/algorithm.h index b78d9e5b10c..13fa64df19b 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/algorithm.h +++ b/STL_Extension/doc/STL_Extension/CGAL/algorithm.h @@ -2,32 +2,6 @@ /// \ingroup PkgSTLExtensionRef -namespace CGAL { - -/*! -\ingroup STLAlgos - -\deprecated This function is deprecated, std::copy_n should be -used instead. - -Copies the first `n` items from `first` to `result`. - -\returns the value of `result` after inserting the `n` items. - -\note The \stl release June 13, 1997, from SGI contains an equivalent -function, but it is not part of the ISO standard. - -\sa `CGAL::Counting_iterator` - -copies - -*/ -template OutputIterator copy_n(InputIterator first, Size n, -OutputIterator result); - -} /* namespace CGAL */ - namespace CGAL { /*! @@ -35,16 +9,17 @@ namespace CGAL { Computes the minimal and the -maximal element of a range. It is modeled after the STL functions -`std::min_element` and `std::max_element`. The advantage of -`min_max_element` compared to calling both STL functions is that +maximal element of a range. It is modeled after the \stl functions +`std::min_element` +and `std::max_element`. +The advantage of `min_max_element()` compared to calling both \stl functions is that one only iterates once over the sequence. This is more efficient especially for large and/or complex sequences. \cgalHeading{Example} The following example program computes the minimal and -maximal element of the sequence ` (3,\,6,\,5)`. Hence the output is +maximal element of the sequence `(3,\,6,\,5)`. Hence the output is `min = 3, max = 6`. \cgalExample{STL_Extension/min_max_element_example.cpp} @@ -64,9 +39,11 @@ first, ForwardIterator last); \ingroup STLAlgos Computes the minimal and the -maximal element of a range. It is modeled after the STL functions -`std::min_element` and `std::max_element`. The advantage of -`min_max_element` compared to calling both STL functions is that +maximal element of a range. It is modeled after the \stl functions +`std::min_element` +and `std::max_element`. +The advantage of `min_max_element()` compared to calling both \stl functions is that one only iterates once over the sequence. This is more efficient especially for large and/or complex sequences. @@ -90,54 +67,18 @@ CompareMin comp_min, CompareMax comp_max); } /* namespace CGAL */ -namespace CGAL { - -/*! -\ingroup STLAlgos - -\deprecated This function is deprecated. `std::prev` should be used -instead. - -Returns the previous iterator, -i.e.\ the result of `operator--` on a bidirectional iterator. - -\sa `CGAL::successor()` - -\returns `--it`. -*/ -template -BidirectionalIterator predecessor(BidirectionalIterator it); - -} /* namespace CGAL */ namespace CGAL { -/*! -\ingroup STLAlgos - -\deprecated This function is deprecated. `std::next` should be used -instead. - - -Returns the next iterator, i.e. -the result of `operator++` on a forward iterator. - - -\sa `CGAL::predecessor()` - -\returns `++it`. -*/ -template -ForwardIterator successor(ForwardIterator it); namespace cpp98 { /*! \ingroup STLAlgos -Replacement for `std::random_shuffle()` +Replacement for `std::random_shuffle` which was deprecated in C++14, and removed by C++17. -In the \stl it was replaced by `std::shuffle()`. +In the \stl it was replaced by `std::shuffle`. \note The implementation in \cgal produces the same order on all platforms. */ @@ -149,9 +90,9 @@ random_shuffle(RandomAccessIterator begin, RandomAccessIterator end, /*! \ingroup STLAlgos -Replacement for `std::random_shuffle()` +Replacement for `std::random_shuffle` which was deprecated in C++14, and removed by C++17. -In the \stl it was replaced by `std::shuffle()`. +In the \stl it was replaced by `std::shuffle`. \note The implementation in \cgal produces the same order on all platforms. */ diff --git a/STL_Extension/doc/STL_Extension/CGAL/iterator.h b/STL_Extension/doc/STL_Extension/CGAL/iterator.h index e4454d37bb4..fdc82bb1ffd 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/iterator.h +++ b/STL_Extension/doc/STL_Extension/CGAL/iterator.h @@ -61,8 +61,6 @@ from input iterators. `Iterator` is a model for `InputIterator`. -\sa `CGAL::copy_n()` - */ template< typename Iterator, typename Value > diff --git a/STL_Extension/doc/STL_Extension/PackageDescription.txt b/STL_Extension/doc/STL_Extension/PackageDescription.txt index a4df6c9b0bb..552378e03e6 100644 --- a/STL_Extension/doc/STL_Extension/PackageDescription.txt +++ b/STL_Extension/doc/STL_Extension/PackageDescription.txt @@ -41,10 +41,8 @@ - `CGAL::Multiset` \cgalCRPSection{Generic Algorithms} -- `CGAL::copy_n` - `CGAL::min_max_element` -- `CGAL::predecessor` -- `CGAL::successor` +- `CGAL::cpp98::random_shuffle` \cgalCRPSection{Iterators and Iterator/Circulator Adaptors} - `CGAL::Dispatch_output_iterator` diff --git a/STL_Extension/doc/STL_Extension/STL_Extension.txt b/STL_Extension/doc/STL_Extension/STL_Extension.txt index 584f04e4bec..947faab8ba2 100644 --- a/STL_Extension/doc/STL_Extension/STL_Extension.txt +++ b/STL_Extension/doc/STL_Extension/STL_Extension.txt @@ -393,3 +393,35 @@ void foo() */ } /* namespace CGAL */ +/*! +\page FromBoostNPtoCGALNP Upgrading Code using \boost Parameters to \cgal Named Function Parameters + +Prior to \cgal 5.6, some packages were using Boost parameters to provide a user friendly +way to set parameters of classes and functions. In an attempt to remove a dependency and +to get a more uniform API accross packages, these packages have been updated to now use +\cgal \ref bgl_namedparameters inspired by the function named parameters from +the \boost graph library. In practice this means that the following call: +\code +Mesh_criteria criteria(edge_size = 8, + facet_angle = 25, + facet_size = 8, + facet_distance = 0.2, + cell_radius_edge_ratio = 3, + cell_size = 10); +\endcode +should now be written as follows: +\code +Mesh_criteria criteria(edge_size(8). + facet_angle(25). + facet_size(8). + facet_distance(0.2). + cell_radius_edge_ratio(3). + cell_size(10)); +\endcode + +Note that we have tried to preserve the backward compatibility by allowing previous API +to remain valid. However, if new parameters are introduced for those functions, there is +no guarantee that they will be ported to the old API. So we strongly encourage users to +upgrade to the new API. Additionally, passing parameters without names is deprecated +and even removed for some functions. +*/ \ No newline at end of file diff --git a/STL_Extension/doc/STL_Extension/dependencies b/STL_Extension/doc/STL_Extension/dependencies index cf8c5e176f3..e3e3864ed1f 100644 --- a/STL_Extension/doc/STL_Extension/dependencies +++ b/STL_Extension/doc/STL_Extension/dependencies @@ -4,3 +4,4 @@ Number_types Kernel_23 Miscellany Surface_mesh +BGL diff --git a/STL_Extension/include/CGAL/Multiset.h b/STL_Extension/include/CGAL/Multiset.h index 96b6bcc612b..9382923dbc6 100644 --- a/STL_Extension/include/CGAL/Multiset.h +++ b/STL_Extension/include/CGAL/Multiset.h @@ -14,7 +14,6 @@ #include #include -#include #include #include #include @@ -168,7 +167,7 @@ protected: Node* predecessor () const { // The DUMMY_BEGIN node has no predecessor. - CGAL_multiset_assertion (color != DUMMY_BEGIN); + CGAL_assertion (color != DUMMY_BEGIN); Node *predP; @@ -203,7 +202,7 @@ protected: Node* successor () const { // The DUMMY_END node has no successor. - CGAL_multiset_assertion (color != DUMMY_END); + CGAL_assertion (color != DUMMY_END); Node *succP; @@ -346,7 +345,7 @@ public: /*! Increment operator (prefix notation). */ iterator& operator++ () { - CGAL_multiset_precondition (nodeP != nullptr); + CGAL_precondition (nodeP != nullptr); nodeP = nodeP->successor(); return (*this); @@ -355,7 +354,7 @@ public: /*! Increment operator (postfix notation). */ iterator operator++ (int ) { - CGAL_multiset_precondition (nodeP != nullptr); + CGAL_precondition (nodeP != nullptr); iterator temp = *this; @@ -366,7 +365,7 @@ public: /*! Decrement operator (prefix notation). */ iterator& operator-- () { - CGAL_multiset_precondition (nodeP != nullptr); + CGAL_precondition (nodeP != nullptr); nodeP = nodeP->predecessor(); return (*this); @@ -375,7 +374,7 @@ public: /*! Decrement operator (postfix notation). */ iterator operator-- (int ) { - CGAL_multiset_precondition (nodeP != nullptr); + CGAL_precondition (nodeP != nullptr); iterator temp = *this; @@ -388,7 +387,7 @@ public: */ reference operator* () const { - CGAL_multiset_precondition (nodeP != nullptr && nodeP->is_valid()); + CGAL_precondition (nodeP != nullptr && nodeP->is_valid()); return (nodeP->object); } @@ -398,7 +397,7 @@ public: */ pointer operator-> () const { - CGAL_multiset_precondition (nodeP != nullptr && nodeP->is_valid()); + CGAL_precondition (nodeP != nullptr && nodeP->is_valid()); return (&(nodeP->object)); } @@ -461,7 +460,7 @@ public: /*! Increment operator (prefix notation). */ const_iterator& operator++ () { - CGAL_multiset_precondition (nodeP != nullptr); + CGAL_precondition (nodeP != nullptr); nodeP = nodeP->successor(); return (*this); @@ -470,7 +469,7 @@ public: /*! Increment operator (postfix notation). */ const_iterator operator++ (int ) { - CGAL_multiset_precondition (nodeP != nullptr); + CGAL_precondition (nodeP != nullptr); const_iterator temp = *this; @@ -481,7 +480,7 @@ public: /*! Decrement operator (prefix notation). */ const_iterator& operator-- () { - CGAL_multiset_precondition (nodeP != nullptr); + CGAL_precondition (nodeP != nullptr); nodeP = nodeP->predecessor(); return (*this); @@ -490,7 +489,7 @@ public: /*! Decrement operator (postfix notation). */ const_iterator operator-- (int ) { - CGAL_multiset_precondition (nodeP != nullptr); + CGAL_precondition (nodeP != nullptr); const_iterator temp = *this; @@ -503,7 +502,7 @@ public: */ reference operator* () const { - CGAL_multiset_precondition (nodeP != nullptr && nodeP->is_valid()); + CGAL_precondition (nodeP != nullptr && nodeP->is_valid()); return (nodeP->object); } @@ -513,7 +512,7 @@ public: */ pointer operator-> () const { - CGAL_multiset_precondition (nodeP != nullptr && nodeP->is_valid()); + CGAL_precondition (nodeP != nullptr && nodeP->is_valid()); return (&(nodeP->object)); } @@ -1956,7 +1955,7 @@ Multiset::insert (iterator positi { Node *nodeP = position.nodeP; - CGAL_multiset_precondition (_is_valid (nodeP)); + CGAL_precondition (_is_valid (nodeP)); // Compare the object to the one stored at the given node in order to decide // in which direction to proceed. @@ -2033,7 +2032,7 @@ Multiset::insert_after (iterator Node *nodeP = position.nodeP; // In case we are given a nullptr node, object should be the tree minimum. - CGAL_multiset_assertion (nodeP != &endNode); + CGAL_assertion (nodeP != &endNode); if (nodeP == &beginNode) nodeP = nullptr; @@ -2042,7 +2041,7 @@ Multiset::insert_after (iterator { // In case the tree is empty, make sure that we did not receive a valid // iterator. - CGAL_multiset_precondition (nodeP == nullptr); + CGAL_precondition (nodeP == nullptr); // Assign a new root node. Notice that the root is always black. rootP = _allocate_node (object, Node::BLACK); @@ -2070,7 +2069,7 @@ Multiset::insert_after (iterator // child of the current minimal leaf. parentP = beginNode.parentP; - CGAL_multiset_precondition (comp_f(object, parentP->object) != LARGER); + CGAL_precondition (comp_f(object, parentP->object) != LARGER); parentP->leftP = newNodeP; @@ -2081,9 +2080,9 @@ Multiset::insert_after (iterator else { // Make sure the insertion does not violate the tree order. - CGAL_multiset_precondition_code (Node *_succP = nodeP->successor()); - CGAL_multiset_precondition (comp_f(object, nodeP->object) != SMALLER); - CGAL_multiset_precondition (! _succP->is_valid() || + CGAL_precondition_code (Node *_succP = nodeP->successor()); + CGAL_precondition (comp_f(object, nodeP->object) != SMALLER); + CGAL_precondition (! _succP->is_valid() || comp_f(object, _succP->object) != LARGER); // In case given node has no right child, place the new node as its @@ -2131,7 +2130,7 @@ Multiset::insert_before (iterator Node *nodeP = position.nodeP; // In case we are given a nullptr node, object should be the tree maximum. - CGAL_multiset_assertion (nodeP != &beginNode); + CGAL_assertion (nodeP != &beginNode); if (nodeP == &endNode) nodeP = nullptr; @@ -2140,7 +2139,7 @@ Multiset::insert_before (iterator { // In case the tree is empty, make sure that we did not receive a valid // iterator. - CGAL_multiset_precondition (nodeP == nullptr); + CGAL_precondition (nodeP == nullptr); // Assign a new root node. Notice that the root is always black. rootP = _allocate_node(object, Node::BLACK); @@ -2168,7 +2167,7 @@ Multiset::insert_before (iterator // child of the current maximal leaf. parentP = endNode.parentP; - CGAL_multiset_precondition (comp_f(object, parentP->object) != SMALLER); + CGAL_precondition (comp_f(object, parentP->object) != SMALLER); parentP->rightP = newNodeP; @@ -2179,9 +2178,9 @@ Multiset::insert_before (iterator else { // Make sure the insertion does not violate the tree order. - CGAL_multiset_precondition_code (Node *_predP = nodeP->predecessor()); - CGAL_multiset_precondition (comp_f(object, nodeP->object) != LARGER); - CGAL_multiset_precondition (! _predP->is_valid() || + CGAL_precondition_code (Node *_predP = nodeP->predecessor()); + CGAL_precondition (comp_f(object, nodeP->object) != LARGER); + CGAL_precondition (! _predP->is_valid() || comp_f(object, _predP->object) != SMALLER); // In case given node has no left child, place the new node as its @@ -2258,7 +2257,7 @@ void Multiset::erase (iterator po { Node *nodeP = position.nodeP; - CGAL_multiset_precondition (_is_valid (nodeP)); + CGAL_precondition (_is_valid (nodeP)); _remove_at (nodeP); return; @@ -2294,16 +2293,16 @@ void Multiset::replace (iterator { Node *nodeP = position.nodeP; - CGAL_multiset_precondition (_is_valid (nodeP)); + CGAL_precondition (_is_valid (nodeP)); // Make sure the replacement does not violate the tree order. - CGAL_multiset_precondition_code (Node *_succP = nodeP->successor()); - CGAL_multiset_precondition (_succP == nullptr || + CGAL_precondition_code (Node *_succP = nodeP->successor()); + CGAL_precondition (_succP == nullptr || _succP->color == Node::DUMMY_END || comp_f(object, _succP->object) != LARGER); - CGAL_multiset_precondition_code (Node *_predP = nodeP->predecessor()); - CGAL_multiset_precondition (_predP == nullptr || + CGAL_precondition_code (Node *_predP = nodeP->predecessor()); + CGAL_precondition (_predP == nullptr || _predP->color == Node::DUMMY_BEGIN || comp_f(object, _predP->object) != SMALLER); @@ -2323,30 +2322,30 @@ void Multiset::swap (iterator pos Node *node1_P = pos1.nodeP; Node *node2_P = pos2.nodeP; - CGAL_multiset_precondition (_is_valid (node1_P)); - CGAL_multiset_precondition (_is_valid (node2_P)); + CGAL_precondition (_is_valid (node1_P)); + CGAL_precondition (_is_valid (node2_P)); if (node1_P == node2_P) return; // Make sure the swap does not violate the tree order. - CGAL_multiset_precondition_code (Node *_succ1_P = node1_P->successor()); - CGAL_multiset_precondition (! _is_valid (_succ1_P) || + CGAL_precondition_code (Node *_succ1_P = node1_P->successor()); + CGAL_precondition (! _is_valid (_succ1_P) || comp_f (node2_P->object, _succ1_P->object) != LARGER); - CGAL_multiset_precondition_code (Node *_pred1_P = node1_P->predecessor()); - CGAL_multiset_precondition (! _is_valid (_pred1_P) || + CGAL_precondition_code (Node *_pred1_P = node1_P->predecessor()); + CGAL_precondition (! _is_valid (_pred1_P) || comp_f (node2_P->object, _pred1_P->object) != SMALLER); - CGAL_multiset_precondition_code (Node *_succ2_P = node2_P->successor()); - CGAL_multiset_precondition (! _is_valid (_succ2_P) || + CGAL_precondition_code (Node *_succ2_P = node2_P->successor()); + CGAL_precondition (! _is_valid (_succ2_P) || comp_f (node1_P->object, _succ2_P->object) != LARGER); - CGAL_multiset_precondition_code (Node *_pred2_P = node2_P->predecessor()); - CGAL_multiset_precondition (! _is_valid (_pred2_P) || + CGAL_precondition_code (Node *_pred2_P = node2_P->predecessor()); + CGAL_precondition (! _is_valid (_pred2_P) || comp_f (node1_P->object, _pred2_P->object) != SMALLER); @@ -2438,13 +2437,13 @@ void Multiset::catenate (Self& tr if (min2_P == nullptr) { // The other tree is empty - nothing to do. - CGAL_multiset_assertion (tree.rootP == nullptr); + CGAL_assertion (tree.rootP == nullptr); return; } else if (max1_P == nullptr) { // Our tree is empty: Copy all other tree properties to our tree. - CGAL_multiset_assertion (rootP == nullptr); + CGAL_assertion (rootP == nullptr); _shallow_assign (tree); return; @@ -2452,12 +2451,12 @@ void Multiset::catenate (Self& tr // Make sure that the minimal object in the other tree is not less than the // maximal object in our tree. - CGAL_multiset_precondition (comp_f (max1_P->object, + CGAL_precondition (comp_f (max1_P->object, min2_P->object) != LARGER); // Make sure both tree roots black. - CGAL_multiset_assertion (_is_black (rootP)); - CGAL_multiset_assertion (_is_black (tree.rootP)); + CGAL_assertion (_is_black (rootP)); + CGAL_assertion (_is_black (tree.rootP)); // Splice max1_P (or min2_P) from its tree, but without deleting it. Node* auxP = nullptr; @@ -2561,7 +2560,7 @@ void Multiset::catenate (Self& tr if (_is_red (node2_P)) node2_P = node2_P->leftP; - CGAL_multiset_assertion (_is_valid (node2_P)); + CGAL_assertion (_is_valid (node2_P)); } else { @@ -2578,7 +2577,7 @@ void Multiset::catenate (Self& tr if (_is_red (node1_P)) node1_P = node1_P->rightP; - CGAL_multiset_assertion (_is_valid (node2_P)); + CGAL_assertion (_is_valid (node2_P)); } // Check which one of the tree roots have we reached. @@ -2615,7 +2614,7 @@ void Multiset::catenate (Self& tr // moving auxP to be their parent. parentP = node1_P->parentP; - CGAL_multiset_assertion (parentP != nullptr); + CGAL_assertion (parentP != nullptr); // The catenated tree will be rooted at the current root of our tree. newRootP = rootP; @@ -2670,7 +2669,7 @@ template ::split (iterator position, Self& tree) { - CGAL_multiset_precondition (tree.empty()); + CGAL_precondition (tree.empty()); // Check the extremal cases. if (position == begin()) @@ -2691,7 +2690,7 @@ void Multiset::split (iterator po // is at most twice the black-height of the tree. Node *nodeP = position.nodeP; - CGAL_multiset_precondition (_is_valid (nodeP)); + CGAL_precondition (_is_valid (nodeP)); Node *currP = nodeP; Comparison_result *path = new Comparison_result [2 * iBlackHeight]; @@ -2708,7 +2707,7 @@ void Multiset::split (iterator po currP = currP->parentP; } - CGAL_multiset_assertion (currP == rootP); + CGAL_assertion (currP == rootP); // Now go down the path and split the tree accordingly. We also keep // track of the black-height of the current node. @@ -2726,7 +2725,7 @@ void Multiset::split (iterator po while (depth >= 0) { - CGAL_multiset_assertion (_is_valid (currP)); + CGAL_assertion (_is_valid (currP)); // If we encounter a black node, the black-height of both its left and // right subtrees is decremented. @@ -2770,8 +2769,8 @@ void Multiset::split (iterator po else if (_is_valid (childP)) { // Catenate T_r with the current rightTree. - CGAL_multiset_assertion (_is_valid (spineRightP) && - _is_valid(auxRightP)); + CGAL_assertion (_is_valid (spineRightP) && + _is_valid(auxRightP)); // Make sure the root of T_r is black. size_t iCurrRightBHeight = iCurrBHeight; @@ -2784,7 +2783,7 @@ void Multiset::split (iterator po // Go down the leftmost path of rightTree until locating a black // node whose black height is exactly iCurrRightBHeight. - CGAL_multiset_assertion (iRightBHeight >= iCurrRightBHeight); + CGAL_assertion (iRightBHeight >= iCurrRightBHeight); while (iRightBHeight > iCurrRightBHeight) { @@ -2795,7 +2794,7 @@ void Multiset::split (iterator po if (_is_red (spineRightP)) spineRightP = spineRightP->leftP; - CGAL_multiset_assertion (_is_valid (spineRightP)); + CGAL_assertion (_is_valid (spineRightP)); // Use the auxiliary node and make it the parent of T_r (which // becomes its left sub-tree) and spineRightP (which becomes its @@ -2905,8 +2904,8 @@ void Multiset::split (iterator po else if (_is_valid (childP)) { // Catenate T_l with the current leftTree. - CGAL_multiset_assertion (_is_valid (spineLeftP) && - _is_valid(auxLeftP)); + CGAL_assertion (_is_valid (spineLeftP) && + _is_valid(auxLeftP)); // Make sure the root of T_l is black. size_t iCurrLeftBHeight = iCurrBHeight; @@ -2919,7 +2918,7 @@ void Multiset::split (iterator po // Go down the rightmost path of leftTree until locating a black // node whose black height is exactly iCurrLeftBHeight. - CGAL_multiset_assertion (iLeftBHeight >= iCurrLeftBHeight); + CGAL_assertion (iLeftBHeight >= iCurrLeftBHeight); while (iLeftBHeight > iCurrLeftBHeight) { @@ -2930,7 +2929,7 @@ void Multiset::split (iterator po if (_is_red (spineLeftP)) spineLeftP = spineLeftP->rightP; - CGAL_multiset_assertion (_is_valid (spineLeftP)); + CGAL_assertion (_is_valid (spineLeftP)); // Use the auxiliary node and make it the parent of T_l (which // becomes its right sub-tree) and spineLeftP (which becomes its @@ -3012,7 +3011,7 @@ void Multiset::split (iterator po // It is now possible to free the path. delete[] path; - CGAL_multiset_assertion (auxLeftP == nullptr && auxRightP == nodeP); + CGAL_assertion (auxLeftP == nullptr && auxRightP == nodeP); // Fix the properties of the left tree: We know its minimal node is the // same as the current minimum. @@ -3020,7 +3019,7 @@ void Multiset::split (iterator po leftTree.beginNode.parentP->leftP = &(leftTree.beginNode); // Traverse the rightmost path of the left tree to find the its maximum. - CGAL_multiset_assertion (_is_valid (spineLeftP)); + CGAL_assertion (_is_valid (spineLeftP)); while (_is_valid (spineLeftP->rightP)) spineLeftP = spineLeftP->rightP; @@ -3130,7 +3129,7 @@ void Multiset::_shallow_clear () template void Multiset::_remove_at (Node* nodeP) { - CGAL_multiset_precondition (_is_valid (nodeP)); + CGAL_precondition (_is_valid (nodeP)); if (nodeP == rootP && ! _is_valid (rootP->leftP) && ! _is_valid (rootP->rightP)) @@ -3155,7 +3154,7 @@ void Multiset::_remove_at (Node* // which is the leftmost child in its right sub-tree and has at most // one child (it may have a right child). Node *succP = _sub_minimum (nodeP->rightP); - CGAL_multiset_assertion (_is_valid (succP)); + CGAL_assertion (_is_valid (succP)); // Now physically swap nodeP and its successor. Notice this may temporarily // violate the tree properties, but we are going to remove nodeP anyway. @@ -3169,7 +3168,7 @@ void Multiset::_remove_at (Node* if (_is_valid (nodeP->leftP)) { - CGAL_multiset_assertion (! _is_valid (nodeP->rightP)); + CGAL_assertion (! _is_valid (nodeP->rightP)); childP = nodeP->leftP; } else @@ -3247,8 +3246,8 @@ template ::_swap (Node* node1_P, Node* node2_P) { - CGAL_multiset_assertion (_is_valid (node1_P)); - CGAL_multiset_assertion (_is_valid (node2_P)); + CGAL_assertion (_is_valid (node1_P)); + CGAL_assertion (_is_valid (node2_P)); // Store the properties of the first node. typename Node::Node_color color1 = node1_P->color; @@ -3388,8 +3387,8 @@ template ::_swap_siblings (Node* node1_P, Node* node2_P) { - CGAL_multiset_assertion (_is_valid (node1_P)); - CGAL_multiset_assertion (_is_valid (node2_P)); + CGAL_assertion (_is_valid (node1_P)); + CGAL_assertion (_is_valid (node2_P)); // Store the properties of the first node. typename Node::Node_color color1 = node1_P->color; @@ -3422,7 +3421,7 @@ void Multiset::_swap_siblings (No Node *parent_P = node1_P->parentP; Node *temp; - CGAL_multiset_assertion (parent_P == node2_P->parentP); + CGAL_assertion (parent_P == node2_P->parentP); temp = parent_P->leftP; parent_P->leftP = parent_P->rightP; @@ -3464,7 +3463,7 @@ template ::_sub_height (const Node* nodeP) const { - CGAL_multiset_assertion (_is_valid (nodeP)); + CGAL_assertion (_is_valid (nodeP)); // Recursively calculate the heights of the left and right sub-trees. size_t iRightHeight = 0; @@ -3552,7 +3551,7 @@ template ::Node* Multiset::_sub_minimum (Node* nodeP) const { - CGAL_multiset_assertion (_is_valid (nodeP)); + CGAL_assertion (_is_valid (nodeP)); Node *minP = nodeP; @@ -3568,7 +3567,7 @@ template ::Node* Multiset::_sub_maximum (Node* nodeP) const { - CGAL_multiset_assertion (_is_valid (nodeP)); + CGAL_assertion (_is_valid (nodeP)); Node *maxP = nodeP; @@ -3593,7 +3592,7 @@ void Multiset::_rotate_left (Node // Get the right child of the node. Node *yNodeP = xNodeP->rightP; - CGAL_multiset_assertion (_is_valid (yNodeP)); + CGAL_assertion (_is_valid (yNodeP)); // Change its left subtree (T2) to x's right subtree. xNodeP->rightP = yNodeP->leftP; @@ -3639,7 +3638,7 @@ void Multiset::_rotate_right (Nod // Get the left child of the node. Node *xNodeP = yNodeP->leftP; - CGAL_multiset_assertion (_is_valid (xNodeP)); + CGAL_assertion (_is_valid (xNodeP)); // Change its right subtree (T2) to y's left subtree. yNodeP->leftP = xNodeP->rightP; @@ -3683,7 +3682,7 @@ template ::Node* Multiset::_duplicate (const Node* nodeP) { - CGAL_multiset_assertion (_is_valid (nodeP)); + CGAL_assertion (_is_valid (nodeP)); // Create a node of the same color, containing the same object. Node *dupNodeP = _allocate_node(nodeP->object, nodeP->color); @@ -3711,7 +3710,7 @@ Multiset::_duplicate (const Node* template void Multiset::_destroy (Node* nodeP) { - CGAL_multiset_assertion (_is_valid (nodeP)); + CGAL_assertion (_is_valid (nodeP)); // Destroy the children recursively. if (_is_valid (nodeP->rightP)) @@ -3734,7 +3733,7 @@ void Multiset::_destroy (Node* no template void Multiset::_insert_fixup (Node* nodeP) { - CGAL_multiset_precondition (_is_red (nodeP)); + CGAL_precondition (_is_red (nodeP)); // Fix the red-black propreties: we may have inserted a red leaf as the // child of a red parent - so we have to fix the coloring of the parent @@ -3748,7 +3747,7 @@ void Multiset::_insert_fixup (Nod // Get a pointer to the current node's grandparent (notice the root is // always black, so the red parent must have a parent). grandparentP = currP->parentP->parentP; - CGAL_multiset_precondition (grandparentP != nullptr); + CGAL_precondition (grandparentP != nullptr); if (currP->parentP == grandparentP->leftP) { @@ -3781,7 +3780,7 @@ void Multiset::_insert_fixup (Nod // Color the parent black and the grandparent red. currP->parentP->color = Node::BLACK; - CGAL_multiset_assertion (grandparentP == currP->parentP->parentP); + CGAL_assertion (grandparentP == currP->parentP->parentP); grandparentP->color = Node::RED; // Right-rotate the grandparent's sub-tree @@ -3819,7 +3818,7 @@ void Multiset::_insert_fixup (Nod // Color the parent black and the grandparent red. currP->parentP->color = Node::BLACK; - CGAL_multiset_assertion(grandparentP == currP->parentP->parentP); + CGAL_assertion(grandparentP == currP->parentP->parentP); grandparentP->color = Node::RED; // Left-rotate the grandparent's sub-tree @@ -3873,7 +3872,7 @@ void Multiset::_remove_fixup (Nod siblingP = currParentP->rightP; } - CGAL_multiset_assertion (_is_valid (siblingP)); + CGAL_assertion (_is_valid (siblingP)); if (_is_black (siblingP->leftP) && _is_black (siblingP->rightP)) { @@ -3889,7 +3888,7 @@ void Multiset::_remove_fixup (Nod // the black height of the entire tree. if (currP == rootP) { - CGAL_multiset_assertion (currParentP == nullptr); + CGAL_assertion (currParentP == nullptr); iBlackHeight--; } } @@ -3938,7 +3937,7 @@ void Multiset::_remove_fixup (Nod siblingP = currParentP->leftP; } - CGAL_multiset_assertion (_is_valid (siblingP)); + CGAL_assertion (_is_valid (siblingP)); if (_is_black (siblingP->leftP) && _is_black (siblingP->rightP)) { @@ -3954,7 +3953,7 @@ void Multiset::_remove_fixup (Nod // the black height of the entire tree. if (currP == rootP) { - CGAL_multiset_assertion (currParentP == nullptr); + CGAL_assertion (currParentP == nullptr); iBlackHeight--; } } @@ -4011,8 +4010,8 @@ Multiset::_allocate_node (const Type& object, typename Node::Node_color color) { - CGAL_multiset_assertion (color != Node::DUMMY_BEGIN && - color != Node::DUMMY_END); + CGAL_assertion (color != Node::DUMMY_BEGIN && + color != Node::DUMMY_END); Node* new_node = node_alloc.allocate(beginNode); new_node->init(object, color); diff --git a/STL_Extension/include/CGAL/Named_function_parameters.h b/STL_Extension/include/CGAL/Named_function_parameters.h index bf7059b3ca9..06d9043ab33 100644 --- a/STL_Extension/include/CGAL/Named_function_parameters.h +++ b/STL_Extension/include/CGAL/Named_function_parameters.h @@ -17,14 +17,18 @@ #endif #include +#include #include +#include #include #include #define CGAL_NP_TEMPLATE_PARAMETERS NP_T=bool, typename NP_Tag=CGAL::internal_np::all_default_t, typename NP_Base=CGAL::internal_np::No_property #define CGAL_NP_TEMPLATE_PARAMETERS_NO_DEFAULT NP_T, typename NP_Tag, typename NP_Base +#define CGAL_NP_TEMPLATE_PARAMETERS_NO_DEFAULT_1 NP_T1, typename NP_Tag1, typename NP_Base1 +#define CGAL_NP_TEMPLATE_PARAMETERS_NO_DEFAULT_2 NP_T2, typename NP_Tag2, typename NP_Base2 #define CGAL_NP_CLASS CGAL::Named_function_parameters #define CGAL_NP_TEMPLATE_PARAMETERS_1 NP_T1=bool, typename NP_Tag1=CGAL::internal_np::all_default_t, typename NP_Base1=CGAL::internal_np::No_property @@ -32,6 +36,8 @@ #define CGAL_NP_TEMPLATE_PARAMETERS_2 NP_T2=bool, typename NP_Tag2=CGAL::internal_np::all_default_t, typename NP_Base2=CGAL::internal_np::No_property #define CGAL_NP_CLASS_2 CGAL::Named_function_parameters +#define CGAL_NP_TEMPLATE_PARAMETERS_VARIADIC NP_T, typename ... NP_Tag, typename ... NP_Base + namespace CGAL { namespace internal_np{ @@ -43,8 +49,16 @@ enum all_default_t { all_default }; // define enum types and values for new named parameters #define CGAL_add_named_parameter(X, Y, Z) \ enum X { Y }; +#define CGAL_add_named_parameter_with_compatibility(X, Y, Z) \ + enum X { Y }; +#define CGAL_add_named_parameter_with_compatibility_ref_only(X, Y, Z) \ + enum X { Y }; +#define CGAL_add_extra_named_parameter_with_compatibility(X, Y, Z) #include #undef CGAL_add_named_parameter +#undef CGAL_add_named_parameter_with_compatibility +#undef CGAL_add_named_parameter_with_compatibility_ref_only +#undef CGAL_add_extra_named_parameter_with_compatibility template struct Named_params_impl : Base @@ -230,72 +244,17 @@ get_parameter_reference_impl(const Named_params_impl& np, Query_ta return get_parameter_reference_impl(static_cast(np), tag); } - } // end of internal_np namespace - template -struct Named_function_parameters - : internal_np::Named_params_impl -{ - typedef internal_np::Named_params_impl base; - typedef Named_function_parameters self; +struct Named_function_parameters; - Named_function_parameters() : base(T()) {} - Named_function_parameters(const T& v) : base(v) {} - Named_function_parameters(const T& v, const Base& b) : base(v, b) {} - -// create the functions for new named parameters and the one imported boost -// used to concatenate several parameters -#define CGAL_add_named_parameter(X, Y, Z) \ - template \ - Named_function_parameters \ - Z(const K& k) const \ - { \ - typedef Named_function_parameters Params;\ - return Params(k, *this); \ - } -#include -#undef CGAL_add_named_parameter -}; - -namespace parameters { +namespace parameters{ typedef Named_function_parameters Default_named_parameters; -#ifndef CGAL_NO_DEPRECATED_CODE Default_named_parameters -inline all_default() -{ - return Default_named_parameters(); -} -#endif - -Default_named_parameters -inline default_values() -{ - return Default_named_parameters(); -} - -template -Named_function_parameters -inline no_parameters(Named_function_parameters) -{ - typedef Named_function_parameters Params; - return Params(); -} - -// define free functions for named parameters -#define CGAL_add_named_parameter(X, Y, Z) \ - template \ - Named_function_parameters \ - Z(const K& p) \ - { \ - typedef Named_function_parameters Params;\ - return Params(p); \ - } -#include -#undef CGAL_add_named_parameter +inline default_values(); // function to extract a parameter template @@ -358,6 +317,185 @@ const T& choose_parameter(const T& t) return t; } +} // parameters namespace + +namespace internal_np { + +template +auto +combine_named_parameters(const Named_function_parameters& np, const NPS& ... nps) +{ + return np.combine(nps ...); +} + +} // end of internal_np namespace + +template +struct Named_function_parameters + : internal_np::Named_params_impl +{ + typedef internal_np::Named_params_impl base; + typedef Named_function_parameters self; + + Named_function_parameters() : base(T()) {} + Named_function_parameters(const T& v) : base(v) {} + Named_function_parameters(const T& v, const Base& b) : base(v, b) {} + +// create the functions for new named parameters and the one imported boost +// used to concatenate several parameters +#define CGAL_add_named_parameter(X, Y, Z) \ + template \ + Named_function_parameters \ + Z(const K& k) const \ + { \ + typedef Named_function_parameters Params;\ + return Params(k, *this); \ + } +#define CGAL_add_named_parameter_with_compatibility(X, Y, Z) \ + template \ + Named_function_parameters \ + Z(const K& k) const \ + { \ + typedef Named_function_parameters Params;\ + return Params(k, *this); \ + } +#define CGAL_add_named_parameter_with_compatibility_ref_only(X, Y, Z) \ + template \ + Named_function_parameters, \ + internal_np::X, self> \ + Z(const K& k) const \ + { \ + typedef Named_function_parameters,\ + internal_np::X, self> Params; \ + return Params(std::cref(k), *this); \ + } +#define CGAL_add_extra_named_parameter_with_compatibility(X, Y, Z) \ + template \ + Named_function_parameters \ + Z(const K& k) const \ + { \ + typedef Named_function_parameters Params;\ + return Params(k, *this); \ + } +#include +#undef CGAL_add_named_parameter +#undef CGAL_add_named_parameter_with_compatibility +#undef CGAL_add_named_parameter_with_compatibility_ref_only +#undef CGAL_add_extra_named_parameter_with_compatibility + +// inject mesh specific named parameter functions +#define CGAL_NP_BASE self +#define CGAL_NP_BUILD(P, V) P(V, *this) + +#include + +#undef CGAL_NP_BASE +#undef CGAL_NP_BUILD + + template + Named_function_parameters + combine(const Named_function_parameters& np) const + { + return Named_function_parameters(np.v,*this); + } + + template + auto + combine(const Named_function_parameters& np, const NPS& ... nps) const + { + return Named_function_parameters(np.v,*this).combine(nps...); + } + + // typedef for SFINAE + typedef int CGAL_Named_function_parameters_class; +}; + +namespace parameters { + +Default_named_parameters +inline default_values() +{ + return Default_named_parameters(); +} + +#ifndef CGAL_NO_DEPRECATED_CODE +Default_named_parameters +inline all_default() +{ + return Default_named_parameters(); +} +#endif + +template +Named_function_parameters +inline no_parameters(Named_function_parameters) +{ + typedef Named_function_parameters Params; + return Params(); +} + +template +struct Boost_parameter_compatibility_wrapper +{ + template + Named_function_parameters + operator()(const K& p) const + { + typedef Named_function_parameters Params; + return Params(p); + } + + template + Named_function_parameters + operator=(const K& p) const + { + typedef Named_function_parameters Params; + return Params(p); + } +}; + +template +struct Boost_parameter_compatibility_wrapper +{ + template + Named_function_parameters, Tag> + operator()(const K& p) const + { + typedef Named_function_parameters, Tag> Params; + return Params(std::cref(p)); + } + + template + Named_function_parameters, Tag> + operator=(const K& p) const + { + typedef Named_function_parameters, Tag> Params; + return Params(std::cref(p)); + } +}; + +// define free functions and Boost_parameter_compatibility_wrapper for named parameters +#define CGAL_add_named_parameter(X, Y, Z) \ + template \ + Named_function_parameters \ + Z(const K& p) \ + { \ + typedef Named_function_parameters Params;\ + return Params(p); \ + } + +#define CGAL_add_named_parameter_with_compatibility(X, Y, Z) \ + const Boost_parameter_compatibility_wrapper Z; +#define CGAL_add_named_parameter_with_compatibility_ref_only(X, Y, Z) \ + const Boost_parameter_compatibility_wrapper Z; +#define CGAL_add_extra_named_parameter_with_compatibility(X, Y, Z) \ + const Boost_parameter_compatibility_wrapper Z; +#include +#undef CGAL_add_named_parameter +#undef CGAL_add_extra_named_parameter_with_compatibility +#undef CGAL_add_named_parameter_with_compatibility +#undef CGAL_add_named_parameter_with_compatibility_ref_only + // Version with three parameters for dynamic property maps template D choose_parameter(const internal_np::Param_not_found&, Dynamic_tag tag, PolygonMesh& pm) @@ -407,4 +545,9 @@ namespace boost } #endif +// For disambiguation using SFINAE +BOOST_MPL_HAS_XXX_TRAIT_DEF(CGAL_Named_function_parameters_class) +template +CGAL_CPP17_INLINE constexpr bool is_named_function_parameter = has_CGAL_Named_function_parameters_class::value; + #endif // CGAL_BOOST_FUNCTION_PARAMS_HPP diff --git a/SMDS_3/include/CGAL/SMDS_3/Has_features.h b/STL_Extension/include/CGAL/STL_Extension/internal/Has_features.h similarity index 82% rename from SMDS_3/include/CGAL/SMDS_3/Has_features.h rename to STL_Extension/include/CGAL/STL_Extension/internal/Has_features.h index e2c322fc0f6..d9681f1579c 100644 --- a/SMDS_3/include/CGAL/SMDS_3/Has_features.h +++ b/STL_Extension/include/CGAL/STL_Extension/internal/Has_features.h @@ -6,21 +6,17 @@ // // $URL$ // $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Stéphane Tayeb, Laurent Rineau -#ifndef CGAL_MESH_3_HAS_FEATURES_H -#define CGAL_MESH_3_HAS_FEATURES_H - -#include - +#ifndef CGAL_HAS_FEATURES_H +#define CGAL_HAS_FEATURES_H #include #include namespace CGAL { -namespace Mesh_3 { namespace internal { // A type has_Has_features to check if type 'Has_features' is a nested @@ -40,7 +36,6 @@ namespace internal { {}; } // end namespace internal -} // end namespace Mesh_3 } // end namespace CGAL #endif // CGAL_MESH_3_HAS_FEATURES_H diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/mesh_option_classes.h b/STL_Extension/include/CGAL/STL_Extension/internal/mesh_option_classes.h new file mode 100644 index 00000000000..09487cc44f9 --- /dev/null +++ b/STL_Extension/include/CGAL/STL_Extension/internal/mesh_option_classes.h @@ -0,0 +1,236 @@ +// Copyright (c) 2009 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// + +#ifndef CGAL_MESH_OPTION_CLASSES_H +#define CGAL_MESH_OPTION_CLASSES_H + +#include + +namespace CGAL { + +enum Mesh_error_code { + CGAL_MESH_3_NO_ERROR = 0, + CGAL_MESH_3_MAXIMAL_NUMBER_OF_VERTICES_REACHED, + CGAL_MESH_3_STOPPED +}; + +namespace parameters { + +namespace internal { + +const int undef_parameter = -1; + +// Helpers +struct Optimization_options_base +{ + Optimization_options_base(bool b) + : b_(b), time_limit_(undef_parameter), bound_(undef_parameter) {} + + operator bool() const { return b_; } + + bool is_time_limit_set() const { return time_limit_ != undef_parameter; } + void set_time_limit(double d) { time_limit_ = d; } + double time_limit() const { return time_limit_; } + + bool is_bound_set() const { return bound_ != undef_parameter; } + void set_bound(double d) { bound_ = d; } + double bound() const { return bound_; } + +private: + bool b_; + double time_limit_; + double bound_; +}; + +struct Global_optimization_options_base +{ + Global_optimization_options_base() + : convergence_(undef_parameter), max_it_nb_(undef_parameter) {} + + bool is_convergence_set() const { return convergence_ != undef_parameter; } + void set_convergence(double d) { convergence_ = d; } + double convergence() const { return convergence_; } + + bool is_max_iteration_number_set() const { return max_it_nb_ != std::size_t(undef_parameter); } + void set_max_iteration_number(std::size_t i) { max_it_nb_ = i; } + std::size_t max_iteration_number() const { return max_it_nb_; } + +private: + double convergence_; + std::size_t max_it_nb_; +}; + +// Perturb +struct Perturb_options : public Optimization_options_base +{ + Perturb_options(bool b) : Optimization_options_base(b) {} +}; + +// Exude +struct Exude_options : public Optimization_options_base +{ + Exude_options(bool b) : Optimization_options_base(b) {} +}; + +// Odt +struct Odt_options : public Optimization_options_base +, public Global_optimization_options_base +{ + Odt_options(bool b) : Optimization_options_base(b) + , Global_optimization_options_base() {} +}; + +// Lloyd +struct Lloyd_options : public Optimization_options_base +, public Global_optimization_options_base +{ + Lloyd_options(bool b) : Optimization_options_base(b) + , Global_optimization_options_base() {} +}; + +// Manifold +struct Manifold_options { + enum { + NON_MANIFOLD = 0, + MANIFOLD_WITH_BOUNDARY = 8, + NO_BOUNDARY = 16, + MANIFOLD = 24 + }; + + Manifold_options(const int topology) + : mesh_topology(topology) + {} + Manifold_options() + : mesh_topology(NON_MANIFOLD) + {} + + int mesh_topology; +}; + +// Various Mesh_3 option +struct Mesh_3_options { +#ifndef CGAL_NO_ATOMIC + typedef std::atomic* Pointer_to_stop_atomic_boolean_t; +#else + typedef bool* Pointer_to_stop_atomic_boolean_t; +#endif + Mesh_3_options(bool nonlinear = false) + // This parameter `nonlinear` adds a compatibility with previous + // API of the constructor of `C3t3_initializer`. + // -- Laurent Rineau, 2019/05/03 + : dump_after_init_prefix() + , dump_after_refine_surface_prefix() + , dump_after_refine_prefix() + , dump_after_glob_opt_prefix() + , dump_after_perturb_prefix() + , dump_after_exude_prefix() + , number_of_initial_points(-1) + , nonlinear_growth_of_balls(nonlinear) + , maximal_number_of_vertices(0) + , pointer_to_error_code(0) +#ifndef CGAL_NO_ATOMIC + , pointer_to_stop_atomic_boolean(0) +#endif + {} + + std::string dump_after_init_prefix; + std::string dump_after_refine_surface_prefix; + std::string dump_after_refine_prefix; + std::string dump_after_glob_opt_prefix; + std::string dump_after_perturb_prefix; + std::string dump_after_exude_prefix; + int number_of_initial_points; + bool nonlinear_growth_of_balls; + std::size_t maximal_number_of_vertices; + Mesh_error_code* pointer_to_error_code; +#ifndef CGAL_NO_ATOMIC + Pointer_to_stop_atomic_boolean_t pointer_to_stop_atomic_boolean; +#endif + +}; // end struct Mesh_3_options + +// Features +struct Features_options +{ + Features_options(bool b) : b_(b) {} + bool features() const { return b_; } +private: + bool b_; +}; + +// ----------------------------------- +// Features generator +// ----------------------------------- +// struct Features_option_generator +template +struct Features_options_generator {}; + +template<> +struct Features_options_generator +{ + Features_options operator()() { return Features_options(true); } +}; + +template<> +struct Features_options_generator +{ + Features_options operator()() { return Features_options(false); } +}; + +// struct Domain_features_generator is designed to handle cases where +// MeshDomain::Has_features is not a valid type +template< typename MeshDomain, bool MeshDomainHasHasFeatures > +struct Domain_features_generator {}; + +template< typename MeshDomain > +struct Domain_features_generator< MeshDomain, false > +{ + Features_options operator()() + { + return Features_options_generator()(); + } +}; + +template< typename MeshDomain > +struct Domain_features_generator< MeshDomain, true > +{ + Features_options operator()() + { + return Features_options_generator()(); + } +}; + +} // end namespace internal + + +namespace default_values_for_mesh_3 { + +const double time_limit = 0.; + +// exude_mesh_3 +const double exude_sliver_bound = 0.; + +// perturb_mesh_3 +const double perturb_sliver_bound = 0.; + +// lloyd_optimize_mesh_3 +const double lloyd_freeze_ratio = 0.01; +const double lloyd_convergence_ratio = 0.02; + +// odt_optimize_mesh_3 +const double odt_freeze_ratio = 0.01; +const double odt_convergence_ratio = 0.02; + +// global optimizers +const bool do_freeze = true; + +} } } //namespace CGAL::parameters::def + +#endif diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/mesh_parameters_interface.h b/STL_Extension/include/CGAL/STL_Extension/internal/mesh_parameters_interface.h new file mode 100644 index 00000000000..ece342c321b --- /dev/null +++ b/STL_Extension/include/CGAL/STL_Extension/internal/mesh_parameters_interface.h @@ -0,0 +1,370 @@ +// Copyright (c) 2017 GeometryFactory (France). All rights reserved. +// +// This file is part of CGAL (www.cgal.org) +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// + +// List of named parameters special functions used in meshing packages of CGAL +// no guard on purpose as they are injected both in the parameter namespace +// and the Named_function_parameters class. + + +// ----------------------------------- +// Reset_c3t3 (undocumented) +// ----------------------------------- +inline +Named_function_parameters +reset_c3t3() +{ + typedef Named_function_parameters Param; + return CGAL_NP_BUILD(Param, true); +} + +inline +Named_function_parameters +no_reset_c3t3() +{ + typedef Named_function_parameters Param; + return CGAL_NP_BUILD(Param, false); +} + +// ----------------------------------- +// Perturb +// ----------------------------------- +template +Named_function_parameters<::CGAL::parameters::internal::Perturb_options, ::CGAL::internal_np::perturb_options_param_t, CGAL_NP_BASE> +perturb(const CGAL_NP_CLASS& np = parameters::default_values()) +{ + using ::CGAL::parameters::choose_parameter; + using ::CGAL::parameters::get_parameter; + double time_limit = choose_parameter(get_parameter(np,::CGAL::internal_np::maximum_running_time),::CGAL::parameters::internal::undef_parameter); + double sliver_bound = choose_parameter(get_parameter(np,::CGAL::internal_np::lower_sliver_bound),::CGAL::parameters::default_values_for_mesh_3::perturb_sliver_bound); + + ::CGAL::parameters::internal::Perturb_options options(true); + + if ( ::CGAL::parameters::internal::undef_parameter != time_limit) + options.set_time_limit(time_limit); + + options.set_bound(sliver_bound); + typedef Named_function_parameters<::CGAL::parameters::internal::Perturb_options, ::CGAL::internal_np::perturb_options_param_t, CGAL_NP_BASE> Param; + return CGAL_NP_BUILD(Param, options); +} + +template +Named_function_parameters<::CGAL::parameters::internal::Exude_options, ::CGAL::internal_np::exude_options_param_t, CGAL_NP_BASE> +perturb(const CGAL_NP_CLASS_1& np1, const CGAL_NP_CLASS_2& np2, const NP& ... nps) +{ + return perturb(::CGAL::internal_np::combine_named_parameters(np1, np2, nps...)); +} + + +inline Named_function_parameters<::CGAL::parameters::internal::Perturb_options, ::CGAL::internal_np::perturb_options_param_t, CGAL_NP_BASE> +no_perturb() +{ + typedef Named_function_parameters<::CGAL::parameters::internal::Perturb_options, ::CGAL::internal_np::perturb_options_param_t, CGAL_NP_BASE> Param; + return CGAL_NP_BUILD(Param,::CGAL::parameters::internal::Perturb_options(false)); +} + +#ifndef CGAL_NO_DEPRECATED_CODE +CGAL_DEPRECATED +inline +Named_function_parameters<::CGAL::parameters::internal::Perturb_options, ::CGAL::internal_np::perturb_options_param_t, CGAL_NP_BASE> +perturb(double time_limit_, + double sliver_bound_=0) +{ + return perturb(time_limit(time_limit_). + sliver_bound(sliver_bound_)); +} +#endif + +// ----------------------------------- +// Exude +// ----------------------------------- +template +Named_function_parameters<::CGAL::parameters::internal::Exude_options, ::CGAL::internal_np::exude_options_param_t, CGAL_NP_BASE> +exude(const CGAL_NP_CLASS& np = parameters::default_values()) +{ + using ::CGAL::parameters::choose_parameter; + using ::CGAL::parameters::get_parameter; + double time_limit = choose_parameter(get_parameter(np,::CGAL::internal_np::maximum_running_time),::CGAL::parameters::internal::undef_parameter); + double sliver_bound = choose_parameter(get_parameter(np,::CGAL::internal_np::lower_sliver_bound),::CGAL::parameters::default_values_for_mesh_3::perturb_sliver_bound); + + ::CGAL::parameters::internal::Exude_options options(true); + + if ( ::CGAL::parameters::internal::undef_parameter != time_limit) + options.set_time_limit(time_limit); + options.set_bound(sliver_bound); + typedef Named_function_parameters<::CGAL::parameters::internal::Exude_options, ::CGAL::internal_np::exude_options_param_t, CGAL_NP_BASE> Param; + + return CGAL_NP_BUILD(Param, options); +} + +template +Named_function_parameters<::CGAL::parameters::internal::Exude_options, ::CGAL::internal_np::exude_options_param_t, CGAL_NP_BASE> +exude(const CGAL_NP_CLASS_1& np1, const CGAL_NP_CLASS_2& np2, const NP& ... nps) +{ + return exude(::CGAL::internal_np::combine_named_parameters(np1, np2, nps...)); +} + +inline Named_function_parameters<::CGAL::parameters::internal::Exude_options, ::CGAL::internal_np::exude_options_param_t, CGAL_NP_BASE> +no_exude() +{ + typedef Named_function_parameters<::CGAL::parameters::internal::Exude_options, ::CGAL::internal_np::exude_options_param_t, CGAL_NP_BASE> Param; + return CGAL_NP_BUILD(Param,::CGAL::parameters::internal::Exude_options(false)); +} + +#ifndef CGAL_NO_DEPRECATED_CODE +CGAL_DEPRECATED +inline +Named_function_parameters<::CGAL::parameters::internal::Exude_options, ::CGAL::internal_np::exude_options_param_t, CGAL_NP_BASE> +exude(double time_limit_, + double sliver_bound_ = 0) +{ + return exude(time_limit(time_limit_).sliver_bound(sliver_bound_)); +} +#endif + +// ----------------------------------- +// Odt +// ----------------------------------- +template +Named_function_parameters<::CGAL::parameters::internal::Odt_options, ::CGAL::internal_np::odt_options_param_t, CGAL_NP_BASE> +odt(const CGAL_NP_CLASS& np = parameters::default_values()) +{ + using ::CGAL::parameters::choose_parameter; + using ::CGAL::parameters::get_parameter; + double time_limit = choose_parameter(get_parameter(np,::CGAL::internal_np::maximum_running_time),0); + double freeze_bound = choose_parameter(get_parameter(np,::CGAL::internal_np::vertex_freeze_bound),::CGAL::parameters::default_values_for_mesh_3::odt_freeze_ratio); + double convergence = choose_parameter(get_parameter(np,::CGAL::internal_np::convergence_ratio), ::CGAL::parameters::default_values_for_mesh_3::odt_convergence_ratio); + std::size_t max_iteration_number = choose_parameter(get_parameter(np,::CGAL::internal_np::number_of_iterations), 0); + ::CGAL::parameters::internal::Odt_options options(true); + + options.set_time_limit(time_limit); + options.set_bound(freeze_bound); + options.set_convergence(convergence); + options.set_max_iteration_number(max_iteration_number); + typedef Named_function_parameters<::CGAL::parameters::internal::Odt_options, ::CGAL::internal_np::odt_options_param_t, CGAL_NP_BASE> Param; + return CGAL_NP_BUILD(Param,options); +} + +template +Named_function_parameters<::CGAL::parameters::internal::Odt_options, ::CGAL::internal_np::odt_options_param_t, CGAL_NP_BASE> +odt(const CGAL_NP_CLASS& ... nps) +{ + return odt(::CGAL::internal_np::combine_named_parameters(nps...)); +} + +inline Named_function_parameters<::CGAL::parameters::internal::Odt_options, ::CGAL::internal_np::odt_options_param_t, CGAL_NP_BASE> +no_odt() +{ + typedef Named_function_parameters<::CGAL::parameters::internal::Odt_options, ::CGAL::internal_np::odt_options_param_t, CGAL_NP_BASE> Param; + return CGAL_NP_BUILD(Param,::CGAL::parameters::internal::Odt_options(false)); +} + +#ifndef CGAL_NO_DEPRECATED_CODE +CGAL_DEPRECATED +inline +Named_function_parameters<::CGAL::parameters::internal::Odt_options, ::CGAL::internal_np::odt_options_param_t, CGAL_NP_BASE> +odt(double time_limit_, + std::size_t max_iteration_number_ = 0, + double convergence_ = 0.02, + double freeze_bound_ = 0.01, + bool do_freeze_ = true) +{ + return odt(time_limit(time_limit_). + max_iteration_number(max_iteration_number_). + convergence(convergence_). + freeze_bound(freeze_bound_). + do_freeze(do_freeze_)); +} +#endif + +// ----------------------------------- +// Lloyd +// ----------------------------------- +template +Named_function_parameters<::CGAL::parameters::internal::Lloyd_options, ::CGAL::internal_np::lloyd_options_param_t, CGAL_NP_BASE> +lloyd(const CGAL_NP_CLASS& np = parameters::default_values()) +{ + using ::CGAL::parameters::choose_parameter; + using ::CGAL::parameters::get_parameter; + double time_limit = choose_parameter(get_parameter(np,::CGAL::internal_np::maximum_running_time),0); + double freeze_bound = choose_parameter(get_parameter(np,::CGAL::internal_np::vertex_freeze_bound),::CGAL::parameters::default_values_for_mesh_3::lloyd_freeze_ratio); + double convergence = choose_parameter(get_parameter(np,::CGAL::internal_np::convergence_ratio), ::CGAL::parameters::default_values_for_mesh_3::lloyd_convergence_ratio); + std::size_t max_iteration_number = choose_parameter(get_parameter(np,::CGAL::internal_np::number_of_iterations), 0); + ::CGAL::parameters::internal::Lloyd_options options(true); + + options.set_time_limit(time_limit); + options.set_bound(freeze_bound); + options.set_convergence(convergence); + options.set_max_iteration_number(max_iteration_number); + + typedef Named_function_parameters<::CGAL::parameters::internal::Lloyd_options, ::CGAL::internal_np::lloyd_options_param_t, CGAL_NP_BASE> Param; + return CGAL_NP_BUILD(Param, options); +} + +template +Named_function_parameters<::CGAL::parameters::internal::Lloyd_options, ::CGAL::internal_np::lloyd_options_param_t, CGAL_NP_BASE> +lloyd(const CGAL_NP_CLASS& ... nps) +{ + return lloyd(::CGAL::internal_np::combine_named_parameters(nps...)); +} + +inline Named_function_parameters<::CGAL::parameters::internal::Lloyd_options, ::CGAL::internal_np::lloyd_options_param_t, CGAL_NP_BASE> +no_lloyd() +{ + typedef Named_function_parameters<::CGAL::parameters::internal::Lloyd_options, ::CGAL::internal_np::lloyd_options_param_t, CGAL_NP_BASE> Param; + return CGAL_NP_BUILD(Param, ::CGAL::parameters::internal::Lloyd_options(false)); +} + +#ifndef CGAL_NO_DEPRECATED_CODE +CGAL_DEPRECATED +inline +Named_function_parameters<::CGAL::parameters::internal::Lloyd_options, ::CGAL::internal_np::lloyd_options_param_t, CGAL_NP_BASE> +lloyd(double time_limit_, + std::size_t max_iteration_number_ = 0, + double convergence_ = 0.02, + double freeze_bound_ = 0.01, + bool do_freeze_= true) +{ + return lloyd(time_limit(time_limit_). + max_iteration_number(max_iteration_number_). + convergence(convergence_). + freeze_bound(freeze_bound_). + do_freeze(do_freeze_)); +} +#endif + +// ----------------------------------- +// Manifold options +// ----------------------------------- +template +Named_function_parameters<::CGAL::parameters::internal::Manifold_options, ::CGAL::internal_np::manifold_param_t, CGAL_NP_BASE> +manifold_options(const CGAL_NP_CLASS& np = parameters::default_values()) +{ + using ::CGAL::parameters::choose_parameter; + using ::CGAL::parameters::get_parameter; + int mesh_topology = choose_parameter(get_parameter(np, ::CGAL::internal_np::mesh_topology_number), -1); + ::CGAL::parameters::internal::Manifold_options options; + options.mesh_topology = mesh_topology; + + typedef Named_function_parameters<::CGAL::parameters::internal::Manifold_options, ::CGAL::internal_np::manifold_param_t, CGAL_NP_BASE> Param; + return CGAL_NP_BUILD(Param, options); +} + + +template +Named_function_parameters<::CGAL::parameters::internal::Manifold_options, ::CGAL::internal_np::manifold_param_t, CGAL_NP_BASE> +manifold_options(const CGAL_NP_CLASS& ... nps) +{ + return manifold_options(::CGAL::internal_np::combine_named_parameters(nps...)); +} + +inline Named_function_parameters<::CGAL::parameters::internal::Manifold_options, ::CGAL::internal_np::manifold_param_t, CGAL_NP_BASE> +manifold() +{ + typedef Named_function_parameters<::CGAL::parameters::internal::Manifold_options, ::CGAL::internal_np::manifold_param_t, CGAL_NP_BASE> Param; + return CGAL_NP_BUILD(Param, ::CGAL::parameters::internal::Manifold_options(::CGAL::parameters::internal::Manifold_options::MANIFOLD)); +} +inline Named_function_parameters<::CGAL::parameters::internal::Manifold_options, ::CGAL::internal_np::manifold_param_t, CGAL_NP_BASE> +manifold_with_boundary() +{ + typedef Named_function_parameters<::CGAL::parameters::internal::Manifold_options, ::CGAL::internal_np::manifold_param_t, CGAL_NP_BASE> Param; + return CGAL_NP_BUILD(Param,::CGAL::parameters::internal::Manifold_options( + ::CGAL::parameters::internal::Manifold_options::MANIFOLD_WITH_BOUNDARY)); +} +inline Named_function_parameters<::CGAL::parameters::internal::Manifold_options, ::CGAL::internal_np::manifold_param_t, CGAL_NP_BASE> +non_manifold() +{ + typedef Named_function_parameters<::CGAL::parameters::internal::Manifold_options, ::CGAL::internal_np::manifold_param_t, CGAL_NP_BASE> Param; + return CGAL_NP_BUILD(Param, ::CGAL::parameters::internal::Manifold_options(::CGAL::parameters::internal::Manifold_options::NON_MANIFOLD)); +} + +// ----------------------------------- +// Mesh options +// ----------------------------------- + +// Undocumented parameter for refine_mesh_3 and make_mesh_3. +// Allows to dump the mesh at given stage of the mesh generation +// algorithm. +template +Named_function_parameters<::CGAL::parameters::internal::Mesh_3_options, ::CGAL::internal_np::mesh_param_t, CGAL_NP_BASE> +mesh_3_options(const CGAL_NP_CLASS& np = parameters::default_values()) +{ + using ::CGAL::parameters::choose_parameter; + using ::CGAL::parameters::get_parameter; + ::CGAL::parameters::internal::Mesh_3_options options; + + options.dump_after_init_prefix=choose_parameter(get_parameter(np, ::CGAL::internal_np::dump_after_init_prefix_param), ""); + options.dump_after_refine_surface_prefix=choose_parameter(get_parameter(np, ::CGAL::internal_np::dump_after_refine_surface_prefix_param), ""); + options.dump_after_refine_prefix=choose_parameter(get_parameter(np, ::CGAL::internal_np::dump_after_refine_prefix_param), ""); + options.dump_after_glob_opt_prefix=choose_parameter(get_parameter(np, ::CGAL::internal_np::dump_after_glob_opt_prefix_param), ""); + options.dump_after_perturb_prefix=choose_parameter(get_parameter(np, ::CGAL::internal_np::dump_after_perturb_prefix_param), ""); + options.dump_after_exude_prefix=choose_parameter(get_parameter(np, ::CGAL::internal_np::dump_after_refine_surface_prefix_param), ""); + options.number_of_initial_points=choose_parameter(get_parameter(np, ::CGAL::internal_np::number_of_initial_points_param), -1); + options.nonlinear_growth_of_balls = choose_parameter(get_parameter(np, ::CGAL::internal_np::nonlinear_growth_of_balls_param), false); + options.maximal_number_of_vertices=choose_parameter(get_parameter(np, ::CGAL::internal_np::maximal_number_of_vertices_param), 0); + options.pointer_to_error_code=choose_parameter(get_parameter(np, ::CGAL::internal_np::pointer_to_error_code_param), ((Mesh_error_code*)0)); +#ifndef CGAL_NO_ATOMIC + options.pointer_to_stop_atomic_boolean=choose_parameter(get_parameter(np, ::CGAL::internal_np::pointer_to_stop_atomic_boolean_param), + ((::CGAL::parameters::internal::Mesh_3_options::Pointer_to_stop_atomic_boolean_t)0)); +#endif + + typedef Named_function_parameters<::CGAL::parameters::internal::Mesh_3_options, ::CGAL::internal_np::mesh_param_t, CGAL_NP_BASE> Param; + return CGAL_NP_BUILD(Param, options); +} + +template +Named_function_parameters<::CGAL::parameters::internal::Mesh_3_options, ::CGAL::internal_np::mesh_param_t, CGAL_NP_BASE> +mesh_3_options(const CGAL_NP_CLASS& ... nps) +{ + return mesh_3_options(::CGAL::internal_np::combine_named_parameters(nps...)); +} + +// Undocumented parameter for refine_mesh_3 and make_mesh_3. +// Default Mesh_3_options: dump at every stage of the mesh generation. +inline +Named_function_parameters<::CGAL::parameters::internal::Mesh_3_options, ::CGAL::internal_np::mesh_param_t, CGAL_NP_BASE> +mesh_3_dump() +{ + typedef Named_function_parameters<::CGAL::parameters::internal::Mesh_3_options, ::CGAL::internal_np::mesh_param_t, CGAL_NP_BASE> Param; + ::CGAL::parameters::internal::Mesh_3_options options; + + options.dump_after_init_prefix = "mesh_dump_after_init"; + options.dump_after_refine_surface_prefix = "mesh_dump_after_refine_surface"; + options.dump_after_refine_prefix = "mesh_dump_after_refine"; + options.dump_after_glob_opt_prefix = "mesh_dump_after_glob_opt"; + options.dump_after_perturb_prefix = "mesh_dump_after_perturb"; + options.dump_after_exude_prefix = "mesh_dump_after_exude"; + + return CGAL_NP_BUILD(Param, options); +} + +// ----------------------------------- +// Features_options +// ----------------------------------- +inline Named_function_parameters<::CGAL::parameters::internal::Features_options, ::CGAL::internal_np::features_option_param_t, CGAL_NP_BASE> +features() { + typedef Named_function_parameters<::CGAL::parameters::internal::Features_options, ::CGAL::internal_np::features_option_param_t, CGAL_NP_BASE> Param; + return CGAL_NP_BUILD(Param, ::CGAL::parameters::internal::Features_options(true)); +} + +inline Named_function_parameters<::CGAL::parameters::internal::Features_options, ::CGAL::internal_np::features_option_param_t, CGAL_NP_BASE> +no_features() { + typedef Named_function_parameters<::CGAL::parameters::internal::Features_options, ::CGAL::internal_np::features_option_param_t, CGAL_NP_BASE> Param; + return CGAL_NP_BUILD(Param, ::CGAL::parameters::internal::Features_options(false)); } + +template < typename MeshDomain > +inline Named_function_parameters<::CGAL::parameters::internal::Features_options, ::CGAL::internal_np::features_option_param_t, CGAL_NP_BASE> +features(const MeshDomain& /*domain*/) +{ + typedef typename ::CGAL::parameters::internal::Domain_features_generator::value > Generator; + + typedef Named_function_parameters<::CGAL::parameters::internal::Features_options, ::CGAL::internal_np::features_option_param_t, CGAL_NP_BASE> Param; + return CGAL_NP_BUILD(Param,Generator()()); +} diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h index 6e25c8d438a..c5ad5f82e96 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h +++ b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h @@ -261,7 +261,70 @@ CGAL_add_named_parameter(adjust_directions_t, adjust_directions, adjust_directio CGAL_add_named_parameter(segment_t, segment_map, segment_map) // List of named parameters used in Mesh_2 package -CGAL_add_named_parameter(seeds_t, seeds, seeds) -CGAL_add_named_parameter(domain_is_initialized_t, domain_is_initialized, domain_is_initialized) -CGAL_add_named_parameter(seeds_are_in_domain_t, seeds_are_in_domain, seeds_are_in_domain) -CGAL_add_named_parameter(criteria_t, criteria, criteria) +CGAL_add_named_parameter_with_compatibility(seeds_t, seeds, seeds) +CGAL_add_named_parameter_with_compatibility(domain_is_initialized_t, domain_is_initialized, domain_is_initialized) +CGAL_add_named_parameter_with_compatibility(seeds_are_in_domain_t, seeds_are_in_domain, seeds_are_in_domain) +CGAL_add_extra_named_parameter_with_compatibility(seeds_are_in_domain_t, seeds_are_in_domain, mark) +CGAL_add_named_parameter_with_compatibility(criteria_t, criteria, criteria) +CGAL_add_named_parameter_with_compatibility(convergence_ratio_t, convergence_ratio, convergence) +CGAL_add_named_parameter_with_compatibility(vertex_freeze_bound_t, vertex_freeze_bound, freeze_bound) +CGAL_add_named_parameter_with_compatibility(i_seed_begin_iterator_t, i_seed_begin_iterator, seeds_begin) +CGAL_add_named_parameter_with_compatibility(i_seed_end_iterator_t, i_seed_end_iterator, seeds_end) + +//List of named parameters used in exude_mesh_3.h +CGAL_add_named_parameter_with_compatibility(lower_sliver_bound_t,lower_sliver_bound,sliver_bound) +CGAL_add_named_parameter_with_compatibility(freeze_t,freeze,do_freeze) +//List of named parameters used in perturb_mesh_3.h +CGAL_add_named_parameter_with_compatibility(sliver_criteria_t, sliver_criteria, sliver_criterion) +CGAL_add_named_parameter_with_compatibility(perturb_vector_t, perturb_vector, perturbation_vector) + +//List of named parameters used in refine_mesh_3.h +CGAL_add_extra_named_parameter_with_compatibility(number_of_iterations_t, number_of_iterations, max_iteration_number) +CGAL_add_extra_named_parameter_with_compatibility(maximum_running_time_t, maximum_running_time, time_limit) +CGAL_add_named_parameter_with_compatibility(mesh_topology_number_t, mesh_topology_number, mesh_topology) +CGAL_add_named_parameter_with_compatibility(dump_after_init_prefix_param_t, dump_after_init_prefix_param, dump_after_init_prefix) +CGAL_add_named_parameter_with_compatibility(dump_after_refine_surface_prefix_param_t, dump_after_refine_surface_prefix_param, dump_after_refine_surface_prefix) +CGAL_add_named_parameter_with_compatibility(dump_after_refine_prefix_param_t, dump_after_refine_prefix_param, dump_after_refine_prefix) +CGAL_add_named_parameter_with_compatibility(dump_after_glob_opt_prefix_param_t, dump_after_glob_opt_prefix_param, dump_after_glob_opt_prefix) +CGAL_add_named_parameter_with_compatibility(dump_after_perturb_prefix_param_t, dump_after_perturb_prefix_param, dump_after_perturb_prefix) +CGAL_add_named_parameter_with_compatibility(dump_after_exude_prefix_param_t, dump_after_exude_prefix_param, dump_after_exude_prefix) +CGAL_add_named_parameter_with_compatibility(number_of_initial_points_param_t, number_of_initial_points_param, number_of_initial_points) +CGAL_add_named_parameter_with_compatibility(maximal_number_of_vertices_param_t, maximal_number_of_vertices_param, maximal_number_of_vertices) +CGAL_add_named_parameter_with_compatibility(nonlinear_growth_of_balls_param_t, nonlinear_growth_of_balls_param, nonlinear_growth_of_balls) +CGAL_add_named_parameter_with_compatibility(pointer_to_error_code_param_t, pointer_to_error_code_param, pointer_to_error_code) +CGAL_add_named_parameter_with_compatibility(pointer_to_stop_atomic_boolean_param_t, pointer_to_stop_atomic_boolean_param, pointer_to_stop_atomic_boolean) +CGAL_add_named_parameter_with_compatibility(exude_options_param_t, exude_options_param, exude_options) +CGAL_add_named_parameter_with_compatibility(perturb_options_param_t, perturb_options_param, perturb_options) +CGAL_add_named_parameter_with_compatibility(odt_options_param_t, odt_options_param, odt_options) +CGAL_add_named_parameter_with_compatibility(lloyd_options_param_t, lloyd_options_param, lloyd_options) +CGAL_add_named_parameter_with_compatibility(do_reset_c3t3_t, do_reset_c3t3, do_reset_c3t3) +CGAL_add_named_parameter_with_compatibility(mesh_param_t, mesh_param, mesh_options) +CGAL_add_named_parameter_with_compatibility(manifold_param_t, manifold_param, manifold_option) +CGAL_add_named_parameter_with_compatibility(features_option_param_t,features_options_param,features_options) + +CGAL_add_named_parameter_with_compatibility_ref_only(image_3_param_t, image_3_param, image) +CGAL_add_named_parameter_with_compatibility(iso_value_param_t, iso_value_param, iso_value) +CGAL_add_named_parameter_with_compatibility(image_subdomain_index_t, image_subdomain_index, image_values_to_subdomain_indices) +CGAL_add_named_parameter_with_compatibility(voxel_value_t, voxel_value, value_outside) +CGAL_add_named_parameter_with_compatibility(error_bound_t, error_bound, relative_error_bound) +CGAL_add_named_parameter_with_compatibility(rng_t, rng, p_rng) +CGAL_add_named_parameter_with_compatibility(null_subdomain_index_param_t,null_subdomain_index_param, null_subdomain_index) +CGAL_add_named_parameter_with_compatibility(surface_patch_index_t, surface_patch_index, construct_surface_patch_index) +CGAL_add_named_parameter_with_compatibility_ref_only(weights_param_t, weights_param, weights) + +CGAL_add_named_parameter_with_compatibility(edge_size_param_t, edge_size_param, edge_size) +CGAL_add_named_parameter_with_compatibility_ref_only(edge_sizing_field_param_t, edge_sizing_field_param, edge_sizing_field) +CGAL_add_named_parameter_with_compatibility(facet_angle_param_t, facet_angle_param, facet_angle) +CGAL_add_named_parameter_with_compatibility(facet_size_param_t, facet_size_param, facet_size) +CGAL_add_named_parameter_with_compatibility_ref_only(facet_sizing_field_param_t, facet_sizing_field_param, facet_sizing_field) +CGAL_add_named_parameter_with_compatibility_ref_only(facet_distance_param_t, facet_distance_param, facet_distance) +CGAL_add_named_parameter_with_compatibility(facet_topology_param_t, facet_topology_param, facet_topology) +CGAL_add_named_parameter_with_compatibility(cell_radius_edge_param_t, cell_radius_edge_param, cell_radius_edge) +CGAL_add_named_parameter_with_compatibility(cell_radius_edge_ratio_param_t, cell_radius_edge_ratio_param, cell_radius_edge_ratio) +CGAL_add_named_parameter_with_compatibility(cell_size_param_t, cell_size_param, cell_size) +CGAL_add_named_parameter_with_compatibility_ref_only(cell_sizing_field_param_t, cell_sizing_field_param, cell_sizing_field) +CGAL_add_named_parameter_with_compatibility_ref_only(sizing_field_param_t, sizing_field_param, sizing_field) + +CGAL_add_named_parameter_with_compatibility(function_param_t, function_param, function) +CGAL_add_named_parameter_with_compatibility(bounding_object_param_t, bounding_object_param, bounding_object) + diff --git a/STL_Extension/include/CGAL/assertions.h b/STL_Extension/include/CGAL/assertions.h index 45d513d9f5f..b9e145ec9e7 100644 --- a/STL_Extension/include/CGAL/assertions.h +++ b/STL_Extension/include/CGAL/assertions.h @@ -44,6 +44,31 @@ # define CGAL_NO_WARNINGS #endif +#if defined(CGAL_ENABLE_DISABLE_ASSERTIONS_AT_RUNTIME) + +#include +namespace CGAL{ +inline bool& get_use_assertions() +{ + CGAL_STATIC_THREAD_LOCAL_VARIABLE(bool, b, true); + return b; +} +inline void set_use_assertions(bool b) +{ + get_use_assertions() = b; +} +} + +#else + +namespace CGAL{ +inline void set_use_assertions(bool){} +inline constexpr bool get_use_assertions(){return true;} +} + +#endif + + namespace CGAL { // function declarations @@ -89,18 +114,18 @@ inline bool possibly(Uncertain c); #else // no CGAL_NO_ASSERTIONS # define CGAL_ASSERTIONS_ENABLED true # define CGAL_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) # if __cpp_lib_uncaught_exceptions || ( _MSVC_LANG >= 201703L ) // C++17 # define CGAL_destructor_assertion(EX) \ - (CGAL::possibly(EX)||(std::uncaught_exceptions() > 0)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX)||(std::uncaught_exceptions() > 0))?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) # define CGAL_destructor_assertion_catch(CODE) try{ CODE } catch(...) { if(std::uncaught_exceptions() <= 0) throw; } # else // use C++03 `std::uncaught_exception()` # define CGAL_destructor_assertion(EX) \ - (CGAL::possibly(EX)||std::uncaught_exception()?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX)||std::uncaught_exception())?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) # define CGAL_destructor_assertion_catch(CODE) try{ CODE } catch(...) { if(!std::uncaught_exception()) throw; } # endif // use C++03 `std::uncaught_exception()` # define CGAL_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) # define CGAL_assertion_code(CODE) CODE # define CGAL_assume(EX) CGAL_assertion(EX) # define CGAL_assume_code(CODE) CGAL_assertion_code(CODE) @@ -124,9 +149,9 @@ inline bool possibly(Uncertain c); # define CGAL_exactness_assertion_code(CODE) #else # define CGAL_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) # define CGAL_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) # define CGAL_exactness_assertion_code(CODE) CODE #endif // CGAL_NO_ASSERTIONS @@ -136,9 +161,9 @@ inline bool possibly(Uncertain c); # define CGAL_expensive_assertion_code(CODE) #else # define CGAL_expensive_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) # define CGAL_expensive_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) # define CGAL_expensive_assertion_code(CODE) CODE #endif // CGAL_NO_ASSERTIONS @@ -148,9 +173,9 @@ inline bool possibly(Uncertain c); # define CGAL_expensive_exactness_assertion_code(CODE) #else # define CGAL_expensive_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) # define CGAL_expensive_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) # define CGAL_expensive_exactness_assertion_code(CODE) CODE #endif // CGAL_NO_ASSERTIONS @@ -166,9 +191,9 @@ inline bool possibly(Uncertain c); #else # define CGAL_PRECONDITIONS_ENABLED true # define CGAL_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) # define CGAL_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) # define CGAL_precondition_code(CODE) CODE #endif // CGAL_NO_PRECONDITIONS @@ -178,9 +203,9 @@ inline bool possibly(Uncertain c); # define CGAL_exactness_precondition_code(CODE) #else # define CGAL_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) # define CGAL_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) # define CGAL_exactness_precondition_code(CODE) CODE #endif // CGAL_NO_PRECONDITIONS @@ -190,9 +215,9 @@ inline bool possibly(Uncertain c); # define CGAL_expensive_precondition_code(CODE) #else # define CGAL_expensive_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) # define CGAL_expensive_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) # define CGAL_expensive_precondition_code(CODE) CODE #endif // CGAL_NO_PRECONDITIONS @@ -202,9 +227,9 @@ inline bool possibly(Uncertain c); # define CGAL_expensive_exactness_precondition_code(CODE) #else # define CGAL_expensive_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) # define CGAL_expensive_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) # define CGAL_expensive_exactness_precondition_code(CODE) CODE #endif // CGAL_NO_PRECONDITIONS @@ -218,9 +243,9 @@ inline bool possibly(Uncertain c); # define CGAL_postcondition_code(CODE) #else # define CGAL_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) # define CGAL_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) # define CGAL_postcondition_code(CODE) CODE #endif // CGAL_NO_POSTCONDITIONS @@ -230,9 +255,9 @@ inline bool possibly(Uncertain c); # define CGAL_exactness_postcondition_code(CODE) #else # define CGAL_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) # define CGAL_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) # define CGAL_exactness_postcondition_code(CODE) CODE #endif // CGAL_NO_POSTCONDITIONS @@ -242,9 +267,9 @@ inline bool possibly(Uncertain c); # define CGAL_expensive_postcondition_code(CODE) #else # define CGAL_expensive_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) # define CGAL_expensive_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) # define CGAL_expensive_postcondition_code(CODE) CODE #endif // CGAL_NO_POSTCONDITIONS @@ -254,9 +279,9 @@ inline bool possibly(Uncertain c); # define CGAL_expensive_exactness_postcondition_code(CODE) #else # define CGAL_expensive_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) # define CGAL_expensive_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) # define CGAL_expensive_exactness_postcondition_code(CODE) CODE #endif // CGAL_NO_POSTCONDITIONS @@ -271,16 +296,16 @@ inline bool possibly(Uncertain c); # define CGAL_warning_code(CODE) #else # define CGAL_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) # if __cpp_lib_uncaught_exceptions || ( _MSVC_LANG >= 201703L ) // C++17 # define CGAL_destructor_warning(EX) \ - (CGAL::possibly(EX)||(std::uncaught_exceptions() > 0)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX)||(std::uncaught_exceptions() > 0))?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) # else // use C++03 `std::uncaught_exception()` # define CGAL_destructor_warning(EX) \ - (CGAL::possibly(EX)||std::uncaught_exception()?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX)||std::uncaught_exception())?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) # endif // use C++03 `std::uncaught_exception()` # define CGAL_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) # define CGAL_warning_code(CODE) CODE #endif // CGAL_NO_WARNINGS @@ -290,9 +315,9 @@ inline bool possibly(Uncertain c); # define CGAL_exactness_warning_code(CODE) #else # define CGAL_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) # define CGAL_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) # define CGAL_exactness_warning_code(CODE) CODE #endif // CGAL_NO_WARNINGS @@ -302,9 +327,9 @@ inline bool possibly(Uncertain c); # define CGAL_expensive_warning_code(CODE) #else # define CGAL_expensive_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) # define CGAL_expensive_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) # define CGAL_expensive_warning_code(CODE) CODE #endif // CGAL_NO_WARNINGS @@ -314,9 +339,9 @@ inline bool possibly(Uncertain c); # define CGAL_expensive_exactness_warning_code(CODE) #else # define CGAL_expensive_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) # define CGAL_expensive_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) + ((!CGAL::get_use_assertions() || CGAL::possibly(EX))?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) # define CGAL_expensive_exactness_warning_code(CODE) CODE #endif // CGAL_NO_WARNINGS diff --git a/STL_Extension/include/CGAL/multiset_assertions.h b/STL_Extension/include/CGAL/multiset_assertions.h deleted file mode 100644 index 894accd47fc..00000000000 --- a/STL_Extension/include/CGAL/multiset_assertions.h +++ /dev/null @@ -1,337 +0,0 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). All rights reserved. -// -// This file is part of CGAL (www.cgal.org) -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Geert-Jan Giezeman, Sven Schoenherr -// -// Generated from script create_assertions.sh - - -// Note that this header file is intentionnaly not protected with a -// macro (as ). Calling it a second time with another value -// for CGAL_NO_ASSERTIONS for example must make a difference. - -#include - -// macro definitions -// ================= -// assertions -// ---------- - -#undef CGAL_multiset_assertion -#undef CGAL_multiset_assertion_msg -#undef CGAL_multiset_assertion_code - -#if defined(CGAL_MULTISET_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) -# define CGAL_multiset_assertion(EX) (static_cast(0)) -# define CGAL_multiset_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_multiset_assertion_code(CODE) -#else -# define CGAL_multiset_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_multiset_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_multiset_assertion_code(CODE) CODE -# define CGAL_multiset_assertions 1 -#endif // CGAL_MULTISET_NO_ASSERTIONS - - -#undef CGAL_multiset_exactness_assertion -#undef CGAL_multiset_exactness_assertion_msg -#undef CGAL_multiset_exactness_assertion_code - -#if defined(CGAL_MULTISET_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_multiset_exactness_assertion(EX) (static_cast(0)) -# define CGAL_multiset_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_multiset_exactness_assertion_code(CODE) -#else -# define CGAL_multiset_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_multiset_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_multiset_exactness_assertion_code(CODE) CODE -# define CGAL_multiset_exactness_assertions 1 -#endif // CGAL_MULTISET_NO_ASSERTIONS - - -#undef CGAL_multiset_expensive_assertion -#undef CGAL_multiset_expensive_assertion_msg -#undef CGAL_multiset_expensive_assertion_code - -#if defined(CGAL_MULTISET_NO_ASSERTIONS) \ - || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_multiset_expensive_assertion(EX) (static_cast(0)) -# define CGAL_multiset_expensive_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_multiset_expensive_assertion_code(CODE) -#else -# define CGAL_multiset_expensive_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_multiset_expensive_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_multiset_expensive_assertion_code(CODE) CODE -# define CGAL_multiset_expensive_assertions 1 -#endif // CGAL_MULTISET_NO_ASSERTIONS - - -#undef CGAL_multiset_expensive_exactness_assertion -#undef CGAL_multiset_expensive_exactness_assertion_msg -#undef CGAL_multiset_expensive_exactness_assertion_code - -#if defined(CGAL_MULTISET_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_multiset_expensive_exactness_assertion(EX) (static_cast(0)) -# define CGAL_multiset_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_multiset_expensive_exactness_assertion_code(CODE) -#else -# define CGAL_multiset_expensive_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_multiset_expensive_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_multiset_expensive_exactness_assertion_code(CODE) CODE -# define CGAL_multiset_expensive_exactness_assertions 1 -#endif // CGAL_MULTISET_NO_ASSERTIONS - - -// preconditions -// ------------- - -#undef CGAL_multiset_precondition -#undef CGAL_multiset_precondition_msg -#undef CGAL_multiset_precondition_code - -#if defined(CGAL_MULTISET_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) -# define CGAL_multiset_precondition(EX) (static_cast(0)) -# define CGAL_multiset_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_multiset_precondition_code(CODE) -#else -# define CGAL_multiset_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_multiset_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_multiset_precondition_code(CODE) CODE -# define CGAL_multiset_preconditions 1 -#endif // CGAL_MULTISET_NO_PRECONDITIONS - - -#undef CGAL_multiset_exactness_precondition -#undef CGAL_multiset_exactness_precondition_msg -#undef CGAL_multiset_exactness_precondition_code - -#if defined(CGAL_MULTISET_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_multiset_exactness_precondition(EX) (static_cast(0)) -# define CGAL_multiset_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_multiset_exactness_precondition_code(CODE) -#else -# define CGAL_multiset_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_multiset_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_multiset_exactness_precondition_code(CODE) CODE -# define CGAL_multiset_exactness_preconditions 1 -#endif // CGAL_MULTISET_NO_PRECONDITIONS - - -#undef CGAL_multiset_expensive_precondition -#undef CGAL_multiset_expensive_precondition_msg -#undef CGAL_multiset_expensive_precondition_code - -#if defined(CGAL_MULTISET_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_multiset_expensive_precondition(EX) (static_cast(0)) -# define CGAL_multiset_expensive_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_multiset_expensive_precondition_code(CODE) -#else -# define CGAL_multiset_expensive_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_multiset_expensive_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_multiset_expensive_precondition_code(CODE) CODE -# define CGAL_multiset_expensive_preconditions 1 -#endif // CGAL_MULTISET_NO_PRECONDITIONS - - -#undef CGAL_multiset_expensive_exactness_precondition -#undef CGAL_multiset_expensive_exactness_precondition_msg -#undef CGAL_multiset_expensive_exactness_precondition_code - -#if defined(CGAL_MULTISET_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_multiset_expensive_exactness_precondition(EX) (static_cast(0)) -# define CGAL_multiset_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_multiset_expensive_exactness_precondition_code(CODE) -#else -# define CGAL_multiset_expensive_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_multiset_expensive_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_multiset_expensive_exactness_precondition_code(CODE) CODE -# define CGAL_multiset_expensive_exactness_preconditions 1 -#endif // CGAL_MULTISET_NO_PRECONDITIONS - - -// postconditions -// -------------- - -#undef CGAL_multiset_postcondition -#undef CGAL_multiset_postcondition_msg -#undef CGAL_multiset_postcondition_code - -#if defined(CGAL_MULTISET_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) -# define CGAL_multiset_postcondition(EX) (static_cast(0)) -# define CGAL_multiset_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_multiset_postcondition_code(CODE) -#else -# define CGAL_multiset_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_multiset_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_multiset_postcondition_code(CODE) CODE -# define CGAL_multiset_postconditions 1 -#endif // CGAL_MULTISET_NO_POSTCONDITIONS - - -#undef CGAL_multiset_exactness_postcondition -#undef CGAL_multiset_exactness_postcondition_msg -#undef CGAL_multiset_exactness_postcondition_code - -#if defined(CGAL_MULTISET_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_multiset_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_multiset_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_multiset_exactness_postcondition_code(CODE) -#else -# define CGAL_multiset_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_multiset_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_multiset_exactness_postcondition_code(CODE) CODE -# define CGAL_multiset_exactness_postconditions 1 -#endif // CGAL_MULTISET_NO_POSTCONDITIONS - - -#undef CGAL_multiset_expensive_postcondition -#undef CGAL_multiset_expensive_postcondition_msg -#undef CGAL_multiset_expensive_postcondition_code - -#if defined(CGAL_MULTISET_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_multiset_expensive_postcondition(EX) (static_cast(0)) -# define CGAL_multiset_expensive_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_multiset_expensive_postcondition_code(CODE) -#else -# define CGAL_multiset_expensive_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_multiset_expensive_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_multiset_expensive_postcondition_code(CODE) CODE -# define CGAL_multiset_expensive_postconditions 1 -#endif // CGAL_MULTISET_NO_POSTCONDITIONS - - -#undef CGAL_multiset_expensive_exactness_postcondition -#undef CGAL_multiset_expensive_exactness_postcondition_msg -#undef CGAL_multiset_expensive_exactness_postcondition_code - -#if defined(CGAL_MULTISET_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_multiset_expensive_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_multiset_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_multiset_expensive_exactness_postcondition_code(CODE) -#else -# define CGAL_multiset_expensive_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_multiset_expensive_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_multiset_expensive_exactness_postcondition_code(CODE) CODE -# define CGAL_multiset_expensive_exactness_postconditions 1 -#endif // CGAL_MULTISET_NO_POSTCONDITIONS - - -// warnings -// -------- - -#undef CGAL_multiset_warning -#undef CGAL_multiset_warning_msg -#undef CGAL_multiset_warning_code - -#if defined(CGAL_MULTISET_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) -# define CGAL_multiset_warning(EX) (static_cast(0)) -# define CGAL_multiset_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_multiset_warning_code(CODE) -#else -# define CGAL_multiset_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_multiset_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_multiset_warning_code(CODE) CODE -# define CGAL_multiset_warnings 1 -#endif // CGAL_MULTISET_NO_WARNINGS - - -#undef CGAL_multiset_exactness_warning -#undef CGAL_multiset_exactness_warning_msg -#undef CGAL_multiset_exactness_warning_code - -#if defined(CGAL_MULTISET_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_multiset_exactness_warning(EX) (static_cast(0)) -# define CGAL_multiset_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_multiset_exactness_warning_code(CODE) -#else -# define CGAL_multiset_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_multiset_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_multiset_exactness_warning_code(CODE) CODE -# define CGAL_multiset_exactness_warnings 1 -#endif // CGAL_MULTISET_NO_WARNINGS - - -#undef CGAL_multiset_expensive_warning -#undef CGAL_multiset_expensive_warning_msg -#undef CGAL_multiset_expensive_warning_code - -#if defined(CGAL_MULTISET_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_multiset_expensive_warning(EX) (static_cast(0)) -# define CGAL_multiset_expensive_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_multiset_expensive_warning_code(CODE) -#else -# define CGAL_multiset_expensive_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_multiset_expensive_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_multiset_expensive_warning_code(CODE) CODE -# define CGAL_multiset_expensive_warnings 1 -#endif // CGAL_MULTISET_NO_WARNINGS - - -#undef CGAL_multiset_expensive_exactness_warning -#undef CGAL_multiset_expensive_exactness_warning_msg -#undef CGAL_multiset_expensive_exactness_warning_code - -#if defined(CGAL_MULTISET_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_multiset_expensive_exactness_warning(EX) (static_cast(0)) -# define CGAL_multiset_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_multiset_expensive_exactness_warning_code(CODE) -#else -# define CGAL_multiset_expensive_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_multiset_expensive_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_multiset_expensive_exactness_warning_code(CODE) CODE -# define CGAL_multiset_expensive_exactness_warnings 1 -#endif // CGAL_MULTISET_NO_WARNINGS diff --git a/STL_Extension/include/CGAL/triangulation_assertions.h b/STL_Extension/include/CGAL/triangulation_assertions.h deleted file mode 100644 index 07c7c80e72f..00000000000 --- a/STL_Extension/include/CGAL/triangulation_assertions.h +++ /dev/null @@ -1,339 +0,0 @@ -// Copyright (c) 2001 INRIA Sophia-Antipolis (France). All rights reserved. -// -// This file is part of CGAL (www.cgal.org) -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Geert-Jan Giezeman, Sven Schoenherr -// -// Generated from script create_assertions.sh - - -// Note that this header file is intentionnaly not protected with a -// macro (as ). Calling it a second time with another value -// for CGAL_NO_ASSERTIONS for example must make a difference. - -#include - -// macro definitions -// ================= -// assertions -// ---------- - -#undef CGAL_triangulation_assertion -#undef CGAL_triangulation_assertion_msg -#undef CGAL_triangulation_assertion_code - -#if defined(CGAL_TRIANGULATION_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) -# define CGAL_triangulation_assertion(EX) (static_cast(0)) - - -# define CGAL_triangulation_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_triangulation_assertion_code(CODE) -#else -# define CGAL_triangulation_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_triangulation_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_triangulation_assertion_code(CODE) CODE -# define CGAL_triangulation_assertions 1 -#endif // CGAL_TRIANGULATION_NO_ASSERTIONS - - -#undef CGAL_triangulation_exactness_assertion -#undef CGAL_triangulation_exactness_assertion_msg -#undef CGAL_triangulation_exactness_assertion_code - -#if defined(CGAL_TRIANGULATION_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_triangulation_exactness_assertion(EX) (static_cast(0)) -# define CGAL_triangulation_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_triangulation_exactness_assertion_code(CODE) -#else -# define CGAL_triangulation_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_triangulation_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_triangulation_exactness_assertion_code(CODE) CODE -# define CGAL_triangulation_exactness_assertions 1 -#endif // CGAL_TRIANGULATION_NO_ASSERTIONS - - -#undef CGAL_triangulation_expensive_assertion -#undef CGAL_triangulation_expensive_assertion_msg -#undef CGAL_triangulation_expensive_assertion_code - -#if defined(CGAL_TRIANGULATION_NO_ASSERTIONS) \ - || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_triangulation_expensive_assertion(EX) (static_cast(0)) -# define CGAL_triangulation_expensive_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_triangulation_expensive_assertion_code(CODE) -#else -# define CGAL_triangulation_expensive_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_triangulation_expensive_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_triangulation_expensive_assertion_code(CODE) CODE -# define CGAL_triangulation_expensive_assertions 1 -#endif // CGAL_TRIANGULATION_NO_ASSERTIONS - - -#undef CGAL_triangulation_expensive_exactness_assertion -#undef CGAL_triangulation_expensive_exactness_assertion_msg -#undef CGAL_triangulation_expensive_exactness_assertion_code - -#if defined(CGAL_TRIANGULATION_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_triangulation_expensive_exactness_assertion(EX) (static_cast(0)) -# define CGAL_triangulation_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_triangulation_expensive_exactness_assertion_code(CODE) -#else -# define CGAL_triangulation_expensive_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_triangulation_expensive_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_triangulation_expensive_exactness_assertion_code(CODE) CODE -# define CGAL_triangulation_expensive_exactness_assertions 1 -#endif // CGAL_TRIANGULATION_NO_ASSERTIONS - - -// preconditions -// ------------- - -#undef CGAL_triangulation_precondition -#undef CGAL_triangulation_precondition_msg -#undef CGAL_triangulation_precondition_code - -#if defined(CGAL_TRIANGULATION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) -# define CGAL_triangulation_precondition(EX) (static_cast(0)) -# define CGAL_triangulation_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_triangulation_precondition_code(CODE) -#else -# define CGAL_triangulation_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_triangulation_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_triangulation_precondition_code(CODE) CODE -# define CGAL_triangulation_preconditions 1 -#endif // CGAL_TRIANGULATION_NO_PRECONDITIONS - - -#undef CGAL_triangulation_exactness_precondition -#undef CGAL_triangulation_exactness_precondition_msg -#undef CGAL_triangulation_exactness_precondition_code - -#if defined(CGAL_TRIANGULATION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_triangulation_exactness_precondition(EX) (static_cast(0)) -# define CGAL_triangulation_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_triangulation_exactness_precondition_code(CODE) -#else -# define CGAL_triangulation_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_triangulation_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_triangulation_exactness_precondition_code(CODE) CODE -# define CGAL_triangulation_exactness_preconditions 1 -#endif // CGAL_TRIANGULATION_NO_PRECONDITIONS - - -#undef CGAL_triangulation_expensive_precondition -#undef CGAL_triangulation_expensive_precondition_msg -#undef CGAL_triangulation_expensive_precondition_code - -#if defined(CGAL_TRIANGULATION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_triangulation_expensive_precondition(EX) (static_cast(0)) -# define CGAL_triangulation_expensive_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_triangulation_expensive_precondition_code(CODE) -#else -# define CGAL_triangulation_expensive_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_triangulation_expensive_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_triangulation_expensive_precondition_code(CODE) CODE -# define CGAL_triangulation_expensive_preconditions 1 -#endif // CGAL_TRIANGULATION_NO_PRECONDITIONS - - -#undef CGAL_triangulation_expensive_exactness_precondition -#undef CGAL_triangulation_expensive_exactness_precondition_msg -#undef CGAL_triangulation_expensive_exactness_precondition_code - -#if defined(CGAL_TRIANGULATION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_triangulation_expensive_exactness_precondition(EX) (static_cast(0)) -# define CGAL_triangulation_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_triangulation_expensive_exactness_precondition_code(CODE) -#else -# define CGAL_triangulation_expensive_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_triangulation_expensive_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_triangulation_expensive_exactness_precondition_code(CODE) CODE -# define CGAL_triangulation_expensive_exactness_preconditions 1 -#endif // CGAL_TRIANGULATION_NO_PRECONDITIONS - - -// postconditions -// -------------- - -#undef CGAL_triangulation_postcondition -#undef CGAL_triangulation_postcondition_msg -#undef CGAL_triangulation_postcondition_code - -#if defined(CGAL_TRIANGULATION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) -# define CGAL_triangulation_postcondition(EX) (static_cast(0)) -# define CGAL_triangulation_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_triangulation_postcondition_code(CODE) -#else -# define CGAL_triangulation_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_triangulation_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_triangulation_postcondition_code(CODE) CODE -# define CGAL_triangulation_postconditions 1 -#endif // CGAL_TRIANGULATION_NO_POSTCONDITIONS - - -#undef CGAL_triangulation_exactness_postcondition -#undef CGAL_triangulation_exactness_postcondition_msg -#undef CGAL_triangulation_exactness_postcondition_code - -#if defined(CGAL_TRIANGULATION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_triangulation_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_triangulation_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_triangulation_exactness_postcondition_code(CODE) -#else -# define CGAL_triangulation_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_triangulation_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_triangulation_exactness_postcondition_code(CODE) CODE -# define CGAL_triangulation_exactness_postconditions 1 -#endif // CGAL_TRIANGULATION_NO_POSTCONDITIONS - - -#undef CGAL_triangulation_expensive_postcondition -#undef CGAL_triangulation_expensive_postcondition_msg -#undef CGAL_triangulation_expensive_postcondition_code - -#if defined(CGAL_TRIANGULATION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_triangulation_expensive_postcondition(EX) (static_cast(0)) -# define CGAL_triangulation_expensive_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_triangulation_expensive_postcondition_code(CODE) -#else -# define CGAL_triangulation_expensive_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_triangulation_expensive_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_triangulation_expensive_postcondition_code(CODE) CODE -# define CGAL_triangulation_expensive_postconditions 1 -#endif // CGAL_TRIANGULATION_NO_POSTCONDITIONS - - -#undef CGAL_triangulation_expensive_exactness_postcondition -#undef CGAL_triangulation_expensive_exactness_postcondition_msg -#undef CGAL_triangulation_expensive_exactness_postcondition_code - -#if defined(CGAL_TRIANGULATION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_triangulation_expensive_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_triangulation_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_triangulation_expensive_exactness_postcondition_code(CODE) -#else -# define CGAL_triangulation_expensive_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_triangulation_expensive_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_triangulation_expensive_exactness_postcondition_code(CODE) CODE -# define CGAL_triangulation_expensive_exactness_postconditions 1 -#endif // CGAL_TRIANGULATION_NO_POSTCONDITIONS - - -// warnings -// -------- - -#undef CGAL_triangulation_warning -#undef CGAL_triangulation_warning_msg -#undef CGAL_triangulation_warning_code - -#if defined(CGAL_TRIANGULATION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) -# define CGAL_triangulation_warning(EX) (static_cast(0)) -# define CGAL_triangulation_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_triangulation_warning_code(CODE) -#else -# define CGAL_triangulation_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_triangulation_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_triangulation_warning_code(CODE) CODE -# define CGAL_triangulation_warnings 1 -#endif // CGAL_TRIANGULATION_NO_WARNINGS - - -#undef CGAL_triangulation_exactness_warning -#undef CGAL_triangulation_exactness_warning_msg -#undef CGAL_triangulation_exactness_warning_code - -#if defined(CGAL_TRIANGULATION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_triangulation_exactness_warning(EX) (static_cast(0)) -# define CGAL_triangulation_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_triangulation_exactness_warning_code(CODE) -#else -# define CGAL_triangulation_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_triangulation_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_triangulation_exactness_warning_code(CODE) CODE -# define CGAL_triangulation_exactness_warnings 1 -#endif // CGAL_TRIANGULATION_NO_WARNINGS - - -#undef CGAL_triangulation_expensive_warning -#undef CGAL_triangulation_expensive_warning_msg -#undef CGAL_triangulation_expensive_warning_code - -#if defined(CGAL_TRIANGULATION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_triangulation_expensive_warning(EX) (static_cast(0)) -# define CGAL_triangulation_expensive_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_triangulation_expensive_warning_code(CODE) -#else -# define CGAL_triangulation_expensive_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_triangulation_expensive_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_triangulation_expensive_warning_code(CODE) CODE -# define CGAL_triangulation_expensive_warnings 1 -#endif // CGAL_TRIANGULATION_NO_WARNINGS - - -#undef CGAL_triangulation_expensive_exactness_warning -#undef CGAL_triangulation_expensive_exactness_warning_msg -#undef CGAL_triangulation_expensive_exactness_warning_code - -#if defined(CGAL_TRIANGULATION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_triangulation_expensive_exactness_warning(EX) (static_cast(0)) -# define CGAL_triangulation_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_triangulation_expensive_exactness_warning_code(CODE) -#else -# define CGAL_triangulation_expensive_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_triangulation_expensive_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_triangulation_expensive_exactness_warning_code(CODE) CODE -# define CGAL_triangulation_expensive_exactness_warnings 1 -#endif // CGAL_TRIANGULATION_NO_WARNINGS diff --git a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Alpha_shape_mesher.h b/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Alpha_shape_mesher.h index 7cfdb245391..2a55578de06 100644 --- a/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Alpha_shape_mesher.h +++ b/Scale_space_reconstruction_3/include/CGAL/Scale_space_reconstruction_3/Alpha_shape_mesher.h @@ -559,9 +559,6 @@ private: { std::set done; - unsigned int nb_facets_removed = 0; - - unsigned int nb_skipped = 0; for (Cell_iterator cit = _shape->cells_begin (); cit != _shape->cells_end (); ++ cit) { if (_shape->is_infinite (cit)) @@ -702,7 +699,6 @@ private: } else { - nb_facets_removed ++; mark_handled (f); _garbage.push_back (ordered_facet_indices (f)); } @@ -716,7 +712,6 @@ private: } else { - nb_facets_removed ++; mark_handled (_shape->mirror_facet (f)); _garbage.push_back (ordered_facet_indices (_shape->mirror_facet (f))); } @@ -782,7 +777,6 @@ private: // If number of layers is != 2, ignore volume and discard bubble if (layer != 1) { - nb_skipped ++; for (unsigned int i = 0; i < 2; ++ i) for (typename std::set::iterator fit = _bubbles.back()[i].begin (); fit != _bubbles.back()[i].end (); ++ fit) @@ -790,7 +784,6 @@ private: mark_handled (*fit); _map_f2b.erase (*fit); _garbage.push_back (ordered_facet_indices (*fit)); - nb_facets_removed ++; } _bubbles.pop_back (); } @@ -805,10 +798,6 @@ private: typedef std::map, std::set > Edge_shell_map_triples; typedef typename Edge_shell_map_triples::iterator Edge_shell_map_triples_iterator; - unsigned int nb_facets_removed = 0; - - unsigned int nb_nm_edges = 0; - // Store for each pair edge/shell the incident facets Edge_shell_map_triples eshell_triples; std::map map_t2f; @@ -841,8 +830,6 @@ private: if (eit->second.size () < 3) continue; - ++ nb_nm_edges; - Facet_iterator tit = _shells[eit->first.second]; Facet_iterator end = (eit->first.second == _shells.size () - 1) ? _surface.end () : _shells[eit->first.second + 1]; @@ -863,7 +850,6 @@ private: _map_f2s.erase (map_t2f[*current]); _surface.erase (current); - ++ nb_facets_removed; eit->second.erase (search); } @@ -931,14 +917,12 @@ private: _surface.splice(end, tmp, tmp.begin(), tmp.end()); } - unsigned int nb_facets_removed = 0; unsigned int nb_nm_vertices = 0; // Removing facets to fix non-manifold vertices might make some other vertices // become non-manifold, therefore we iterate until no facet needs to be removed. do { nb_nm_vertices = 0; - nb_facets_removed = 0; // Store for each pair vertex/shell the incident facets Vertex_shell_map_facets vshell_facets; @@ -1052,7 +1036,6 @@ private: _garbage.push_back (*current); _surface.erase (current); - ++ nb_facets_removed; ++ tindex; } diff --git a/Scripts/scripts/cgal_create_cmake_script b/Scripts/scripts/cgal_create_cmake_script index 33d1826bf86..a7a22294904 100755 --- a/Scripts/scripts/cgal_create_cmake_script +++ b/Scripts/scripts/cgal_create_cmake_script @@ -38,15 +38,15 @@ find_package(CGAL REQUIRED QUIET OPTIONAL_COMPONENTS Core ) EOF if [ -d "${SOURCE_DIR}" ] ; then - echo " set(CGAL_CURRENT_SOURCE_DIR \"${SOURCE_DIR}\")" + echo "set(CGAL_CURRENT_SOURCE_DIR \"${SOURCE_DIR}\")" echo fi if [ -d "${SOURCE_DIR}../include" ] ; then - echo " include_directories (BEFORE \"${SOURCE_DIR}../include\")" + echo "include_directories (BEFORE \"${SOURCE_DIR}../include\")" echo fi if [ -d "${SOURCE_DIR}include" ] ; then - echo " include_directories (BEFORE \"${SOURCE_DIR}include\")" + echo "include_directories (BEFORE \"${SOURCE_DIR}include\")" echo fi diff --git a/SearchStructures/include/CGAL/Range_tree_d.h b/SearchStructures/include/CGAL/Range_tree_d.h index 17f28b8383b..0a1cae56d43 100644 --- a/SearchStructures/include/CGAL/Range_tree_d.h +++ b/SearchStructures/include/CGAL/Range_tree_d.h @@ -222,18 +222,18 @@ protected: link_type vleft = new Range_tree_node2( 0, 0, (*current), m_interface.get_key(*current) ); //CGAL_NIL CGAL_NIL first two arguments - CGAL_Tree_assertion( vleft != 0); + CGAL_assertion( vleft != 0); ++current; link_type vright = new Range_tree_node2( 0,0, (*current), m_interface.get_key(*current) ); //CGAL_NIL CGAL_NIL first two arguments - CGAL_Tree_assertion( vright != 0); + CGAL_assertion( vright != 0); current++; sublevel_last = current; link_type vparent = new Range_tree_node2( vleft, vright, vleft->key ); - CGAL_Tree_assertion( vparent != 0); + CGAL_assertion( vparent != 0); vleft->parent_link = vparent; vright->parent_link = vparent; @@ -260,7 +260,7 @@ protected: link_type vright = new Range_tree_node2( 0, 0, (*current), m_interface.get_key(*current) ); //CGAL_NIL CGAL_NIL first two arguments - CGAL_Tree_assertion( vright != 0); //CGAL_NIL + CGAL_assertion( vright != 0); //CGAL_NIL current++; sublevel_last = current; prevchild = vright; @@ -276,7 +276,7 @@ protected: link_type vparent = new Range_tree_node2( prevchild, 0, rightchild->key ); //CGAL_NIL argument - CGAL_Tree_assertion( vparent != 0); + CGAL_assertion( vparent != 0); prevchild->parent_link = vparent; diff --git a/SearchStructures/include/CGAL/Segment_tree_d.h b/SearchStructures/include/CGAL/Segment_tree_d.h index e116f5f9c0c..732a9596f91 100644 --- a/SearchStructures/include/CGAL/Segment_tree_d.h +++ b/SearchStructures/include/CGAL/Segment_tree_d.h @@ -533,9 +533,9 @@ public: } else { - CGAL_Tree_warning_msg(m_interface.comp(m_interface.get_left(*count), - m_interface.get_right(*count)), - "invalid segment ignored"); + CGAL_warning_msg(m_interface.comp(m_interface.get_left(*count), + m_interface.get_right(*count)), + "invalid segment ignored"); } count++; } @@ -627,9 +627,9 @@ public: if(is_less_equal(m_interface.get_right_win(win), m_interface.get_left_win(win))) { - CGAL_Tree_warning_msg(m_interface.comp(m_interface.get_right_win(win), - m_interface.get_left_win(win)), - "invalid window -- query ignored"); + CGAL_warning_msg(m_interface.comp(m_interface.get_right_win(win), + m_interface.get_left_win(win)), + "invalid window -- query ignored"); return result; } link_type v = root(); @@ -680,9 +680,9 @@ public: if(is_less_equal(m_interface.get_right_win(win), m_interface.get_left_win(win))) { - CGAL_Tree_warning_msg(m_interface.comp(m_interface.get_right_win(win), - m_interface.get_left_win(win)), - "invalid window -- query ignored"); + CGAL_warning_msg(m_interface.comp(m_interface.get_right_win(win), + m_interface.get_left_win(win)), + "invalid window -- query ignored"); return result; } link_type v = root(); diff --git a/SearchStructures/include/CGAL/Tree_assertions.h b/SearchStructures/include/CGAL/Tree_assertions.h deleted file mode 100644 index 091d35fa81b..00000000000 --- a/SearchStructures/include/CGAL/Tree_assertions.h +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) 1997 ETH Zurich (Switzerland). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Geert-Jan Giezeman, Sven Schoenherr, Gabriele Neyer -// -// Generated from script create_assertions.sh - - -// Note that this header file is intentionnaly not protected with a -// macro (as ). Calling it a second time with another value -// for CGAL_NO_ASSERTIONS for example must make a difference. - -#include - -// macro definitions -// ================= -// assertions -// ---------- - -#undef CGAL_Tree_assertion -#undef CGAL_Tree_assertion_msg -#undef CGAL_Tree_assertion_code - -#if defined(CGAL_TREE_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) -# define CGAL_Tree_assertion(EX) (static_cast(0)) - -#include - -# define CGAL_Tree_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_Tree_assertion_code(CODE) -#else -# define CGAL_Tree_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_Tree_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_Tree_assertion_code(CODE) CODE -# define CGAL_Tree_assertions 1 -#endif // CGAL_TREE_NO_ASSERTIONS - - -#undef CGAL_Tree_exactness_assertion -#undef CGAL_Tree_exactness_assertion_msg -#undef CGAL_Tree_exactness_assertion_code - -#if defined(CGAL_TREE_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_Tree_exactness_assertion(EX) (static_cast(0)) -# define CGAL_Tree_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_Tree_exactness_assertion_code(CODE) -#else -# define CGAL_Tree_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_Tree_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_Tree_exactness_assertion_code(CODE) CODE -# define CGAL_Tree_exactness_assertions 1 -#endif // CGAL_TREE_NO_ASSERTIONS - - -#undef CGAL_Tree_expensive_assertion -#undef CGAL_Tree_expensive_assertion_msg -#undef CGAL_Tree_expensive_assertion_code - -#if defined(CGAL_TREE_NO_ASSERTIONS) \ - || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_Tree_expensive_assertion(EX) (static_cast(0)) -# define CGAL_Tree_expensive_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_Tree_expensive_assertion_code(CODE) -#else -# define CGAL_Tree_expensive_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_Tree_expensive_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_Tree_expensive_assertion_code(CODE) CODE -# define CGAL_Tree_expensive_assertions 1 -#endif // CGAL_TREE_NO_ASSERTIONS - - -#undef CGAL_Tree_expensive_exactness_assertion -#undef CGAL_Tree_expensive_exactness_assertion_msg -#undef CGAL_Tree_expensive_exactness_assertion_code - -#if defined(CGAL_TREE_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_Tree_expensive_exactness_assertion(EX) (static_cast(0)) -# define CGAL_Tree_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_Tree_expensive_exactness_assertion_code(CODE) -#else -# define CGAL_Tree_expensive_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_Tree_expensive_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_Tree_expensive_exactness_assertion_code(CODE) CODE -# define CGAL_Tree_expensive_exactness_assertions 1 -#endif // CGAL_TREE_NO_ASSERTIONS - - -// preconditions -// ------------- - -#undef CGAL_Tree_precondition -#undef CGAL_Tree_precondition_msg -#undef CGAL_Tree_precondition_code - -#if defined(CGAL_TREE_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) -# define CGAL_Tree_precondition(EX) (static_cast(0)) -# define CGAL_Tree_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_Tree_precondition_code(CODE) -#else -# define CGAL_Tree_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_Tree_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_Tree_precondition_code(CODE) CODE -# define CGAL_Tree_preconditions 1 -#endif // CGAL_TREE_NO_PRECONDITIONS - - -#undef CGAL_Tree_exactness_precondition -#undef CGAL_Tree_exactness_precondition_msg -#undef CGAL_Tree_exactness_precondition_code - -#if defined(CGAL_TREE_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_Tree_exactness_precondition(EX) (static_cast(0)) -# define CGAL_Tree_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_Tree_exactness_precondition_code(CODE) -#else -# define CGAL_Tree_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_Tree_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_Tree_exactness_precondition_code(CODE) CODE -# define CGAL_Tree_exactness_preconditions 1 -#endif // CGAL_TREE_NO_PRECONDITIONS - - -#undef CGAL_Tree_expensive_precondition -#undef CGAL_Tree_expensive_precondition_msg -#undef CGAL_Tree_expensive_precondition_code - -#if defined(CGAL_TREE_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_Tree_expensive_precondition(EX) (static_cast(0)) -# define CGAL_Tree_expensive_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_Tree_expensive_precondition_code(CODE) -#else -# define CGAL_Tree_expensive_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_Tree_expensive_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_Tree_expensive_precondition_code(CODE) CODE -# define CGAL_Tree_expensive_preconditions 1 -#endif // CGAL_TREE_NO_PRECONDITIONS - - -#undef CGAL_Tree_expensive_exactness_precondition -#undef CGAL_Tree_expensive_exactness_precondition_msg -#undef CGAL_Tree_expensive_exactness_precondition_code - -#if defined(CGAL_TREE_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_Tree_expensive_exactness_precondition(EX) (static_cast(0)) -# define CGAL_Tree_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_Tree_expensive_exactness_precondition_code(CODE) -#else -# define CGAL_Tree_expensive_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_Tree_expensive_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_Tree_expensive_exactness_precondition_code(CODE) CODE -# define CGAL_Tree_expensive_exactness_preconditions 1 -#endif // CGAL_TREE_NO_PRECONDITIONS - - -// postconditions -// -------------- - -#undef CGAL_Tree_postcondition -#undef CGAL_Tree_postcondition_msg -#undef CGAL_Tree_postcondition_code - -#if defined(CGAL_TREE_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) -# define CGAL_Tree_postcondition(EX) (static_cast(0)) -# define CGAL_Tree_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_Tree_postcondition_code(CODE) -#else -# define CGAL_Tree_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_Tree_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_Tree_postcondition_code(CODE) CODE -# define CGAL_Tree_postconditions 1 -#endif // CGAL_TREE_NO_POSTCONDITIONS - - -#undef CGAL_Tree_exactness_postcondition -#undef CGAL_Tree_exactness_postcondition_msg -#undef CGAL_Tree_exactness_postcondition_code - -#if defined(CGAL_TREE_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_Tree_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_Tree_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_Tree_exactness_postcondition_code(CODE) -#else -# define CGAL_Tree_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_Tree_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_Tree_exactness_postcondition_code(CODE) CODE -# define CGAL_Tree_exactness_postconditions 1 -#endif // CGAL_TREE_NO_POSTCONDITIONS - - -#undef CGAL_Tree_expensive_postcondition -#undef CGAL_Tree_expensive_postcondition_msg -#undef CGAL_Tree_expensive_postcondition_code - -#if defined(CGAL_TREE_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_Tree_expensive_postcondition(EX) (static_cast(0)) -# define CGAL_Tree_expensive_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_Tree_expensive_postcondition_code(CODE) -#else -# define CGAL_Tree_expensive_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_Tree_expensive_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_Tree_expensive_postcondition_code(CODE) CODE -# define CGAL_Tree_expensive_postconditions 1 -#endif // CGAL_TREE_NO_POSTCONDITIONS - - -#undef CGAL_Tree_expensive_exactness_postcondition -#undef CGAL_Tree_expensive_exactness_postcondition_msg -#undef CGAL_Tree_expensive_exactness_postcondition_code - -#if defined(CGAL_TREE_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_Tree_expensive_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_Tree_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_Tree_expensive_exactness_postcondition_code(CODE) -#else -# define CGAL_Tree_expensive_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_Tree_expensive_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_Tree_expensive_exactness_postcondition_code(CODE) CODE -# define CGAL_Tree_expensive_exactness_postconditions 1 -#endif // CGAL_TREE_NO_POSTCONDITIONS - - -// warnings -// -------- - -#undef CGAL_Tree_warning -#undef CGAL_Tree_warning_msg -#undef CGAL_Tree_warning_code - -#if defined(CGAL_TREE_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) -# define CGAL_Tree_warning(EX) (static_cast(0)) -# define CGAL_Tree_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_Tree_warning_code(CODE) -#else -# define CGAL_Tree_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_Tree_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_Tree_warning_code(CODE) CODE -# define CGAL_Tree_warnings 1 -#endif // CGAL_TREE_NO_WARNINGS - - -#undef CGAL_Tree_exactness_warning -#undef CGAL_Tree_exactness_warning_msg -#undef CGAL_Tree_exactness_warning_code - -#if defined(CGAL_TREE_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_Tree_exactness_warning(EX) (static_cast(0)) -# define CGAL_Tree_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_Tree_exactness_warning_code(CODE) -#else -# define CGAL_Tree_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_Tree_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_Tree_exactness_warning_code(CODE) CODE -# define CGAL_Tree_exactness_warnings 1 -#endif // CGAL_TREE_NO_WARNINGS - - -#undef CGAL_Tree_expensive_warning -#undef CGAL_Tree_expensive_warning_msg -#undef CGAL_Tree_expensive_warning_code - -#if defined(CGAL_TREE_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_Tree_expensive_warning(EX) (static_cast(0)) -# define CGAL_Tree_expensive_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_Tree_expensive_warning_code(CODE) -#else -# define CGAL_Tree_expensive_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_Tree_expensive_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_Tree_expensive_warning_code(CODE) CODE -# define CGAL_Tree_expensive_warnings 1 -#endif // CGAL_TREE_NO_WARNINGS - - -#undef CGAL_Tree_expensive_exactness_warning -#undef CGAL_Tree_expensive_exactness_warning_msg -#undef CGAL_Tree_expensive_exactness_warning_code - -#if defined(CGAL_TREE_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_Tree_expensive_exactness_warning(EX) (static_cast(0)) -# define CGAL_Tree_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_Tree_expensive_exactness_warning_code(CODE) -#else -# define CGAL_Tree_expensive_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_Tree_expensive_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_Tree_expensive_exactness_warning_code(CODE) CODE -# define CGAL_Tree_expensive_exactness_warnings 1 -#endif // CGAL_TREE_NO_WARNINGS diff --git a/SearchStructures/include/CGAL/Tree_base.h b/SearchStructures/include/CGAL/Tree_base.h index 90368baf98e..fd011f90a2f 100644 --- a/SearchStructures/include/CGAL/Tree_base.h +++ b/SearchStructures/include/CGAL/Tree_base.h @@ -22,7 +22,6 @@ #include #include #include -#include #ifndef CGAL_TREE_BASE_nullptr #define CGAL_TREE_BASE_nullptr 0 diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Triangulation_face_base_with_edges_2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Triangulation_face_base_with_edges_2.h index 4095dadf734..7519abf3039 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Triangulation_face_base_with_edges_2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Triangulation_face_base_with_edges_2.h @@ -17,12 +17,7 @@ #include - - #include -#include - - namespace CGAL { diff --git a/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2.h b/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2.h index 47093483971..fb8d2378953 100644 --- a/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2.h +++ b/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2.h @@ -43,6 +43,7 @@ #include #include +#include #include #include diff --git a/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Segment_Delaunay_graph_Linf_2_impl.h b/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Segment_Delaunay_graph_Linf_2_impl.h index 6f346a248bc..73a5247879e 100644 --- a/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Segment_Delaunay_graph_Linf_2_impl.h +++ b/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Segment_Delaunay_graph_Linf_2_impl.h @@ -105,6 +105,7 @@ find_faces_to_split(const Vertex_handle& v, const Site_2& t, Face_circulator fc_start = fc; int n_inf = 0; int n_faces = 0; + CGAL_USE(n_faces); do { if ( is_infinite(fc) ) { n_inf++; } fc++; diff --git a/Skin_surface_3/include/CGAL/Skin_surface_base_3.h b/Skin_surface_3/include/CGAL/Skin_surface_base_3.h index 00f97708e78..6962b1ec8f2 100644 --- a/Skin_surface_3/include/CGAL/Skin_surface_base_3.h +++ b/Skin_surface_3/include/CGAL/Skin_surface_base_3.h @@ -655,8 +655,8 @@ locate_in_tmc(const Bare_point &p0, TMC_Cell_handle start) const if (start->has_vertex(_tmc.infinite_vertex(), ind_inf) ) start = start->neighbor(ind_inf); - CGAL_triangulation_precondition(start != TMC_Cell_handle()); - CGAL_triangulation_precondition(!start->has_vertex(_tmc.infinite_vertex())); + CGAL_precondition(start != TMC_Cell_handle()); + CGAL_precondition(!start->has_vertex(_tmc.infinite_vertex())); // We implement the remembering visibility/stochastic walk. diff --git a/Spatial_searching/test/Spatial_searching/test_print.cpp b/Spatial_searching/test/Spatial_searching/test_print.cpp index eff527cef53..8826824ef49 100644 --- a/Spatial_searching/test/Spatial_searching/test_print.cpp +++ b/Spatial_searching/test/Spatial_searching/test_print.cpp @@ -27,10 +27,9 @@ void test_print(const std::string filename) { std::ifstream in(filename); CGAL::IO::set_ascii_mode(in); - Point_3 p; std::size_t count = 0; + Point_3 p; while (in >> p) { points.push_back(p); - ++count; } assert(points.size() > 0); diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/assertions.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/assertions.h index 3916c7627c5..252fab5815e 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/assertions.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/assertions.h @@ -15,18 +15,6 @@ #include -#if defined(CGAL_STRAIGHT_SKELETON_NO_POSTCONDITIONS) \ - || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_STRAIGHT_SKELETON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_stskel_expensive_postcondition(EX) (static_cast(0)) -# define CGAL_stskel_expensive_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_stskel_expensive_postcondition_code(CODE) -#else -# define CGAL_stskel_expensive_postcondition(EX) (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_stskel_expensive_postcondition_msg(EX,MSG) (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_stskel_expensive_postcondition_code(CODE) CODE -#endif - namespace CGAL { @@ -44,4 +32,3 @@ template inline bool handle_assigned ( Handle const& aH ) #endif // CGAL_STRAIGHT_SKELETON_ASSERTIONS_H // // EOF // - diff --git a/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h b/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h index 7331f70bd69..4ceae69e570 100644 --- a/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h +++ b/Straight_skeleton_2/include/CGAL/arrange_offset_polygons_2.h @@ -46,8 +46,9 @@ bool arrange_offset_polygons_2 ( InputPolygonPtrIterator aBegin , const K& ) { - bool bk_poly_assert_mode = get_use_polygon_assertions(); - set_use_polygon_assertions(false); // disable assertions in Polygon_2 function as we may manipulate strictly simple polygons + bool bk_poly_assert_mode = get_use_assertions(); + set_use_assertions(false); // disable assertions in Polygon_2 function as we may + // manipulate strictly simple polygons typedef typename std::iterator_traits::difference_type difference_type ; typedef typename std::iterator_traits::value_type PolygonPtr ; @@ -100,14 +101,14 @@ bool arrange_offset_polygons_2 ( InputPolygonPtrIterator aBegin if (lParent == nullptr) { - set_use_polygon_assertions(bk_poly_assert_mode); + set_use_assertions(bk_poly_assert_mode); return false; } lParent->add_hole(*lPoly); } } - set_use_polygon_assertions(bk_poly_assert_mode); + set_use_assertions(bk_poly_assert_mode); return true; } diff --git a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_offset.cpp b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_offset.cpp index ad14146a74b..02082ff8724 100644 --- a/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_offset.cpp +++ b/Straight_skeleton_2/test/Straight_skeleton_2/test_sls_offset.cpp @@ -2,6 +2,7 @@ #include #include +#define CGAL_ENABLE_DISABLE_ASSERTIONS_AT_RUNTIME #define CGAL_SLS_TEST_SPEED_THINGS_UP_FOR_THE_TESTSUITE //#define CGAL_STRAIGHT_SKELETON_ENABLE_TRACE 100 @@ -943,12 +944,12 @@ void test_offset(const char* filename) std::cout << offset_poly_with_holes.size() << " polygons with holes" << std::endl; // for(const auto& offp : offset_poly_with_holes) // print_polygon_with_holes(*offp); - CGAL::set_use_polygon_assertions(false); + CGAL::set_use_assertions(false); for(const auto& offp : offset_poly_with_holes){ (void)offp; assert(offp->outer_boundary().is_counterclockwise_oriented()); } - CGAL::set_use_polygon_assertions(true); + CGAL::set_use_assertions(true); #ifdef CGAL_SLS_TEST_SPEED_THINGS_UP_FOR_THE_TESTSUITE if(i > 2) break; diff --git a/Stream_lines_2/include/CGAL/Regular_grid_2.h b/Stream_lines_2/include/CGAL/Regular_grid_2.h index 57b69a00e41..2ef9c992a01 100644 --- a/Stream_lines_2/include/CGAL/Regular_grid_2.h +++ b/Stream_lines_2/include/CGAL/Regular_grid_2.h @@ -17,7 +17,7 @@ #include -#include +#include #include @@ -59,7 +59,7 @@ public: std::pair get_field(const Point_2 & p) const { - CGAL_streamlines_precondition(is_in_domain(p)); + CGAL_precondition(is_in_domain(p)); Vector_2 v = get_vector_field(p); FT density = get_density_field(p); return std::pair(v,density); @@ -126,7 +126,7 @@ template inline typename Regular_grid_2::Vector_2 Regular_grid_2::get_field(int i, int j) const { - CGAL_streamlines_precondition(is_in_samples(i,j)); + CGAL_precondition(is_in_samples(i,j)); int index = get_index(i,j); return Vector_2((*vector_field)[index], (*vector_field)[index+1]); } @@ -137,7 +137,7 @@ Regular_grid_2::set_field(int i, int j, const Vector_2 & v) { - CGAL_streamlines_precondition(is_in_samples(i,j)); + CGAL_precondition(is_in_samples(i,j)); int index = get_index(i,j); (*vector_field)[index++] = v.x(); (*vector_field)[index] = v.y(); diff --git a/Stream_lines_2/include/CGAL/Stream_lines_2.h b/Stream_lines_2/include/CGAL/Stream_lines_2.h index a000bbf684f..16d71b84af7 100644 --- a/Stream_lines_2/include/CGAL/Stream_lines_2.h +++ b/Stream_lines_2/include/CGAL/Stream_lines_2.h @@ -26,7 +26,7 @@ #include -#include +#include #include #include // undocumented class @@ -392,7 +392,7 @@ Stream_lines_2::integrate_forward(const Vector_fiel { Point_2 ex_old_point = old_point; old_point = new_point; - CGAL_streamlines_precondition(vector_field_2.is_in_domain(old_point)); + CGAL_precondition(vector_field_2.is_in_domain(old_point)); new_point = integrator(old_point,vector_field_2,true); bEnd = !vector_field_2.is_in_domain(new_point); bEnd = bEnd || (new_point == old_point);/* to review */ @@ -521,7 +521,7 @@ void Stream_lines_2::integrate_backward(const Vecto Point_2 ex_old_point = old_point; old_point = new_point; std::pair field_vector; - CGAL_streamlines_precondition(vector_field_2.is_in_domain(old_point)); + CGAL_precondition(vector_field_2.is_in_domain(old_point)); new_point = integrator(old_point,vector_field_2,false); bEnd = !vector_field_2.is_in_domain(new_point); FT dist_ = distance(ex_old_point,new_point); diff --git a/Stream_lines_2/include/CGAL/streamlines_assertions.h b/Stream_lines_2/include/CGAL/streamlines_assertions.h deleted file mode 100644 index ce5fe41b14b..00000000000 --- a/Stream_lines_2/include/CGAL/streamlines_assertions.h +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) 2005 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Geert-Jan Giezeman, Sven Schoenherr, Abdelkrim Mebarki -// -// Generated from script create_assertions.sh - - -// Note that this header file is intentionnaly not protected with a -// macro (as ). Calling it a second time with another value -// for CGAL_NO_ASSERTIONS for example must make a difference. - -#include - -// macro definitions -// ================= -// assertions -// ---------- - -#undef CGAL_streamlines_assertion -#undef CGAL_streamlines_assertion_msg -#undef CGAL_streamlines_assertion_code - -#if defined(CGAL_STREAMLINES_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) -# define CGAL_streamlines_assertion(EX) (static_cast(0)) - -#include - -# define CGAL_streamlines_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_streamlines_assertion_code(CODE) -#else -# define CGAL_streamlines_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_streamlines_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_streamlines_assertion_code(CODE) CODE -# define CGAL_streamlines_assertions 1 -#endif // CGAL_STREAMLINES_NO_ASSERTIONS - - -#undef CGAL_streamlines_exactness_assertion -#undef CGAL_streamlines_exactness_assertion_msg -#undef CGAL_streamlines_exactness_assertion_code - -#if defined(CGAL_STREAMLINES_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_streamlines_exactness_assertion(EX) (static_cast(0)) -# define CGAL_streamlines_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_streamlines_exactness_assertion_code(CODE) -#else -# define CGAL_streamlines_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_streamlines_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_streamlines_exactness_assertion_code(CODE) CODE -# define CGAL_streamlines_exactness_assertions 1 -#endif // CGAL_STREAMLINES_NO_ASSERTIONS - - -#undef CGAL_streamlines_expensive_assertion -#undef CGAL_streamlines_expensive_assertion_msg -#undef CGAL_streamlines_expensive_assertion_code - -#if defined(CGAL_STREAMLINES_NO_ASSERTIONS) \ - || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_streamlines_expensive_assertion(EX) (static_cast(0)) -# define CGAL_streamlines_expensive_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_streamlines_expensive_assertion_code(CODE) -#else -# define CGAL_streamlines_expensive_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_streamlines_expensive_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_streamlines_expensive_assertion_code(CODE) CODE -# define CGAL_streamlines_expensive_assertions 1 -#endif // CGAL_STREAMLINES_NO_ASSERTIONS - - -#undef CGAL_streamlines_expensive_exactness_assertion -#undef CGAL_streamlines_expensive_exactness_assertion_msg -#undef CGAL_streamlines_expensive_exactness_assertion_code - -#if defined(CGAL_STREAMLINES_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_streamlines_expensive_exactness_assertion(EX) (static_cast(0)) -# define CGAL_streamlines_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) -# define CGAL_streamlines_expensive_exactness_assertion_code(CODE) -#else -# define CGAL_streamlines_expensive_exactness_assertion(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) -# define CGAL_streamlines_expensive_exactness_assertion_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_streamlines_expensive_exactness_assertion_code(CODE) CODE -# define CGAL_streamlines_expensive_exactness_assertions 1 -#endif // CGAL_STREAMLINES_NO_ASSERTIONS - - -// preconditions -// ------------- - -#undef CGAL_streamlines_precondition -#undef CGAL_streamlines_precondition_msg -#undef CGAL_streamlines_precondition_code - -#if defined(CGAL_STREAMLINES_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) -# define CGAL_streamlines_precondition(EX) (static_cast(0)) -# define CGAL_streamlines_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_streamlines_precondition_code(CODE) -#else -# define CGAL_streamlines_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_streamlines_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_streamlines_precondition_code(CODE) CODE -# define CGAL_streamlines_preconditions 1 -#endif // CGAL_STREAMLINES_NO_PRECONDITIONS - - -#undef CGAL_streamlines_exactness_precondition -#undef CGAL_streamlines_exactness_precondition_msg -#undef CGAL_streamlines_exactness_precondition_code - -#if defined(CGAL_STREAMLINES_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_streamlines_exactness_precondition(EX) (static_cast(0)) -# define CGAL_streamlines_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_streamlines_exactness_precondition_code(CODE) -#else -# define CGAL_streamlines_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_streamlines_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_streamlines_exactness_precondition_code(CODE) CODE -# define CGAL_streamlines_exactness_preconditions 1 -#endif // CGAL_STREAMLINES_NO_PRECONDITIONS - - -#undef CGAL_streamlines_expensive_precondition -#undef CGAL_streamlines_expensive_precondition_msg -#undef CGAL_streamlines_expensive_precondition_code - -#if defined(CGAL_STREAMLINES_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_streamlines_expensive_precondition(EX) (static_cast(0)) -# define CGAL_streamlines_expensive_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_streamlines_expensive_precondition_code(CODE) -#else -# define CGAL_streamlines_expensive_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_streamlines_expensive_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_streamlines_expensive_precondition_code(CODE) CODE -# define CGAL_streamlines_expensive_preconditions 1 -#endif // CGAL_STREAMLINES_NO_PRECONDITIONS - - -#undef CGAL_streamlines_expensive_exactness_precondition -#undef CGAL_streamlines_expensive_exactness_precondition_msg -#undef CGAL_streamlines_expensive_exactness_precondition_code - -#if defined(CGAL_STREAMLINES_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_streamlines_expensive_exactness_precondition(EX) (static_cast(0)) -# define CGAL_streamlines_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_streamlines_expensive_exactness_precondition_code(CODE) -#else -# define CGAL_streamlines_expensive_exactness_precondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_streamlines_expensive_exactness_precondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::precondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_streamlines_expensive_exactness_precondition_code(CODE) CODE -# define CGAL_streamlines_expensive_exactness_preconditions 1 -#endif // CGAL_STREAMLINES_NO_PRECONDITIONS - - -// postconditions -// -------------- - -#undef CGAL_streamlines_postcondition -#undef CGAL_streamlines_postcondition_msg -#undef CGAL_streamlines_postcondition_code - -#if defined(CGAL_STREAMLINES_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) -# define CGAL_streamlines_postcondition(EX) (static_cast(0)) -# define CGAL_streamlines_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_streamlines_postcondition_code(CODE) -#else -# define CGAL_streamlines_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_streamlines_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_streamlines_postcondition_code(CODE) CODE -# define CGAL_streamlines_postconditions 1 -#endif // CGAL_STREAMLINES_NO_POSTCONDITIONS - - -#undef CGAL_streamlines_exactness_postcondition -#undef CGAL_streamlines_exactness_postcondition_msg -#undef CGAL_streamlines_exactness_postcondition_code - -#if defined(CGAL_STREAMLINES_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_streamlines_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_streamlines_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_streamlines_exactness_postcondition_code(CODE) -#else -# define CGAL_streamlines_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_streamlines_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_streamlines_exactness_postcondition_code(CODE) CODE -# define CGAL_streamlines_exactness_postconditions 1 -#endif // CGAL_STREAMLINES_NO_POSTCONDITIONS - - -#undef CGAL_streamlines_expensive_postcondition -#undef CGAL_streamlines_expensive_postcondition_msg -#undef CGAL_streamlines_expensive_postcondition_code - -#if defined(CGAL_STREAMLINES_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_streamlines_expensive_postcondition(EX) (static_cast(0)) -# define CGAL_streamlines_expensive_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_streamlines_expensive_postcondition_code(CODE) -#else -# define CGAL_streamlines_expensive_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_streamlines_expensive_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_streamlines_expensive_postcondition_code(CODE) CODE -# define CGAL_streamlines_expensive_postconditions 1 -#endif // CGAL_STREAMLINES_NO_POSTCONDITIONS - - -#undef CGAL_streamlines_expensive_exactness_postcondition -#undef CGAL_streamlines_expensive_exactness_postcondition_msg -#undef CGAL_streamlines_expensive_exactness_postcondition_code - -#if defined(CGAL_STREAMLINES_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_streamlines_expensive_exactness_postcondition(EX) (static_cast(0)) -# define CGAL_streamlines_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) -# define CGAL_streamlines_expensive_exactness_postcondition_code(CODE) -#else -# define CGAL_streamlines_expensive_exactness_postcondition(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__)) -# define CGAL_streamlines_expensive_exactness_postcondition_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::postcondition_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_streamlines_expensive_exactness_postcondition_code(CODE) CODE -# define CGAL_streamlines_expensive_exactness_postconditions 1 -#endif // CGAL_STREAMLINES_NO_POSTCONDITIONS - - -// warnings -// -------- - -#undef CGAL_streamlines_warning -#undef CGAL_streamlines_warning_msg -#undef CGAL_streamlines_warning_code - -#if defined(CGAL_STREAMLINES_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) -# define CGAL_streamlines_warning(EX) (static_cast(0)) -# define CGAL_streamlines_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_streamlines_warning_code(CODE) -#else -# define CGAL_streamlines_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_streamlines_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_streamlines_warning_code(CODE) CODE -# define CGAL_streamlines_warnings 1 -#endif // CGAL_STREAMLINES_NO_WARNINGS - - -#undef CGAL_streamlines_exactness_warning -#undef CGAL_streamlines_exactness_warning_msg -#undef CGAL_streamlines_exactness_warning_code - -#if defined(CGAL_STREAMLINES_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) -# define CGAL_streamlines_exactness_warning(EX) (static_cast(0)) -# define CGAL_streamlines_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_streamlines_exactness_warning_code(CODE) -#else -# define CGAL_streamlines_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_streamlines_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_streamlines_exactness_warning_code(CODE) CODE -# define CGAL_streamlines_exactness_warnings 1 -#endif // CGAL_STREAMLINES_NO_WARNINGS - - -#undef CGAL_streamlines_expensive_warning -#undef CGAL_streamlines_expensive_warning_msg -#undef CGAL_streamlines_expensive_warning_code - -#if defined(CGAL_STREAMLINES_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_streamlines_expensive_warning(EX) (static_cast(0)) -# define CGAL_streamlines_expensive_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_streamlines_expensive_warning_code(CODE) -#else -# define CGAL_streamlines_expensive_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_streamlines_expensive_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_streamlines_expensive_warning_code(CODE) CODE -# define CGAL_streamlines_expensive_warnings 1 -#endif // CGAL_STREAMLINES_NO_WARNINGS - - -#undef CGAL_streamlines_expensive_exactness_warning -#undef CGAL_streamlines_expensive_exactness_warning_msg -#undef CGAL_streamlines_expensive_exactness_warning_code - -#if defined(CGAL_STREAMLINES_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) -# define CGAL_streamlines_expensive_exactness_warning(EX) (static_cast(0)) -# define CGAL_streamlines_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) -# define CGAL_streamlines_expensive_exactness_warning_code(CODE) -#else -# define CGAL_streamlines_expensive_exactness_warning(EX) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) -# define CGAL_streamlines_expensive_exactness_warning_msg(EX,MSG) \ - (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) -# define CGAL_streamlines_expensive_exactness_warning_code(CODE) CODE -# define CGAL_streamlines_expensive_exactness_warnings 1 -#endif // CGAL_STREAMLINES_NO_WARNINGS diff --git a/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h b/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h index 97ba5aed47b..8e274941fc1 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h @@ -289,10 +289,22 @@ public: if(m_vcolors == 3) { - unsigned char r, g, b; - element.assign(r, "red"); - element.assign(g, "green"); - element.assign(b, "blue"); + unsigned char r=0, g=0, b=0; + float rf=0, gf=0, bf=0; + if(element.has_property("red",r)) + { + element.assign(r, "red"); + element.assign(g, "green"); + element.assign(b, "blue"); + }else if(element.has_property("red", rf)) + { + element.assign(rf, "red"); + element.assign(gf, "green"); + element.assign(bf, "blue"); + r = static_cast(std::floor(rf*255)); + g = static_cast(std::floor(gf*255)); + b = static_cast(std::floor(bf*255)); + } m_vcolor_map[vi] = CGAL::IO::Color(r, g, b); } } @@ -331,10 +343,22 @@ public: if(m_fcolors == 3) { - unsigned char r, g, b; - element.assign(r, "red"); - element.assign(g, "green"); - element.assign(b, "blue"); + unsigned char r=0, g=0, b=0; + float rf=0, gf=0, bf=0; + if(element.has_property("red",r)) + { + element.assign(r, "red"); + element.assign(g, "green"); + element.assign(b, "blue"); + } else if(element.has_property("red", rf)) + { + element.assign(rf, "red"); + element.assign(gf, "green"); + element.assign(bf, "blue"); + r = static_cast(std::floor(rf*255)); + g = static_cast(std::floor(gf*255)); + b = static_cast(std::floor(bf*255)); + } m_fcolor_map[fi] = CGAL::IO::Color(r, g, b); } } diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index dc30f94af43..5191f3b1397 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -82,6 +83,10 @@ namespace CGAL { size_type idx() const { return idx_; } + // For convenience + size_type id() const { + return idx_; + } /// increments the internal index. This operation does not /// guarantee that the index is valid or undeleted after the @@ -1466,7 +1471,7 @@ public: /// perform an expensive validity check on the data structure and /// print found errors to `std::cerr` when `verbose == true`. - bool is_valid(bool verbose = true) const + bool is_valid(bool verbose = false) const { bool valid = true; size_type vcount = 0, hcount = 0, fcount = 0; @@ -1578,23 +1583,37 @@ public: } /// performs a validity check on a single vertex. - bool is_valid(Vertex_index v) const { + bool is_valid(Vertex_index v, + bool verbose = false) const + { + Verbose_ostream verr(verbose); + if(!has_valid_index(v)) - return false; + { + verr << "Vertex has invalid index: " << (size_type)v << std::endl; + return false; + } Halfedge_index h = vconn_[v].halfedge_; - if(h!= null_halfedge() && (!has_valid_index(h) || is_removed(h))) { - std::cerr << "Vertex connectivity halfedge error in " << (size_type)v - << " with " << (size_type)h << std::endl; - return false; + if(h != null_halfedge() && (!has_valid_index(h) || is_removed(h))) { + verr << "Vertex connectivity halfedge error: Vertex " << (size_type)v + << " with " << (size_type)h << std::endl; + return false; } return true; } /// performs a validity check on a single halfedge. - bool is_valid(Halfedge_index h) const { + bool is_valid(Halfedge_index h, + bool verbose = false) const + { + Verbose_ostream verr(verbose); + if(!has_valid_index(h)) + { + verr << "Halfedge has invalid index: " << (size_type)h << std::endl; return false; + } Face_index f = hconn_[h].face_; Vertex_index v = hconn_[h].vertex_; @@ -1605,30 +1624,30 @@ public: // don't validate the face if this is a border halfedge if(!is_border(h)) { if(!has_valid_index(f) || is_removed(f)) { - std::cerr << "Halfedge connectivity Face " - << (!has_valid_index(f) ? "invalid" : "removed") - << " in " << (size_type)h << std::endl; + verr << "Halfedge connectivity error: Face " + << (!has_valid_index(f) ? "invalid" : "removed") + << " in " << (size_type)h << std::endl; valid = false; } } if(!has_valid_index(v) || is_removed(v)) { - std::cerr << "Halfedge connectivity Vertex " - << (!has_valid_index(v) ? "invalid" : "removed") - << " in " << (size_type)h << std::endl; + verr << "Halfedge connectivity error: Vertex " + << (!has_valid_index(v) ? "invalid" : "removed") + << " in " << (size_type)h << std::endl; valid = false; } if(!has_valid_index(hn) || is_removed(hn)) { - std::cerr << "Halfedge connectivity hnext " - << (!has_valid_index(hn) ? "invalid" : "removed") - << " in " << (size_type)h << std::endl; + verr << "Halfedge connectivity error: hnext " + << (!has_valid_index(hn) ? "invalid" : "removed") + << " in " << (size_type)h << std::endl; valid = false; } if(!has_valid_index(hp) || is_removed(hp)) { - std::cerr << "Halfedge connectivity hprev " - << (!has_valid_index(hp) ? "invalid" : "removed") - << " in " << (size_type)h << std::endl; + verr << "Halfedge connectivity error: hprev " + << (!has_valid_index(hp) ? "invalid" : "removed") + << " in " << (size_type)h << std::endl; valid = false; } return valid; @@ -1636,25 +1655,39 @@ public: /// performs a validity check on a single edge. - bool is_valid(Edge_index e) const { + bool is_valid(Edge_index e, + bool verbose = false) const + { + Verbose_ostream verr(verbose); + if(!has_valid_index(e)) + { + verr << "Edge has invalid index: " << (size_type)e << std::endl; return false; + } Halfedge_index h = halfedge(e); - return is_valid(h) && is_valid(opposite(h)); + return is_valid(h, verbose) && is_valid(opposite(h), verbose); } /// performs a validity check on a single face. - bool is_valid(Face_index f) const { + bool is_valid(Face_index f, + bool verbose = false) const + { + Verbose_ostream verr(verbose); + if(!has_valid_index(f)) + { + verr << "Face has invalid index: " << (size_type)f << std::endl; return false; + } Halfedge_index h = fconn_[f].halfedge_; if(!has_valid_index(h) || is_removed(h)) { - std::cerr << "Face connectivity halfedge error in " << (size_type)f - << " with " << (size_type)h << std::endl; - return false; + verr << "Face connectivity halfedge error: Face " << (size_type)f + << " with " << (size_type)h << std::endl; + return false; } return true; } diff --git a/Surface_mesh/include/CGAL/boost/graph/graph_traits_Surface_mesh.h b/Surface_mesh/include/CGAL/boost/graph/graph_traits_Surface_mesh.h index 547b8374776..d044c38a557 100644 --- a/Surface_mesh/include/CGAL/boost/graph/graph_traits_Surface_mesh.h +++ b/Surface_mesh/include/CGAL/boost/graph/graph_traits_Surface_mesh.h @@ -528,6 +528,51 @@ template void normalize_border(const CGAL::Surface_mesh

    &) {} + +template +bool is_valid_vertex_descriptor(typename boost::graph_traits >::vertex_descriptor v, + const CGAL::Surface_mesh

    & g, + const bool verbose = false) +{ + if(!g.is_valid(v, verbose)) + return false; + + return BGL::is_valid_vertex_descriptor(v, g, verbose); +} + +template +bool is_valid_halfedge_descriptor(typename boost::graph_traits >::halfedge_descriptor h, + const CGAL::Surface_mesh

    & g, + const bool verbose = false) +{ + if(!g.is_valid(h, verbose)) + return false; + + return BGL::is_valid_halfedge_descriptor(h, g, verbose); +} + +template +bool is_valid_edge_descriptor(typename boost::graph_traits >::edge_descriptor e, + const CGAL::Surface_mesh

    & g, + const bool verbose = false) +{ + if(!g.is_valid(e, verbose)) + return false; + + return BGL::is_valid_edge_descriptor(e, g, verbose); +} + +template +bool is_valid_face_descriptor(typename boost::graph_traits >::face_descriptor f, + const CGAL::Surface_mesh

    & g, + const bool verbose = false) +{ + if(!g.is_valid(f, verbose)) + return false; + + return BGL::is_valid_face_descriptor(f, g, verbose); +} + } // namespace CGAL #endif // DOXYGEN_RUNNING diff --git a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/examples.txt b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/examples.txt index db7aa8e187c..c7d456389ec 100644 --- a/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/examples.txt +++ b/Surface_mesh_parameterization/doc/Surface_mesh_parameterization/examples.txt @@ -1,4 +1,5 @@ /*! + \example Surface_mesh_parameterization/ARAP_parameterization.cpp \example Surface_mesh_parameterization/discrete_authalic.cpp \example Surface_mesh_parameterization/lscm.cpp \example Surface_mesh_parameterization/orbifold.cpp diff --git a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/ARAP_parameterization.cpp b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/ARAP_parameterization.cpp new file mode 100644 index 00000000000..6919bd32dc8 --- /dev/null +++ b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/ARAP_parameterization.cpp @@ -0,0 +1,57 @@ +#include + +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include + +typedef CGAL::Simple_cartesian Kernel; +typedef Kernel::Point_2 Point_2; +typedef Kernel::Point_3 Point_3; +typedef CGAL::Surface_mesh SurfaceMesh; + +typedef boost::graph_traits::halfedge_descriptor halfedge_descriptor; +typedef boost::graph_traits::vertex_descriptor vertex_descriptor; +typedef boost::graph_traits::face_descriptor face_descriptor; + +namespace SMP = CGAL::Surface_mesh_parameterization; + +int main(int argc, char** argv) +{ + const std::string filename = (argc>1) ? argv[1] : CGAL::data_file_path("meshes/head.off"); + + SurfaceMesh sm; + if(!CGAL::IO::read_polygon_mesh(filename, sm)) + { + std::cerr << "Invalid input file." << std::endl; + return EXIT_FAILURE; + } + + // A halfedge on the border + halfedge_descriptor bhd = CGAL::Polygon_mesh_processing::longest_border(sm).first; + + // The 2D points of the uv parametrisation will be written into this map + typedef SurfaceMesh::Property_map UV_pmap; + UV_pmap uv_map = sm.add_property_map("v:uv").first; + + SMP::ARAP_parameterizer_3 parameterizer; + SMP::Error_code err = SMP::parameterize(sm, parameterizer, bhd, uv_map); + + if(err != SMP::OK) { + std::cerr << "Error: " << SMP::get_error_message(err) << std::endl; + return EXIT_FAILURE; + } + + std::ofstream out("result.off"); + SMP::IO::output_uvmap_to_off(sm, bhd, uv_map, out); + + return EXIT_SUCCESS; +} diff --git a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt index 0c373f160c6..5f6da12cea2 100644 --- a/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt +++ b/Surface_mesh_parameterization/examples/Surface_mesh_parameterization/CMakeLists.txt @@ -53,6 +53,8 @@ if(TARGET CGAL::Eigen3_support) # End of SuiteSparse detection # ------------------------------------------------------------------ + create_single_source_cgal_program("ARAP_parameterization.cpp") + target_link_libraries(ARAP_parameterization PUBLIC CGAL::Eigen3_support) create_single_source_cgal_program("discrete_authalic.cpp") target_link_libraries(discrete_authalic PUBLIC CGAL::Eigen3_support) create_single_source_cgal_program("lscm.cpp") @@ -68,6 +70,7 @@ if(TARGET CGAL::Eigen3_support) create_single_source_cgal_program( "iterative_authalic_parameterizer.cpp" ) target_link_libraries(iterative_authalic_parameterizer PUBLIC CGAL::Eigen3_support) if(SuiteSparse_FOUND) + target_link_libraries(ARAP_parameterization PRIVATE ${SuiteSparse_LIBRARIES}) target_link_libraries(orbifold PRIVATE ${SuiteSparse_LIBRARIES}) endif() diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h index 3002d4beffe..65bd6659902 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/ARAP_parameterizer_3.h @@ -560,7 +560,6 @@ private: Error_code status = OK; // compute A - unsigned int count = 0; for(vertex_descriptor vd : vertices) { if(!get(vpmap, vd)) { // not yet parameterized // Compute the line i of the matrix A @@ -570,7 +569,6 @@ private: } else { // fixed vertices int index = get(vimap, vd); A.set_coef(index, index, 1, true /*new*/); - ++count; } } return status; @@ -1079,7 +1077,6 @@ private: // Initialize the right hand side B in the linear system "A*X = B" Error_code status = OK; - unsigned int count = 0; for(vertex_descriptor vd : vertices) { if(!get(vpmap, vd)) { // not yet parameterized // Compute the lines i of the vectors Bu and Bv @@ -1092,7 +1089,6 @@ private: const Point_2& uv = get(uvmap, vd); Bu.set(index, uv.x()); Bv.set(index, uv.y()); - ++count; } } return status; diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Fixed_border_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Fixed_border_parameterizer_3.h index d25d7c36fa7..44f86383d32 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Fixed_border_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Fixed_border_parameterizer_3.h @@ -255,7 +255,6 @@ public: main_border.insert(v); } - int count = 0; for(vertex_descriptor v : vertices){ // inner vertices only if(main_border.find(v) == main_border.end()){ @@ -263,8 +262,6 @@ public: status = setup_inner_vertex_relations(A, Bu, Bv, mesh, v, vimap); if(status != OK) return status; - } else { - count++; } } diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h index 1eb0b485d45..39070956d64 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/Orbifold_Tutte_parameterizer_3.h @@ -26,7 +26,6 @@ #include #include -#include #include #include #include diff --git a/Surface_mesh_topology/doc/Surface_mesh_topology/PackageDescription.txt b/Surface_mesh_topology/doc/Surface_mesh_topology/PackageDescription.txt index 53106ce0049..97f1f3bad7e 100644 --- a/Surface_mesh_topology/doc/Surface_mesh_topology/PackageDescription.txt +++ b/Surface_mesh_topology/doc/Surface_mesh_topology/PackageDescription.txt @@ -1,10 +1,10 @@ -/// \defgroup PkgSurfaceMeshTopology Surface Mesh Topology Reference +/// \defgroup PkgSurfaceMeshTopologyRef Surface Mesh Topology Reference /// \defgroup PkgSurfaceMeshTopologyConcepts Concepts -/// \ingroup PkgSurfaceMeshTopology +/// \ingroup PkgSurfaceMeshTopologyRef /// \defgroup PkgSurfaceMeshTopologyClasses Classes -/// \ingroup PkgSurfaceMeshTopology +/// \ingroup PkgSurfaceMeshTopologyRef /*! \code @@ -12,17 +12,17 @@ \endcode */ /// \defgroup PkgDrawFaceGraphWithPaths Draw a Mesh with Paths -/// \ingroup PkgSurfaceMeshTopology +/// \ingroup PkgSurfaceMeshTopologyRef /*! -\addtogroup PkgSurfaceMeshTopology +\addtogroup PkgSurfaceMeshTopologyRef \cgalPkgDescriptionBegin{Surface Mesh Topology,PkgSurfaceMeshTopology} \cgalPkgPicture{surface-mesh-topology-logo.png} \cgalPkgSummaryBegin \cgalPkgAuthor{Guillaume Damiand, Francis Lazarus} \cgalPkgDesc{This package provides a toolbox for manipulating curves on a combinatorial surface from the topological point of view. Two main functionalities are proposed. One is the computation of shortest curves that cannot be continuously deformed to a point. This includes the computation of the so-called edge width and face width of the vertex-edge graph of a combinatorial surface. The other functionality is the homotopy test for deciding if two given curves on a combinatorial surface can be continuously deformed one into the other.} -\cgalPkgManuals{Chapter_Surface_Mesh_Topology,PkgSurfaceMeshTopology} +\cgalPkgManuals{Chapter_Surface_Mesh_Topology,PkgSurfaceMeshTopologyRef} \cgalPkgSummaryEnd \cgalPkgShortInfoBegin \cgalPkgSince{5.1} diff --git a/Surface_mesh_topology/examples/Surface_mesh_topology/draw_facewidth.h b/Surface_mesh_topology/examples/Surface_mesh_topology/draw_facewidth.h index 0afd17425fb..4a489b19ff1 100644 --- a/Surface_mesh_topology/examples/Surface_mesh_topology/draw_facewidth.h +++ b/Surface_mesh_topology/examples/Surface_mesh_topology/draw_facewidth.h @@ -54,17 +54,16 @@ template void draw_facewidth(const LCC& lcc, const std::vector& cycle) { - int nbv=0, nbf=0; typename LCC::size_type vertex_mark = lcc.get_new_mark(); typename LCC::size_type face_mark = lcc.get_new_mark(); for (std::size_t i=0; i(cycle[i], vertex_mark); ++nbv; } + { lcc.template mark_cell<0>(cycle[i], vertex_mark); } // Color the face if (!lcc.is_marked(cycle[i], face_mark)) - { lcc.template mark_cell<2>(cycle[i], face_mark); ++nbf; } + { lcc.template mark_cell<2>(cycle[i], face_mark); } } Facewidth_draw_functor df(vertex_mark, face_mark); diff --git a/Surface_mesher/include/CGAL/Surface_mesher/Surface_mesher_manifold.h b/Surface_mesher/include/CGAL/Surface_mesher/Surface_mesher_manifold.h index 1638fc00565..71b6cb08cbd 100644 --- a/Surface_mesher/include/CGAL/Surface_mesher/Surface_mesher_manifold.h +++ b/Surface_mesher/include/CGAL/Surface_mesher/Surface_mesher_manifold.h @@ -107,15 +107,17 @@ namespace CGAL { { #ifdef CGAL_SURFACE_MESHER_VERBOSE std::cerr << "scanning vertices" << std::endl; -#endif int n = 0; +#endif for (Finite_vertices_iterator vit = SMMBB::tr.finite_vertices_begin(); vit != SMMBB::tr.finite_vertices_end(); ++vit) { if ( (SMMBB::c2t3.face_status(vit) // @TODO: appeler is_regular == C2t3::SINGULAR) ) { bad_vertices.insert( vit ); +#ifdef CGAL_SURFACE_MESHER_VERBOSE ++n; +#endif } } bad_vertices_initialized = true; diff --git a/Surface_mesher/include/CGAL/Surface_mesher/Surface_mesher_regular_edges.h b/Surface_mesher/include/CGAL/Surface_mesher/Surface_mesher_regular_edges.h index 815ca228874..25095602a93 100644 --- a/Surface_mesher/include/CGAL/Surface_mesher/Surface_mesher_regular_edges.h +++ b/Surface_mesher/include/CGAL/Surface_mesher/Surface_mesher_regular_edges.h @@ -213,8 +213,8 @@ namespace CGAL { if(withBoundary) std::cerr << "(boundaries allowed)"; std::cerr << "...\n"; -#endif int n = 0; +#endif for (Finite_edges_iterator eit = SMB::tr.finite_edges_begin(); eit != SMB::tr.finite_edges_end(); ++eit) { if ( (SMB::c2t3.face_status(*eit) @@ -223,7 +223,9 @@ namespace CGAL { (SMB::c2t3.face_status(*eit) == C2t3::BOUNDARY) ) ) { bad_edges.insert( edge_to_edgevv(*eit) ); +#ifdef CGAL_SURFACE_MESHER_VERBOSE ++n; +#endif } } bad_edges_initialized = true; diff --git a/TDS_2/include/CGAL/Triangulation_data_structure_2.h b/TDS_2/include/CGAL/Triangulation_data_structure_2.h index c49536c1a2e..79f0b1b4022 100644 --- a/TDS_2/include/CGAL/Triangulation_data_structure_2.h +++ b/TDS_2/include/CGAL/Triangulation_data_structure_2.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include @@ -240,8 +240,8 @@ public: Vertex_handle mirror_vertex(Face_handle f, int i) const { - CGAL_triangulation_precondition ( f->neighbor(i) != Face_handle() - && f->dimension() >= 1); + CGAL_precondition ( f->neighbor(i) != Face_handle() + && f->dimension() >= 1); return f->neighbor(i)->vertex(mirror_index(f,i)); } @@ -249,8 +249,8 @@ public: mirror_index(Face_handle f, int i) const { // return the index of opposite vertex in neighbor(i); - CGAL_triangulation_precondition (f->neighbor(i) != Face_handle() && - f->dimension() >= 1); + CGAL_precondition (f->neighbor(i) != Face_handle() && + f->dimension() >= 1); if (f->dimension() == 1) { CGAL_assertion(i<=1); const int j = f->neighbor(i)->index(f->vertex((i==0) ? 1 : 0)); @@ -263,8 +263,8 @@ public: Edge mirror_edge(const Edge e) const { - CGAL_triangulation_precondition(e.first->neighbor(e.second) != Face_handle() - && e.first->dimension() >= 1); + CGAL_precondition(e.first->neighbor(e.second) != Face_handle() + && e.first->dimension() >= 1); return Edge(e.first->neighbor(e.second), mirror_index(e.first, e.second)); } @@ -461,7 +461,7 @@ public: void insert_in_hole(Vertex_handle v, FaceIt face_begin, FaceIt face_end) { - CGAL_triangulation_precondition(dimension() == 2); + CGAL_precondition(dimension() == 2); std::vector new_faces; std::vector bdry_edges; @@ -604,7 +604,7 @@ public: // the triangulation is assumed to have dim=2 // hole is supposed to be ccw oriented { - CGAL_triangulation_precondition(dimension() == 2); + CGAL_precondition(dimension() == 2); EdgeIt eit = edge_begin; FaceIt fit = face_begin; @@ -742,7 +742,7 @@ void Triangulation_data_structure_2:: swap(Tds &tds) { - CGAL_triangulation_expensive_precondition(tds.is_valid() && is_valid()); + CGAL_expensive_precondition(tds.is_valid() && is_valid()); std::swap(_dimension, tds._dimension); faces().swap(tds.faces()); vertices().swap(tds.vertices()); @@ -895,7 +895,7 @@ void Triangulation_data_structure_2:: flip(Face_handle f, int i) { - CGAL_triangulation_precondition( dimension()==2); + CGAL_precondition( dimension()==2); Face_handle n = f->neighbor(i); int ni = mirror_index(f,i); //ni = n->index(f); @@ -930,8 +930,8 @@ typename Triangulation_data_structure_2::Vertex_handle Triangulation_data_structure_2:: insert_first( ) { - CGAL_triangulation_precondition( number_of_vertices() == 0 && - dimension()==-2 ); + CGAL_precondition( number_of_vertices() == 0 && + dimension()==-2 ); return insert_dim_up(); } @@ -940,8 +940,8 @@ typename Triangulation_data_structure_2::Vertex_handle Triangulation_data_structure_2:: insert_second() { - CGAL_triangulation_precondition( number_of_vertices() == 1 && - dimension()==-1 ); + CGAL_precondition( number_of_vertices() == 1 && + dimension()==-1 ); return insert_dim_up(); } @@ -953,7 +953,7 @@ Triangulation_data_structure_2:: insert_in_face(Face_handle f) // New vertex will replace f->vertex(0) in face f { - CGAL_triangulation_precondition( f != Face_handle() && dimension()== 2); + CGAL_precondition( f != Face_handle() && dimension()== 2); Vertex_handle v = create_vertex(); Vertex_handle v0 = f->vertex(0); @@ -992,11 +992,11 @@ Triangulation_data_structure_2:: insert_in_edge(Face_handle f, int i) //insert in the edge opposite to vertex i of face f { - CGAL_triangulation_precondition(f != Face_handle() && dimension() >= 1); - if (dimension() == 1) {CGAL_triangulation_precondition(i == 2);} - if (dimension() == 2) {CGAL_triangulation_precondition(i == 0 || - i == 1 || - i == 2);} + CGAL_precondition(f != Face_handle() && dimension() >= 1); + if (dimension() == 1) {CGAL_precondition(i == 2);} + if (dimension() == 2) {CGAL_precondition(i == 0 || + i == 1 || + i == 2);} Vertex_handle v; if (dimension() == 1) { v = create_vertex(); @@ -1118,7 +1118,7 @@ insert_dim_up(Vertex_handle w, bool orient) } break; default: - CGAL_triangulation_assertion(false); + CGAL_assertion(false); break; } return v; } @@ -1130,11 +1130,11 @@ Triangulation_data_structure_2:: remove_degree_3(Vertex_handle v, Face_handle f) // remove a vertex of degree 3 { - CGAL_triangulation_precondition(v != Vertex_handle()); - CGAL_triangulation_precondition(degree(v) == 3); + CGAL_precondition(v != Vertex_handle()); + CGAL_precondition(degree(v) == 3); if (f == Face_handle()) {f= v->face();} - else { CGAL_triangulation_assertion( f->has_vertex(v));} + else { CGAL_assertion( f->has_vertex(v));} int i = f->index(v); Face_handle left = f->neighbor(cw(i)); @@ -1144,7 +1144,7 @@ remove_degree_3(Vertex_handle v, Face_handle f) Face_handle ll, rr; Vertex_handle q = left->vertex(li); - CGAL_triangulation_assertion( left->vertex(li) == right->vertex(ri)); + CGAL_assertion( left->vertex(li) == right->vertex(ri)); ll = left->neighbor(cw(li)); if(ll != Face_handle()) { @@ -1177,11 +1177,11 @@ void Triangulation_data_structure_2:: dim_down(Face_handle f, int i) { - CGAL_triangulation_expensive_precondition( is_valid() ); - CGAL_triangulation_precondition( dimension() == 2 ); - CGAL_triangulation_precondition( number_of_vertices() > 3 ); - CGAL_triangulation_precondition( degree( f->vertex(i) ) == - number_of_vertices()-1 ); + CGAL_expensive_precondition( is_valid() ); + CGAL_precondition( dimension() == 2 ); + CGAL_precondition( number_of_vertices() > 3 ); + CGAL_precondition( degree( f->vertex(i) ) == + number_of_vertices()-1 ); Vertex_handle v = f->vertex(i); std::list to_delete; @@ -1236,7 +1236,7 @@ remove_dim_down(Vertex_handle v) break; case 1: case 2: -// CGAL_triangulation_precondition ( +// CGAL_precondition ( // (dimension() == 1 && number_of_vertices() == 3) || // (dimension() == 2 && number_of_vertices() > 3) ); // the faces incident to v are down graded one dimension @@ -1282,12 +1282,12 @@ void Triangulation_data_structure_2:: remove_1D(Vertex_handle v) { - CGAL_triangulation_precondition( dimension() == 1 && - number_of_vertices() > 3); + CGAL_precondition( dimension() == 1 && + number_of_vertices() > 3); Face_handle f = v->face(); int i = f->index(v); if (i==0) {f = f->neighbor(1);} - CGAL_triangulation_assertion( f->index(v) == 1); + CGAL_assertion( f->index(v) == 1); Face_handle g= f->neighbor(0); f->set_vertex(1, g->vertex(1)); set_adjacency(f, 0, g->neighbor(0), 1); @@ -1304,8 +1304,8 @@ inline void Triangulation_data_structure_2:: remove_second(Vertex_handle v) { - CGAL_triangulation_precondition(number_of_vertices()== 2 && - dimension() == 0); + CGAL_precondition(number_of_vertices()== 2 && + dimension() == 0); remove_dim_down(v); return; } @@ -1316,8 +1316,8 @@ inline void Triangulation_data_structure_2:: remove_first(Vertex_handle v) { - CGAL_triangulation_precondition(number_of_vertices()== 1 && - dimension() == -1); + CGAL_precondition(number_of_vertices()== 1 && + dimension() == -1); remove_dim_down(v); return; } @@ -1353,7 +1353,7 @@ make_hole(Vertex_handle v, List_edges& hole) // delete the faces incident to v and v // and return the dscription of the hole in hole { - CGAL_triangulation_precondition(dimension() == 2); + CGAL_precondition(dimension() == 2); std::list to_delete; Face_handle f, fn; @@ -1506,9 +1506,9 @@ inline void Triangulation_data_structure_2:: set_adjacency(Face_handle f0, int i0, Face_handle f1, int i1) const { - CGAL_triangulation_assertion(i0 >= 0 && i0 <= dimension()); - CGAL_triangulation_assertion(i1 >= 0 && i1 <= dimension()); - CGAL_triangulation_assertion(f0 != f1); + CGAL_assertion(i0 >= 0 && i0 <= dimension()); + CGAL_assertion(i1 >= 0 && i1 <= dimension()); + CGAL_assertion(f0 != f1); f0->set_neighbor(i0,f1); f1->set_neighbor(i1,f0); } @@ -1518,10 +1518,10 @@ inline void Triangulation_data_structure_2:: delete_face(Face_handle f) { - CGAL_triangulation_expensive_precondition( dimension() != 2 || is_face(f)); - CGAL_triangulation_expensive_precondition( dimension() != 1 || is_edge(f,2)); - CGAL_triangulation_expensive_precondition( dimension() != 0 || - is_vertex(f->vertex(0)) ); + CGAL_expensive_precondition( dimension() != 2 || is_face(f)); + CGAL_expensive_precondition( dimension() != 1 || is_edge(f,2)); + CGAL_expensive_precondition( dimension() != 0 || + is_vertex(f->vertex(0)) ); faces().erase(f); } @@ -1530,7 +1530,7 @@ inline void Triangulation_data_structure_2:: delete_vertex(Vertex_handle v) { - CGAL_triangulation_expensive_precondition( is_vertex(v) ); + CGAL_expensive_precondition( is_vertex(v) ); vertices().erase(v); } @@ -1586,11 +1586,11 @@ split_vertex(Vertex_handle v, Face_handle f1, Face_handle g1) // */ - CGAL_triangulation_expensive_precondition( is_valid() ); + CGAL_expensive_precondition( is_valid() ); - CGAL_triangulation_precondition( dimension() == 2 ); - CGAL_triangulation_precondition( f1 != Face_handle() && f1->has_vertex(v) ); - CGAL_triangulation_precondition( g1 != Face_handle() && g1->has_vertex(v) ); + CGAL_precondition( dimension() == 2 ); + CGAL_precondition( f1 != Face_handle() && f1->has_vertex(v) ); + CGAL_precondition( g1 != Face_handle() && g1->has_vertex(v) ); // 1. first we read some information that we will need int i1 = f1->index(v); @@ -1657,7 +1657,7 @@ split_vertex(Vertex_handle v, Face_handle f1, Face_handle g1) g1->set_neighbor( cw(j1), g ); g2->set_neighbor( ccw(j2), g ); - CGAL_triangulation_expensive_postcondition( is_valid() ); + CGAL_expensive_postcondition( is_valid() ); // 6. return the new stuff return Fourtuple(v1, v2, f, g); @@ -1668,9 +1668,9 @@ typename Triangulation_data_structure_2::Vertex_handle Triangulation_data_structure_2:: join_vertices(Face_handle f, int i, Vertex_handle v) { - CGAL_triangulation_expensive_precondition( is_valid() ); - CGAL_triangulation_precondition( f != Face_handle() ); - CGAL_triangulation_precondition( i >= 0 && i <= 2 ); + CGAL_expensive_precondition( is_valid() ); + CGAL_precondition( f != Face_handle() ); + CGAL_precondition( i >= 0 && i <= 2 ); // this methods does the "join"-operation and preserves // the vertex v among the two vertices that define the edge (f, i) @@ -1678,7 +1678,7 @@ join_vertices(Face_handle f, int i, Vertex_handle v) Vertex_handle v1 = f->vertex( ccw(i) ); Vertex_handle v2 = f->vertex( cw(i) ); - CGAL_triangulation_precondition( v == v1 || v == v2 ); + CGAL_precondition( v == v1 || v == v2 ); if ( v == v2 ) { return join_vertices(f->neighbor(i), mirror_index(f,i), v); @@ -1686,7 +1686,7 @@ join_vertices(Face_handle f, int i, Vertex_handle v) size_type deg2 = degree(v2); - CGAL_triangulation_precondition( deg2 >= 3 ); + CGAL_precondition( deg2 >= 3 ); if ( deg2 == 3 ) { remove_degree_3(v2, f->neighbor(ccw(i))); @@ -1762,7 +1762,7 @@ join_vertices(Face_handle f, int i, Vertex_handle v) ++fc; } while ( fc != fc_start ); - CGAL_triangulation_assertion( + CGAL_assertion( static_cast(star_faces_of_v2.size()) == deg2 ); // from this point and on we modify the values @@ -1775,7 +1775,7 @@ join_vertices(Face_handle f, int i, Vertex_handle v) // contain v1 for (unsigned int k = 0; k < star_faces_of_v2.size(); k++) { int id = star_indices_of_v2[k]; - CGAL_triangulation_assertion( star_faces_of_v2[k]->vertex(id) == v2 ); + CGAL_assertion( star_faces_of_v2[k]->vertex(id) == v2 ); star_faces_of_v2[k]->set_vertex( id, v1 ); } @@ -1788,10 +1788,10 @@ join_vertices(Face_handle f, int i, Vertex_handle v) if ( v1->face() == f || v1->face() == g ) v1->set_face(tl); -#if ! defined(CGAL_TRIANGULATION_NO_ASSERTIONS) && ! defined(CGAL_NO_ASSERTIONS) +#if ! defined(CGAL_NO_ASSERTIONS) for (Face_iterator fit = faces_begin(); fit != faces_end(); ++fit) { int id; - CGAL_triangulation_assertion( !fit->has_vertex(v2, id) ); + CGAL_assertion( !fit->has_vertex(v2, id) ); } #endif @@ -1804,7 +1804,7 @@ join_vertices(Face_handle f, int i, Vertex_handle v) delete_vertex(v2); - CGAL_triangulation_expensive_postcondition( is_valid() ); + CGAL_expensive_postcondition( is_valid() ); return v1; } @@ -1912,7 +1912,7 @@ is_valid(bool verbose, int level) const bool result = (dimension()>= -1); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); //count and test the validity of the faces (for positive dimensions) Face_iterator ib = face_iterator_base_begin(); @@ -1922,25 +1922,25 @@ is_valid(bool verbose, int level) const count_stored_faces += 1; if (dimension()>= 0) { result = result && ib->is_valid(verbose,level); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); } } result = result && (count_stored_faces == number_of_full_dim_faces()); - CGAL_triangulation_assertion( + CGAL_assertion( count_stored_faces == number_of_full_dim_faces()); // vertex count size_type vertex_count = 0; for(Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++vit) { - CGAL_triangulation_assertion( vit->face() != Face_handle()); + CGAL_assertion( vit->face() != Face_handle()); result = result && vit->is_valid(verbose,level); - CGAL_triangulation_assertion( result ); + CGAL_assertion( result ); ++vertex_count; } result = result && (number_of_vertices() == vertex_count); - CGAL_triangulation_assertion( number_of_vertices() == vertex_count ); + CGAL_assertion( number_of_vertices() == vertex_count ); //edge count size_type edge_count = 0; @@ -1958,26 +1958,26 @@ is_valid(bool verbose, int level) const case -1: result = result && vertex_count == 1 && face_count == 0 && edge_count == 0; - CGAL_triangulation_assertion(result); + CGAL_assertion(result); break; case 0: result = result && vertex_count == 2 && face_count == 0 && edge_count == 0; - CGAL_triangulation_assertion(result); + CGAL_assertion(result); break; case 1: result = result && edge_count == vertex_count; - CGAL_triangulation_assertion(result); + CGAL_assertion(result); result = result && face_count == 0; - CGAL_triangulation_assertion(result); + CGAL_assertion(result); break; case 2: result = result && edge_count == 3*face_count/2 ; - CGAL_triangulation_assertion(edge_count == 3*face_count/2); + CGAL_assertion(edge_count == 3*face_count/2); break; default: result = false; - CGAL_triangulation_assertion(result); + CGAL_assertion(result); } return result; } @@ -1992,7 +1992,7 @@ copy_tds(const TDS_src& tds_src, const ConvertFace& convert_face) { if (vert != typename TDS_src::Vertex_handle()) - CGAL_triangulation_precondition( tds_src.is_vertex(vert)); + CGAL_precondition( tds_src.is_vertex(vert)); clear(); set_dimension(tds_src.dimension()); @@ -2043,7 +2043,7 @@ copy_tds(const TDS_src& tds_src, // remove the post condition because it is false when copying the // TDS of a regular triangulation because of hidden vertices - // CGAL_triangulation_postcondition( is_valid() ); + // CGAL_postcondition( is_valid() ); return (vert == typename TDS_src::Vertex_handle()) ? Vertex_handle() : vmap[vert]; } diff --git a/TDS_2/include/CGAL/Triangulation_ds_circulators_2.h b/TDS_2/include/CGAL/Triangulation_ds_circulators_2.h index bf5aa71b9a2..3fa0d17af0a 100644 --- a/TDS_2/include/CGAL/Triangulation_ds_circulators_2.h +++ b/TDS_2/include/CGAL/Triangulation_ds_circulators_2.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include namespace CGAL { @@ -71,22 +71,22 @@ public: bool operator!=(const Face_handle &fh) const { return pos != fh; } bool is_empty() const; - bool operator==(std::nullptr_t /*CGAL_triangulation_assertion_code(n)*/) const; - bool operator!=(std::nullptr_t /*CGAL_triangulation_assertion_code(n)*/) const; + bool operator==(std::nullptr_t /*CGAL_assertion_code(n)*/) const; + bool operator!=(std::nullptr_t /*CGAL_assertion_code(n)*/) const; Face& operator*() const { - CGAL_triangulation_precondition(pos != Face_handle() && - _v != Vertex_handle()); + CGAL_precondition(pos != Face_handle() && + _v != Vertex_handle()); return *pos; } Face* operator->() const { - CGAL_triangulation_precondition(pos != Face_handle() && - _v != Vertex_handle()); + CGAL_precondition(pos != Face_handle() && + _v != Vertex_handle()); return &*pos; } @@ -152,22 +152,22 @@ public: { return pos->vertex(_ri) != vh; } bool is_empty() const; - bool operator==(std::nullptr_t /*CGAL_triangulation_assertion_code(n)*/) const; - bool operator!=(std::nullptr_t /*CGAL_triangulation_assertion_code(n)*/) const; + bool operator==(std::nullptr_t /*CGAL_assertion_code(n)*/) const; + bool operator!=(std::nullptr_t /*CGAL_assertion_code(n)*/) const; Vertex& operator*() const { - CGAL_triangulation_precondition(pos != Face_handle() && - _v != Vertex_handle()); + CGAL_precondition(pos != Face_handle() && + _v != Vertex_handle()); return *(pos->vertex(_ri)); } Vertex* operator->() const { - CGAL_triangulation_precondition(pos != Face_handle() && - _v != Vertex_handle()); + CGAL_precondition(pos != Face_handle() && + _v != Vertex_handle()); return &*(pos->vertex(_ri)); } @@ -231,8 +231,8 @@ public: bool operator==(const Edge_circulator &vc) const; bool operator!=(const Edge_circulator &vc) const; bool is_empty() const; - bool operator==(std::nullptr_t /*CGAL_triangulation_assertion_code(n)*/) const; - bool operator!=(std::nullptr_t /*CGAL_triangulation_assertion_code(n)*/) const; + bool operator==(std::nullptr_t /*CGAL_assertion_code(n)*/) const; + bool operator!=(std::nullptr_t /*CGAL_assertion_code(n)*/) const; Edge* operator->() const { edge.first=pos; @@ -259,7 +259,7 @@ Triangulation_ds_face_circulator_2(Vertex_handle v, Face_handle f) if (pos == Face_handle()|| pos->dimension() < 2) { _v = Vertex_handle() ; pos = Face_handle(); return;} - else CGAL_triangulation_precondition( pos->has_vertex(v)); + else CGAL_precondition( pos->has_vertex(v)); } @@ -268,8 +268,8 @@ Triangulation_ds_face_circulator_2& Triangulation_ds_face_circulator_2 :: operator++() { - CGAL_triangulation_precondition( pos != Face_handle() && - _v != Vertex_handle()); + CGAL_precondition( pos != Face_handle() && + _v != Vertex_handle()); int i = pos->index(_v); pos = pos->neighbor(ccw(i)); return *this; @@ -280,8 +280,8 @@ Triangulation_ds_face_circulator_2 Triangulation_ds_face_circulator_2 :: operator++(int) { - CGAL_triangulation_precondition(pos != Face_handle() && - _v != Vertex_handle()); + CGAL_precondition(pos != Face_handle() && + _v != Vertex_handle()); Face_circulator tmp(*this); ++(*this); return tmp; @@ -292,8 +292,8 @@ Triangulation_ds_face_circulator_2& Triangulation_ds_face_circulator_2 :: operator--() { - CGAL_triangulation_precondition(pos != Face_handle() && - _v != Vertex_handle()); + CGAL_precondition(pos != Face_handle() && + _v != Vertex_handle()); int i = pos->index(_v); pos = pos->neighbor(cw(i)); return *this; @@ -304,8 +304,8 @@ Triangulation_ds_face_circulator_2 Triangulation_ds_face_circulator_2 :: operator--(int) { - CGAL_triangulation_precondition(pos != Face_handle() && - _v != Vertex_handle()); + CGAL_precondition(pos != Face_handle() && + _v != Vertex_handle()); Face_circulator tmp(*this); --(*this); return tmp; @@ -338,18 +338,18 @@ return (_v == Vertex_handle() || pos == Face_handle() ); template < class Tds > inline bool Triangulation_ds_face_circulator_2 :: -operator==(std::nullptr_t /*CGAL_triangulation_assertion_code(n)*/) const +operator==(std::nullptr_t /*CGAL_assertion_code(n)*/) const { - //CGAL_triangulation_assertion( n == nullptr); + //CGAL_assertion( n == nullptr); return (_v == Vertex_handle() || pos == Face_handle() ); } template < class Tds > inline bool Triangulation_ds_face_circulator_2 :: -operator!=(std::nullptr_t /*CGAL_triangulation_assertion_code(n)*/) const +operator!=(std::nullptr_t /*CGAL_assertion_code(n)*/) const { - //CGAL_triangulation_assertion( n == nullptr); + //CGAL_assertion( n == nullptr); return ! (*this == nullptr); } @@ -376,8 +376,8 @@ Triangulation_ds_vertex_circulator_2& Triangulation_ds_vertex_circulator_2 :: operator++() { - CGAL_triangulation_precondition(pos != Face_handle() && - _v != Vertex_handle()); + CGAL_precondition(pos != Face_handle() && + _v != Vertex_handle()); int i = pos->index(_v); if (pos->dimension() == 1) { @@ -408,7 +408,7 @@ Triangulation_ds_vertex_circulator_2& Triangulation_ds_vertex_circulator_2 :: operator--() { - CGAL_triangulation_precondition(pos != Face_handle() && + CGAL_precondition(pos != Face_handle() && _v != Vertex_handle()); int i = pos->index(_v); @@ -462,18 +462,18 @@ is_empty() const template < class Tds > inline bool Triangulation_ds_vertex_circulator_2 :: -operator==(std::nullptr_t /*CGAL_triangulation_assertion_code(n)*/) const +operator==(std::nullptr_t /*CGAL_assertion_code(n)*/) const { - //CGAL_triangulation_assertion( n == nullptr); + //CGAL_assertion( n == nullptr); return (_v == Vertex_handle() || pos == Face_handle()); } template < class Tds > inline bool Triangulation_ds_vertex_circulator_2 :: -operator!=(std::nullptr_t /*CGAL_triangulation_assertion_code(n)*/) const +operator!=(std::nullptr_t /*CGAL_assertion_code(n)*/) const { - //CGAL_triangulation_assertion( n == nullptr); + //CGAL_assertion( n == nullptr); return !(*this == nullptr); } @@ -499,7 +499,7 @@ Triangulation_ds_edge_circulator_2& Triangulation_ds_edge_circulator_2 :: operator++() { - CGAL_triangulation_precondition(pos != Face_handle() && + CGAL_precondition(pos != Face_handle() && _v != Vertex_handle()); int i = pos->index(_v); if (pos->dimension() == 1) { @@ -530,8 +530,8 @@ Triangulation_ds_edge_circulator_2& Triangulation_ds_edge_circulator_2 :: operator--() { - CGAL_triangulation_precondition(pos != Face_handle() && - _v != Vertex_handle()); + CGAL_precondition(pos != Face_handle() && + _v != Vertex_handle()); int i = pos->index(_v); if (pos->dimension() == 1) { @@ -584,18 +584,18 @@ is_empty() const template < class Tds > inline bool Triangulation_ds_edge_circulator_2 :: -operator==(std::nullptr_t /*CGAL_triangulation_assertion_code(n)*/) const +operator==(std::nullptr_t /*CGAL_assertion_code(n)*/) const { - //CGAL_triangulation_assertion( n == nullptr); + //CGAL_assertion( n == nullptr); return (_v == Vertex_handle() || pos == Face_handle()); } template < class Tds > inline bool Triangulation_ds_edge_circulator_2 :: -operator!=(std::nullptr_t /*CGAL_triangulation_assertion_code(n)*/) const +operator!=(std::nullptr_t /*CGAL_assertion_code(n)*/) const { - //CGAL_triangulation_assertion( n == nullptr); + //CGAL_assertion( n == nullptr); return !(*this == nullptr); } diff --git a/TDS_2/include/CGAL/Triangulation_ds_face_2.h b/TDS_2/include/CGAL/Triangulation_ds_face_2.h index e617e4c3320..4cad650dbc3 100644 --- a/TDS_2/include/CGAL/Triangulation_ds_face_2.h +++ b/TDS_2/include/CGAL/Triangulation_ds_face_2.h @@ -67,8 +67,8 @@ typename Triangulation_ds_face_2::Vertex_handle Triangulation_ds_face_2:: mirror_vertex(int i) const { - CGAL_triangulation_precondition ( this->neighbor(i) != Face_handle() - && this->dimension() >= 1); + CGAL_precondition ( this->neighbor(i) != Face_handle() + && this->dimension() >= 1); //return neighbor(i)->vertex(neighbor(i)->index(this->handle())); return this->neighbor(i)->vertex(mirror_index(i)); } @@ -79,8 +79,8 @@ Triangulation_ds_face_2:: mirror_index(int i) const { // return the index of opposite vertex in neighbor(i); - CGAL_triangulation_precondition (this->neighbor(i) != Face_handle() && - this->dimension() >= 1); + CGAL_precondition (this->neighbor(i) != Face_handle() && + this->dimension() >= 1); if (this->dimension() == 1) { return 1 - (this->neighbor(i)->index(this->vertex(1-i))); } diff --git a/TDS_2/include/CGAL/Triangulation_ds_face_base_2.h b/TDS_2/include/CGAL/Triangulation_ds_face_base_2.h index b9e660d9d03..bb4c448c669 100644 --- a/TDS_2/include/CGAL/Triangulation_ds_face_base_2.h +++ b/TDS_2/include/CGAL/Triangulation_ds_face_base_2.h @@ -17,7 +17,7 @@ #include -#include +#include #include #include @@ -129,7 +129,7 @@ typename Triangulation_ds_face_base_2::Vertex_handle Triangulation_ds_face_base_2:: vertex(int i) const { - CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2); + CGAL_precondition( i == 0 || i == 1 || i == 2); return V[i]; } @@ -169,7 +169,7 @@ index(Vertex_handle v) const { if (v == V[0]) return 0; if (v == V[1]) return 1; - CGAL_triangulation_assertion( v == V[2] ); + CGAL_assertion( v == V[2] ); return 2; } @@ -179,7 +179,7 @@ typename Triangulation_ds_face_base_2::Face_handle Triangulation_ds_face_base_2:: neighbor(int i) const { - CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2); + CGAL_precondition( i == 0 || i == 1 || i == 2); return N[i]; } @@ -221,7 +221,7 @@ index(Face_handle n) const { if (n == N[0]) return 0; if (n == N[1]) return 1; - CGAL_triangulation_assertion( n == N[2] ); + CGAL_assertion( n == N[2] ); return 2; } @@ -230,7 +230,7 @@ inline void Triangulation_ds_face_base_2 :: set_vertex(int i, Vertex_handle v) { - CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2); + CGAL_precondition( i == 0 || i == 1 || i == 2); V[i] = v; } @@ -239,8 +239,8 @@ inline void Triangulation_ds_face_base_2 :: set_neighbor(int i, Face_handle n) { - CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2); - CGAL_triangulation_precondition( this != n.operator->() ); + CGAL_precondition( i == 0 || i == 1 || i == 2); + CGAL_precondition( this != n.operator->() ); N[i] = n; } @@ -275,9 +275,9 @@ inline void Triangulation_ds_face_base_2 :: set_neighbors(Face_handle n0,Face_handle n1, Face_handle n2) { - CGAL_triangulation_precondition( this != n0.operator->() ); - CGAL_triangulation_precondition( this != n1.operator->() ); - CGAL_triangulation_precondition( this != n2.operator->() ); + CGAL_precondition( this != n0.operator->() ); + CGAL_precondition( this != n1.operator->() ); + CGAL_precondition( this != n2.operator->() ); N[0] = n0; N[1] = n1; N[2] = n2; diff --git a/TDS_2/include/CGAL/Triangulation_ds_iterators_2.h b/TDS_2/include/CGAL/Triangulation_ds_iterators_2.h index caede3ef945..45c9c07ec23 100644 --- a/TDS_2/include/CGAL/Triangulation_ds_iterators_2.h +++ b/TDS_2/include/CGAL/Triangulation_ds_iterators_2.h @@ -17,7 +17,7 @@ #include -#include +#include #include namespace CGAL { @@ -109,7 +109,7 @@ void Triangulation_ds_edge_iterator_2:: increment() { - CGAL_triangulation_precondition(_tds->dimension() >= 1); + CGAL_precondition(_tds->dimension() >= 1); if (_tds->dimension() == 1) ++pos; else if (edge.second == 2) {edge.second = 0; ++pos;} else edge.second += 1; @@ -122,7 +122,7 @@ void Triangulation_ds_edge_iterator_2:: decrement() { - CGAL_triangulation_precondition(_tds->dimension() >= 1); + CGAL_precondition(_tds->dimension() >= 1); if (_tds->dimension() == 1) --pos; else if (edge.second == 0) { edge.second = 2; --pos;} else edge.second -= 1; @@ -145,7 +145,7 @@ Triangulation_ds_edge_iterator_2& Triangulation_ds_edge_iterator_2:: operator++() { - //CGAL_triangulation_precondition(pos != Iterator_base() && + //CGAL_precondition(pos != Iterator_base() && // pos != _tds->faces().end()); do increment(); while( pos != _tds->faces().end() && !associated_edge()); @@ -159,7 +159,7 @@ Triangulation_ds_edge_iterator_2& Triangulation_ds_edge_iterator_2:: operator--() { - // CGAL_triangulation_precondition(pos != Iterator_base() + // CGAL_precondition(pos != Iterator_base() // && *this != Edge_iterator(_tds)); do decrement(); while ( !associated_edge() && *this != Edge_iterator(_tds) ); diff --git a/TDS_2/include/CGAL/Triangulation_ds_vertex_2.h b/TDS_2/include/CGAL/Triangulation_ds_vertex_2.h index 4f2c6fee42e..ca17923ec49 100644 --- a/TDS_2/include/CGAL/Triangulation_ds_vertex_2.h +++ b/TDS_2/include/CGAL/Triangulation_ds_vertex_2.h @@ -17,7 +17,7 @@ #include -#include +#include namespace CGAL { @@ -105,13 +105,13 @@ Triangulation_ds_vertex_2 :: is_valid(bool verbose, int level) { bool result = Vb::is_valid(verbose, level); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); if (this->face() != Face_handle()) { // face==nullptr if dim <0 result = result && ( &*this->face()->vertex(0) == this || &*this->face()->vertex(1) == this || &*this->face()->vertex(2) == this ); } - CGAL_triangulation_assertion(result); + CGAL_assertion(result); return result; } diff --git a/TDS_2/include/CGAL/Triangulation_utils_2.h b/TDS_2/include/CGAL/Triangulation_utils_2.h index 2501c51858f..17f661eafea 100644 --- a/TDS_2/include/CGAL/Triangulation_utils_2.h +++ b/TDS_2/include/CGAL/Triangulation_utils_2.h @@ -18,7 +18,7 @@ #include -#include +#include namespace CGAL { template < class T = void > @@ -39,13 +39,13 @@ class Triangulation_cw_ccw_2 public: static int ccw(const int i) { - CGAL_triangulation_precondition( i >= 0 && i < 3); + CGAL_precondition( i >= 0 && i < 3); return ccw_map[i]; } static int cw(const int i) { - CGAL_triangulation_precondition( i >= 0 && i < 3); + CGAL_precondition( i >= 0 && i < 3); return cw_map[i]; } }; diff --git a/TDS_3/include/CGAL/TDS_3/internal/Triangulation_ds_circulators_3.h b/TDS_3/include/CGAL/TDS_3/internal/Triangulation_ds_circulators_3.h index e39b14907bb..3568d783b53 100644 --- a/TDS_3/include/CGAL/TDS_3/internal/Triangulation_ds_circulators_3.h +++ b/TDS_3/include/CGAL/TDS_3/internal/Triangulation_ds_circulators_3.h @@ -15,7 +15,7 @@ #include -#include +#include #include #include @@ -45,43 +45,43 @@ public: Triangulation_ds_cell_circulator_3(Cell_handle c, int s, int t) : _s(c->vertex(s)), _t(c->vertex(t)), pos(c) { - CGAL_triangulation_precondition( c != Cell_handle() && - s >= 0 && s < 4 && - t >= 0 && t < 4 ); + CGAL_precondition( c != Cell_handle() && + s >= 0 && s < 4 && + t >= 0 && t < 4 ); } Triangulation_ds_cell_circulator_3(const Edge & e) : _s(e.first->vertex(e.second)), _t(e.first->vertex(e.third)), pos(e.first) { - CGAL_triangulation_precondition( e.first != Cell_handle() && - e.second >=0 && e.second < 4 && - e.third >=0 && e.third < 4); + CGAL_precondition( e.first != Cell_handle() && + e.second >=0 && e.second < 4 && + e.third >=0 && e.third < 4); } Triangulation_ds_cell_circulator_3(Cell_handle c, int s, int t, Cell_handle start) : _s(c->vertex(s)), _t(c->vertex(t)), pos(start) { - CGAL_triangulation_precondition( c != Cell_handle() && - s >= 0 && s < 4 && - t >= 0 && t < 4 && - start->has_vertex( _s ) && - start->has_vertex( _t ) ); + CGAL_precondition( c != Cell_handle() && + s >= 0 && s < 4 && + t >= 0 && t < 4 && + start->has_vertex( _s ) && + start->has_vertex( _t ) ); } Triangulation_ds_cell_circulator_3(const Edge & e, Cell_handle start) : _s(e.first->vertex(e.second)), _t(e.first->vertex(e.third)), pos(start) { - CGAL_triangulation_precondition( e.first != Cell_handle() && - e.second >=0 && e.second < 4 && - e.third >=0 && e.third < 4 && - start->has_vertex( _s ) && - start->has_vertex( _t ) ); + CGAL_precondition( e.first != Cell_handle() && + e.second >=0 && e.second < 4 && + e.third >=0 && e.third < 4 && + start->has_vertex( _s ) && + start->has_vertex( _t ) ); } Cell_circulator & operator++() { - CGAL_triangulation_precondition( pos != Cell_handle() ); + CGAL_precondition( pos != Cell_handle() ); //then dimension() cannot be < 3 pos = pos->neighbor(next_around_edge(pos->index(_s), pos->index(_t))); @@ -97,7 +97,7 @@ public: Cell_circulator & operator--() { - CGAL_triangulation_precondition( pos != Cell_handle() ); + CGAL_precondition( pos != Cell_handle() ); pos = pos->neighbor(next_around_edge(pos->index(_t), pos->index(_s))); return *this; @@ -140,9 +140,9 @@ public: return ch != pos; } - bool operator==(std::nullptr_t CGAL_triangulation_assertion_code(n)) const + bool operator==(std::nullptr_t CGAL_assertion_code(n)) const { - CGAL_triangulation_assertion( n == nullptr); + CGAL_assertion( n == nullptr); return pos == Cell_handle(); } @@ -207,34 +207,34 @@ public: Triangulation_ds_facet_circulator_3(Cell_handle c, int s, int t) : _s(c->vertex(s)), _t(c->vertex(t)), pos(c) { - CGAL_triangulation_precondition( c != Cell_handle() && - s >= 0 && s < 4 && - t >= 0 && t < 4 ); + CGAL_precondition( c != Cell_handle() && + s >= 0 && s < 4 && + t >= 0 && t < 4 ); } Triangulation_ds_facet_circulator_3(const Edge & e) : _s(e.first->vertex(e.second)), _t(e.first->vertex(e.third)), pos(e.first) { - CGAL_triangulation_precondition( e.first != Cell_handle() && - e.second >= 0 && e.second < 4 && - e.third >= 0 && e.third < 4); + CGAL_precondition( e.first != Cell_handle() && + e.second >= 0 && e.second < 4 && + e.third >= 0 && e.third < 4); } Triangulation_ds_facet_circulator_3(Cell_handle c, int s, int t, Cell_handle start, int f) : _s(c->vertex(s)), _t(c->vertex(t)) { - CGAL_triangulation_precondition( c != Cell_handle() && - s >= 0 && s < 4 && - t >= 0 && t < 4 && - f >= 0 && f < 4 && - start->has_vertex( _s ) && - start->has_vertex( _t ) ); + CGAL_precondition( c != Cell_handle() && + s >= 0 && s < 4 && + t >= 0 && t < 4 && + f >= 0 && f < 4 && + start->has_vertex( _s ) && + start->has_vertex( _t ) ); int i = start->index( _s ); int j = start->index( _t ); - CGAL_triangulation_precondition( f!=i && f!=j ); + CGAL_precondition( f!=i && f!=j ); if ( f == next_around_edge(i,j) ) pos = start; @@ -246,16 +246,16 @@ public: const Facet & start) : _s(c->vertex(s)), _t(c->vertex(t)) { - CGAL_triangulation_precondition( c != Cell_handle() && - s >= 0 && s < 4 && - t >= 0 && t < 4 && - start.first->has_vertex( _s ) && - start.first->has_vertex( _t ) ); + CGAL_precondition( c != Cell_handle() && + s >= 0 && s < 4 && + t >= 0 && t < 4 && + start.first->has_vertex( _s ) && + start.first->has_vertex( _t ) ); int i = start.first->index( _s ); int j = start.first->index( _t ); - CGAL_triangulation_precondition( start.second !=i && start.second !=j ); + CGAL_precondition( start.second !=i && start.second !=j ); if ( start.second == next_around_edge(i,j) ) pos = start.first; @@ -266,17 +266,17 @@ public: Triangulation_ds_facet_circulator_3(const Edge & e, Cell_handle start, int f) : _s(e.first->vertex(e.second)), _t(e.first->vertex(e.third)) { - CGAL_triangulation_precondition( e.first != Cell_handle() && - e.second >= 0 && e.second < 4 && - e.third >= 0 && e.third < 4 && - f >= 0 && f < 4 && - start->has_vertex( _s ) && - start->has_vertex( _t ) ); + CGAL_precondition( e.first != Cell_handle() && + e.second >= 0 && e.second < 4 && + e.third >= 0 && e.third < 4 && + f >= 0 && f < 4 && + start->has_vertex( _s ) && + start->has_vertex( _t ) ); int i = start->index( _s ); int j = start->index( _t ); - CGAL_triangulation_precondition( f!=i && f!=j ); + CGAL_precondition( f!=i && f!=j ); if ( f == next_around_edge(i,j) ) pos = start; @@ -287,11 +287,11 @@ public: Triangulation_ds_facet_circulator_3(const Edge & e, const Facet & start) : _s(e.first->vertex(e.second)), _t(e.first->vertex(e.third)) { - CGAL_triangulation_precondition( e.first != Cell_handle() && - e.second >= 0 && e.second < 4 && - e.third >= 0 && e.third < 4 && - start.first->has_vertex( _s ) && - start.first->has_vertex( _t ) ); + CGAL_precondition( e.first != Cell_handle() && + e.second >= 0 && e.second < 4 && + e.third >= 0 && e.third < 4 && + start.first->has_vertex( _s ) && + start.first->has_vertex( _t ) ); int i = start.first->index( _s ); int j = start.first->index( _t ); @@ -304,7 +304,7 @@ public: Facet_circulator & operator++() { - CGAL_triangulation_precondition( pos != Cell_handle() ); + CGAL_precondition( pos != Cell_handle() ); //then dimension() cannot be < 3 pos = pos->neighbor( next_around_edge( pos->index(_s), pos->index(_t) ) ); @@ -320,7 +320,7 @@ public: Facet_circulator & operator--() { - CGAL_triangulation_precondition( pos != Cell_handle() ); + CGAL_precondition( pos != Cell_handle() ); pos = pos->neighbor( next_around_edge( pos->index(_t), pos->index(_s) ) ); return *this; @@ -359,9 +359,9 @@ public: return ! (*this == ccir); } - bool operator==(std::nullptr_t CGAL_triangulation_assertion_code(c)) const + bool operator==(std::nullptr_t CGAL_assertion_code(c)) const { - CGAL_triangulation_assertion(c == nullptr); + CGAL_assertion(c == nullptr); return pos == Cell_handle(); } @@ -410,7 +410,7 @@ public: Face_circulator & operator++() { - CGAL_triangulation_precondition( pos != Cell_handle() ); + CGAL_precondition( pos != Cell_handle() ); //then dimension() cannot be < 3 pos = pos->neighbor(ccw(pos->index(_s))); @@ -426,7 +426,7 @@ public: Face_circulator & operator--() { - CGAL_triangulation_precondition( pos != Cell_handle() ); + CGAL_precondition( pos != Cell_handle() ); pos = pos->neighbor(cw(pos->index(_s))); return *this; @@ -459,9 +459,9 @@ public: return ! (*this == ccir); } - bool operator==(std::nullptr_t CGAL_triangulation_assertion_code(c)) const + bool operator==(std::nullptr_t CGAL_assertion_code(c)) const { - CGAL_triangulation_assertion(c == nullptr); + CGAL_assertion(c == nullptr); return pos == Cell_handle(); } diff --git a/TDS_3/include/CGAL/TDS_3/internal/Triangulation_ds_iterators_3.h b/TDS_3/include/CGAL/TDS_3/internal/Triangulation_ds_iterators_3.h index 885172184d0..459b166447e 100644 --- a/TDS_3/include/CGAL/TDS_3/internal/Triangulation_ds_iterators_3.h +++ b/TDS_3/include/CGAL/TDS_3/internal/Triangulation_ds_iterators_3.h @@ -17,7 +17,6 @@ #include -#include #include namespace CGAL { namespace internal { diff --git a/TDS_3/include/CGAL/Triangulation_data_structure_3.h b/TDS_3/include/CGAL/Triangulation_data_structure_3.h index c75846da252..b7830d74c0a 100644 --- a/TDS_3/include/CGAL/Triangulation_data_structure_3.h +++ b/TDS_3/include/CGAL/Triangulation_data_structure_3.h @@ -36,7 +36,7 @@ #include #include -#include +#include #include #include @@ -338,14 +338,14 @@ public: Cell_handle create_face() { - CGAL_triangulation_precondition(dimension()<3); + CGAL_precondition(dimension()<3); return create_cell(); } Cell_handle create_face(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2) { - CGAL_triangulation_precondition(dimension()<3); + CGAL_precondition(dimension()<3); return cells().emplace(v0, v1, v2, Vertex_handle()); } @@ -354,7 +354,7 @@ public: Cell_handle f1, int i1, Cell_handle f2, int i2) { - CGAL_triangulation_precondition(dimension() <= 2); + CGAL_precondition(dimension() <= 2); Cell_handle newf = create_face(f0->vertex(cw(i0)), f1->vertex(cw(i1)), f2->vertex(cw(i2))); @@ -367,7 +367,7 @@ public: Cell_handle create_face(Cell_handle f0, int i0, Cell_handle f1, int i1) { - CGAL_triangulation_precondition(dimension() <= 2); + CGAL_precondition(dimension() <= 2); Cell_handle newf = create_face(f0->vertex(cw(i0)), f1->vertex(cw(i1)), f1->vertex(ccw(i1))); @@ -378,7 +378,7 @@ public: Cell_handle create_face(Cell_handle f, int i, Vertex_handle v) { - CGAL_triangulation_precondition(dimension() <= 2); + CGAL_precondition(dimension() <= 2); Cell_handle newf = create_face(f->vertex(cw(i)), f->vertex(ccw(i)), v); @@ -397,13 +397,13 @@ public: void delete_vertex( Vertex_handle v ) { - CGAL_triangulation_expensive_precondition( is_vertex(v) ); + CGAL_expensive_precondition( is_vertex(v) ); vertices().erase(v); } void delete_cell( Cell_handle c ) { - CGAL_triangulation_expensive_precondition( is_simplex(c) ); + CGAL_expensive_precondition( is_simplex(c) ); cells().erase(c); } @@ -504,7 +504,7 @@ public: Cell_handle begin, int i, Vertex_handle newv) { - CGAL_triangulation_precondition(begin != Cell_handle()); + CGAL_precondition(begin != Cell_handle()); // if begin == nullptr (default arg), we could compute one by walking in // CellIt. At the moment, the functionality is not available, you have // to specify a starting facet. @@ -639,7 +639,7 @@ public: // Change orientation of the whole TDS. void reorient() { - CGAL_triangulation_precondition(dimension() >= 1); + CGAL_precondition(dimension() >= 1); for (Cell_iterator i = cells().begin(); i != cells().end(); ++i) change_orientation(i); @@ -728,66 +728,66 @@ public: // cells around an edge Cell_circulator incident_cells(const Edge & e) const { - CGAL_triangulation_precondition( dimension() == 3 ); + CGAL_precondition( dimension() == 3 ); return Cell_circulator(e); } Cell_circulator incident_cells(Cell_handle ce, int i, int j) const { - CGAL_triangulation_precondition( dimension() == 3 ); + CGAL_precondition( dimension() == 3 ); return Cell_circulator(ce, i, j); } Cell_circulator incident_cells(const Edge &e, Cell_handle start) const { - CGAL_triangulation_precondition( dimension() == 3 ); + CGAL_precondition( dimension() == 3 ); return Cell_circulator(e, start); } Cell_circulator incident_cells(Cell_handle ce, int i, int j, Cell_handle start) const { - CGAL_triangulation_precondition( dimension() == 3 ); + CGAL_precondition( dimension() == 3 ); return Cell_circulator(ce, i, j, start); } //facets around an edge Facet_circulator incident_facets(const Edge & e) const { - CGAL_triangulation_precondition( dimension() == 3 ); + CGAL_precondition( dimension() == 3 ); return Facet_circulator(e); } Facet_circulator incident_facets(Cell_handle ce, int i, int j) const { - CGAL_triangulation_precondition( dimension() == 3 ); + CGAL_precondition( dimension() == 3 ); return Facet_circulator(ce, i, j); } Facet_circulator incident_facets(const Edge & e, const Facet & start) const { - CGAL_triangulation_precondition( dimension() == 3 ); + CGAL_precondition( dimension() == 3 ); return Facet_circulator(e, start); } Facet_circulator incident_facets(Cell_handle ce, int i, int j, const Facet & start) const { - CGAL_triangulation_precondition( dimension() == 3 ); + CGAL_precondition( dimension() == 3 ); return Facet_circulator(ce, i, j, start); } Facet_circulator incident_facets(const Edge & e, Cell_handle start, int f) const { - CGAL_triangulation_precondition( dimension() == 3 ); + CGAL_precondition( dimension() == 3 ); return Facet_circulator(e, start, f); } Facet_circulator incident_facets(Cell_handle ce, int i, int j, Cell_handle start, int f) const { - CGAL_triangulation_precondition( dimension() == 3 ); + CGAL_precondition( dimension() == 3 ); return Facet_circulator(ce, i, j, start, f); } // 2D : circulates on the faces adjacent to a vertex. Face_circulator incident_faces(Vertex_handle v) const { - CGAL_triangulation_precondition( dimension() == 2 ); + CGAL_precondition( dimension() == 2 ); return Face_circulator(v, v->cell()); } @@ -800,7 +800,7 @@ private: std::pair it) const { - CGAL_triangulation_precondition(dimension() == 3); + CGAL_precondition(dimension() == 3); std::stack cell_stack; cell_stack.push(d); @@ -861,7 +861,7 @@ private: void just_incident_cells_3(Vertex_handle v, std::vector& cells) const { - CGAL_triangulation_precondition(dimension() == 3); + CGAL_precondition(dimension() == 3); Cell_handle d = v->cell(); cells.push_back(d); @@ -890,7 +890,7 @@ private: incident_cells_2(Vertex_handle v, Cell_handle, OutputIterator cells) const { - CGAL_triangulation_precondition(dimension() == 2); + CGAL_precondition(dimension() == 2); Face_circulator fc = incident_faces(v); Face_circulator done(fc); @@ -1166,7 +1166,7 @@ public: OutputIterator incident_facets(Vertex_handle v, OutputIterator facets, Filter f = Filter()) const { - CGAL_triangulation_precondition( dimension() > 1 ); + CGAL_precondition( dimension() > 1 ); if(dimension() == 3) return visit_incident_cells, OutputIterator>(v, facets, f); else @@ -1184,7 +1184,7 @@ public: OutputIterator incident_facets_threadsafe(Vertex_handle v, OutputIterator facets, Filter f = Filter()) const { - CGAL_triangulation_precondition( dimension() > 1 ); + CGAL_precondition( dimension() > 1 ); if(dimension() == 3) return visit_incident_cells_threadsafe, OutputIterator>(v, facets, f); else @@ -1203,7 +1203,7 @@ public: incident_edges_1d(Vertex_handle v, OutputIterator edges, Filter f = Filter()) const { CGAL_assertion (dimension() == 1); - CGAL_triangulation_assertion( number_of_vertices() >= 3); + CGAL_assertion( number_of_vertices() >= 3); Cell_handle n0 = v->cell(); const int index_v_in_n0 = n0->index(v); CGAL_assume(index_v_in_n0 <= 1); @@ -1221,10 +1221,10 @@ public: OutputIterator incident_edges(Vertex_handle v, OutputIterator edges, Filter f = Filter()) const { - CGAL_triangulation_precondition( v != Vertex_handle() ); - CGAL_triangulation_precondition( dimension() >= 1 ); - CGAL_triangulation_expensive_precondition( is_vertex(v) ); - CGAL_triangulation_expensive_precondition( is_valid() ); + CGAL_precondition( v != Vertex_handle() ); + CGAL_precondition( dimension() >= 1 ); + CGAL_expensive_precondition( is_vertex(v) ); + CGAL_expensive_precondition( is_valid() ); if (dimension() == 1) { return incident_edges_1d(v, edges, f); @@ -1240,10 +1240,10 @@ public: incident_edges_threadsafe(Vertex_handle v, OutputIterator edges, Filter f = Filter()) const { - CGAL_triangulation_precondition( v != Vertex_handle() ); - CGAL_triangulation_precondition( dimension() >= 1 ); - CGAL_triangulation_expensive_precondition( is_vertex(v) ); - CGAL_triangulation_expensive_precondition( is_valid() ); + CGAL_precondition( v != Vertex_handle() ); + CGAL_precondition( dimension() >= 1 ); + CGAL_expensive_precondition( is_vertex(v) ); + CGAL_expensive_precondition( is_valid() ); if (dimension() == 1) { return incident_edges_1d(v, edges, f); @@ -1273,10 +1273,10 @@ public: OutputIterator adjacent_vertices(Vertex_handle v, OutputIterator vertices, Filter f = Filter()) const { - CGAL_triangulation_precondition( v != Vertex_handle() ); - CGAL_triangulation_precondition( dimension() >= -1 ); - CGAL_triangulation_expensive_precondition( is_vertex(v) ); - CGAL_triangulation_expensive_precondition( is_valid() ); + CGAL_precondition( v != Vertex_handle() ); + CGAL_precondition( dimension() >= -1 ); + CGAL_expensive_precondition( is_vertex(v) ); + CGAL_expensive_precondition( is_valid() ); if (dimension() == -1) return vertices; @@ -1288,7 +1288,7 @@ public: } if (dimension() == 1) { - CGAL_triangulation_assertion( number_of_vertices() >= 3); + CGAL_assertion( number_of_vertices() >= 3); Cell_handle n0 = v->cell(); const int index_v_in_n0 = n0->index(v); CGAL_assume(index_v_in_n0 <= 1); @@ -1335,10 +1335,10 @@ public: adjacent_vertices_threadsafe(Vertex_handle v, OutputIterator vertices, Filter f = Filter()) const { - CGAL_triangulation_precondition(v != Vertex_handle()); - CGAL_triangulation_precondition(dimension() >= -1); - CGAL_triangulation_expensive_precondition(is_vertex(v)); - CGAL_triangulation_expensive_precondition(is_valid()); + CGAL_precondition(v != Vertex_handle()); + CGAL_precondition(dimension() >= -1); + CGAL_expensive_precondition(is_vertex(v)); + CGAL_expensive_precondition(is_valid()); if (dimension() == -1) return vertices; @@ -1350,7 +1350,7 @@ public: } if (dimension() == 1) { - CGAL_triangulation_assertion(number_of_vertices() >= 3); + CGAL_assertion(number_of_vertices() >= 3); Cell_handle n0 = v->cell(); const int index_v_in_n0 = n0->index(v); CGAL_assume(index_v_in_n0 <= 1); @@ -1373,8 +1373,8 @@ public: OutputIterator visit_incident_cells(Vertex_handle v, OutputIterator output, Filter f) const { - CGAL_triangulation_precondition( v != Vertex_handle() ); - CGAL_triangulation_expensive_precondition( is_vertex(v) ); + CGAL_precondition( v != Vertex_handle() ); + CGAL_expensive_precondition( is_vertex(v) ); if ( dimension() < 2 ) return output; @@ -1405,8 +1405,8 @@ public: visit_incident_cells_threadsafe( Vertex_handle v, OutputIterator output, Filter f) const { - CGAL_triangulation_precondition( v != Vertex_handle() ); - CGAL_triangulation_expensive_precondition( is_vertex(v) ); + CGAL_precondition( v != Vertex_handle() ); + CGAL_expensive_precondition( is_vertex(v) ); if ( dimension() < 2 ) return output; @@ -1437,8 +1437,8 @@ public: visit_incident_cells(Vertex_handle v, OutputIterator output, std::vector &cells, Filter f) const { - CGAL_triangulation_precondition( v != Vertex_handle() ); - CGAL_triangulation_expensive_precondition( is_vertex(v) ); + CGAL_precondition( v != Vertex_handle() ); + CGAL_expensive_precondition( is_vertex(v) ); if ( dimension() < 2 ) return output; @@ -1465,8 +1465,8 @@ public: OutputIterator visit_just_incident_cells(Vertex_handle v, OutputIterator output, Filter f) const { - CGAL_triangulation_precondition( v != Vertex_handle() ); - CGAL_triangulation_expensive_precondition( is_vertex(v) ); + CGAL_precondition( v != Vertex_handle() ); + CGAL_expensive_precondition( is_vertex(v) ); if ( dimension() < 2 ) return output; @@ -1499,10 +1499,10 @@ public: std::vector &cells, VertexFilter f = VertexFilter()) const { - CGAL_triangulation_precondition( v != Vertex_handle() ); - CGAL_triangulation_precondition( dimension() == 3 ); - CGAL_triangulation_expensive_precondition( is_vertex(v) ); - CGAL_triangulation_expensive_precondition( is_valid() ); + CGAL_precondition( v != Vertex_handle() ); + CGAL_precondition( dimension() == 3 ); + CGAL_expensive_precondition( is_vertex(v) ); + CGAL_expensive_precondition( is_valid() ); return visit_incident_cells @@ -1554,16 +1554,16 @@ public: void set_adjacency(Cell_handle c0, int i0, Cell_handle c1, int i1) const { - CGAL_triangulation_assertion(i0 >= 0 && i0 <= dimension()); - CGAL_triangulation_assertion(i1 >= 0 && i1 <= dimension()); - CGAL_triangulation_assertion(c0 != c1); + CGAL_assertion(i0 >= 0 && i0 <= dimension()); + CGAL_assertion(i1 >= 0 && i1 <= dimension()); + CGAL_assertion(c0 != c1); c0->set_neighbor(i0,c1); c1->set_neighbor(i1,c0); } int mirror_index(Cell_handle c, int i) const { - CGAL_triangulation_precondition ( i>=0 && i<4 ); + CGAL_precondition ( i>=0 && i<4 ); return c->neighbor(i)->index(c); } @@ -1656,7 +1656,7 @@ public: convert_cell(c, *C[j]); } - CGAL_triangulation_assertion(is_valid(false)); + CGAL_assertion(is_valid(false)); return is; } @@ -1698,9 +1698,9 @@ typename Triangulation_data_structure_3::Cell_handle Triangulation_data_structure_3:: create_star_3(Vertex_handle v, Cell_handle c, int li, int prev_ind2) { - CGAL_triangulation_precondition( dimension() == 3); - CGAL_triangulation_precondition( c->tds_data().is_in_conflict() ); - CGAL_triangulation_precondition( ! c->neighbor(li)->tds_data().is_in_conflict() ); + CGAL_precondition( dimension() == 3); + CGAL_precondition( c->tds_data().is_in_conflict() ); + CGAL_precondition( ! c->neighbor(li)->tds_data().is_in_conflict() ); Cell_handle cnew = create_cell(c->vertex(0), c->vertex(1), @@ -1724,7 +1724,7 @@ create_star_3(Vertex_handle v, Cell_handle c, int li, int prev_ind2) Cell_handle n = cur->neighbor(zz); // turn around the oriented edge vj1 vj2 while ( n->tds_data().is_in_conflict() ) { - CGAL_triangulation_assertion( n != c ); + CGAL_assertion( n != c ); cur = n; zz = next_around_edge(n->index(vj1), n->index(vj2)); n = cur->neighbor(zz); @@ -1756,9 +1756,9 @@ recursive_create_star_3(Vertex_handle v, Cell_handle c, int li, int prev_ind2, int depth) { if ( depth == 100 ) return non_recursive_create_star_3(v,c,li,prev_ind2); - CGAL_triangulation_precondition( dimension() == 3); - CGAL_triangulation_precondition( c->tds_data().is_in_conflict() ); - CGAL_triangulation_precondition( ! c->neighbor(li)->tds_data().is_in_conflict() ); + CGAL_precondition( dimension() == 3); + CGAL_precondition( c->tds_data().is_in_conflict() ); + CGAL_precondition( ! c->neighbor(li)->tds_data().is_in_conflict() ); Cell_handle cnew = create_cell(c->vertex(0), c->vertex(1), @@ -1782,7 +1782,7 @@ recursive_create_star_3(Vertex_handle v, Cell_handle c, int li, Cell_handle n = cur->neighbor(zz); // turn around the oriented edge vj1 vj2 while ( n->tds_data().is_in_conflict() ) { - CGAL_triangulation_assertion( n != c ); + CGAL_assertion( n != c ); cur = n; zz = next_around_edge(n->index(vj1), n->index(vj2)); n = cur->neighbor(zz); @@ -1814,9 +1814,9 @@ typename Triangulation_data_structure_3::Cell_handle Triangulation_data_structure_3:: non_recursive_create_star_3(Vertex_handle v, Cell_handle c, int li, int prev_ind2) { - CGAL_triangulation_precondition( dimension() == 3); - CGAL_triangulation_precondition( c->tds_data().is_in_conflict() ); - CGAL_triangulation_precondition( ! c->neighbor(li)->tds_data().is_in_conflict() ); + CGAL_precondition( dimension() == 3); + CGAL_precondition( c->tds_data().is_in_conflict() ); + CGAL_precondition( ! c->neighbor(li)->tds_data().is_in_conflict() ); Cell_handle cnew = create_cell(c->vertex(0), c->vertex(1), @@ -1843,7 +1843,7 @@ non_recursive_create_star_3(Vertex_handle v, Cell_handle c, int li, int prev_ind Cell_handle n = cur->neighbor(zz); // turn around the oriented edge vj1 vj2 while ( n->tds_data().is_in_conflict() ) { - CGAL_triangulation_assertion( n != c ); + CGAL_assertion( n != c ); cur = n; zz = next_around_edge(n->index(vj1), n->index(vj2)); n = cur->neighbor(zz); @@ -1863,8 +1863,8 @@ non_recursive_create_star_3(Vertex_handle v, Cell_handle c, int li, int prev_ind adjacency_info_stack.push( iAdjacency_info(zzz,cnew,ii,c,li,prev_ind2) ); c=nnn; li=zz; prev_ind2=zzz; ii=0; //copy-pasted from beginning to avoid if ii==0 - CGAL_triangulation_precondition( c->tds_data().is_in_conflict() ); - CGAL_triangulation_precondition( ! c->neighbor(li)->tds_data().is_in_conflict() ); + CGAL_precondition( c->tds_data().is_in_conflict() ); + CGAL_precondition( ! c->neighbor(li)->tds_data().is_in_conflict() ); cnew = create_cell(c->vertex(0),c->vertex(1),c->vertex(2),c->vertex(3)); cnew->set_vertex(li, v); c_li = c->neighbor(li); @@ -1891,7 +1891,7 @@ typename Triangulation_data_structure_3::Cell_handle Triangulation_data_structure_3:: create_star_2(Vertex_handle v, Cell_handle c, int li ) { - CGAL_triangulation_assertion( dimension() == 2 ); + CGAL_assertion( dimension() == 2 ); Cell_handle cnew; // i1 i2 such that v,i1,i2 positive @@ -1980,7 +1980,7 @@ operator>>(std::istream& is, Triangulation_data_structure_3& tds) std::size_t m; tds.read_cells(is, V, m, C); - CGAL_triangulation_assertion( tds.is_valid() ); + CGAL_assertion( tds.is_valid() ); return is; } @@ -2022,7 +2022,7 @@ operator<<(std::ostream& os, const Triangulation_data_structure_3 &tds for (Vertex_iterator it=tds.vertices_begin(); it != tds.vertices_end(); ++it) V[it] = i++; - CGAL_triangulation_assertion( i == n ); + CGAL_assertion( i == n ); tds.print_cells(os, V); @@ -2059,7 +2059,7 @@ is_edge(Vertex_handle u, Vertex_handle v, Cell_handle &c, int &i, int &j) const // returns false when dimension <1 or when indices wrong { - CGAL_triangulation_expensive_precondition( is_vertex(u) && is_vertex(v) ); + CGAL_expensive_precondition( is_vertex(u) && is_vertex(v) ); if (u==v) return false; @@ -2113,7 +2113,7 @@ is_facet(Vertex_handle u, Vertex_handle v, Cell_handle & c, int & i, int & j, int & k) const // returns false when dimension <2 or when indices wrong { - CGAL_triangulation_expensive_precondition( is_vertex(u) && + CGAL_expensive_precondition( is_vertex(u) && is_vertex(v) && is_vertex(w) ); @@ -2141,7 +2141,7 @@ bool Triangulation_data_structure_3:: is_facet(Cell_handle c, int i) const { - CGAL_triangulation_precondition(i>=0 && i<4); + CGAL_precondition(i>=0 && i<4); if ( dimension() < 2 ) return false; @@ -2172,7 +2172,7 @@ is_cell(Vertex_handle u, Vertex_handle v, Cell_handle & c, int & i, int & j, int & k, int & l) const // returns false when dimension <3 { - CGAL_triangulation_expensive_precondition( is_vertex(u) && + CGAL_expensive_precondition( is_vertex(u) && is_vertex(v) && is_vertex(w) && is_vertex(t) ); @@ -2217,7 +2217,7 @@ has_vertex(Cell_handle c, int i, Vertex_handle v, int & j) const // facet (c,i) // j has no meaning if false is returned { - CGAL_triangulation_precondition( dimension() == 3 ); + CGAL_precondition( dimension() == 3 ); return ( c->has_vertex(v,j) && (j != i) ); } @@ -2228,7 +2228,7 @@ Triangulation_data_structure_3:: has_vertex(Cell_handle c, int i, Vertex_handle v) const // checks whether the query facet (c,i) has vertex v { - CGAL_triangulation_precondition( dimension() == 3 ); + CGAL_precondition( dimension() == 3 ); int j; return ( c->has_vertex(v,j) && (j != i) ); } @@ -2264,7 +2264,7 @@ are_equal(Cell_handle c, int i, Cell_handle n, int j) const // if ( c->neighbor(i) != n ) return false; // if ( n->neighbor(j) != c ) return false; { - CGAL_triangulation_precondition( dimension() == 3 ); + CGAL_precondition( dimension() == 3 ); if ( (c==n) && (i==j) ) return true; @@ -2300,9 +2300,9 @@ flip( Cell_handle c, int i ) // flips facet i of cell c // c will be replaced by one of the new cells { - CGAL_triangulation_precondition( (dimension() == 3) && (0<=i) && (i<4) + CGAL_precondition( (dimension() == 3) && (0<=i) && (i<4) && (number_of_vertices() >= 6) ); - CGAL_triangulation_expensive_precondition( is_cell(c) ); + CGAL_expensive_precondition( is_cell(c) ); Cell_handle n = c->neighbor(i); int in = n->index(c); @@ -2323,16 +2323,16 @@ flip_flippable(Cell_handle c, int i ) // flips facet i of cell c // c will be replaced by one of the new cells { - CGAL_triangulation_precondition( (dimension() == 3) && (0<=i) && (i<4) + CGAL_precondition( (dimension() == 3) && (0<=i) && (i<4) && (number_of_vertices() >= 6) ); - CGAL_triangulation_expensive_precondition( is_cell(c) ); + CGAL_expensive_precondition( is_cell(c) ); Cell_handle n = c->neighbor(i); int in = n->index(c); // checks that the facet is flippable, // ie the future edge does not already exist - CGAL_triangulation_expensive_precondition( !is_edge(c->vertex(i), + CGAL_expensive_precondition( !is_edge(c->vertex(i), n->vertex(in))); flip_really(c,i,n,in); } @@ -2374,7 +2374,7 @@ flip_really( Cell_handle c, int i, Cell_handle n, int in ) c->vertex(i2)->set_cell(c); n->vertex(in3)->set_cell(n); // to be implemented : 2d case - // CGAL_triangulation_precondition( (0<=i) && (i<3) ); + // CGAL_precondition( (0<=i) && (i<3) ); } template @@ -2386,12 +2386,12 @@ flip( Cell_handle c, int i, int j ) // flips edge i,j of cell c // c will be deleted { - CGAL_triangulation_precondition( (dimension() == 3) + CGAL_precondition( (dimension() == 3) && (0<=i) && (i<4) && (0<=j) && (j<4) && ( i != j ) && (number_of_vertices() >= 6) ); - CGAL_triangulation_expensive_precondition( is_cell(c) ); + CGAL_expensive_precondition( is_cell(c) ); // checks that the edge is flippable ie degree 3 int degree = 0; @@ -2436,24 +2436,24 @@ flip_flippable( Cell_handle c, int i, int j ) // flips edge i,j of cell c // c will be deleted { - CGAL_triangulation_precondition( (dimension() == 3) + CGAL_precondition( (dimension() == 3) && (0<=i) && (i<4) && (0<=j) && (j<4) && ( i != j ) && (number_of_vertices() >= 6) ); - CGAL_triangulation_expensive_precondition( is_cell(c) ); + CGAL_expensive_precondition( is_cell(c) ); // checks that the edge is flippable ie degree 3 - CGAL_triangulation_precondition_code( int degree = 0; ); - CGAL_triangulation_precondition_code + CGAL_precondition_code( int degree = 0; ); + CGAL_precondition_code ( Cell_circulator ccir = incident_cells(c,i,j); ); - CGAL_triangulation_precondition_code( Cell_circulator cdone = ccir; ); - CGAL_triangulation_precondition_code( do { + CGAL_precondition_code( Cell_circulator cdone = ccir; ); + CGAL_precondition_code( do { ++degree; ++ccir; } while ( ccir != cdone ); ); - CGAL_triangulation_precondition( degree == 3 ); + CGAL_precondition( degree == 3 ); int next = next_around_edge(i,j); Cell_handle c1 = c->neighbor( next ); @@ -2472,8 +2472,8 @@ flip_flippable( Cell_handle c, int i, int j ) // checks that the edge is flippable, // is the future cells do not already exist - CGAL_triangulation_expensive_precondition( !is_cell(v1,v2,v3,c->vertex(i)) ); - CGAL_triangulation_expensive_precondition( !is_cell(v1,v2,v3,c->vertex(j)) ); + CGAL_expensive_precondition( !is_cell(v1,v2,v3,c->vertex(i)) ); + CGAL_expensive_precondition( !is_cell(v1,v2,v3,c->vertex(j)) ); flip_really(c,i,j,c1,v1,i1,j1,next1,c2,v2,i2,j2,next2,v3); } @@ -2559,7 +2559,7 @@ read_cells(std::istream& is, const std::vector< Vertex_handle > &V, { m = 2; C.resize(m); - // CGAL_triangulation_assertion( n == 2 ); + // CGAL_assertion( n == 2 ); for (int i=0; i < 2; i++) { Cell_handle c = create_face(V[i], Vertex_handle(), Vertex_handle()); C[i] = c; @@ -2575,7 +2575,7 @@ read_cells(std::istream& is, const std::vector< Vertex_handle > &V, { m = 1; C.resize(m); - // CGAL_triangulation_assertion( n == 1 ); + // CGAL_assertion( n == 1 ); Cell_handle c = create_face(V[0], Vertex_handle(), Vertex_handle()); C[0] = c; V[0]->set_cell(c); @@ -2617,7 +2617,7 @@ print_cells(std::ostream& os, const Unique_hash_map write(os, V[it->vertex(j)]); } } - CGAL_triangulation_assertion( i == m ); + CGAL_assertion( i == m ); // write the neighbors for(it = cells_begin(); it != cells_end(); ++it) { @@ -2660,7 +2660,7 @@ print_cells(std::ostream& os, const Unique_hash_map } } } - CGAL_triangulation_assertion( i == m ); + CGAL_assertion( i == m ); // write the neighbors for(it = facets_begin(); it != facets_end(); ++it) { @@ -2703,7 +2703,7 @@ print_cells(std::ostream& os, const Unique_hash_map } } } - CGAL_triangulation_assertion( i == m ); + CGAL_assertion( i == m ); // write the neighbors for(it = edges_begin(); it != edges_end(); ++it) { @@ -2732,7 +2732,7 @@ Triangulation_data_structure_3::insert_first_finite_cell( Vertex_handle &v0, Vertex_handle &v1, Vertex_handle &v2, Vertex_handle &v3, Vertex_handle v_infinite) { - CGAL_triangulation_precondition( + CGAL_precondition( (v_infinite == Vertex_handle() && dimension() == -2) || (v_infinite != Vertex_handle() && dimension() == -1)); @@ -2778,9 +2778,9 @@ typename Triangulation_data_structure_3::Vertex_handle Triangulation_data_structure_3:: insert_in_cell(Cell_handle c) { - CGAL_triangulation_precondition( dimension() == 3 ); - CGAL_triangulation_precondition( c != Cell_handle() ); - CGAL_triangulation_expensive_precondition( is_cell(c) ); + CGAL_precondition( dimension() == 3 ); + CGAL_precondition( c != Cell_handle() ); + CGAL_expensive_precondition( is_cell(c) ); Vertex_handle v = create_vertex(); @@ -2824,8 +2824,8 @@ Triangulation_data_structure_3:: insert_in_facet(Cell_handle c, int i) { // inserts v in the facet opposite to vertex i of cell c - CGAL_triangulation_precondition( c != Cell_handle() ); - CGAL_triangulation_precondition( dimension() >= 2 ); + CGAL_precondition( c != Cell_handle() ); + CGAL_precondition( dimension() >= 2 ); Vertex_handle v = create_vertex(); @@ -2833,8 +2833,8 @@ insert_in_facet(Cell_handle c, int i) case 3: { - CGAL_triangulation_expensive_precondition( is_cell(c) ); - CGAL_triangulation_precondition( i == 0 || i == 1 || + CGAL_expensive_precondition( is_cell(c) ); + CGAL_precondition( i == 0 || i == 1 || i == 2 || i == 3 ); // c will be modified to have v replacing vertex(i+3) int i1,i2,i3; @@ -2905,7 +2905,7 @@ insert_in_facet(Cell_handle c, int i) } case 2: { - CGAL_triangulation_expensive_precondition( is_facet(c,i) ); + CGAL_expensive_precondition( is_facet(c,i) ); Cell_handle n = c->neighbor(2); Cell_handle cnew = create_face(c->vertex(0),c->vertex(1),v); set_adjacency(cnew, 2, n, n->index(c)); @@ -2933,15 +2933,15 @@ Triangulation_data_structure_3:: insert_in_edge(Cell_handle c, int i, int j) // inserts a vertex in the edge of cell c with vertices i and j { - CGAL_triangulation_precondition( c != Cell_handle() ); - CGAL_triangulation_precondition( i != j ); - CGAL_triangulation_precondition( dimension() >= 1 ); + CGAL_precondition( c != Cell_handle() ); + CGAL_precondition( i != j ); + CGAL_precondition( dimension() >= 1 ); switch ( dimension() ) { case 3: { - CGAL_triangulation_expensive_precondition( is_cell(c) ); - CGAL_triangulation_precondition( i>=0 && i<=3 && j>=0 && j<=3 ); + CGAL_expensive_precondition( is_cell(c) ); + CGAL_precondition( i>=0 && i<=3 && j>=0 && j<=3 ); std::vector cells; cells.reserve(32); @@ -2957,7 +2957,7 @@ insert_in_edge(Cell_handle c, int i, int j) } case 2: { - CGAL_triangulation_expensive_precondition( is_edge(c,i,j) ); + CGAL_expensive_precondition( is_edge(c,i,j) ); Vertex_handle v = create_vertex(); int k=3-i-j; // index of the third vertex of the facet @@ -2996,7 +2996,7 @@ insert_in_edge(Cell_handle c, int i, int j) default: // case 1: { Vertex_handle v = create_vertex(); - CGAL_triangulation_expensive_precondition( is_edge(c,i,j) ); + CGAL_expensive_precondition( is_edge(c,i,j) ); Cell_handle cnew = create_face(v, c->vertex(1), Vertex_handle()); c->vertex(1)->set_cell(cnew); c->set_vertex(1,v); @@ -3019,15 +3019,15 @@ insert_increase_dimension(Vertex_handle star) // = nullptr only used to insert the 1st vertex (dimension -2 to dimension -1) // changes the dimension { - CGAL_triangulation_precondition( dimension() < 3); + CGAL_precondition( dimension() < 3); Vertex_handle v = create_vertex(); int dim = dimension(); if (dim != -2) { - CGAL_triangulation_precondition( star != Vertex_handle() ); + CGAL_precondition( star != Vertex_handle() ); // In this case, this precondition is not relatively expensive. - CGAL_triangulation_precondition( is_vertex(star) ); + CGAL_precondition( is_vertex(star) ); } // this is set now, so that it becomes allowed to reorient @@ -3188,13 +3188,13 @@ void Triangulation_data_structure_3:: remove_decrease_dimension(Vertex_handle v, Vertex_handle w) { - CGAL_triangulation_expensive_precondition( is_valid() ); - CGAL_triangulation_precondition( dimension() >= -1 ); - CGAL_triangulation_precondition( dimension() != 1 || + CGAL_expensive_precondition( is_valid() ); + CGAL_precondition( dimension() >= -1 ); + CGAL_precondition( dimension() != 1 || number_of_vertices() == 3); - CGAL_triangulation_precondition( number_of_vertices() > + CGAL_precondition( number_of_vertices() > (size_type) dimension() + 1 ); - CGAL_triangulation_precondition( degree(v) == number_of_vertices()-1 ); + CGAL_precondition( degree(v) == number_of_vertices()-1 ); if (dimension() <= 0) { delete_cell(v->cell()); @@ -3235,7 +3235,7 @@ remove_decrease_dimension(Vertex_handle v, Vertex_handle w) } delete_vertex(v); set_dimension(dimension()-1); - CGAL_triangulation_postcondition(is_valid()); + CGAL_postcondition(is_valid()); } template @@ -3243,9 +3243,9 @@ typename Triangulation_data_structure_3::Cell_handle Triangulation_data_structure_3:: remove_from_maximal_dimension_simplex(Vertex_handle v) { - CGAL_triangulation_precondition(dimension() >= 1); - CGAL_triangulation_precondition(degree(v) == (size_type) dimension() + 1); - CGAL_triangulation_precondition(number_of_vertices() > + CGAL_precondition(dimension() >= 1); + CGAL_precondition(degree(v) == (size_type) dimension() + 1); + CGAL_precondition(number_of_vertices() > (size_type) dimension() + 1); if (number_of_vertices() == (size_type) dimension() + 2) { @@ -3267,9 +3267,9 @@ typename Triangulation_data_structure_3::Cell_handle Triangulation_data_structure_3:: remove_degree_2(Vertex_handle v) { - CGAL_triangulation_precondition(dimension() == 1); - CGAL_triangulation_precondition(degree(v) == 2); - CGAL_triangulation_precondition(number_of_vertices() >= 4); + CGAL_precondition(dimension() == 1); + CGAL_precondition(degree(v) == 2); + CGAL_precondition(number_of_vertices() >= 4); // Cells to be killed. Cell_handle c0, c1; @@ -3306,9 +3306,9 @@ typename Triangulation_data_structure_3::Cell_handle Triangulation_data_structure_3:: remove_degree_3(Vertex_handle v) { - CGAL_triangulation_precondition(dimension() == 2); - CGAL_triangulation_precondition(degree(v) == 3); - CGAL_triangulation_precondition(number_of_vertices() >= 5); + CGAL_precondition(dimension() == 2); + CGAL_precondition(degree(v) == 3); + CGAL_precondition(number_of_vertices() >= 5); // Cells to be killed. Cell_handle c0, c1, c2; @@ -3350,9 +3350,9 @@ typename Triangulation_data_structure_3::Cell_handle Triangulation_data_structure_3:: remove_degree_4(Vertex_handle v) { - CGAL_triangulation_precondition(dimension() == 3); - CGAL_triangulation_precondition(degree(v) == 4); - CGAL_triangulation_precondition(number_of_vertices() >= 6); + CGAL_precondition(dimension() == 3); + CGAL_precondition(degree(v) == 4); + CGAL_precondition(number_of_vertices() >= 6); // Cells to be killed. Cell_handle c0, c1, c2, c3; @@ -3400,11 +3400,11 @@ void Triangulation_data_structure_3:: decrease_dimension(Cell_handle c, int i) { - CGAL_triangulation_expensive_precondition( is_valid() );; - CGAL_triangulation_precondition( dimension() >= 2); - CGAL_triangulation_precondition( number_of_vertices() > + CGAL_expensive_precondition( is_valid() );; + CGAL_precondition( dimension() >= 2); + CGAL_precondition( number_of_vertices() > (size_type) dimension() + 1 ); - CGAL_triangulation_precondition( degree(c->vertex(i)) == number_of_vertices()-1 ); + CGAL_precondition( degree(c->vertex(i)) == number_of_vertices()-1 ); Vertex_handle v = c->vertex(i); Vertex_handle w = c->vertex(i); @@ -3530,7 +3530,7 @@ decrease_dimension(Cell_handle c, int i) v1->set_cell(c2); } - CGAL_triangulation_postcondition(is_valid()); + CGAL_postcondition(is_valid()); } @@ -3556,7 +3556,7 @@ is_valid(bool verbose, int level ) const if(number_of_vertices() <= 4) { if (verbose) std::cerr << "wrong number of vertices" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -3566,7 +3566,7 @@ is_valid(bool verbose, int level ) const if ( number_of_vertices() != vertex_count ) { if (verbose) std::cerr << "wrong number of vertices" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -3584,7 +3584,7 @@ is_valid(bool verbose, int level ) const if ( cell_count - facet_count + edge_count - vertex_count != 0 ) { if (verbose) std::cerr << "Euler relation unsatisfied" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -3596,7 +3596,7 @@ is_valid(bool verbose, int level ) const if(number_of_vertices() <= 3) { if (verbose) std::cerr << "wrong number of vertices" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -3607,7 +3607,7 @@ is_valid(bool verbose, int level ) const if ( number_of_vertices() != vertex_count ) { if (verbose) std::cerr << "false number of vertices" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -3619,7 +3619,7 @@ is_valid(bool verbose, int level ) const if (verbose) std::cerr << "Euler relation unsatisfied - edges/vertices" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -3631,7 +3631,7 @@ is_valid(bool verbose, int level ) const if (verbose) std::cerr << "Euler relation unsatisfied - facets/vertices" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } break; @@ -3642,7 +3642,7 @@ is_valid(bool verbose, int level ) const if(number_of_vertices() <= 1) { if (verbose) std::cerr << "wrong number of vertices" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -3652,7 +3652,7 @@ is_valid(bool verbose, int level ) const if ( number_of_vertices() != vertex_count ) { if (verbose) std::cerr << "false number of vertices" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } size_type edge_count; @@ -3662,7 +3662,7 @@ is_valid(bool verbose, int level ) const if ( edge_count != vertex_count ) { if (verbose) std::cerr << "false number of edges" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } break; @@ -3672,7 +3672,7 @@ is_valid(bool verbose, int level ) const if ( number_of_vertices() < 2 ) { if (verbose) std::cerr << "fewer than 2 vertices but dimension 0" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } CGAL_FALLTHROUGH; @@ -3682,7 +3682,7 @@ is_valid(bool verbose, int level ) const if ( number_of_vertices() < 1 ) { if (verbose) std::cerr << "no vertex but dimension -1" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } // vertex count @@ -3692,7 +3692,7 @@ is_valid(bool verbose, int level ) const if ( number_of_vertices() != vertex_count ) { if (verbose) std::cerr << "false number of vertices" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } } @@ -3712,7 +3712,7 @@ is_valid(Vertex_handle v, bool verbose, int level) const if ( ! result ) { if ( verbose ) std::cerr << "invalid vertex" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); } return result; } @@ -3732,14 +3732,14 @@ is_valid(Cell_handle c, bool verbose, int level) const if ( c->vertex(0) == Vertex_handle() ) { if (verbose) std::cerr << "vertex 0 nullptr" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } is_valid(c->vertex(0),verbose,level); if ( c->vertex(1) != Vertex_handle() || c->vertex(2) != Vertex_handle()) { if (verbose) std::cerr << "vertex 1 or 2 != nullptr" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } if ( c->neighbor(0) != Cell_handle() || @@ -3747,7 +3747,7 @@ is_valid(Cell_handle c, bool verbose, int level) const c->neighbor(2) != Cell_handle()) { if (verbose) std::cerr << "one neighbor != nullptr" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } break; @@ -3758,35 +3758,35 @@ is_valid(Cell_handle c, bool verbose, int level) const if ( c->vertex(0) == Vertex_handle() ) { if (verbose) std::cerr << "vertex 0 nullptr" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } is_valid(c->vertex(0),verbose,level); if ( c->neighbor (0) == Cell_handle() ) { if (verbose) std::cerr << "neighbor 0 nullptr" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } if ( c->vertex(1) != Vertex_handle() || c->vertex(2) != Vertex_handle() ) { if (verbose) std::cerr << "vertex 1 or 2 != nullptr" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } if ( c->neighbor(1) != Cell_handle() || c->neighbor(2) != Cell_handle() ) { if (verbose) std::cerr << "neighbor 1 or 2 != nullptr" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } if ( ! c->neighbor(0)->has_vertex(c->vertex(0)) ) { if (verbose) std::cerr << "neighbor 0 does not have vertex 0" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } break; @@ -3802,7 +3802,7 @@ is_valid(Cell_handle c, bool verbose, int level) const if ( v0 == Vertex_handle() || v1 == Vertex_handle() ) { if (verbose) std::cerr << "vertex 0 or 1 nullptr" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } is_valid(c->vertex(0),verbose,level); @@ -3810,7 +3810,7 @@ is_valid(Cell_handle c, bool verbose, int level) const if ( n0 == Cell_handle() || n1 == Cell_handle() ) { if (verbose) std::cerr << "neighbor 0 or 1 nullptr" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -3818,14 +3818,14 @@ is_valid(Cell_handle c, bool verbose, int level) const if (verbose) std::cerr << "neighbor 1 does not have vertex 0 as vertex 1" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } if ( v1 != n0->vertex(0) ) { if (verbose) std::cerr << "neighbor 0 does not have vertex 1 as vertex 0" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -3833,14 +3833,14 @@ is_valid(Cell_handle c, bool verbose, int level) const if (verbose) std::cerr << "neighbor 0 does not have this as neighbor 1" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } if ( n1->neighbor(0) != c ) { if (verbose) std::cerr << "neighbor 1 does not have this as neighbor 0" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -3854,7 +3854,7 @@ is_valid(Cell_handle c, bool verbose, int level) const c->vertex(2) == Vertex_handle() ) { if (verbose) std::cerr << "vertex 0, 1, or 2 nullptr" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } is_valid(c->vertex(0),verbose,level); @@ -3867,14 +3867,14 @@ is_valid(Cell_handle c, bool verbose, int level) const if ( n == Cell_handle() ) { if (verbose) std::cerr << "neighbor " << i << " nullptr" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } if ( ! n->has_vertex(c->vertex(cw(i)),in ) ) { if (verbose) std::cerr << "vertex " << cw(i) << " not vertex of neighbor " << i << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } in = cw(in); @@ -3883,7 +3883,7 @@ is_valid(Cell_handle c, bool verbose, int level) const std::cerr << "neighbor " << i << " does not have this as neighbor " << in << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } if ( c->vertex(ccw(i)) != n->vertex(cw(in)) ) { @@ -3891,7 +3891,7 @@ is_valid(Cell_handle c, bool verbose, int level) const std::cerr << "vertex " << ccw(i) << " is not vertex " << cw(in) << " of neighbor " << i << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } } @@ -3905,7 +3905,7 @@ is_valid(Cell_handle c, bool verbose, int level) const if ( c->vertex(i) == Vertex_handle() ) { if (verbose) std::cerr << "vertex " << i << " nullptr" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } is_valid(c->vertex(i),verbose,level); @@ -3916,7 +3916,7 @@ is_valid(Cell_handle c, bool verbose, int level) const if ( n == Cell_handle() ) { if (verbose) std::cerr << "neighbor " << i << " nullptr" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -3929,7 +3929,7 @@ is_valid(Cell_handle c, bool verbose, int level) const if (in == 5) { if (verbose) std::cerr << "neighbor of c has not c as neighbor" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -3938,28 +3938,28 @@ is_valid(Cell_handle c, bool verbose, int level) const if (verbose) { std::cerr << "vertex (+1) " << ((i+1)&3) << " not vertex of neighbor " << i << std::endl; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } if ( ! n->has_vertex(c->vertex((i+2)&3),j2n) ) { if (verbose) { std::cerr << "vertex (+2) " << ((i+2)&3) << " not vertex of neighbor " << i << std::endl; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } if ( ! n->has_vertex(c->vertex((i+3)&3),j3n) ) { if (verbose) { std::cerr << "vertex (+3) " << ((i+3)&3) << " not vertex of neighbor " << i << std::endl; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } if ( in+j1n+j2n+j3n != 6) { if (verbose) { std::cerr << "sum of the indices != 6 " << std::endl; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -3970,7 +3970,7 @@ is_valid(Cell_handle c, bool verbose, int level) const if (verbose) std::cerr << " pb orientation with neighbor " << i << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } } @@ -3979,7 +3979,7 @@ is_valid(Cell_handle c, bool verbose, int level) const if (verbose) std::cerr << " pb orientation with neighbor " << i << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } } @@ -3988,7 +3988,7 @@ is_valid(Cell_handle c, bool verbose, int level) const if (verbose) std::cerr << " pb orientation with neighbor " << i << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } } @@ -3999,7 +3999,7 @@ is_valid(Cell_handle c, bool verbose, int level) const if (verbose) std::cerr << " pb orientation with neighbor " << i << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } } @@ -4008,7 +4008,7 @@ is_valid(Cell_handle c, bool verbose, int level) const if (verbose) std::cerr << " pb orientation with neighbor " << i << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } } @@ -4017,7 +4017,7 @@ is_valid(Cell_handle c, bool verbose, int level) const if (verbose) std::cerr << " pb orientation with neighbor " << i << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } } @@ -4037,7 +4037,7 @@ copy_tds(const TDS_src& tds, const ConvertVertex& convert_vertex, const ConvertCell& convert_cell) { - CGAL_triangulation_expensive_precondition( vert == Vertex_handle() + CGAL_expensive_precondition( vert == Vertex_handle() || tds.is_vertex(vert) ); clear(); @@ -4086,7 +4086,7 @@ copy_tds(const TDS_src& tds, F[cit2]->set_neighbor(j, F[cit2->neighbor(j)] ); } - CGAL_triangulation_postcondition( is_valid() ); + CGAL_postcondition( is_valid() ); return (vert != typename TDS_src::Vertex_handle()) ? V[vert] : Vertex_handle(); } @@ -4149,7 +4149,7 @@ void Triangulation_data_structure_3:: swap(Tds & tds) { - CGAL_triangulation_expensive_precondition(tds.is_valid() && is_valid()); + CGAL_expensive_precondition(tds.is_valid() && is_valid()); std::swap(_dimension, tds._dimension); cells().swap(tds.cells()); @@ -4178,7 +4178,7 @@ count_vertices(size_type & i, bool verbose, int level) const if ( ! is_valid(it,verbose,level) ) { if (verbose) std::cerr << "invalid vertex" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } ++i; @@ -4198,7 +4198,7 @@ count_facets(size_type & i, bool verbose, int level) const if ( ! is_valid((*it).first,verbose, level) ) { if (verbose) std::cerr << "invalid facet" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } ++i; @@ -4218,7 +4218,7 @@ count_edges(size_type & i, bool verbose, int level) const if ( ! is_valid((*it).first,verbose, level) ) { if (verbose) std::cerr << "invalid edge" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } ++i; @@ -4238,7 +4238,7 @@ count_cells(size_type & i, bool verbose, int level) const if ( ! is_valid(it,verbose, level) ) { if (verbose) std::cerr << "invalid cell" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } ++i; diff --git a/TDS_3/include/CGAL/Triangulation_ds_cell_base_3.h b/TDS_3/include/CGAL/Triangulation_ds_cell_base_3.h index 27ebcb68950..852ceefb8cb 100644 --- a/TDS_3/include/CGAL/Triangulation_ds_cell_base_3.h +++ b/TDS_3/include/CGAL/Triangulation_ds_cell_base_3.h @@ -19,7 +19,7 @@ #include -#include +#include #include namespace CGAL { @@ -66,7 +66,7 @@ public: Vertex_handle vertex(int i) const { - CGAL_triangulation_precondition( i >= 0 && i <= 3 ); + CGAL_precondition( i >= 0 && i <= 3 ); CGAL_assume( i >= 0 && i <= 3 ); return V[i]; } @@ -90,13 +90,13 @@ public: if (v == V[0]) { return 0; } if (v == V[1]) { return 1; } if (v == V[2]) { return 2; } - CGAL_triangulation_assertion( v == V[3] ); + CGAL_assertion( v == V[3] ); return 3; } Cell_handle neighbor(int i) const { - CGAL_triangulation_precondition( i >= 0 && i <= 3); + CGAL_precondition( i >= 0 && i <= 3); return N[i]; } @@ -119,7 +119,7 @@ public: if (n == N[0]) return 0; if (n == N[1]) return 1; if (n == N[2]) return 2; - CGAL_triangulation_assertion( n == N[3] ); + CGAL_assertion( n == N[3] ); return 3; } @@ -127,14 +127,14 @@ public: void set_vertex(int i, Vertex_handle v) { - CGAL_triangulation_precondition( i >= 0 && i <= 3); + CGAL_precondition( i >= 0 && i <= 3); V[i] = v; } void set_neighbor(int i, Cell_handle n) { - CGAL_triangulation_precondition( i >= 0 && i <= 3); - CGAL_triangulation_precondition( this != n.operator->() ); + CGAL_precondition( i >= 0 && i <= 3); + CGAL_precondition( this != n.operator->() ); N[i] = n; } @@ -160,10 +160,10 @@ public: void set_neighbors(Cell_handle n0, Cell_handle n1, Cell_handle n2, Cell_handle n3) { - CGAL_triangulation_precondition( this != n0.operator->() ); - CGAL_triangulation_precondition( this != n1.operator->() ); - CGAL_triangulation_precondition( this != n2.operator->() ); - CGAL_triangulation_precondition( this != n3.operator->() ); + CGAL_precondition( this != n0.operator->() ); + CGAL_precondition( this != n1.operator->() ); + CGAL_precondition( this != n2.operator->() ); + CGAL_precondition( this != n3.operator->() ); N[0] = n0; N[1] = n1; N[2] = n2; diff --git a/TDS_3/include/CGAL/Triangulation_utils_3.h b/TDS_3/include/CGAL/Triangulation_utils_3.h index 8b99c725a65..2f6646a2087 100644 --- a/TDS_3/include/CGAL/Triangulation_utils_3.h +++ b/TDS_3/include/CGAL/Triangulation_utils_3.h @@ -16,7 +16,7 @@ #include -#include +#include namespace CGAL { @@ -63,13 +63,13 @@ struct Triangulation_utils_3 { static int ccw(const int i) { - CGAL_triangulation_precondition( i >= 0 && i < 3); + CGAL_precondition( i >= 0 && i < 3); return ccw_map[i]; } static int cw(const int i) { - CGAL_triangulation_precondition( i >= 0 && i < 3); + CGAL_precondition( i >= 0 && i < 3); return cw_map[i]; } @@ -77,9 +77,9 @@ struct Triangulation_utils_3 { // index of the next cell when turning around the // oriented edge vertex(i) vertex(j) in 3d - CGAL_triangulation_precondition( ( i >= 0 && i < 4 ) && - ( j >= 0 && j < 4 ) && - ( i != j ) ); + CGAL_precondition( ( i >= 0 && i < 4 ) && + ( j >= 0 && j < 4 ) && + ( i != j ) ); return tab_next_around_edge[i][j]; } @@ -88,8 +88,8 @@ struct Triangulation_utils_3 { // indexes of the jth vertex of the facet of a cell // opposite to vertx i - CGAL_triangulation_precondition( ( i >= 0 && i < 4 ) && - ( j >= 0 && j < 3 ) ); + CGAL_precondition( ( i >= 0 && i < 4 ) && + ( j >= 0 && j < 3 ) ); return tab_vertex_triple_index[i][j]; } diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h index 745f89bb1d2..49ff1c2390e 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h @@ -414,10 +414,11 @@ public: #ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE std::cout << "Smooth vertices..."; std::cout.flush(); -#endif + std::size_t nb_done_3d = 0; std::size_t nb_done_2d = 0; std::size_t nb_done_1d = 0; +#endif FT total_move = 0.; Tr& tr = c3t3.triangulation(); @@ -540,8 +541,11 @@ public: #endif // move vertex const typename Tr::Point new_pos(final_position.x(), final_position.y(), final_position.z()); - if(check_inversion_and_move(v, new_pos, inc_cells[vid], tr, total_move)) + if(check_inversion_and_move(v, new_pos, inc_cells[vid], tr, total_move)){ +#ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE nb_done_1d++; +#endif + } } else if (neighbors[vid] > 0) { @@ -574,8 +578,11 @@ public: #endif // move vertex const typename Tr::Point new_pos(final_position.x(), final_position.y(), final_position.z()); - if(check_inversion_and_move(v, new_pos, inc_cells[vid], tr, total_move)) + if(check_inversion_and_move(v, new_pos, inc_cells[vid], tr, total_move)){ +#ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE nb_done_1d++; +#endif + } } } } @@ -647,8 +654,11 @@ public: os_surf << "2 " << current_pos << " " << final_position << std::endl; #endif const typename Tr::Point new_pos(final_position.x(), final_position.y(), final_position.z()); - if(check_inversion_and_move(v, new_pos, inc_cells[vid], tr, total_move)) + if(check_inversion_and_move(v, new_pos, inc_cells[vid], tr, total_move)){ +#ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE nb_done_2d++; +#endif + } } else if (neighbors[vid] > 0) { @@ -660,8 +670,11 @@ public: if (boost::optional mls_projection = project(si, current_pos)) { const typename Tr::Point new_pos(CGAL::ORIGIN + *mls_projection); - if(check_inversion_and_move(v, new_pos, inc_cells[vid], tr, total_move)) + if(check_inversion_and_move(v, new_pos, inc_cells[vid], tr, total_move)){ +#ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE nb_done_2d++; +#endif + } #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG os_surf0 << "2 " << current_pos << " " << new_pos << std::endl; @@ -715,8 +728,11 @@ public: #endif const Vector_3 p = smoothed_positions[vid] / static_cast(neighbors[vid]); typename Tr::Point new_pos(p.x(), p.y(), p.z()); - if(check_inversion_and_move(v, new_pos, inc_cells[vid], tr, total_move)) + if(check_inversion_and_move(v, new_pos, inc_cells[vid], tr, total_move)){ +#ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE nb_done_3d++; +#endif + } #ifdef CGAL_TETRAHEDRAL_REMESHING_DEBUG os_vol << " " << point(v->point()) << std::endl; diff --git a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_mesh_and_remesh_image.cpp b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_mesh_and_remesh_image.cpp index cf75b94c0a5..1e415320b5e 100644 --- a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_mesh_and_remesh_image.cpp +++ b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_mesh_and_remesh_image.cpp @@ -39,7 +39,7 @@ int main() std::cerr << "Error: Cannot read file " << filename << std::endl; return EXIT_FAILURE; } - Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image, 1e-9); + Mesh_domain domain = Mesh_domain::create_labeled_image_mesh_domain(image, relative_error_bound = 1e-9); // Mesh criteria Facet_criteria facet_criteria(25, 20, 2); // angle, size, approximation diff --git a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h index 9d294ac7ec2..56a07c13fa8 100644 --- a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h @@ -16,7 +16,7 @@ #include -#include +#include #include #include @@ -163,7 +163,7 @@ public: : Ctr(gt) { insert_constraints(lc.begin(), lc.end()); - CGAL_triangulation_postcondition( is_valid() ); + CGAL_postcondition( is_valid() ); } template @@ -173,7 +173,7 @@ public: : Ctr(gt) { insert_constraints(it, last); - CGAL_triangulation_postcondition( is_valid() ); + CGAL_postcondition( is_valid() ); } virtual ~Constrained_Delaunay_triangulation_2() {} @@ -448,7 +448,7 @@ public: OutputItFaces fit, OutputItBoundaryEdges eit, Face_handle start = Face_handle()) const { - CGAL_triangulation_precondition( dimension() == 2); + CGAL_precondition( dimension() == 2); int li; Locate_type lt; Face_handle fh = locate(p,lt,li, start); @@ -467,7 +467,7 @@ public: pit = propagate_conflicts(p,fh,2,pit); return pit; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return std::make_pair(fit,eit); } @@ -702,7 +702,7 @@ flip (Face_handle& f, int i) // The following precondition prevents the test suit // of triangulation to work on constrained Delaunay triangulation - //CGAL_triangulation_precondition(is_flipable(f,i)); + //CGAL_precondition(is_flipable(f,i)); this->_tds.flip(f, i); // restore constraint status @@ -945,9 +945,9 @@ remove(Vertex_handle v) // remove a vertex and updates the constrained edges of the new faces // precondition : there is no incident constraints { - CGAL_triangulation_precondition( v != Vertex_handle() ); - CGAL_triangulation_precondition( ! is_infinite(v)); - CGAL_triangulation_precondition( ! are_there_incident_constraints(v)); + CGAL_precondition( v != Vertex_handle() ); + CGAL_precondition( ! is_infinite(v)); + CGAL_precondition( ! are_there_incident_constraints(v)); if (dimension() <= 1) Ctr::remove(v); else remove_2D(v); return; @@ -1016,13 +1016,13 @@ Constrained_Delaunay_triangulation_2:: is_valid(bool verbose, int level) const { bool result = Ctr::is_valid(verbose, level); - CGAL_triangulation_assertion( result ); + CGAL_assertion( result ); Finite_faces_iterator fit= finite_faces_begin(); for (; fit != finite_faces_end(); fit++) { for(int i=0;i<3;i++) { result = result && !is_flipable(fit,i, false); - CGAL_triangulation_assertion( result ); + CGAL_assertion( result ); } } return result; diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h index 37637b2909f..11531498530 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include @@ -204,7 +204,7 @@ public: for( ;lcit != lc.end(); lcit++) { insert( (*lcit).first, (*lcit).second); } - CGAL_triangulation_postcondition( is_valid() ); + CGAL_postcondition( is_valid() ); } template @@ -216,7 +216,7 @@ public: for ( ; it != last; it++) { insert_constraint((*it).first, (*it).second); } - CGAL_triangulation_postcondition( is_valid() ); + CGAL_postcondition( is_valid() ); } //TODO Is that destructor correct ? @@ -335,7 +335,7 @@ insert_constraint(Vertex_handle vaa, Vertex_handle vbb, OutputIterator out) // if a vertex vc of t lies on segment ab // of if ab intersect some constrained edges { - CGAL_triangulation_precondition( vaa != vbb); + CGAL_precondition( vaa != vbb); Vertex_handle vi; Face_handle fr; @@ -810,7 +810,7 @@ insert_constraint(Vertex_handle vaa, Vertex_handle vbb) while(! stack.empty()){ boost::tie(vaa,vbb) = stack.top(); stack.pop(); - CGAL_triangulation_precondition( vaa != vbb); + CGAL_precondition( vaa != vbb); #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS std::cerr << CGAL::internal::cdt_2_indent_level << "CT_2::insert_constraint, stack pop=( #" << vaa->time_stamp() << "= " << vaa->point() @@ -1073,9 +1073,9 @@ intersect(Face_handle f, int i, const Point& pc = f->vertex(cw(i))->point(); const Point& pd = f->vertex(ccw(i))->point(); Point pi; - CGAL_triangulation_assertion_code( bool ok = ) + CGAL_assertion_code( bool ok = ) intersection(geom_traits(), pa, pb, pc, pd, pi, itag ); - CGAL_triangulation_assertion(ok); + CGAL_assertion(ok); Vertex_handle vi = virtual_insert(pi, Triangulation::EDGE, f, i); return vi; } @@ -1308,7 +1308,7 @@ update_constraints_incident(Vertex_handle va, //dimension() ==2 int cwi, ccwi, indf; Face_circulator fc=incident_faces(va), done(fc); - CGAL_triangulation_assertion(fc != nullptr); + CGAL_assertion(fc != nullptr); do { indf = fc->index(va); cwi=cw(indf); @@ -1356,7 +1356,7 @@ update_constraints_opposite(Vertex_handle va) // update status of edges opposite to a // after insertion of a { - CGAL_triangulation_assertion(dimension()==2); + CGAL_assertion(dimension()==2); Face_handle f=va->face(), start=f; int indf; do { @@ -1463,9 +1463,9 @@ remove(Vertex_handle v) // remove a vertex and updates the constrained edges of the new faces // precondition : there is no incident constraints { - CGAL_triangulation_precondition( v != Vertex_handle() ); - CGAL_triangulation_precondition( ! is_infinite(v)); - CGAL_triangulation_precondition( ! are_there_incident_constraints(v)); + CGAL_precondition( v != Vertex_handle() ); + CGAL_precondition( ! is_infinite(v)); + CGAL_precondition( ! are_there_incident_constraints(v)); if (number_of_vertices() == 1) remove_first(v); else if (number_of_vertices() == 2) remove_second(v); diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_face_base_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_face_base_2.h index 382d408abfb..941de300ded 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_face_base_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_face_base_2.h @@ -16,7 +16,7 @@ #include -#include +#include #include namespace CGAL { @@ -109,7 +109,7 @@ inline void Constrained_triangulation_face_base_2:: set_constraint(int i, bool b) { - CGAL_triangulation_precondition( i == 0 || i == 1 || i == 2); + CGAL_precondition( i == 0 || i == 1 || i == 2); C[i] = b; } diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h index 5a88fdc9efa..50ca1f4bfec 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include #include @@ -232,7 +232,7 @@ public: , hierarchy(Vh_less_xy(this)) { insert_constraints(first, last); - CGAL_triangulation_postcondition( this->is_valid() ); + CGAL_postcondition( this->is_valid() ); } @@ -242,7 +242,7 @@ public: , hierarchy(Vh_less_xy(this)) { insert_constraints(constraints.begin(), constraints.end()); - CGAL_triangulation_postcondition( this->is_valid() ); + CGAL_postcondition( this->is_valid() ); } //Helping void clear() { Base::clear(); hierarchy.clear(); } @@ -898,7 +898,7 @@ insert_subconstraint(Vertex_handle vaa, while(! stack.empty()){ boost::tie(vaa,vbb) = stack.top(); stack.pop(); - CGAL_triangulation_precondition( vaa != vbb); + CGAL_precondition( vaa != vbb); #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS std::cerr << CGAL::internal::cdt_2_indent_level << "CT_plus_2::insert_subconstraint, stack pop=( #" << vaa->time_stamp() << "= " << vaa->point() @@ -1055,7 +1055,7 @@ copy_triangulation(const Constrained_triangulation_plus_2 &ctp) Vertex_iterator vit = ctp.vertices_begin(); Vertex_iterator vvit = this->vertices_begin(); for( ; vit != ctp.vertices_end(); ++vit, ++vvit) { - CGAL_triangulation_assertion(vit->point() == vvit->point()); + CGAL_assertion(vit->point() == vvit->point()); vmap[vit] = vvit; } hierarchy.copy(ctp.hierarchy, vmap); @@ -1167,12 +1167,12 @@ intersect(Face_handle f, int i, Vertex_handle vcc, vdd; vcc = f->vertex(cw(i)); vdd = f->vertex(ccw(i)); - CGAL_triangulation_assertion_code( bool b1 = ) + CGAL_assertion_code( bool b1 = ) hierarchy.enclosing_constraint(vcc,vdd,vc,vd); - CGAL_triangulation_assertion_code( bool b2 = ) + CGAL_assertion_code( bool b2 = ) hierarchy.enclosing_constraint(vaa,vbb,va,vb); - CGAL_triangulation_assertion(b1); - CGAL_triangulation_assertion(b2); + CGAL_assertion(b1); + CGAL_assertion(b2); const Point& pa = va->point(); const Point& pb = vb->point(); @@ -1189,9 +1189,9 @@ intersect(Face_handle f, int i, Point pi(ORIGIN); // initialize although we are sure that it will be // set by the intersection, but to quiet a warning Intersection_tag itag = Intersection_tag(); - CGAL_triangulation_assertion_code( bool ok = ) + CGAL_assertion_code( bool ok = ) intersection(geom_traits(), pa, pb, pc, pd, pi, itag ); - CGAL_triangulation_assertion(ok); + CGAL_assertion(ok); Vertex_handle vi = insert(pi, Triangulation::EDGE, f, i); #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS diff --git a/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h b/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h index 134027f99c0..f730bb08efc 100644 --- a/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h @@ -88,7 +88,7 @@ public: Delaunay_triangulation_2( const Delaunay_triangulation_2 &tr) : Triangulation_2(tr) - { CGAL_triangulation_postcondition(is_valid()); } + { CGAL_postcondition(is_valid()); } Delaunay_triangulation_2(Delaunay_triangulation_2&&) = default; Delaunay_triangulation_2& operator=(const Delaunay_triangulation_2&) = default; @@ -404,7 +404,7 @@ public: OutputItBoundaryEdges eit, Face_handle start = Face_handle()) const { - CGAL_triangulation_precondition(this->dimension() == 2); + CGAL_precondition(this->dimension() == 2); int li; Locate_type lt; Face_handle fh = this->locate(p,lt,li, start); @@ -422,7 +422,7 @@ public: pit = propagate_conflicts(p,fh,2,pit); return pit; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return std::make_pair(fit,eit); } @@ -674,7 +674,7 @@ is_valid(bool verbose, int level) const result = result && ON_POSITIVE_SIDE != side_of_oriented_circle(it, this->mirror_vertex(it,i)->point(), false); } - CGAL_triangulation_assertion(result); + CGAL_assertion(result); } } return result; @@ -705,7 +705,7 @@ typename Delaunay_triangulation_2::Vertex_handle Delaunay_triangulation_2:: nearest_vertex_2D(const Point& p, Face_handle f) const { - CGAL_triangulation_precondition(this->dimension() == 2); + CGAL_precondition(this->dimension() == 2); f = this->locate(p,f); typename Geom_traits::Compare_distance_2 @@ -775,8 +775,8 @@ typename Delaunay_triangulation_2::Point Delaunay_triangulation_2:: dual(Face_handle f) const { - CGAL_triangulation_precondition(this->_tds.is_face(f)); - CGAL_triangulation_precondition(this->dimension()==2); + CGAL_precondition(this->_tds.is_face(f)); + CGAL_precondition(this->dimension()==2); return circumcenter(f); } @@ -785,12 +785,12 @@ Object Delaunay_triangulation_2:: dual(const Edge &e) const { - CGAL_triangulation_precondition(this->_tds.is_edge(e.first,e.second)); + CGAL_precondition(this->_tds.is_edge(e.first,e.second)); typedef typename Geom_traits::Line_2 Line; typedef typename Geom_traits::Ray_2 Ray; - CGAL_triangulation_precondition (!this->is_infinite(e)); + CGAL_precondition (!this->is_infinite(e)); if(this->dimension()== 1) { const Point& p = (e.first)->vertex(cw(e.second))->point(); const Point& q = (e.first)->vertex(ccw(e.second))->point(); @@ -1031,8 +1031,8 @@ void Delaunay_triangulation_2:: remove_and_give_new_faces(Vertex_handle v, OutputItFaces fit) { - CGAL_triangulation_precondition(v != Vertex_handle()); - CGAL_triangulation_precondition(!this->is_infinite(v)); + CGAL_precondition(v != Vertex_handle()); + CGAL_precondition(!this->is_infinite(v)); if(this->number_of_vertices() == 1) this->remove_first(v); else if(this->number_of_vertices() == 2) this->remove_second(v); @@ -1071,8 +1071,8 @@ remove(Vertex_handle v) { int d; - CGAL_triangulation_precondition(v != Vertex_handle()); - CGAL_triangulation_precondition(!this->is_infinite(v)); + CGAL_precondition(v != Vertex_handle()); + CGAL_precondition(!this->is_infinite(v)); if(this->dimension() <= 1) { Triangulation::remove(v); return; } @@ -2119,7 +2119,7 @@ typename Delaunay_triangulation_2::Vertex_handle Delaunay_triangulation_2:: move_if_no_collision(Vertex_handle v, const Point &p) { - CGAL_triangulation_precondition(!this->is_infinite(v)); + CGAL_precondition(!this->is_infinite(v)); if(v->point() == p) return v; const int dim = this->dimension(); @@ -2167,7 +2167,7 @@ move_if_no_collision(Vertex_handle v, const Point &p) Face_handle f = v->face(); int i = f->index(v); if(i==0) {f = f->neighbor(1);} - CGAL_triangulation_assertion(f->index(v) == 1); + CGAL_assertion(f->index(v) == 1); Face_handle g= f->neighbor(0); f->set_vertex(1, g->vertex(1)); f->set_neighbor(0,g->neighbor(0)); @@ -2177,7 +2177,7 @@ move_if_no_collision(Vertex_handle v, const Point &p) Face_handle f_ins = inserted->face(); i = f_ins->index(inserted); if(i==0) {f_ins = f_ins->neighbor(1);} - CGAL_triangulation_assertion(f_ins->index(inserted) == 1); + CGAL_assertion(f_ins->index(inserted) == 1); Face_handle g_ins = f_ins->neighbor(0); f_ins->set_vertex(1, v); g_ins->set_vertex(0, v); @@ -2249,7 +2249,7 @@ typename Delaunay_triangulation_2::Vertex_handle Delaunay_triangulation_2:: move(Vertex_handle v, const Point &p) { - CGAL_triangulation_precondition(!this->is_infinite(v)); + CGAL_precondition(!this->is_infinite(v)); if(v->point() == p) return v; Vertex_handle w = move_if_no_collision(v,p); if(w != v) { @@ -2264,9 +2264,9 @@ bool Delaunay_triangulation_2:: is_delaunay_after_displacement(Vertex_handle v, const Point &p) const { - CGAL_triangulation_precondition(!this->is_infinite(v)); - CGAL_triangulation_precondition(this->dimension() == 2); - CGAL_triangulation_precondition(!this->test_dim_down(v)); + CGAL_precondition(!this->is_infinite(v)); + CGAL_precondition(this->dimension() == 2); + CGAL_precondition(!this->test_dim_down(v)); if(v->point() == p) return true; Point ant = v->point(); v->set_point(p); @@ -2320,7 +2320,7 @@ move_if_no_collision_and_give_new_faces(Vertex_handle v, const Point &p, OutputItFaces oif) { - CGAL_triangulation_precondition(!this->is_infinite(v)); + CGAL_precondition(!this->is_infinite(v)); if(v->point() == p) return v; const int dim = this->dimension(); @@ -2374,7 +2374,7 @@ move_if_no_collision_and_give_new_faces(Vertex_handle v, Face_handle f = v->face(); int i = f->index(v); if(i==0) {f = f->neighbor(1);} - CGAL_triangulation_assertion(f->index(v) == 1); + CGAL_assertion(f->index(v) == 1); Face_handle g= f->neighbor(0); f->set_vertex(1, g->vertex(1)); f->set_neighbor(0,g->neighbor(0)); @@ -2385,7 +2385,7 @@ move_if_no_collision_and_give_new_faces(Vertex_handle v, Face_handle f_ins = inserted->face(); i = f_ins->index(inserted); if(i==0) {f_ins = f_ins->neighbor(1);} - CGAL_triangulation_assertion(f_ins->index(inserted) == 1); + CGAL_assertion(f_ins->index(inserted) == 1); Face_handle g_ins = f_ins->neighbor(0); f_ins->set_vertex(1, v); g_ins->set_vertex(0, v); diff --git a/Triangulation_2/include/CGAL/Regular_triangulation_2.h b/Triangulation_2/include/CGAL/Regular_triangulation_2.h index fe4b02f7f41..145b387263f 100644 --- a/Triangulation_2/include/CGAL/Regular_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Regular_triangulation_2.h @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -563,7 +564,7 @@ public: Face_handle start = Face_handle()) const { - CGAL_triangulation_precondition(dimension() == 2); + CGAL_precondition(dimension() == 2); int li; Locate_type lt; Face_handle fh = locate(p,lt,li, start); @@ -640,7 +641,7 @@ public: } return make_triple(fit, eit, vit); } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return make_triple(fit, eit, vit); } @@ -771,7 +772,7 @@ copy_triangulation_() for(; hvit != hidden_vertices_end() ; ++hvit){ hvit->face()->vertex_list().push_back(hvit); } - CGAL_triangulation_postcondition(is_valid()); + CGAL_postcondition(is_valid()); } template < class Gt, class Tds > @@ -838,7 +839,7 @@ power_test(const Face_handle& f, int i, const Weighted_point &p) const // p is supposed to be on edge(f,i) // return ON_NEGATIVE_SIDE if p is above(f,i) // (p has to be hidden) - CGAL_triangulation_precondition(!is_infinite(f,i) && + CGAL_precondition(!is_infinite(f,i) && orientation(f->vertex(ccw(i))->point(), f->vertex(cw(i))->point(), p) == COLLINEAR); @@ -857,7 +858,7 @@ power_test(const Weighted_point &p0, const Weighted_point &p, bool perturb) const { - CGAL_triangulation_precondition(orientation(p0, p1, p2) == POSITIVE); + CGAL_precondition(orientation(p0, p1, p2) == POSITIVE); using namespace boost; @@ -887,7 +888,7 @@ power_test(const Weighted_point &p0, return o; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return ON_NEGATIVE_SIDE; } @@ -920,7 +921,7 @@ is_valid_face(Face_handle fh) const bool result = true; if(is_infinite(fh)) result = result && fh->vertex_list().empty(); if(!result) { show_face(fh);} - CGAL_triangulation_assertion(result); + CGAL_assertion(result); typename Vertex_list::iterator vlit = fh->vertex_list().begin(), vldone = fh->vertex_list().end(); @@ -928,7 +929,7 @@ is_valid_face(Face_handle fh) const result = result && power_test(fh,(*vlit)->point()) == ON_NEGATIVE_SIDE; result = result &&((*vlit)->face() == fh); if(!result) show_face(fh); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); } return result; } @@ -978,7 +979,7 @@ is_valid_vertex(Vertex_handle vh) const // show_face(vh->face()); // } } - CGAL_triangulation_assertion(result); + CGAL_assertion(result); return result; } @@ -1022,7 +1023,7 @@ is_valid(bool verbose, int /* level */) const it2->point(), it3->point()); result = result && s == COLLINEAR ; - CGAL_triangulation_assertion(result); + CGAL_assertion(result); ++it1 ; ++it2; ++it3; } } @@ -1030,18 +1031,18 @@ is_valid(bool verbose, int /* level */) const case 2 : for(Finite_faces_iterator it=finite_faces_begin(); it!=finite_faces_end(); it++) { - CGAL_triangulation_assertion(! is_infinite(it)); + CGAL_assertion(! is_infinite(it)); Orientation s = orientation(it->vertex(0)->point(), it->vertex(1)->point(), it->vertex(2)->point()); - CGAL_triangulation_assertion(s == LEFT_TURN); + CGAL_assertion(s == LEFT_TURN); result = result && (s == LEFT_TURN); for(int i = 0 ; i < 3 ; i++) { if(!is_infinite(it->vertex(i))) result = result && ON_POSITIVE_SIDE != power_test(it->neighbor(i), it->vertex(i)->point()); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); } } @@ -1053,7 +1054,7 @@ is_valid(bool verbose, int /* level */) const Orientation s = orientation(pc->point(), qc->point(), rc->point()); - CGAL_triangulation_assertion(s != LEFT_TURN); + CGAL_assertion(s != LEFT_TURN); result = result && (s != LEFT_TURN); ++pc ; ++qc ; ++rc; } while(pc != start); @@ -1063,7 +1064,7 @@ is_valid(bool verbose, int /* level */) const result = result && (number_of_faces() == 2*(number_of_vertices()+1) - 4 - degree(infinite_vertex())); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); break; } @@ -1075,7 +1076,7 @@ is_valid(bool verbose, int /* level */) const } result = result && (Base::number_of_vertices() == number_of_vertices() + number_of_hidden_vertices()); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); return result; } @@ -1167,7 +1168,7 @@ typename Regular_triangulation_2::Bare_point Regular_triangulation_2:: weighted_circumcenter(Face_handle f) const { - CGAL_triangulation_precondition(dimension() == 2 || !is_infinite(f)); + CGAL_precondition(dimension() == 2 || !is_infinite(f)); return weighted_circumcenter(f->vertex(0)->point(), f->vertex(1)->point(), f->vertex(2)->point()); @@ -1194,7 +1195,7 @@ dual(const Edge &e) const typedef typename Geom_traits::Ray_2 Ray; typedef typename Geom_traits::Segment_2 Segment; - CGAL_triangulation_precondition(! is_infinite(e)); + CGAL_precondition(! is_infinite(e)); if(dimension() == 1){ const Weighted_point& p = (e.first)->vertex(cw(e.second))->point(); const Weighted_point& q = (e.first)->vertex(ccw(e.second))->point(); @@ -1354,7 +1355,7 @@ typename Regular_triangulation_2::Vertex_handle Regular_triangulation_2:: reinsert(Vertex_handle v, Face_handle start) { - CGAL_triangulation_assertion(v->is_hidden()); + CGAL_assertion(v->is_hidden()); v->set_hidden(false); _hidden_vertices--; @@ -1385,8 +1386,8 @@ void Regular_triangulation_2:: exchange_hidden(Vertex_handle va, Vertex_handle vb) { - CGAL_triangulation_assertion(vb->is_hidden()); - CGAL_triangulation_assertion(vb == vb->face()->vertex_list().back()); + CGAL_assertion(vb->is_hidden()); + CGAL_assertion(vb == vb->face()->vertex_list().back()); // //to debug // std::cerr << "from exchange hidden 1" << std::endl; @@ -1411,7 +1412,7 @@ void Regular_triangulation_2:: exchange_incidences(Vertex_handle va, Vertex_handle vb) { - CGAL_triangulation_assertion(!vb->is_hidden()); + CGAL_assertion(!vb->is_hidden()); std::list faces; if(dimension() == 0) { faces.push_back(vb->face()); @@ -1421,7 +1422,7 @@ exchange_incidences(Vertex_handle va, Vertex_handle vb) faces.push_back(vb->face()->neighbor(1-i)); } else { - CGAL_triangulation_assertion(dimension() == 2); + CGAL_assertion(dimension() == 2); Face_circulator fc = incident_faces(vb), done(fc); do { faces.push_back(fc); @@ -1486,7 +1487,7 @@ void Regular_triangulation_2:: regularize(Vertex_handle v) { - CGAL_triangulation_precondition(v != infinite_vertex()); + CGAL_precondition(v != infinite_vertex()); Faces_around_stack faces_around; if(dimension() < 1) return; @@ -1553,8 +1554,8 @@ void Regular_triangulation_2:: remove(Vertex_handle v) { - CGAL_triangulation_precondition(v != Vertex_handle()); - CGAL_triangulation_precondition(!is_infinite(v)); + CGAL_precondition(v != Vertex_handle()); + CGAL_precondition(!is_infinite(v)); if(v->is_hidden()) return remove_hidden(v); @@ -1821,7 +1822,7 @@ void Regular_triangulation_2:: update_hidden_points_2_2(const Face_handle& f1, const Face_handle& f2) { - CGAL_triangulation_assertion(f1->has_neighbor(f2)); + CGAL_assertion(f1->has_neighbor(f2)); Vertex_list p_list; p_list.splice(p_list.begin(), f1->vertex_list()); @@ -1862,7 +1863,7 @@ update_hidden_points_2_2(const Face_handle& f1, const Face_handle& f2) int idx2 = f1->index(f2); Vertex_handle v0=f1->vertex(ccw(idx2)); Vertex_handle v1=f1->vertex(cw(idx2)); - CGAL_triangulation_assertion(!is_infinite(v0) && !is_infinite(v1)); + CGAL_assertion(!is_infinite(v0) && !is_infinite(v1)); while(! p_list.empty()) { @@ -1883,7 +1884,7 @@ Regular_triangulation_2:: update_hidden_points_1_3(const Face_handle& f1, const Face_handle& f2, const Face_handle& f3) { - CGAL_triangulation_assertion(f1->has_neighbor(f2) && + CGAL_assertion(f1->has_neighbor(f2) && f2->has_neighbor(f3) && f3->has_neighbor(f1)); @@ -1903,9 +1904,9 @@ update_hidden_points_1_3(const Face_handle& f1, const Face_handle& f2, v0 = f1->vertex(3-(idx2+idx3)), v1 = f2->vertex(f2->index(f1)); - CGAL_triangulation_assertion(f2->has_vertex(v0) && f1->has_vertex(v0)); - CGAL_triangulation_assertion(f3->has_vertex(v1)); - CGAL_triangulation_assertion(! is_infinite(v0)); + CGAL_assertion(f2->has_vertex(v0) && f1->has_vertex(v0)); + CGAL_assertion(f3->has_vertex(v1)); + CGAL_assertion(! is_infinite(v0)); // if two of f1, f2,and f3 are infinite // the list goes entirely to the third finite face @@ -2216,7 +2217,7 @@ typename Regular_triangulation_2::Vertex_handle Regular_triangulation_2:: finite_vertex() const { - CGAL_triangulation_precondition(number_of_vertices() >= 1); + CGAL_precondition(number_of_vertices() >= 1); return(finite_vertices_begin()); } diff --git a/Triangulation_2/include/CGAL/Regular_triangulation_face_base_2.h b/Triangulation_2/include/CGAL/Regular_triangulation_face_base_2.h index 4e0447c39c3..db27f39b00d 100644 --- a/Triangulation_2/include/CGAL/Regular_triangulation_face_base_2.h +++ b/Triangulation_2/include/CGAL/Regular_triangulation_face_base_2.h @@ -17,7 +17,7 @@ #include -#include +#include #include namespace CGAL { diff --git a/Triangulation_2/include/CGAL/Triangulation_2.h b/Triangulation_2/include/CGAL/Triangulation_2.h index 9c20817b5d6..5b5725f86de 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include @@ -737,7 +737,7 @@ bool well_oriented(Vertex_handle v) const } bool from_convex_hull(Vertex_handle v) { - CGAL_triangulation_precondition(!is_infinite(v)); + CGAL_precondition(!is_infinite(v)); Vertex_circulator vc = incident_vertices(v), done(vc); do { if(is_infinite(vc)) return true; } while(++vc != done); return false; @@ -864,7 +864,7 @@ typename Triangulation_2::Vertex_handle Triangulation_2:: finite_vertex() const { - CGAL_triangulation_precondition (number_of_vertices() >= 1); + CGAL_precondition (number_of_vertices() >= 1); return (finite_vertices_begin()); } @@ -911,7 +911,7 @@ is_valid(bool verbose, int level) const << point(it3) << " are not collinear" << std::endl; } - CGAL_triangulation_assertion(result); + CGAL_assertion(result); ++it1 ; ++it2; ++it3; } } @@ -919,7 +919,7 @@ is_valid(bool verbose, int level) const { for(Finite_faces_iterator it=finite_faces_begin(); it!=finite_faces_end(); it++) { - CGAL_triangulation_assertion( ! is_infinite(it)); + CGAL_assertion( ! is_infinite(it)); Orientation s = orientation(point(it, 0), point(it, 1), point(it, 2)); result = result && ( s == LEFT_TURN ); @@ -930,7 +930,7 @@ is_valid(bool verbose, int level) const << point(it, 2) << " form a badly oriented face" << std::endl; } - CGAL_triangulation_assertion(result); + CGAL_assertion(result); } Vertex_circulator start = incident_vertices(infinite_vertex()); @@ -940,7 +940,7 @@ is_valid(bool verbose, int level) const do { Orientation s = orientation(point(pc), point(qc), point(rc)); - CGAL_triangulation_assertion( s != LEFT_TURN ); + CGAL_assertion( s != LEFT_TURN ); result = result && ( s != LEFT_TURN ); if(verbose && (s == LEFT_TURN)) @@ -966,7 +966,7 @@ is_valid(bool verbose, int level) const << " and degree(infinite_vertex()) = " << degree(infinite_vertex()) << std::endl; } - CGAL_triangulation_assertion( result); + CGAL_assertion( result); } return result; } @@ -1108,9 +1108,9 @@ const typename Triangulation_2::Point& Triangulation_2:: point(Face_handle f, int i) const { - CGAL_triangulation_precondition( dimension() >= 0 ); - CGAL_triangulation_precondition( i >= 0 && i <= dimension() ); - CGAL_triangulation_precondition( ! is_infinite(f->vertex(i)) ); + CGAL_precondition( dimension() >= 0 ); + CGAL_precondition( i >= 0 && i <= dimension() ); + CGAL_precondition( ! is_infinite(f->vertex(i)) ); return f->vertex(i)->point(); } @@ -1119,8 +1119,8 @@ const typename Triangulation_2::Point& Triangulation_2:: point(Vertex_handle v) const { - CGAL_triangulation_precondition( dimension() >= 0 ); - CGAL_triangulation_precondition( ! is_infinite(v) ); + CGAL_precondition( dimension() >= 0 ); + CGAL_precondition( ! is_infinite(v) ); return v->point(); } @@ -1129,7 +1129,7 @@ typename Triangulation_2::Segment Triangulation_2:: segment(Face_handle f, int i) const { - CGAL_triangulation_precondition( ! is_infinite(f,i)); + CGAL_precondition( ! is_infinite(f,i)); typename Gt::Construct_segment_2 construct_segment = geom_traits().construct_segment_2_object(); return construct_segment(construct_point(f->vertex(ccw(i))->point()), @@ -1141,7 +1141,7 @@ typename Triangulation_2::Segment Triangulation_2:: segment(const Edge& e) const { - CGAL_triangulation_precondition(! is_infinite(e)); + CGAL_precondition(! is_infinite(e)); typename Gt::Construct_segment_2 construct_segment = geom_traits().construct_segment_2_object(); return construct_segment(construct_point(e.first->vertex(ccw(e.second))->point()), @@ -1177,7 +1177,7 @@ typename Triangulation_2::Triangle Triangulation_2:: triangle(Face_handle f) const { - CGAL_triangulation_precondition( ! is_infinite(f) ); + CGAL_precondition( ! is_infinite(f) ); typename Gt::Construct_triangle_2 construct_triangle = geom_traits().construct_triangle_2_object(); return construct_triangle(construct_point(f->vertex(0)->point()), @@ -1190,13 +1190,13 @@ void Triangulation_2:: flip(Face_handle f, int i) { - CGAL_triangulation_precondition ( f != Face_handle() ); - CGAL_triangulation_precondition (i == 0 || i == 1 || i == 2); - CGAL_triangulation_precondition( dimension()==2); + CGAL_precondition ( f != Face_handle() ); + CGAL_precondition (i == 0 || i == 1 || i == 2); + CGAL_precondition( dimension()==2); - CGAL_triangulation_precondition( !is_infinite(f) && + CGAL_precondition( !is_infinite(f) && !is_infinite(f->neighbor(i)) ); - CGAL_triangulation_precondition( + CGAL_precondition( orientation(f->vertex(i)->point(), f->vertex(cw(i))->point(), mirror_vertex(f,i)->point()) == RIGHT_TURN && @@ -1212,7 +1212,7 @@ typename Triangulation_2::Vertex_handle Triangulation_2:: insert_first(const Point& p) { - CGAL_triangulation_precondition(number_of_vertices() == 0); + CGAL_precondition(number_of_vertices() == 0); Vertex_handle v = _tds.insert_second(); v->set_point(p); return v; @@ -1223,7 +1223,7 @@ typename Triangulation_2::Vertex_handle Triangulation_2:: insert_second(const Point& p) { - CGAL_triangulation_precondition(number_of_vertices() == 1); + CGAL_precondition(number_of_vertices() == 1); Vertex_handle v = _tds.insert_dim_up(infinite_vertex(), true); v->set_point(p); return v; @@ -1234,7 +1234,7 @@ typename Triangulation_2::Vertex_handle Triangulation_2:: insert_in_edge(const Point& p, Face_handle f,int i) { - CGAL_triangulation_exactness_precondition( + CGAL_exactness_precondition( orientation(f->vertex(cw(i))->point(), p, f->vertex(ccw(i))->point()) == COLLINEAR && collinear_between(f->vertex(cw(i))->point(), p, @@ -1249,7 +1249,7 @@ typename Triangulation_2::Vertex_handle Triangulation_2:: insert_in_face(const Point& p, Face_handle f) { - CGAL_triangulation_precondition(oriented_side(f,p) == ON_POSITIVE_SIDE); + CGAL_precondition(oriented_side(f,p) == ON_POSITIVE_SIDE); Vertex_handle v= _tds.insert_in_face(f); v->set_point(p); return v; @@ -1260,7 +1260,7 @@ typename Triangulation_2::Vertex_handle Triangulation_2:: insert_outside_convex_hull(const Point& p, Face_handle f) { - CGAL_triangulation_precondition(is_infinite(f) && dimension() >= 1); + CGAL_precondition(is_infinite(f) && dimension() >= 1); Vertex_handle v; if (dimension() == 1) v=insert_outside_convex_hull_1(p, f); @@ -1276,8 +1276,8 @@ typename Triangulation_2::Vertex_handle Triangulation_2:: insert_outside_convex_hull_1(const Point& p, Face_handle f) { - CGAL_triangulation_precondition( is_infinite(f) && dimension()==1); - CGAL_triangulation_precondition( + CGAL_precondition( is_infinite(f) && dimension()==1); + CGAL_precondition( orientation(mirror_vertex(f, f->index(infinite_vertex()))->point(), f->vertex(1- f->index(infinite_vertex()))->point(), p) == COLLINEAR && @@ -1294,11 +1294,11 @@ typename Triangulation_2::Vertex_handle Triangulation_2:: insert_outside_convex_hull_2(const Point& p, Face_handle f) { - CGAL_triangulation_precondition(is_infinite(f)); + CGAL_precondition(is_infinite(f)); int li = f->index(infinite_vertex()); - CGAL_triangulation_precondition( + CGAL_precondition( orientation(p, f->vertex(ccw(li))->point(), f->vertex(cw(li))->point()) == LEFT_TURN); @@ -1359,14 +1359,14 @@ typename Triangulation_2::Vertex_handle Triangulation_2:: insert_outside_affine_hull(const Point& p) { - CGAL_triangulation_precondition(dimension() < 2); + CGAL_precondition(dimension() < 2); bool conform = false; if (dimension() == 1) { Face_handle f = (*finite_edges_begin()).first; Orientation orient = orientation( f->vertex(0)->point(), f->vertex(1)->point(), p); - CGAL_triangulation_precondition(orient != COLLINEAR); + CGAL_precondition(orient != COLLINEAR); conform = ( orient == COUNTERCLOCKWISE); } Vertex_handle v = _tds.insert_dim_up( infinite_vertex(), conform); @@ -1412,7 +1412,7 @@ insert(const Point& p, Locate_type lt, Face_handle loc, int li) case VERTEX: return loc->vertex(li); } - CGAL_triangulation_assertion(false); // locate step failed + CGAL_assertion(false); // locate step failed return Vertex_handle(); } @@ -1459,8 +1459,8 @@ void Triangulation_2:: remove(Vertex_handle v) { - CGAL_triangulation_precondition( v != Vertex_handle()); - CGAL_triangulation_precondition( !is_infinite(v)); + CGAL_precondition( v != Vertex_handle()); + CGAL_precondition( !is_infinite(v)); if (number_of_vertices() == 1) remove_first(v); @@ -1491,7 +1491,7 @@ test_dim_down(Vertex_handle v) const //it goes down to 1 iff // 1) any finite face is incident to v // 2) all vertices are collinear - CGAL_triangulation_precondition(dimension() == 2); + CGAL_precondition(dimension() == 2); bool dim1 = true; Finite_faces_iterator fit = finite_faces_begin(); while (dim1==true && fit != finite_faces_end()) { @@ -1592,8 +1592,8 @@ void Triangulation_2:: remove_and_give_new_faces(Vertex_handle v, OutputItFaces fit) { - CGAL_triangulation_precondition( v != Vertex_handle()); - CGAL_triangulation_precondition( !is_infinite(v)); + CGAL_precondition( v != Vertex_handle()); + CGAL_precondition( !is_infinite(v)); if(number_of_vertices() == 1) remove_first(v); else if(number_of_vertices() == 2) remove_second(v); @@ -2189,7 +2189,7 @@ typename Triangulation_2::Vertex_handle Triangulation_2:: move_if_no_collision(Vertex_handle v, const Point &p) { - CGAL_triangulation_precondition(!is_infinite(v)); + CGAL_precondition(!is_infinite(v)); if(v->point() == p) return v; const int dim = dimension(); @@ -2220,7 +2220,7 @@ move_if_no_collision(Vertex_handle v, const Point &p) Face_handle f = v->face(); int i = f->index(v); if (i==0) {f = f->neighbor(1);} - CGAL_triangulation_assertion(f->index(v) == 1); + CGAL_assertion(f->index(v) == 1); Face_handle g= f->neighbor(0); f->set_vertex(1, g->vertex(1)); f->set_neighbor(0,g->neighbor(0)); @@ -2230,7 +2230,7 @@ move_if_no_collision(Vertex_handle v, const Point &p) Face_handle f_ins = inserted->face(); i = f_ins->index(inserted); if (i==0) {f_ins = f_ins->neighbor(1);} - CGAL_triangulation_assertion(f_ins->index(inserted) == 1); + CGAL_assertion(f_ins->index(inserted) == 1); Face_handle g_ins = f_ins->neighbor(0); f_ins->set_vertex(1, v); g_ins->set_vertex(0, v); @@ -2292,7 +2292,7 @@ typename Triangulation_2::Vertex_handle Triangulation_2:: move(Vertex_handle v, const Point &p) { - CGAL_triangulation_precondition(!is_infinite(v)); + CGAL_precondition(!is_infinite(v)); if(v->point() == p) return v; Vertex_handle w = move_if_no_collision(v,p); if(w != v) { @@ -2310,7 +2310,7 @@ move_if_no_collision_and_give_new_faces(Vertex_handle v, const Point &p, OutputItFaces oif) { - CGAL_triangulation_precondition(!is_infinite(v)); + CGAL_precondition(!is_infinite(v)); if(v->point() == p) return v; const int dim = this->dimension(); @@ -2346,7 +2346,7 @@ move_if_no_collision_and_give_new_faces(Vertex_handle v, Face_handle f = v->face(); int i = f->index(v); if (i==0) {f = f->neighbor(1);} - CGAL_triangulation_assertion(f->index(v) == 1); + CGAL_assertion(f->index(v) == 1); Face_handle g= f->neighbor(0); f->set_vertex(1, g->vertex(1)); f->set_neighbor(0,g->neighbor(0)); @@ -2357,7 +2357,7 @@ move_if_no_collision_and_give_new_faces(Vertex_handle v, Face_handle f_ins = inserted->face(); i = f_ins->index(inserted); if (i==0) {f_ins = f_ins->neighbor(1);} - CGAL_triangulation_assertion(f_ins->index(inserted) == 1); + CGAL_assertion(f_ins->index(inserted) == 1); Face_handle g_ins = f_ins->neighbor(0); f_ins->set_vertex(1, v); g_ins->set_vertex(0, v); @@ -2579,7 +2579,7 @@ march_locate_1D(const Point& t, return (*eit).first; } } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return Face_handle(); } @@ -2591,7 +2591,7 @@ march_locate_2D_LFC(Face_handle start, Locate_type& lt, int& li) const { - // CGAL_triangulation_precondition( ! is_infinite(start) ); + // CGAL_precondition( ! is_infinite(start) ); const Point& p = start->vertex(0)->point(); const Point& q = start->vertex(1)->point(); const Point& r = start->vertex(2)->point(); @@ -2669,7 +2669,7 @@ march_locate_2D_LFC(Face_handle start, } } while (--fc != done); //should not arrive there; - CGAL_triangulation_assertion(fc != done); + CGAL_assertion(fc != done); } while(! lfc.locate(t, lt, li) ){ @@ -2713,7 +2713,7 @@ compare_walks(const Point& p, show_face(c2); std::cerr << std::endl; } - CGAL_triangulation_assertion(b); + CGAL_assertion(b); } @@ -2726,7 +2726,7 @@ march_locate_2D(Face_handle c, Locate_type& lt, int& li) const { - CGAL_triangulation_assertion(! is_infinite(c)); + CGAL_assertion(! is_infinite(c)); boost::rand48 rng; @@ -2902,7 +2902,7 @@ march_locate_2D(Face_handle c, Locate_type& lt, int& li) const { - CGAL_triangulation_assertion(! is_infinite(c)); + CGAL_assertion(! is_infinite(c)); boost::uniform_smallint<> three(0, 2); boost::variate_generator > die3(rng, three); @@ -2926,7 +2926,7 @@ march_locate_2D(Face_handle c, const Point & p0 = c->vertex( i )->point(); const Point & p1 = c->vertex( ccwi )->point(); Orientation o0, o1, o2; - CGAL_triangulation_assertion(orientation(p0,p1,c->vertex( cwi )->point())==POSITIVE); + CGAL_assertion(orientation(p0,p1,c->vertex( cwi )->point())==POSITIVE); if(c->neighbor(cwi) == prev){ o0 = POSITIVE; } else { @@ -3431,7 +3431,7 @@ typename Triangulation_2::Line_face_circulator Triangulation_2:: line_walk(const Point& p, const Point& q, Face_handle f) const { - CGAL_triangulation_precondition( (dimension() == 2) && ! xy_equal(p,q)); + CGAL_precondition( (dimension() == 2) && ! xy_equal(p,q)); Line_face_circulator lfc = (f == Face_handle()) ? Line_face_circulator(p, q, this) : Line_face_circulator(p, q, f, this); @@ -3470,7 +3470,7 @@ bounded_side(const Point &p0, const Point &p1, const Point &p2, const Point &p) const { // return position of point p with respect to triangle p0p1p2 - CGAL_triangulation_precondition( orientation(p0, p1, p2) != COLLINEAR); + CGAL_precondition( orientation(p0, p1, p2) != COLLINEAR); Orientation o1 = orientation(p0, p1, p), o2 = orientation(p1, p2, p), o3 = orientation(p2, p0, p); @@ -3502,7 +3502,7 @@ Oriented_side Triangulation_2:: oriented_side(Face_handle f, const Point &p) const { - CGAL_triangulation_precondition ( dimension()==2); + CGAL_precondition ( dimension()==2); return oriented_side(f->vertex(0)->point(), f->vertex(1)->point(), f->vertex(2)->point(), @@ -3515,7 +3515,7 @@ Triangulation_2:: side_of_oriented_circle(const Point &p0, const Point &p1, const Point &p2, const Point &p, bool perturb) const { - //CGAL_triangulation_precondition( orientation(p0, p1, p2) == POSITIVE ); + //CGAL_precondition( orientation(p0, p1, p2) == POSITIVE ); // no reason for such precondition and it invalidates fast removal in Delaunay typename Gt::Side_of_oriented_circle_2 pred = geom_traits().side_of_oriented_circle_2_object(); @@ -3546,7 +3546,7 @@ side_of_oriented_circle(const Point &p0, const Point &p1, const Point &p2, if (points[i] == &p0 && (o = orientation(p,p1,p2)) != COLLINEAR ) return Oriented_side(o); } - // CGAL_triangulation_assertion(false); + // CGAL_assertion(false); //no reason for such precondition and it invalidates fast removal in Delaunay return ON_NEGATIVE_SIDE; } @@ -3666,7 +3666,7 @@ typename Triangulation_2::Point_2 Triangulation_2:: circumcenter(Face_handle f) const { - CGAL_triangulation_precondition (dimension()==2); + CGAL_precondition (dimension()==2); return circumcenter((f->vertex(0))->point(), (f->vertex(1))->point(), (f->vertex(2))->point()); @@ -3813,7 +3813,7 @@ std::istream& operator>>(std::istream& is, Triangulation_2 &tr) { tr.file_input(is); - CGAL_triangulation_assertion(tr.is_valid()); + CGAL_assertion(tr.is_valid()); return is; } @@ -3835,11 +3835,11 @@ test_next(const Triangulation_2& t1, // Returns false if an inequality has been found. // Precondition: f1, f2 have been registered as well as their 3 vertices. - CGAL_triangulation_precondition(t1.dimension() >= 2); - CGAL_triangulation_precondition(Fmap[f1] == f2); - CGAL_triangulation_precondition(Vmap.find(f1->vertex(0)) != Vmap.end()); - CGAL_triangulation_precondition(Vmap.find(f1->vertex(1)) != Vmap.end()); - CGAL_triangulation_precondition(t1.dimension() == 1 || Vmap.find(f1->vertex(2)) != Vmap.end()); + CGAL_precondition(t1.dimension() >= 2); + CGAL_precondition(Fmap[f1] == f2); + CGAL_precondition(Vmap.find(f1->vertex(0)) != Vmap.end()); + CGAL_precondition(Vmap.find(f1->vertex(1)) != Vmap.end()); + CGAL_precondition(t1.dimension() == 1 || Vmap.find(f1->vertex(2)) != Vmap.end()); typedef Triangulation_2 Tr1; typedef Triangulation_2 Tr2; diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/Constraint_hierarchy_2.h b/Triangulation_2/include/CGAL/Triangulation_2/internal/Constraint_hierarchy_2.h index f6bb630f203..fd9ecd9244d 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/Constraint_hierarchy_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2/internal/Constraint_hierarchy_2.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include namespace CGAL { @@ -345,7 +345,7 @@ Constraint_hierarchy_2:: context(T va, T vb) { H_context_iterator hcit, past; - if(!get_contexts(va,vb, hcit ,past)) CGAL_triangulation_assertion(false); + if(!get_contexts(va,vb, hcit ,past)) CGAL_assertion(false); return *hcit; } @@ -355,7 +355,7 @@ Constraint_hierarchy_2:: number_of_enclosing_constraints(T va, T vb) { H_context_list* hcl = get_contexts(va, vb); - CGAL_triangulation_assertion(hcl != nullptr); + CGAL_assertion(hcl != nullptr); return hcl->size(); } @@ -365,7 +365,7 @@ Constraint_hierarchy_2:: contexts_begin(T va, T vb) { H_context_iterator first, last; - if( !get_contexts(va,vb,first,last)) CGAL_triangulation_assertion(false); + if( !get_contexts(va,vb,first,last)) CGAL_assertion(false); return first; } @@ -375,7 +375,7 @@ Constraint_hierarchy_2:: contexts_end(T va, T vb) { H_context_iterator first, last; - if( !get_contexts(va,vb,first,last)) CGAL_triangulation_assertion(false); + if( !get_contexts(va,vb,first,last)) CGAL_assertion(false); return last; } @@ -385,7 +385,7 @@ Constraint_hierarchy_2:: vertices_in_constraint_begin(T va, T vb) { H_c_iterator cit = c_to_sc_map.find(make_edge(va,vb)); - CGAL_triangulation_assertion( cit != c_to_sc_map.end()); + CGAL_assertion( cit != c_to_sc_map.end()); return cit->second->begin(); } @@ -395,7 +395,7 @@ Constraint_hierarchy_2:: vertices_in_constraint_end(T va, T vb) { H_c_iterator cit = c_to_sc_map.find(make_edge(va,vb)); - CGAL_triangulation_assertion( cit != c_to_sc_map.end()); + CGAL_assertion( cit != c_to_sc_map.end()); return cit->second->end(); } @@ -444,7 +444,7 @@ Constraint_hierarchy_2:: remove_constraint(T va, T vb){ H_edge he = make_edge(va, vb); typename H_c_to_sc_map::iterator c_to_sc_it = c_to_sc_map.find(he); - CGAL_triangulation_assertion(c_to_sc_it != c_to_sc_map.end()); + CGAL_assertion(c_to_sc_it != c_to_sc_map.end()); H_vertex_list *hvl = c_to_sc_it->second; @@ -454,7 +454,7 @@ remove_constraint(T va, T vb){ ++it){ typename H_sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_triangulation_assertion(scit != sc_to_c_map.end()); + CGAL_assertion(scit != sc_to_c_map.end()); H_context_list* hcl = scit->second; // and remove the contraint from the context list of the subcontraint @@ -534,7 +534,7 @@ next_along_sc(T va, T vb, T& w) const // find the next vertex after vb along any enclosing constrained // return false if there is no .... H_context_iterator ctxtit, past; - if(!get_contexts(va, vb, ctxtit, past)) CGAL_triangulation_assertion(false); + if(!get_contexts(va, vb, ctxtit, past)) CGAL_assertion(false); H_vertex_it pos; for( ; ctxtit != past; ctxtit++){ @@ -564,9 +564,9 @@ remove_Steiner(T v, T va, T vb) CGAL_precondition(!is_constrained_vertex(v)); H_context_list* hcl1 = get_contexts(va, v); - CGAL_triangulation_assertion(hcl1 != nullptr); + CGAL_assertion(hcl1 != nullptr); H_context_list* hcl2 = get_contexts(v, vb); - CGAL_triangulation_assertion(hcl2 != nullptr); + CGAL_assertion(hcl2 != nullptr); H_vertex_it pos; for(H_context_iterator ctit=hcl1->begin(); ctit != hcl1->end(); ctit++){ @@ -600,7 +600,7 @@ void Constraint_hierarchy_2:: add_Steiner(T va, T vb, T vc){ H_context_list* hcl = get_contexts(va, vb); - CGAL_triangulation_assertion(hcl != nullptr); + CGAL_assertion(hcl != nullptr); H_context_list* hcl2 = new H_context_list; @@ -701,7 +701,7 @@ Constraint_hierarchy_2:: oriented_end(T va, T vb, T& vc) const { H_context_iterator ctxt, past; - if(!get_contexts(va,vb, ctxt, past) ) CGAL_triangulation_assertion(false); + if(!get_contexts(va,vb, ctxt, past) ) CGAL_assertion(false); if(*(ctxt->pos) == va) vc = ctxt->enclosing->back(); else diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h b/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h index 130b2a181de..a6c2bf44571 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2/internal/Polyline_constraint_hierarchy_2.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS # include @@ -423,7 +423,7 @@ enclosing_constraint(T vaa, T vbb, T& va, T& vb) const va = *pos; pos = hcit->pos; ++pos; - CGAL_triangulation_assertion(vbb == *pos); + CGAL_assertion(vbb == *pos); while(!pos.input()){ ++pos; } @@ -451,7 +451,7 @@ Polyline_constraint_hierarchy_2:: context(T va, T vb) { Context_iterator hcit, past; - if(!get_contexts(va,vb, hcit ,past)) CGAL_triangulation_assertion(false); + if(!get_contexts(va,vb, hcit ,past)) CGAL_assertion(false); return *hcit; } @@ -461,8 +461,8 @@ Polyline_constraint_hierarchy_2:: number_of_enclosing_constraints(T va, T vb) const { Context_list* hcl = nullptr; - CGAL_triangulation_assertion_code( bool found = ) get_contexts(va,vb,hcl); - CGAL_triangulation_assertion(found); + CGAL_assertion_code( bool found = ) get_contexts(va,vb,hcl); + CGAL_assertion(found); return hcl->size(); } @@ -472,7 +472,7 @@ Polyline_constraint_hierarchy_2:: contexts_begin(T va, T vb) const { Context_iterator first, last; - if( !get_contexts(va,vb,first,last)) CGAL_triangulation_assertion(false); + if( !get_contexts(va,vb,first,last)) CGAL_assertion(false); return first; } @@ -482,7 +482,7 @@ Polyline_constraint_hierarchy_2:: contexts_end(T va, T vb) const { Context_iterator first, last; - if( !get_contexts(va,vb,first,last)) CGAL_triangulation_assertion(false); + if( !get_contexts(va,vb,first,last)) CGAL_assertion(false); return last; } @@ -495,7 +495,7 @@ swap(Constraint_id first, Constraint_id second){ ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_triangulation_assertion(scit != sc_to_c_map.end()); + CGAL_assertion(scit != sc_to_c_map.end()); Context_list* hcl = scit->second; // and replace the context of the constraint @@ -511,7 +511,7 @@ swap(Constraint_id first, Constraint_id second){ ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_triangulation_assertion(scit != sc_to_c_map.end()); + CGAL_assertion(scit != sc_to_c_map.end()); Context_list* hcl = scit->second; // and replace the context of the constraint @@ -527,7 +527,7 @@ swap(Constraint_id first, Constraint_id second){ ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_triangulation_assertion(scit != sc_to_c_map.end()); + CGAL_assertion(scit != sc_to_c_map.end()); Context_list* hcl = scit->second; // and replace the context of the constraint @@ -553,7 +553,7 @@ remove_constraint(Constraint_id cid){ ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_triangulation_assertion(scit != sc_to_c_map.end()); + CGAL_assertion(scit != sc_to_c_map.end()); Context_list* hcl = scit->second; // and remove the context of the constraint @@ -680,7 +680,7 @@ Polyline_constraint_hierarchy_2::concatenate(Constraint_id firs ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_triangulation_assertion(scit != sc_to_c_map.end()); + CGAL_assertion(scit != sc_to_c_map.end()); Context_list* hcl = scit->second; // and replace the context of the constraint @@ -705,7 +705,7 @@ Polyline_constraint_hierarchy_2::concatenate(Constraint_id firs ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_triangulation_assertion(scit != sc_to_c_map.end()); + CGAL_assertion(scit != sc_to_c_map.end()); Context_list* hcl = scit->second; // and update pos in the context of the constraint @@ -733,7 +733,7 @@ Polyline_constraint_hierarchy_2::concatenate2(Constraint_id fir ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_triangulation_assertion(scit != sc_to_c_map.end()); + CGAL_assertion(scit != sc_to_c_map.end()); Context_list* hcl = scit->second; // and replace the context of the constraint @@ -757,7 +757,7 @@ Polyline_constraint_hierarchy_2::concatenate2(Constraint_id fir ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_triangulation_assertion(scit != sc_to_c_map.end()); + CGAL_assertion(scit != sc_to_c_map.end()); Context_list* hcl = scit->second; // and update pos in the context of the constraint @@ -798,7 +798,7 @@ Polyline_constraint_hierarchy_2::split(Constraint_id first, Ver ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_triangulation_assertion(scit != sc_to_c_map.end()); + CGAL_assertion(scit != sc_to_c_map.end()); Context_list* hcl = scit->second; // and replace the context of the constraint @@ -832,7 +832,7 @@ Polyline_constraint_hierarchy_2::split2(Constraint_id first, Ve ++succ != end; ++it){ typename Sc_to_c_map::iterator scit = sc_to_c_map.find(make_edge(*it,*succ)); - CGAL_triangulation_assertion(scit != sc_to_c_map.end()); + CGAL_assertion(scit != sc_to_c_map.end()); Context_list* hcl = scit->second; // and replace the context of the constraint @@ -985,7 +985,7 @@ next_along_sc(T va, T vb, T& w) const // find the next vertex after vb along any enclosing constrained // return false if there is no .... Context_iterator ctxtit, past; - if(!get_contexts(va, vb, ctxtit, past)) CGAL_triangulation_assertion(false); + if(!get_contexts(va, vb, ctxtit, past)) CGAL_assertion(false); Vertex_it pos; for( ; ctxtit != past; ctxtit++){ @@ -1016,8 +1016,8 @@ remove_Steiner(T v, T va, T vb) Context_list* hcl1; Context_list* hcl2; - if(!get_contexts(va,v,hcl1)) CGAL_triangulation_assertion(false); - if(!get_contexts(v,vb,hcl2)) CGAL_triangulation_assertion(false); + if(!get_contexts(va,v,hcl1)) CGAL_assertion(false); + if(!get_contexts(v,vb,hcl2)) CGAL_assertion(false); Vertex_it pos; for(Context_iterator ctit=hcl1->begin(); ctit != hcl1->end(); ctit++){ @@ -1169,7 +1169,7 @@ Polyline_constraint_hierarchy_2:: oriented_end(T va, T vb, T& vc) const { Context_iterator ctxt, past; - if(!get_contexts(va,vb, ctxt, past) ) CGAL_triangulation_assertion(false); + if(!get_contexts(va,vb, ctxt, past) ) CGAL_assertion(false); if(*(ctxt->pos) == va) vc = ctxt->enclosing->back(); else diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_line_face_circulator_2.h b/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_line_face_circulator_2.h index 0f7800637a2..5cd70bb2a6b 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_line_face_circulator_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_line_face_circulator_2.h @@ -19,7 +19,7 @@ #include #include -#include +#include namespace CGAL { @@ -92,7 +92,7 @@ public: bool operator==(const Face_handle& fh) const { return fh == pos; } bool operator!=(const Face_handle& fh) const { return fh != pos; } - bool operator==(std::nullptr_t CGAL_triangulation_assertion_code(n)) const; + bool operator==(std::nullptr_t CGAL_assertion_code(n)) const; bool operator!=(std::nullptr_t n) const; bool is_empty() const; bool collinear_outside() const; @@ -139,7 +139,7 @@ Triangulation_line_face_circulator_2(const Face_handle& face, : pos(face), _tr(t), s(state), i(index), p(pp), q(qq) { - CGAL_triangulation_precondition(! t->xy_equal(p, q)); + CGAL_precondition(! t->xy_equal(p, q)); } @@ -153,7 +153,7 @@ Triangulation_line_face_circulator_2(Vertex_handle v, // dir // or null iterator { - CGAL_triangulation_precondition((!_tr->is_infinite(v)) && + CGAL_precondition((!_tr->is_infinite(v)) && (_tr->dimension() == 2) && (! _tr->xy_equal(v->point(),dir))); p=v->point(); @@ -188,7 +188,7 @@ Triangulation_line_face_circulator_2(Vertex_handle v, // reset vt and conclude. vt is still finite and [pqt] still LEFT_TURN ic = fc->index(v); vt= fc->vertex(cw(ic)); - CGAL_triangulation_assertion (_tr->orientation(p,q, vt->point())== + CGAL_assertion (_tr->orientation(p,q, vt->point())== LEFT_TURN ); if (_tr->is_infinite(vr)) { --fc; @@ -318,7 +318,7 @@ Triangulation_line_face_circulator_2(const Point& pp, // incident to p // if ff is infinite, the walk begin at the first finite face traversed { - CGAL_triangulation_precondition(_tr->is_infinite(ff) || + CGAL_precondition(_tr->is_infinite(ff) || _tr->oriented_side(ff,p) != ON_NEGATIVE_SIDE); int j; if(_tr->is_infinite(pos)){ @@ -416,7 +416,7 @@ void Triangulation_line_face_circulator_2:: increment() { - CGAL_triangulation_precondition(pos != Face_handle()); + CGAL_precondition(pos != Face_handle()); if(s == vertex_vertex || s == edge_vertex) { Orientation o; do{ @@ -469,7 +469,7 @@ void Triangulation_line_face_circulator_2:: decrement() { - CGAL_triangulation_precondition(pos != Face_handle()); + CGAL_precondition(pos != Face_handle()); if(s == vertex_vertex || s == vertex_edge) { if(s == vertex_vertex){ i = cw(i); @@ -538,7 +538,7 @@ locate(const Point& t, Locate_type <, int &li) case vertex_vertex: { if(_tr->is_infinite(pos->vertex(i))){ - CGAL_triangulation_assertion( + CGAL_assertion( _tr->orientation( pos->vertex(cw(i))->point(), pos->vertex(ccw(i))->point(), t) != LEFT_TURN); @@ -589,7 +589,7 @@ Triangulation_line_face_circulator_2& Triangulation_line_face_circulator_2:: operator++() { - CGAL_triangulation_precondition( pos != Face_handle()) ; + CGAL_precondition( pos != Face_handle()) ; increment(); return *this; } @@ -600,7 +600,7 @@ Triangulation_line_face_circulator_2& Triangulation_line_face_circulator_2:: operator--() { - CGAL_triangulation_precondition(pos != Face_handle()) ; + CGAL_precondition(pos != Face_handle()) ; decrement(); return *this; } @@ -632,7 +632,7 @@ inline bool Triangulation_line_face_circulator_2:: operator==(const Line_face_circulator& lfc) const { - CGAL_triangulation_precondition( pos != Face_handle() && + CGAL_precondition( pos != Face_handle() && lfc.pos != Face_handle()); return ( _tr == lfc._tr && ( _tr==nullptr || (pos == lfc.pos && s== lfc.s && p==lfc.p && q==lfc.q) ) ); @@ -657,9 +657,9 @@ is_empty() const template < class Triangulation > inline bool Triangulation_line_face_circulator_2:: -operator==(std::nullptr_t CGAL_triangulation_assertion_code(n)) const +operator==(std::nullptr_t CGAL_assertion_code(n)) const { - CGAL_triangulation_assertion( n == nullptr); + CGAL_assertion( n == nullptr); return pos == Face_handle(); } @@ -668,7 +668,7 @@ inline bool Triangulation_line_face_circulator_2:: operator!=(std::nullptr_t n) const { - CGAL_triangulation_assertion( n == nullptr); + CGAL_assertion( n == nullptr); return !(*this == n); } diff --git a/Triangulation_2/include/CGAL/Triangulation_2_traits_3.h b/Triangulation_2/include/CGAL/Triangulation_2_traits_3.h index ac015011f68..4ed05abecc1 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2_traits_3.h +++ b/Triangulation_2/include/CGAL/Triangulation_2_traits_3.h @@ -22,7 +22,7 @@ #include #include -#include +#include namespace CGAL { diff --git a/Triangulation_2/include/CGAL/Triangulation_face_base_2.h b/Triangulation_2/include/CGAL/Triangulation_face_base_2.h index 7335b7c2c74..ea91ec002cf 100644 --- a/Triangulation_2/include/CGAL/Triangulation_face_base_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_face_base_2.h @@ -17,7 +17,7 @@ #include -#include +#include #include namespace CGAL { diff --git a/Triangulation_2/include/CGAL/Triangulation_hierarchy_2.h b/Triangulation_2/include/CGAL/Triangulation_hierarchy_2.h index d82c4c0a828..48333eab34a 100644 --- a/Triangulation_2/include/CGAL/Triangulation_hierarchy_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_hierarchy_2.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include @@ -252,7 +252,7 @@ private: Vertex_handle nearest_vertex_dispatch(const Point&, Face_handle, Tag_true) const { - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return Vertex_handle(); } @@ -582,7 +582,7 @@ template typename Triangulation_hierarchy_2::Vertex_handle Triangulation_hierarchy_2:: move(Vertex_handle v, const Point &p) { - CGAL_triangulation_precondition(!is_infinite(v)); + CGAL_precondition(!is_infinite(v)); Vertex_handle w = move_if_no_collision(v,p); if(w != v) { remove(v); diff --git a/Triangulation_2/include/CGAL/draw_constrained_triangulation_2.h b/Triangulation_2/include/CGAL/draw_constrained_triangulation_2.h index 7bc3856bc9d..d8aa3ccf92f 100644 --- a/Triangulation_2/include/CGAL/draw_constrained_triangulation_2.h +++ b/Triangulation_2/include/CGAL/draw_constrained_triangulation_2.h @@ -57,7 +57,7 @@ public: protected: void compute_face(Facet_const_handle fh) { - CGAL::IO::Color c = get(ipm, fh)? CGAL::yellow() : CGAL::white(); + CGAL::IO::Color c = get(ipm, fh)? CGAL::IO::yellow() : CGAL::IO::white(); face_begin(c); add_point_in_face(fh->vertex(0)->point()); @@ -69,7 +69,7 @@ protected: void compute_edge(Edge_const_handle eh) { - CGAL::IO::Color c = t2.is_constrained(*eh)? CGAL::green() : CGAL::black(); + CGAL::IO::Color c = t2.is_constrained(*eh)? CGAL::IO::green() : CGAL::IO::black(); add_segment(eh->first->vertex(eh->first->cw(eh->second))->point(), eh->first->vertex(eh->first->ccw(eh->second))->point(), c); diff --git a/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h b/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h index 094950e1fe9..0099a304430 100644 --- a/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h @@ -548,7 +548,7 @@ public: OutputIteratorInternalFacets ifit, bool *could_lock_zone = nullptr) const { - CGAL_triangulation_precondition(dimension() >= 2); + CGAL_precondition(dimension() >= 2); std::vector cells; cells.reserve(32); @@ -621,7 +621,7 @@ public: vertices_on_conflict_zone_boundary(const Point&p, Cell_handle c, OutputIterator res) const { - CGAL_triangulation_precondition(dimension() >= 2); + CGAL_precondition(dimension() >= 2); // Get the facets on the boundary of the hole. std::vector facets; @@ -667,7 +667,7 @@ public: template < typename InputIterator > size_type remove(InputIterator first, InputIterator beyond) { - CGAL_triangulation_precondition(!this->does_repeat_in_range(first, beyond)); + CGAL_precondition(!this->does_repeat_in_range(first, beyond)); size_type n = number_of_vertices(); #ifdef CGAL_TRIANGULATION_3_PROFILING @@ -794,7 +794,7 @@ protected: nearest_vertex(const Point& p, Vertex_handle v, Vertex_handle w) const { // In case of equality, v is returned. - CGAL_triangulation_precondition(v != w); + CGAL_precondition(v != w); if(is_infinite(v)) return w; @@ -1301,7 +1301,7 @@ remove(Vertex_handle v) Vertex_remover remover(tmp); Tr_Base::remove(v, remover); - CGAL_triangulation_expensive_postcondition(is_valid()); + CGAL_expensive_postcondition(is_valid()); } template < class Gt, class Tds, class Lds > @@ -1313,7 +1313,7 @@ remove(Vertex_handle v, bool *could_lock_zone) Vertex_remover remover(tmp); bool ret = Tr_Base::remove(v, remover, could_lock_zone); - CGAL_triangulation_expensive_postcondition(is_valid()); + CGAL_expensive_postcondition(is_valid()); return ret; } @@ -1327,7 +1327,7 @@ move_if_no_collision(Vertex_handle v, const Point& p) Vertex_inserter inserter(*this); Vertex_handle res = Tr_Base::move_if_no_collision(v,p,remover,inserter); - CGAL_triangulation_expensive_postcondition(is_valid()); + CGAL_expensive_postcondition(is_valid()); return res; } @@ -1336,7 +1336,7 @@ typename Delaunay_triangulation_3::Vertex_handle Delaunay_triangulation_3:: move(Vertex_handle v, const Point& p) { - CGAL_triangulation_precondition(!is_infinite(v)); + CGAL_precondition(!is_infinite(v)); if(v->point() == p) return v; @@ -1356,7 +1356,7 @@ remove_and_give_new_cells(Vertex_handle v, OutputItCells fit) Vertex_remover remover(tmp); Tr_Base::remove_and_give_new_cells(v,remover,fit); - CGAL_triangulation_expensive_postcondition(is_valid()); + CGAL_expensive_postcondition(is_valid()); } template < class Gt, class Tds, class Lds > @@ -1373,7 +1373,7 @@ move_if_no_collision_and_give_new_cells(Vertex_handle v, const Point& p, Tr_Base::move_if_no_collision_and_give_new_cells(v,p, remover,inserter,fit); - CGAL_triangulation_expensive_postcondition(is_valid()); + CGAL_expensive_postcondition(is_valid()); return res; } @@ -1383,7 +1383,7 @@ Delaunay_triangulation_3:: side_of_oriented_sphere(const Point& p0, const Point& p1, const Point& p2, const Point& p3, const Point& p, bool perturb) const { - CGAL_triangulation_precondition(orientation(p0, p1, p2, p3) == POSITIVE); + CGAL_precondition(orientation(p0, p1, p2, p3) == POSITIVE); Oriented_side os = geom_traits().side_of_oriented_sphere_3_object()(p0, p1, p2, p3, p); @@ -1416,7 +1416,7 @@ side_of_oriented_sphere(const Point& p0, const Point& p1, const Point& p2, return o; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return ON_NEGATIVE_SIDE; } @@ -1427,8 +1427,8 @@ coplanar_side_of_bounded_circle(const Point& p0, const Point& p1, const Point& p2, const Point& p, bool perturb) const { // In dim==2, we should even be able to assert orient == POSITIVE. - CGAL_triangulation_precondition(coplanar_orientation(p0, p1, p2) - != COLLINEAR); + CGAL_precondition(coplanar_orientation(p0, p1, p2) + != COLLINEAR); Bounded_side bs = geom_traits().coplanar_side_of_bounded_circle_3_object()(p0, p1, p2, p); @@ -1478,7 +1478,7 @@ side_of_sphere(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2, Vertex_handle v3, const Point& p, bool perturb) const { - CGAL_triangulation_precondition(dimension() == 3); + CGAL_precondition(dimension() == 3); if(is_infinite(v0)) { @@ -1538,12 +1538,12 @@ side_of_circle(Cell_handle c, int i, const Point& p, bool perturb) const // ON_BOUNDED_SIDE for a point in the open half-plane // ON_UNBOUNDED_SIDE elsewhere - CGAL_triangulation_precondition(dimension() >= 2); + CGAL_precondition(dimension() >= 2); int i3 = 5; if(dimension() == 2) { - CGAL_triangulation_precondition(i == 3); + CGAL_precondition(i == 3); // the triangulation is supposed to be valid, ie the facet // with vertices 0 1 2 in this order is positively oriented if(! c->has_vertex(infinite_vertex(), i3)) @@ -1556,8 +1556,8 @@ side_of_circle(Cell_handle c, int i, const Point& p, bool perturb) const // is positively oriented Vertex_handle v1 = c->vertex(ccw(i3)), v2 = c->vertex(cw(i3)); - CGAL_triangulation_assertion(coplanar_orientation(v1->point(), v2->point(), - mirror_vertex(c, i3)->point()) == NEGATIVE); + CGAL_assertion(coplanar_orientation(v1->point(), v2->point(), + mirror_vertex(c, i3)->point()) == NEGATIVE); Orientation o = coplanar_orientation(v1->point(), v2->point(), p); if(o != COLLINEAR) return Bounded_side(o); @@ -1570,7 +1570,7 @@ side_of_circle(Cell_handle c, int i, const Point& p, bool perturb) const } // else dimension == 3 - CGAL_triangulation_precondition(i >= 0 && i < 4); + CGAL_precondition(i >= 0 && i < 4); if((! c->has_vertex(infinite_vertex(),i3)) || (i3 != i)) { // finite facet @@ -1579,10 +1579,10 @@ side_of_circle(Cell_handle c, int i, const Point& p, bool perturb) const int i0 = (i>0) ? 0 : 1; int i1 = (i>1) ? 1 : 2; int i2 = (i>2) ? 2 : 3; - CGAL_triangulation_precondition(coplanar(c->vertex(i0)->point(), - c->vertex(i1)->point(), - c->vertex(i2)->point(), - p)); + CGAL_precondition(coplanar(c->vertex(i0)->point(), + c->vertex(i1)->point(), + c->vertex(i2)->point(), + p)); return coplanar_side_of_bounded_circle(c->vertex(i0)->point(), c->vertex(i1)->point(), c->vertex(i2)->point(), @@ -1615,7 +1615,7 @@ Delaunay_triangulation_3:: nearest_vertex_in_cell(const Point& p, Cell_handle c) const { // Returns the finite vertex of the cell c which is the closest to p. - CGAL_triangulation_precondition(dimension() >= 0); + CGAL_precondition(dimension() >= 0); Vertex_handle nearest = nearest_vertex(p, c->vertex(0), c->vertex(1)); if(dimension() >= 2) @@ -1690,9 +1690,9 @@ bool Delaunay_triangulation_3:: is_delaunay_after_displacement(Vertex_handle v, const Point& p) const { - CGAL_triangulation_precondition(!this->is_infinite(v)); - CGAL_triangulation_precondition(this->dimension() == 2); - CGAL_triangulation_precondition(!this->test_dim_down(v)); + CGAL_precondition(!this->is_infinite(v)); + CGAL_precondition(this->dimension() == 2); + CGAL_precondition(!this->test_dim_down(v)); if(v->point() == p) return true; @@ -1766,7 +1766,7 @@ bool Delaunay_triangulation_3:: is_Gabriel(Cell_handle c, int i) const { - CGAL_triangulation_precondition(dimension() == 3 && !is_infinite(c,i)); + CGAL_precondition(dimension() == 3 && !is_infinite(c,i)); typename Geom_traits::Side_of_bounded_sphere_3 side_of_bounded_sphere = geom_traits().side_of_bounded_sphere_3_object(); @@ -1803,7 +1803,7 @@ bool Delaunay_triangulation_3:: is_Gabriel(Cell_handle c, int i, int j) const { - CGAL_triangulation_precondition(dimension() == 3 && !is_infinite(c,i,j)); + CGAL_precondition(dimension() == 3 && !is_infinite(c,i,j)); typename Geom_traits::Side_of_bounded_sphere_3 side_of_bounded_sphere = geom_traits().side_of_bounded_sphere_3_object(); @@ -1830,8 +1830,8 @@ typename Delaunay_triangulation_3::Point Delaunay_triangulation_3:: dual(Cell_handle c) const { - CGAL_triangulation_precondition(dimension()==3); - CGAL_triangulation_precondition(! is_infinite(c)); + CGAL_precondition(dimension()==3); + CGAL_precondition(! is_infinite(c)); return c->circumcenter(geom_traits()); } @@ -1840,12 +1840,12 @@ typename Delaunay_triangulation_3::Object Delaunay_triangulation_3:: dual(Cell_handle c, int i) const { - CGAL_triangulation_precondition(dimension()>=2); - CGAL_triangulation_precondition(! is_infinite(c,i)); + CGAL_precondition(dimension()>=2); + CGAL_precondition(! is_infinite(c,i)); if(dimension() == 2) { - CGAL_triangulation_precondition(i == 3); + CGAL_precondition(i == 3); return construct_object(construct_circumcenter(c->vertex(0)->point(), c->vertex(1)->point(), c->vertex(2)->point())); @@ -1890,12 +1890,12 @@ typename Delaunay_triangulation_3::Line Delaunay_triangulation_3:: dual_support(Cell_handle c, int i) const { - CGAL_triangulation_precondition(dimension()>=2); - CGAL_triangulation_precondition(! is_infinite(c,i)); + CGAL_precondition(dimension()>=2); + CGAL_precondition(! is_infinite(c,i)); if(dimension() == 2) { - CGAL_triangulation_precondition(i == 3); + CGAL_precondition(i == 3); return construct_equidistant_line(c->vertex(0)->point(), c->vertex(1)->point(), c->vertex(2)->point()); @@ -1916,7 +1916,7 @@ is_valid(bool verbose, int level) const if(verbose) std::cerr << "invalid data structure" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -1925,7 +1925,7 @@ is_valid(bool verbose, int level) const if(verbose) std::cerr << "no infinite vertex" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -1946,7 +1946,7 @@ is_valid(bool verbose, int level) const if(verbose) std::cerr << "non-empty sphere " << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } } @@ -1972,7 +1972,7 @@ is_valid(bool verbose, int level) const if(verbose) std::cerr << "non-empty circle " << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } } @@ -2009,7 +2009,7 @@ is_valid(Cell_handle c, bool verbose, int level) const std::cerr << c->vertex(i)->point() << ", " ; std::cerr << std::endl; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } switch(dimension()) @@ -2025,7 +2025,7 @@ is_valid(Cell_handle c, bool verbose, int level) const if(verbose) std::cerr << "non-empty sphere " << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } } @@ -2043,7 +2043,7 @@ is_valid(Cell_handle c, bool verbose, int level) const if(verbose) std::cerr << "non-empty circle " << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } } diff --git a/Triangulation_3/include/CGAL/Delaunay_triangulation_cell_base_3.h b/Triangulation_3/include/CGAL/Delaunay_triangulation_cell_base_3.h index 44c6acdc299..db201ab0372 100644 --- a/Triangulation_3/include/CGAL/Delaunay_triangulation_cell_base_3.h +++ b/Triangulation_3/include/CGAL/Delaunay_triangulation_cell_base_3.h @@ -20,7 +20,6 @@ #include #include -#include #include #include diff --git a/Triangulation_3/include/CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h b/Triangulation_3/include/CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h index 7c43de82703..5f4b99aa943 100644 --- a/Triangulation_3/include/CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h +++ b/Triangulation_3/include/CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h @@ -21,7 +21,7 @@ #include -#include +#include #include namespace CGAL { diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_3.h index 10444aee9fc..ac6371c6484 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_3.h @@ -195,14 +195,14 @@ public: Regular_triangulation_3(const Regular_triangulation_3& rt) : Tr_Base(rt), hidden_point_visitor(this) { - CGAL_triangulation_postcondition(is_valid()); + CGAL_postcondition(is_valid()); } Regular_triangulation_3(Regular_triangulation_3&& rt) noexcept(noexcept(Tr_Base(std::move(rt)))) : Tr_Base(std::move(rt)), hidden_point_visitor(this) { - CGAL_triangulation_postcondition(is_valid()); + CGAL_postcondition(is_valid()); } ~Regular_triangulation_3() = default; @@ -646,7 +646,7 @@ public: const Facet *this_facet_must_be_in_the_cz = nullptr, bool *the_facet_is_in_its_cz = nullptr) const { - CGAL_triangulation_precondition(dimension() >= 2); + CGAL_precondition(dimension() >= 2); std::vector cells; cells.reserve(32); @@ -720,7 +720,7 @@ public: OutputIterator vertices_inside_conflict_zone(const Weighted_point&p, Cell_handle c, OutputIterator res) const { - CGAL_triangulation_precondition(dimension() >= 2); + CGAL_precondition(dimension() >= 2); // Get the facets on the boundary of the hole, and the cells of the hole std::vector cells; @@ -778,7 +778,7 @@ public: Cell_handle c, OutputIterator res) const { - CGAL_triangulation_precondition(dimension() >= 2); + CGAL_precondition(dimension() >= 2); // Get the facets on the boundary of the hole. std::vector facets; @@ -848,7 +848,7 @@ public: template < typename InputIterator > size_type remove(InputIterator first, InputIterator beyond) { - CGAL_triangulation_precondition(!this->does_repeat_in_range(first, beyond)); + CGAL_precondition(!this->does_repeat_in_range(first, beyond)); size_type n = number_of_vertices(); #ifdef CGAL_TRIANGULATION_3_PROFILING @@ -900,7 +900,7 @@ public: Vertex_remover remover(tmp); Tr_Base::remove_and_give_new_cells(v, remover, cit); - CGAL_triangulation_expensive_postcondition(is_valid()); + CGAL_expensive_postcondition(is_valid()); } // Displacement works only for regular triangulation @@ -1057,7 +1057,7 @@ protected: Vertex_handle w) const { // In case of equality, v is returned. - CGAL_triangulation_precondition(v != w); + CGAL_precondition(v != w); if(is_infinite(v)) return w; @@ -1069,21 +1069,21 @@ protected: Oriented_side power_test(const Weighted_point& p, const Weighted_point& q) const { - CGAL_triangulation_precondition(this->equal(p, q)); + CGAL_precondition(this->equal(p, q)); return geom_traits().power_side_of_oriented_power_sphere_3_object()(p, q); } Oriented_side power_test(const Weighted_point& p, const Weighted_point& q, const Weighted_point& r) const { - CGAL_triangulation_precondition(this->collinear(p, q, r)); + CGAL_precondition(this->collinear(p, q, r)); return geom_traits().power_side_of_oriented_power_sphere_3_object()(p, q, r); } Oriented_side power_test(const Weighted_point& p, const Weighted_point& q, const Weighted_point& r, const Weighted_point& s) const { - CGAL_triangulation_precondition(this->coplanar(p, q, r, s)); + CGAL_precondition(this->coplanar(p, q, r, s)); return geom_traits().power_side_of_oriented_power_sphere_3_object()(p, q, r, s); } @@ -1669,7 +1669,7 @@ nearest_power_vertex_in_cell(const Bare_point& p, Cell_handle c) const // Returns the finite vertex of the cell c with smaller // power distance to p. { - CGAL_triangulation_precondition(dimension() >= 1); + CGAL_precondition(dimension() >= 1); Vertex_handle nearest = nearest_power_vertex(p, c->vertex(0), c->vertex(1)); if(dimension() >= 2) { @@ -1735,8 +1735,8 @@ typename Regular_triangulation_3::Bare_point Regular_triangulation_3:: dual(Cell_handle c) const { - CGAL_triangulation_precondition(dimension()==3); - CGAL_triangulation_precondition(! is_infinite(c)); + CGAL_precondition(dimension()==3); + CGAL_precondition(! is_infinite(c)); return c->weighted_circumcenter(geom_traits()); } @@ -1767,7 +1767,7 @@ Regular_triangulation_3:: dual_ray(Cell_handle c, int i, Ray& ray) const { Cell_handle n = c->neighbor(i); - CGAL_triangulation_precondition((!is_infinite(c) != !is_infinite(n))); // xor + CGAL_precondition((!is_infinite(c) != !is_infinite(n))); // xor // either n or c is infinite int in; if(is_infinite(c)) @@ -1853,7 +1853,7 @@ dual_ray_exact(const Facet& facet, Ray& ray) const Cell_handle c = facet.first; int i = facet.second; Cell_handle n = c->neighbor(i); - CGAL_triangulation_precondition(!is_infinite(c) != !is_infinite(n)); // xor + CGAL_precondition(!is_infinite(c) != !is_infinite(n)); // xor // either n or c is infinite int in; if(is_infinite(c)) @@ -1911,12 +1911,12 @@ typename Regular_triangulation_3::Object Regular_triangulation_3:: dual(Cell_handle c, int i) const { - CGAL_triangulation_precondition(dimension()>=2); - CGAL_triangulation_precondition(! is_infinite(c,i)); + CGAL_precondition(dimension()>=2); + CGAL_precondition(! is_infinite(c,i)); if(dimension() == 2) { - CGAL_triangulation_precondition(i == 3); + CGAL_precondition(i == 3); return construct_object(construct_weighted_circumcenter(c->vertex(0)->point(), c->vertex(1)->point(), c->vertex(2)->point())); @@ -1975,7 +1975,7 @@ side_of_oriented_power_sphere(const Weighted_point& p0, const Weighted_point& p3, const Weighted_point& p, bool perturb) const { - CGAL_triangulation_precondition(orientation(p0, p1, p2, p3) == POSITIVE); + CGAL_precondition(orientation(p0, p1, p2, p3) == POSITIVE); using namespace boost; @@ -2008,7 +2008,7 @@ side_of_oriented_power_sphere(const Weighted_point& p0, return o; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return ON_NEGATIVE_SIDE; } @@ -2017,7 +2017,7 @@ Bounded_side Regular_triangulation_3:: side_of_power_sphere(Cell_handle c, const Weighted_point& p, bool perturb) const { - CGAL_triangulation_precondition(dimension() == 3); + CGAL_precondition(dimension() == 3); int i3; if(! c->has_vertex(infinite_vertex(), i3)) { @@ -2065,7 +2065,7 @@ side_of_bounded_power_circle(const Weighted_point& p0, const Weighted_point& p2, const Weighted_point& p, bool perturb) const { - CGAL_triangulation_precondition(coplanar_orientation(p0, p1, p2) != 0); + CGAL_precondition(coplanar_orientation(p0, p1, p2) != 0); if(coplanar_orientation(p0, p1, p2) == POSITIVE) return Bounded_side (side_of_oriented_power_circle(p0, p1, p2, p, perturb)); @@ -2084,7 +2084,7 @@ side_of_oriented_power_circle(const Weighted_point& p0, const Weighted_point& p2, const Weighted_point& p, bool perturb) const { - CGAL_triangulation_precondition(coplanar_orientation(p0, p1, p2) == POSITIVE); + CGAL_precondition(coplanar_orientation(p0, p1, p2) == POSITIVE); using namespace boost; @@ -2116,7 +2116,7 @@ side_of_oriented_power_circle(const Weighted_point& p0, return o; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return ON_NEGATIVE_SIDE; } @@ -2126,11 +2126,11 @@ Regular_triangulation_3:: side_of_power_circle(Cell_handle c, int i, const Weighted_point& p, bool perturb) const { - CGAL_triangulation_precondition(dimension() >= 2); + CGAL_precondition(dimension() >= 2); int i3 = 5; if(dimension() == 2) { - CGAL_triangulation_precondition(i == 3); + CGAL_precondition(i == 3); // the triangulation is supposed to be valid, ie the facet // with vertices 0 1 2 in this order is positively oriented if(! c->has_vertex(infinite_vertex(), i3)) @@ -2143,7 +2143,7 @@ side_of_power_circle(Cell_handle c, int i, const Weighted_point& p, // is positively oriented Vertex_handle v1 = c->vertex(ccw(i3)), v2 = c->vertex(cw(i3)); - CGAL_triangulation_assertion( + CGAL_assertion( coplanar_orientation(v1->point(), v2->point(), mirror_vertex(c, i3)->point()) == NEGATIVE); Orientation o = coplanar_orientation(v1->point(), v2->point(), p); @@ -2157,7 +2157,7 @@ side_of_power_circle(Cell_handle c, int i, const Weighted_point& p, } // dim 2 // else dimension == 3 - CGAL_triangulation_precondition((i >= 0) && (i < 4)); + CGAL_precondition((i >= 0) && (i < 4)); if((! c->has_vertex(infinite_vertex(),i3)) || (i3 != i)) { // finite facet @@ -2166,9 +2166,9 @@ side_of_power_circle(Cell_handle c, int i, const Weighted_point& p, int i0 = (i>0) ? 0 : 1; int i1 = (i>1) ? 1 : 2; int i2 = (i>2) ? 2 : 3; - CGAL_triangulation_precondition(this->coplanar(c->vertex(i0)->point(), - c->vertex(i1)->point(), - c->vertex(i2)->point(), p)); + CGAL_precondition(this->coplanar(c->vertex(i0)->point(), + c->vertex(i1)->point(), + c->vertex(i2)->point(), p)); return side_of_bounded_power_circle(c->vertex(i0)->point(), c->vertex(i1)->point(), c->vertex(i2)->point(), @@ -2218,7 +2218,7 @@ side_of_bounded_power_segment(const Weighted_point& p0, ; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return ON_UNBOUNDED_SIDE; } @@ -2227,7 +2227,7 @@ Bounded_side Regular_triangulation_3:: side_of_power_segment(Cell_handle c, const Weighted_point& p, bool perturb) const { - CGAL_triangulation_precondition(dimension() == 1); + CGAL_precondition(dimension() == 1); if(! is_infinite(c,0,1)) return side_of_bounded_power_segment(c->vertex(0)->point(), c->vertex(1)->point(), @@ -2240,7 +2240,7 @@ side_of_power_segment(Cell_handle c, const Weighted_point& p, bool perturb) cons // Either we compare weights, or we use the finite neighboring edge Cell_handle finite_neighbor = c->neighbor(c->index(infinite_vertex())); - CGAL_triangulation_assertion(!is_infinite(finite_neighbor,0,1)); + CGAL_assertion(!is_infinite(finite_neighbor,0,1)); return side_of_bounded_power_segment(finite_neighbor->vertex(0)->point(), finite_neighbor->vertex(1)->point(), p, perturb); @@ -2269,7 +2269,7 @@ bool Regular_triangulation_3:: is_Gabriel(Cell_handle c, int i) const { - CGAL_triangulation_precondition(dimension() == 3 && !is_infinite(c,i)); + CGAL_precondition(dimension() == 3 && !is_infinite(c,i)); typename Geom_traits::Power_side_of_bounded_power_sphere_3 side_of_bounded_orthogonal_sphere = geom_traits().power_side_of_bounded_power_sphere_3_object(); @@ -2307,7 +2307,7 @@ bool Regular_triangulation_3:: is_Gabriel(Cell_handle c, int i, int j) const { - CGAL_triangulation_precondition(dimension() == 3 && !is_infinite(c,i,j)); + CGAL_precondition(dimension() == 3 && !is_infinite(c,i,j)); typename Geom_traits::Power_side_of_bounded_power_sphere_3 side_of_bounded_orthogonal_sphere = geom_traits().power_side_of_bounded_power_sphere_3_object(); @@ -2416,7 +2416,7 @@ Regular_triangulation_3:: insert_in_hole(const Weighted_point& p, CellIt cell_begin, CellIt cell_end, Cell_handle begin, int i) { - CGAL_triangulation_precondition(cell_begin != cell_end); + CGAL_precondition(cell_begin != cell_end); get_hidden_point_visitor().process_cells_in_conflict(cell_begin,cell_end); @@ -2435,7 +2435,7 @@ Regular_triangulation_3:: insert_in_hole(const Weighted_point& p, CellIt cell_begin, CellIt cell_end, Cell_handle begin, int i, Vertex_handle newv) { - CGAL_triangulation_precondition(cell_begin != cell_end); + CGAL_precondition(cell_begin != cell_end); get_hidden_point_visitor().process_cells_in_conflict(cell_begin,cell_end); @@ -2542,7 +2542,7 @@ remove(Vertex_handle v) if(hv != Vertex_handle()) c = hv->cell(); } - CGAL_triangulation_expensive_postcondition(is_valid()); + CGAL_expensive_postcondition(is_valid()); } template < class Gt, class Tds, class Lds > @@ -2629,7 +2629,7 @@ remove(Vertex_handle v, bool *could_lock_zone) } } - CGAL_triangulation_expensive_postcondition(is_valid()); + CGAL_expensive_postcondition(is_valid()); } } @@ -2649,7 +2649,7 @@ move_if_no_collision(Vertex_handle v, const Weighted_point& p) Vertex_inserter inserter(*this); Vertex_handle res = Tr_Base::move_if_no_collision(v,p,remover,inserter); - CGAL_triangulation_expensive_postcondition(is_valid()); + CGAL_expensive_postcondition(is_valid()); return res; } @@ -2658,7 +2658,7 @@ typename Regular_triangulation_3::Vertex_handle Regular_triangulation_3:: move(Vertex_handle v, const Weighted_point& p) { - CGAL_triangulation_precondition(!is_infinite(v)); + CGAL_precondition(!is_infinite(v)); if(v->point() == p) return v; @@ -2678,7 +2678,7 @@ is_valid(bool verbose, int level) const if(verbose) std::cerr << "invalid base triangulation" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -2701,7 +2701,7 @@ is_valid(bool verbose, int level) const if(verbose) std::cerr << "non-empty sphere " << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } } @@ -2727,7 +2727,7 @@ is_valid(bool verbose, int level) const if(verbose) std::cerr << "non-empty circle " << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } } @@ -2755,7 +2755,7 @@ is_valid(bool verbose, int level) const if(verbose) std::cerr << "non-empty edge " << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } } diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_cell_base_with_weighted_circumcenter_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_cell_base_with_weighted_circumcenter_3.h index b79b2111a05..3a73305b380 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_cell_base_with_weighted_circumcenter_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_cell_base_with_weighted_circumcenter_3.h @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include diff --git a/Triangulation_3/include/CGAL/Triangulation_3.h b/Triangulation_3/include/CGAL/Triangulation_3.h index f075bfdeb5e..336f7f1bd24 100644 --- a/Triangulation_3/include/CGAL/Triangulation_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_3.h @@ -25,7 +25,7 @@ #endif #include -#include +#include #include #include @@ -660,8 +660,8 @@ public: // --------------- s ---------------- t -------------- // BEFORE SOURCE MIDDLE TARGET AFTER - CGAL_triangulation_precondition(!equal(s, t)); - CGAL_triangulation_precondition(collinear(s, p, t)); + CGAL_precondition(!equal(s, t)); + CGAL_precondition(collinear(s, p, t)); Comparison_result ps = compare_xyz(p, s); if(ps == EQUAL) @@ -736,7 +736,7 @@ public: : Base(tr.get_lock_data_structure()), _gt(tr._gt) { infinite = _tds.copy_tds(tr._tds, tr.infinite); - CGAL_triangulation_expensive_postcondition(*this == tr); + CGAL_expensive_postcondition(*this == tr); } Triangulation_3(Triangulation_3&& tr) = default; @@ -758,7 +758,7 @@ public: const GT& gt = GT(), Lock_data_structure *lock_ds = nullptr) : Base(lock_ds), _gt(gt) { - CGAL_triangulation_precondition(orientation(p0, p1, p3, p4) == POSITIVE); + CGAL_precondition(orientation(p0, p1, p3, p4) == POSITIVE); init_tds(p0, p1, p3, p4); } @@ -807,15 +807,15 @@ public: Cell_handle infinite_cell() const { - CGAL_triangulation_assertion(infinite_vertex()->cell()->has_vertex(infinite_vertex())); + CGAL_assertion(infinite_vertex()->cell()->has_vertex(infinite_vertex())); return infinite_vertex()->cell(); } // GEOMETRIC ACCESS FUNCTIONS Tetrahedron tetrahedron(const Cell_handle c) const { - CGAL_triangulation_precondition(dimension() == 3); - CGAL_triangulation_precondition(! is_infinite(c)); + CGAL_precondition(dimension() == 3); + CGAL_precondition(! is_infinite(c)); return construct_tetrahedron(c->vertex(0)->point(), c->vertex(1)->point(), c->vertex(2)->point(), @@ -848,31 +848,31 @@ public: void set_point(Cell_handle c, int i, const Point& p) { - CGAL_triangulation_precondition(dimension() >= 0); - CGAL_triangulation_precondition(i >= 0 && i <= dimension()); - CGAL_triangulation_precondition(! is_infinite(c->vertex(i))); + CGAL_precondition(dimension() >= 0); + CGAL_precondition(i >= 0 && i <= dimension()); + CGAL_precondition(! is_infinite(c->vertex(i))); c->vertex(i)->point() = p; } const Point& point(Cell_handle c, int i) const { - CGAL_triangulation_precondition(dimension() >= 0); - CGAL_triangulation_precondition(i >= 0 && i <= dimension()); - CGAL_triangulation_precondition(! is_infinite(c->vertex(i))); + CGAL_precondition(dimension() >= 0); + CGAL_precondition(i >= 0 && i <= dimension()); + CGAL_precondition(! is_infinite(c->vertex(i))); return c->vertex(i)->point(); } void set_point(Vertex_handle v, const Point& p) { - CGAL_triangulation_precondition(dimension() >= 0); - CGAL_triangulation_precondition(! is_infinite(v)); + CGAL_precondition(dimension() >= 0); + CGAL_precondition(! is_infinite(v)); v->point() = p; } const Point& point(Vertex_handle v) const { - CGAL_triangulation_precondition(number_of_vertices() > 0); - CGAL_triangulation_precondition(! is_infinite(v)); + CGAL_precondition(number_of_vertices() > 0); + CGAL_precondition(! is_infinite(v)); return v->point(); } @@ -880,7 +880,7 @@ public: bool is_infinite(const Vertex_handle v) const { return v == infinite_vertex(); } bool is_infinite(const Cell_handle c) const { - CGAL_triangulation_precondition(dimension() == 3); + CGAL_precondition(dimension() == 3); return c->has_vertex(infinite_vertex()); } @@ -1060,7 +1060,7 @@ public: const Facet& f, Locate_type& lt, int& li, int& lj) const { - CGAL_triangulation_precondition(f.second == 3); + CGAL_precondition(f.second == 3); return side_of_facet(p, f.first, lt, li, lj); } Bounded_side side_of_segment(const Point& p, @@ -1073,8 +1073,8 @@ public: const Edge& e, Locate_type& lt, int& li) const { - CGAL_triangulation_precondition(e.second == 0); - CGAL_triangulation_precondition(e.third == 1); + CGAL_precondition(e.second == 0); + CGAL_precondition(e.third == 1); return side_of_edge(p, e.first, lt, li); } @@ -1329,7 +1329,7 @@ protected: const Facet *this_facet_must_be_in_the_cz = nullptr, bool *the_facet_is_in_its_cz = nullptr) const { - CGAL_triangulation_precondition(dimension()>=2); + CGAL_precondition(dimension()>=2); if(the_facet_is_in_its_cz) *the_facet_is_in_its_cz = false; @@ -1344,7 +1344,7 @@ protected: } } - CGAL_triangulation_precondition(tester(d)); + CGAL_precondition(tester(d)); // To store the boundary cells, in case we need to rollback typedef boost::container::small_vector SV; @@ -1443,9 +1443,9 @@ protected: template < class Conflict_test > Vertex_handle insert_conflict(Cell_handle c, const Conflict_test& tester) { - CGAL_triangulation_precondition(dimension() >= 2); - CGAL_triangulation_precondition(c != Cell_handle()); - CGAL_triangulation_precondition(tester(c)); + CGAL_precondition(dimension() >= 2); + CGAL_precondition(c != Cell_handle()); + CGAL_precondition(tester(c)); std::vector cells; cells.reserve(32); @@ -1569,7 +1569,7 @@ protected: // at this time, it should be implemented here. void flip_2D(Cell_handle f, int i) { - CGAL_triangulation_precondition(dimension()==2); + CGAL_precondition(dimension()==2); Cell_handle n = f->neighbor(i); int ni = this->_tds.mirror_index(f,i); // ni = n->index(f); @@ -1737,7 +1737,7 @@ private: { // tests whether removing the cluster of vertices // marked as "to remove", decreases the dimension of the triangulation - CGAL_triangulation_precondition(dimension() == 3); + CGAL_precondition(dimension() == 3); int k=0; Vertex_handle v[4]; for(Finite_vertices_iterator fit = finite_vertices_begin(); @@ -2348,7 +2348,7 @@ public: convert_cell(c, *C[j]); } - CGAL_triangulation_assertion( is_valid(false) ); + CGAL_assertion( is_valid(false) ); return is; } }; @@ -2413,7 +2413,7 @@ std::istream& operator>> (std::istream& is, Triangulation_3& tr) if(!(is >> *(C[j]))) return is; - CGAL_triangulation_assertion(tr.is_valid(false)); + CGAL_assertion(tr.is_valid(false)); return is; } @@ -2460,8 +2460,8 @@ std::ostream& operator<< (std::ostream& os, const Triangulation_3& for(Vertex_iterator it = tr.vertices_begin(), end = tr.vertices_end(); it != end; ++it) TV[i++] = it; - CGAL_triangulation_assertion(i == n+1); - CGAL_triangulation_assertion(tr.is_infinite(TV[0])); + CGAL_assertion(i == n+1); + CGAL_assertion(tr.is_infinite(TV[0])); Unique_hash_map V; V[tr.infinite_vertex()] = 0; @@ -2578,10 +2578,10 @@ typename Triangulation_3::Triangle Triangulation_3:: triangle(const Cell_handle c, int i) const { - CGAL_triangulation_precondition(dimension() == 2 || dimension() == 3); - CGAL_triangulation_precondition((dimension() == 2 && i == 3) || - (dimension() == 3 && i >= 0 && i <= 3)); - CGAL_triangulation_precondition(! is_infinite(Facet(c, i))); + CGAL_precondition(dimension() == 2 || dimension() == 3); + CGAL_precondition((dimension() == 2 && i == 3) || + (dimension() == 3 && i >= 0 && i <= 3)); + CGAL_precondition(! is_infinite(Facet(c, i))); if((i&1)==0) return construct_triangle(c->vertex((i+2)&3)->point(), c->vertex((i+1)&3)->point(), @@ -2597,11 +2597,11 @@ typename Triangulation_3::Segment Triangulation_3:: segment(const Cell_handle c, int i, int j) const { - CGAL_triangulation_precondition(i != j); - CGAL_triangulation_precondition(dimension() >= 1 && dimension() <= 3); - CGAL_triangulation_precondition(i >= 0 && i <= dimension() && - j >= 0 && j <= dimension()); - CGAL_triangulation_precondition(! is_infinite(Edge(c, i, j))); + CGAL_precondition(i != j); + CGAL_precondition(dimension() >= 1 && dimension() <= 3); + CGAL_precondition(i >= 0 && i <= dimension() && + j >= 0 && j <= dimension()); + CGAL_precondition(! is_infinite(Edge(c, i, j))); return construct_segment(c->vertex(i)->point(), c->vertex(j)->point()); } @@ -2611,9 +2611,9 @@ bool Triangulation_3:: is_infinite(const Cell_handle c, int i) const { - CGAL_triangulation_precondition(dimension() == 2 || dimension() == 3); - CGAL_triangulation_precondition((dimension() == 2 && i == 3) || - (dimension() == 3 && i >= 0 && i <= 3)); + CGAL_precondition(dimension() == 2 || dimension() == 3); + CGAL_precondition((dimension() == 2 && i == 3) || + (dimension() == 3 && i >= 0 && i <= 3)); return is_infinite(c->vertex(i<=0 ? 1 : 0)) || is_infinite(c->vertex(i<=1 ? 2 : 1)) || is_infinite(c->vertex(i<=2 ? 3 : 2)); @@ -2625,9 +2625,9 @@ bool Triangulation_3:: is_infinite(const Cell_handle c, int i, int j) const { - CGAL_triangulation_precondition(i != j); - CGAL_triangulation_precondition(dimension() >= 1 && dimension() <= 3); - CGAL_triangulation_precondition(i >= 0 && i <= dimension() && + CGAL_precondition(i != j); + CGAL_precondition(dimension() >= 1 && dimension() <= 3); + CGAL_precondition(i >= 0 && i <= dimension() && j >= 0 && j <= dimension()); return is_infinite(c->vertex(i)) || is_infinite(c->vertex(j)); } @@ -2790,7 +2790,7 @@ exact_locate(const Point& p, Locate_type& lt, int& li, int& lj, // from the rest of the triangulation // lt = OUTSIDE_AFFINE_HULL if p is not coplanar with the triangulation - CGAL_triangulation_expensive_assertion(start == Cell_handle() || tds().is_simplex(start)); + CGAL_expensive_assertion(start == Cell_handle() || tds().is_simplex(start)); if(could_lock_zone) *could_lock_zone = true; @@ -2812,8 +2812,8 @@ exact_locate(const Point& p, Locate_type& lt, int& li, int& lj, { case 3: { - CGAL_triangulation_precondition(start != Cell_handle()); - CGAL_triangulation_precondition(! start->has_vertex(infinite)); + CGAL_precondition(start != Cell_handle()); + CGAL_precondition(! start->has_vertex(infinite)); // We implement the remembering visibility/stochastic walk. @@ -2931,9 +2931,9 @@ exact_locate(const Point& p, Locate_type& lt, int& li, int& lj, (o[1] != COPLANAR) ? 1 : 2; lj = (o[li+1] != COPLANAR) ? li+1 : (o[li+2] != COPLANAR) ? li+2 : li+3; - CGAL_triangulation_assertion(collinear(p, - c->vertex(li)->point(), - c->vertex(lj)->point())); + CGAL_assertion(collinear(p, + c->vertex(li)->point(), + c->vertex(lj)->point())); break; } case 3: @@ -2950,8 +2950,8 @@ exact_locate(const Point& p, Locate_type& lt, int& li, int& lj, case 2: { - CGAL_triangulation_precondition(start != Cell_handle()); - CGAL_triangulation_precondition(! start->has_vertex(infinite)); + CGAL_precondition(start != Cell_handle()); + CGAL_precondition(! start->has_vertex(infinite)); Cell_handle c = start; boost::uniform_smallint<> three(0, 2); @@ -2990,7 +2990,7 @@ exact_locate(const Point& p, Locate_type& lt, int& li, int& lj, const Point& p1 = c->vertex(ccw(i))->point(); const Point& p2 = c->vertex(cw(i))->point(); Orientation o[3]; - CGAL_triangulation_assertion(coplanar_orientation(p0,p1,p2) == POSITIVE); + CGAL_assertion(coplanar_orientation(p0,p1,p2) == POSITIVE); o[0] = coplanar_orientation(p0,p1,p); if(o[0] == NEGATIVE) { @@ -3047,8 +3047,8 @@ exact_locate(const Point& p, Locate_type& lt, int& li, int& lj, } case 1: { - CGAL_triangulation_precondition(start != Cell_handle()); - CGAL_triangulation_precondition(! start->has_vertex(infinite)); + CGAL_precondition(start != Cell_handle()); + CGAL_precondition(! start->has_vertex(infinite)); Cell_handle c = start; //first tests whether p is collinear with the current triangulation @@ -3114,7 +3114,7 @@ exact_locate(const Point& p, Locate_type& lt, int& li, int& lj, } default: { - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return Cell_handle(); } } @@ -3128,8 +3128,8 @@ Triangulation_3:: inexact_locate(const Point& t, Cell_handle start, int n_of_turns, bool *could_lock_zone) const { - CGAL_triangulation_expensive_assertion(start == Cell_handle() || - tds().is_simplex(start)); + CGAL_expensive_assertion(start == Cell_handle() || + tds().is_simplex(start)); if(could_lock_zone) *could_lock_zone = true; @@ -3155,8 +3155,8 @@ inexact_locate(const Point& t, Cell_handle start, int n_of_turns, if(start->has_vertex(infinite, ind_inf)) start = start->neighbor(ind_inf); - CGAL_triangulation_precondition(start != Cell_handle()); - CGAL_triangulation_precondition(! start->has_vertex(infinite)); + CGAL_precondition(start != Cell_handle()); + CGAL_precondition(! start->has_vertex(infinite)); // We implement the remembering visibility walk. // In this phase, no need to be stochastic @@ -3242,7 +3242,7 @@ side_of_tetrahedron(const Point& p, // - ON_BOUNDARY if p lies on one of the facets // - ON_UNBOUNDED_SIDE if p lies strictly outside the tetrahedron - CGAL_triangulation_precondition(orientation(p0,p1,p2,p3) == POSITIVE); + CGAL_precondition(orientation(p0,p1,p2,p3) == POSITIVE); Orientation o0,o1,o2,o3; if(((o0 = orientation(p,p1,p2,p3)) == NEGATIVE) || @@ -3306,7 +3306,7 @@ side_of_tetrahedron(const Point& p, default: { // impossible : cannot be on 4 facets for a real tetrahedron - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return ON_BOUNDARY; } } @@ -3330,7 +3330,7 @@ side_of_cell(const Point& p, // two cases) // lt only has meaning when ON_BOUNDED_SIDE or ON_BOUNDARY - CGAL_triangulation_precondition(dimension() == 3); + CGAL_precondition(dimension() == 3); if(! is_infinite(c)) { return side_of_tetrahedron(p, @@ -3401,14 +3401,14 @@ side_of_cell(const Point& p, } default: { - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return ON_BOUNDARY; } } // switch side } // case ZERO default: { - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return ON_BOUNDARY; } } // switch o @@ -3432,10 +3432,10 @@ side_of_triangle(const Point& p, // - ON_BOUNDARY if p lies on one of the edges // - ON_UNBOUNDED_SIDE if p lies strictly outside the triangle - CGAL_triangulation_precondition(coplanar(p,p0,p1,p2)); + CGAL_precondition(coplanar(p,p0,p1,p2)); Orientation o012 = coplanar_orientation(p0,p1,p2); - CGAL_triangulation_precondition(o012 != COLLINEAR); + CGAL_precondition(o012 != COLLINEAR); Orientation o0; // edge p0 p1 Orientation o1; // edge p1 p2 @@ -3485,7 +3485,7 @@ side_of_triangle(const Point& p, default: { // cannot happen - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return ON_BOUNDARY; } } @@ -3512,15 +3512,15 @@ side_of_facet(const Point& p, // When they mean anything, li and lj refer to indices in the cell c // giving the facet (c,i). - CGAL_triangulation_precondition(dimension() == 2); + CGAL_precondition(dimension() == 2); if(! is_infinite(c,3)) { // The following precondition is useless because it is written // in side_of_facet - // CGAL_triangulation_precondition(coplanar (p, - // c->vertex(0)->point, - // c->vertex(1)->point, - // c->vertex(2)->point)); + // CGAL_precondition(coplanar (p, + // c->vertex(0)->point, + // c->vertex(1)->point, + // c->vertex(2)->point)); int i_t, j_t; Bounded_side side = side_of_triangle(p, c->vertex(0)->point(), @@ -3544,7 +3544,7 @@ side_of_facet(const Point& p, int inf = c->index(infinite); // The following precondition is useless because it is written // in side_of_facet - // CGAL_triangulation_precondition(coplanar (p, + // CGAL_precondition(coplanar (p, // c->neighbor(inf)->vertex(0)->point(), // c->neighbor(inf)->vertex(1)->point(), // c->neighbor(inf)->vertex(2)->point())); @@ -3553,8 +3553,8 @@ side_of_facet(const Point& p, Vertex_handle v1 = c->vertex(i1), v2 = c->vertex(i2); - CGAL_triangulation_assertion(coplanar_orientation(v1->point(), v2->point(), - mirror_vertex(c, inf)->point()) == POSITIVE); + CGAL_assertion(coplanar_orientation(v1->point(), v2->point(), + mirror_vertex(c, inf)->point()) == POSITIVE); switch(coplanar_orientation(v1->point(), v2->point(), p)) { @@ -3603,8 +3603,8 @@ side_of_segment(const Point& p, // - ON_BOUNDARY if p equals p0 or p1 // - ON_UNBOUNDED_SIDE if p lies strictly outside the edge - CGAL_triangulation_precondition(! equal(p0, p1)); - CGAL_triangulation_precondition(collinear(p, p0, p1)); + CGAL_precondition(! equal(p0, p1)); + CGAL_precondition(collinear(p, p0, p1)); switch(collinear_position(p0, p, p1)) { @@ -3643,7 +3643,7 @@ side_of_edge(const Point& p, // lt only has meaning when ON_BOUNDED_SIDE and ON_BOUNDARY // li refer to indices in the cell c - CGAL_triangulation_precondition(dimension() == 1); + CGAL_precondition(dimension() == 1); if(! is_infinite(c,0,1)) return side_of_segment(p, c->vertex(0)->point(), c->vertex(1)->point(), lt, li); @@ -3669,8 +3669,8 @@ bool Triangulation_3:: flip(Cell_handle c, int i) { - CGAL_triangulation_precondition((dimension() == 3) && (0<=i) && (i<4) && - (number_of_vertices() >= 5)); + CGAL_precondition((dimension() == 3) && (0<=i) && (i<4) && + (number_of_vertices() >= 5)); Cell_handle n = c->neighbor(i); int in = n->index(c); @@ -3727,41 +3727,41 @@ void Triangulation_3:: flip_flippable(Cell_handle c, int i) { - CGAL_triangulation_precondition((dimension() == 3) && (0<=i) && (i<4) && - (number_of_vertices() >= 5)); - CGAL_triangulation_precondition_code(Cell_handle n = c->neighbor(i);); - CGAL_triangulation_precondition_code(int in = n->index(c);); - CGAL_triangulation_precondition((! is_infinite(c)) &&(! is_infinite(n))); + CGAL_precondition((dimension() == 3) && (0<=i) && (i<4) && + (number_of_vertices() >= 5)); + CGAL_precondition_code(Cell_handle n = c->neighbor(i);); + CGAL_precondition_code(int in = n->index(c);); + CGAL_precondition((! is_infinite(c)) &&(! is_infinite(n))); if(i%2 == 1) { - CGAL_triangulation_precondition(orientation(c->vertex((i+1)&3)->point(), - c->vertex((i+2)&3)->point(), - n->vertex(in)->point(), - c->vertex(i)->point()) == POSITIVE); - CGAL_triangulation_precondition(orientation(c->vertex((i+2)&3)->point(), - c->vertex((i+3)&3)->point(), - n->vertex(in)->point(), - c->vertex(i)->point()) == POSITIVE); - CGAL_triangulation_precondition(orientation(c->vertex((i+3)&3)->point(), - c->vertex((i+1)&3)->point(), - n->vertex(in)->point(), - c->vertex(i)->point()) == POSITIVE); + CGAL_precondition(orientation(c->vertex((i+1)&3)->point(), + c->vertex((i+2)&3)->point(), + n->vertex(in)->point(), + c->vertex(i)->point()) == POSITIVE); + CGAL_precondition(orientation(c->vertex((i+2)&3)->point(), + c->vertex((i+3)&3)->point(), + n->vertex(in)->point(), + c->vertex(i)->point()) == POSITIVE); + CGAL_precondition(orientation(c->vertex((i+3)&3)->point(), + c->vertex((i+1)&3)->point(), + n->vertex(in)->point(), + c->vertex(i)->point()) == POSITIVE); } else { - CGAL_triangulation_precondition(orientation(c->vertex((i+2)&3)->point(), - c->vertex((i+1)&3)->point(), - n->vertex(in)->point(), - c->vertex(i)->point()) == POSITIVE); - CGAL_triangulation_precondition(orientation(c->vertex((i+3)&3)->point(), - c->vertex((i+2)&3)->point(), - n->vertex(in)->point(), - c->vertex(i)->point()) == POSITIVE); - CGAL_triangulation_precondition(orientation(c->vertex((i+1)&3)->point(), - c->vertex((i+3)&3)->point(), - n->vertex(in)->point(), - c->vertex(i)->point()) == POSITIVE); + CGAL_precondition(orientation(c->vertex((i+2)&3)->point(), + c->vertex((i+1)&3)->point(), + n->vertex(in)->point(), + c->vertex(i)->point()) == POSITIVE); + CGAL_precondition(orientation(c->vertex((i+3)&3)->point(), + c->vertex((i+2)&3)->point(), + n->vertex(in)->point(), + c->vertex(i)->point()) == POSITIVE); + CGAL_precondition(orientation(c->vertex((i+1)&3)->point(), + c->vertex((i+3)&3)->point(), + n->vertex(in)->point(), + c->vertex(i)->point()) == POSITIVE); } _tds.flip_flippable(c, i); @@ -3774,10 +3774,10 @@ flip(Cell_handle c, int i, int j) { // Flips the edge (i,j) of cell c - CGAL_triangulation_precondition((dimension() == 3) && - (0<=i) && (i<4) && (0<=j) && - (j<4) &&(i != j) && - (number_of_vertices() >= 5)); + CGAL_precondition((dimension() == 3) && + (0<=i) && (i<4) && (0<=j) && + (j<4) &&(i != j) && + (number_of_vertices() >= 5)); // Checks that degree 3 and not on the convex hull int degree = 0; @@ -3825,32 +3825,32 @@ flip_flippable(Cell_handle c, int i, int j) #if !defined CGAL_TRIANGULATION_NO_PRECONDITIONS && \ !defined CGAL_NO_PRECONDITIONS && !defined NDEBUG - CGAL_triangulation_precondition((dimension() == 3) && - (0<=i) && (i<4) && (0<=j) && (j<4) && - (i != j) && (number_of_vertices() >= 5)); + CGAL_precondition((dimension() == 3) && + (0<=i) && (i<4) && (0<=j) && (j<4) && + (i != j) && (number_of_vertices() >= 5)); int degree = 0; Cell_circulator ccir = incident_cells(c,i,j); Cell_circulator cdone = ccir; do { - CGAL_triangulation_precondition(! is_infinite(ccir)); + CGAL_precondition(! is_infinite(ccir)); ++degree; ++ccir; } while(ccir != cdone); - CGAL_triangulation_precondition(degree == 3); + CGAL_precondition(degree == 3); Cell_handle n = c->neighbor(next_around_edge(i, j)); int in = n->index(c->vertex(i)); int jn = n->index(c->vertex(j)); - CGAL_triangulation_precondition(orientation(c->vertex(next_around_edge(i,j))->point(), - c->vertex(next_around_edge(j,i))->point(), - n->vertex(next_around_edge(jn,in))->point(), - c->vertex(j)->point()) == POSITIVE); - CGAL_triangulation_precondition(orientation(c->vertex(i)->point(), - c->vertex(next_around_edge(j,i))->point(), - n->vertex(next_around_edge(jn,in))->point(), - c->vertex(next_around_edge(i,j))->point()) == POSITIVE); + CGAL_precondition(orientation(c->vertex(next_around_edge(i,j))->point(), + c->vertex(next_around_edge(j,i))->point(), + n->vertex(next_around_edge(jn,in))->point(), + c->vertex(j)->point()) == POSITIVE); + CGAL_precondition(orientation(c->vertex(i)->point(), + c->vertex(next_around_edge(j,i))->point(), + n->vertex(next_around_edge(jn,in))->point(), + c->vertex(next_around_edge(i,j))->point()) == POSITIVE); #endif _tds.flip_flippable(c, i, j); @@ -4088,17 +4088,17 @@ typename Triangulation_3::Vertex_handle Triangulation_3:: insert_in_cell(const Point& p, Cell_handle c) { - CGAL_triangulation_precondition(dimension() == 3); - CGAL_triangulation_precondition_code( + CGAL_precondition(dimension() == 3); + CGAL_precondition_code( Locate_type lt; int i; int j; ); - CGAL_triangulation_precondition(side_of_tetrahedron(p, - c->vertex(0)->point(), - c->vertex(1)->point(), - c->vertex(2)->point(), - c->vertex(3)->point(), - lt,i,j) == ON_BOUNDED_SIDE); + CGAL_precondition(side_of_tetrahedron(p, + c->vertex(0)->point(), + c->vertex(1)->point(), + c->vertex(2)->point(), + c->vertex(3)->point(), + lt,i,j) == ON_BOUNDED_SIDE); Vertex_handle v = _tds.insert_in_cell(c); v->set_point(p); @@ -4111,21 +4111,21 @@ typename Triangulation_3::Vertex_handle Triangulation_3:: insert_in_facet(const Point& p, Cell_handle c, int i) { - CGAL_triangulation_precondition(dimension() == 2 || dimension() == 3); - CGAL_triangulation_precondition((dimension() == 2 && i == 3) || - (dimension() == 3 && i >= 0 && i <= 3)); - CGAL_triangulation_exactness_precondition_code( + CGAL_precondition(dimension() == 2 || dimension() == 3); + CGAL_precondition((dimension() == 2 && i == 3) || + (dimension() == 3 && i >= 0 && i <= 3)); + CGAL_exactness_precondition_code( Locate_type lt; int li; int lj; ); - CGAL_triangulation_exactness_precondition(coplanar(p, c->vertex((i+1)&3)->point(), - c->vertex((i+2)&3)->point(), - c->vertex((i+3)&3)->point()) && - side_of_triangle(p, - c->vertex((i+1)&3)->point(), - c->vertex((i+2)&3)->point(), - c->vertex((i+3)&3)->point(), - lt, li, lj) == ON_BOUNDED_SIDE); + CGAL_exactness_precondition(coplanar(p, c->vertex((i+1)&3)->point(), + c->vertex((i+2)&3)->point(), + c->vertex((i+3)&3)->point()) && + side_of_triangle(p, + c->vertex((i+1)&3)->point(), + c->vertex((i+2)&3)->point(), + c->vertex((i+3)&3)->point(), + lt, li, lj) == ON_BOUNDED_SIDE); Vertex_handle v = _tds.insert_in_facet(c, i); v->set_point(p); @@ -4137,11 +4137,11 @@ typename Triangulation_3::Vertex_handle Triangulation_3:: insert_in_edge(const Point& p, Cell_handle c, int i, int j) { - CGAL_triangulation_precondition(i != j); - CGAL_triangulation_precondition(dimension() >= 1 && dimension() <= 3); - CGAL_triangulation_precondition(i >= 0 && i <= dimension() && - j >= 0 && j <= dimension()); - CGAL_triangulation_exactness_precondition_code( + CGAL_precondition(i != j); + CGAL_precondition(dimension() >= 1 && dimension() <= 3); + CGAL_precondition(i >= 0 && i <= dimension() && + j >= 0 && j <= dimension()); + CGAL_exactness_precondition_code( Locate_type lt; int li; ); @@ -4151,19 +4151,19 @@ insert_in_edge(const Point& p, Cell_handle c, int i, int j) case 3: case 2: { - CGAL_triangulation_precondition(! is_infinite(c, i, j)); - CGAL_triangulation_exactness_precondition(collinear(c->vertex(i)->point(), - p, - c->vertex(j)->point()) - && side_of_segment(p, - c->vertex(i)->point(), - c->vertex(j)->point(), - lt, li) == ON_BOUNDED_SIDE); + CGAL_precondition(! is_infinite(c, i, j)); + CGAL_exactness_precondition(collinear(c->vertex(i)->point(), + p, + c->vertex(j)->point()) + && side_of_segment(p, + c->vertex(i)->point(), + c->vertex(j)->point(), + lt, li) == ON_BOUNDED_SIDE); break; } case 1: { - CGAL_triangulation_exactness_precondition(side_of_edge(p, c, lt, li) == ON_BOUNDED_SIDE); + CGAL_exactness_precondition(side_of_edge(p, c, lt, li) == ON_BOUNDED_SIDE); break; } } @@ -4182,8 +4182,8 @@ insert_outside_convex_hull(const Point& p, Cell_handle c) // p is strictly outside the convex hull // dimension 0 not allowed, use outside-affine-hull - CGAL_triangulation_precondition(dimension() > 0); - CGAL_triangulation_precondition(c->has_vertex(infinite)); + CGAL_precondition(dimension() > 0); + CGAL_precondition(c->has_vertex(infinite)); // the precondition that p is in c is tested in each of the // insertion methods called from this method @@ -4218,7 +4218,7 @@ typename Triangulation_3::Vertex_handle Triangulation_3:: insert_outside_affine_hull(const Point& p) { - CGAL_triangulation_precondition(dimension() < 3); + CGAL_precondition(dimension() < 3); bool reorient; switch(dimension()) { @@ -4228,7 +4228,7 @@ insert_outside_affine_hull(const Point& p) Cell_handle n = c->neighbor(c->index(infinite_vertex())); Orientation o = coplanar_orientation(n->vertex(0)->point(), n->vertex(1)->point(), p); - CGAL_triangulation_precondition(o != COLLINEAR); + CGAL_precondition(o != COLLINEAR); reorient = o == NEGATIVE; break; } @@ -4239,7 +4239,7 @@ insert_outside_affine_hull(const Point& p) Orientation o = orientation(n->vertex(0)->point(), n->vertex(1)->point(), n->vertex(2)->point(), p); - CGAL_triangulation_precondition(o != COPLANAR); + CGAL_precondition(o != COPLANAR); reorient = o == NEGATIVE; break; } @@ -4410,8 +4410,8 @@ test_dim_down(Vertex_handle v) const // Returns true iff v is incident to all finite cells/facets // and all the other vertices are coplanar/collinear in dim3/2. - CGAL_triangulation_precondition(dimension() >= 0); - CGAL_triangulation_precondition(! is_infinite(v)); + CGAL_precondition(dimension() >= 0); + CGAL_precondition(! is_infinite(v)); if(dimension() == 3) { @@ -4474,8 +4474,8 @@ test_dim_down_using_incident_cells_3(Vertex_handle v, std::vector& adj_vertices, bool *could_lock_zone) const { - CGAL_triangulation_precondition(dimension() == 3); - CGAL_triangulation_precondition(! is_infinite(v)); + CGAL_precondition(dimension() == 3); + CGAL_precondition(! is_infinite(v)); // Collect all vertices on the boundary // and all incident cells @@ -4913,7 +4913,7 @@ make_hole_3D(Vertex_handle v, Vertex_triple_Facet_map& outer_map, std::vector& hole) { - CGAL_triangulation_expensive_precondition(! test_dim_down(v)); + CGAL_expensive_precondition(! test_dim_down(v)); incident_cells(v, std::back_inserter(hole)); @@ -4943,7 +4943,7 @@ make_hole_3D(Vertex_handle v, const std::vector& incident_cells, Vertex_triple_Facet_map& outer_map) { - CGAL_triangulation_expensive_precondition(! test_dim_down(v)); + CGAL_expensive_precondition(! test_dim_down(v)); for(typename std::vector::const_iterator cit = incident_cells.begin(), end = incident_cells.end(); cit != end; ++cit) @@ -4968,7 +4968,7 @@ VertexRemover& Triangulation_3:: remove_dim_down(Vertex_handle v, VertexRemover& remover) { - CGAL_triangulation_precondition (dimension() >= 0); + CGAL_precondition (dimension() >= 0); // Collect all the hidden points. for(All_cells_iterator ci = tds().raw_cells_begin(), @@ -4998,7 +4998,7 @@ VertexRemover& Triangulation_3:: remove_1D(Vertex_handle v, VertexRemover& remover) { - CGAL_triangulation_precondition (dimension() == 1); + CGAL_precondition (dimension() == 1); Cell_handle c1 = v->cell(); Cell_handle c2 = c1->neighbor(c1->index(v) == 0 ? 1 : 0); @@ -5016,7 +5016,7 @@ VertexRemover& Triangulation_3:: remove_2D(Vertex_handle v, VertexRemover& remover) { - CGAL_triangulation_precondition(dimension() == 2); + CGAL_precondition(dimension() == 2); std::list hole; make_hole_2D(v, hole, remover); fill_hole_2D(hole, remover); @@ -5124,7 +5124,7 @@ remove_3D(Vertex_handle v, VertexRemover& remover) vmap[remover.tmp.infinite_vertex()] = infinite_vertex(); } - CGAL_triangulation_assertion(remover.tmp.dimension() == 3); + CGAL_assertion(remover.tmp.dimension() == 3); // Construct the set of vertex triples of remover.tmp // We reorient the vertex triple so that it matches those from outer_map @@ -5179,7 +5179,7 @@ remove_3D(Vertex_handle v, VertexRemover& remover) unsigned int o_i = o_vt_f_pair.second.second; typename Vertex_triple_Facet_map::iterator iit = inner_map.find(o_vt_f_pair.first); - CGAL_triangulation_assertion(iit != inner_map.end()); + CGAL_assertion(iit != inner_map.end()); typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit; Cell_handle i_ch = i_vt_f_pair.second.first; unsigned int i_i = i_vt_f_pair.second.second; @@ -5321,7 +5321,7 @@ remove_3D(Vertex_handle v, VertexRemover& remover, vmap[remover.tmp.infinite_vertex()] = infinite_vertex(); } - CGAL_triangulation_assertion(remover.tmp.dimension() == 3); + CGAL_assertion(remover.tmp.dimension() == 3); // Construct the set of vertex triples of remover.tmp // We reorient the vertex triple so that it matches those from outer_map @@ -5377,7 +5377,7 @@ remove_3D(Vertex_handle v, VertexRemover& remover, typename Vertex_triple_Facet_map::iterator iit = inner_map.find(o_vt_f_pair.first); - CGAL_triangulation_assertion(iit != inner_map.end()); + CGAL_assertion(iit != inner_map.end()); typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit; Cell_handle i_ch = i_vt_f_pair.second.first; unsigned int i_i = i_vt_f_pair.second.second; @@ -5431,9 +5431,9 @@ void Triangulation_3:: remove(Vertex_handle v, VertexRemover& remover) { - CGAL_triangulation_precondition(v != Vertex_handle()); - CGAL_triangulation_precondition(!is_infinite(v)); - CGAL_triangulation_expensive_precondition(tds().is_vertex(v)); + CGAL_precondition(v != Vertex_handle()); + CGAL_precondition(!is_infinite(v)); + CGAL_expensive_precondition(tds().is_vertex(v)); if(test_dim_down (v)) { @@ -5450,7 +5450,7 @@ remove(Vertex_handle v, VertexRemover& remover) case 3: remove_3D (v, remover); break; default: - CGAL_triangulation_assertion (false); + CGAL_assertion (false); } } } @@ -5464,10 +5464,10 @@ remove(Vertex_handle v, VertexRemover& remover, bool *could_lock_zone) // N.B.: dimension doesn't need to be atomic since the parallel removal // will never decrease the dimension (the last few removes are done // sequentially) - CGAL_triangulation_precondition(v != Vertex_handle()); - CGAL_triangulation_precondition(!is_infinite(v)); - CGAL_triangulation_precondition(dimension() == 3); - CGAL_triangulation_expensive_precondition(tds().is_vertex(v)); + CGAL_precondition(v != Vertex_handle()); + CGAL_precondition(!is_infinite(v)); + CGAL_precondition(dimension() == 3); + CGAL_expensive_precondition(tds().is_vertex(v)); #ifdef CGAL_CONCURRENT_TRIANGULATION_3_PROFILING static Profile_branch_counter_3 bcounter( @@ -5551,7 +5551,7 @@ VertexRemover& Triangulation_3:: remove_2D(Vertex_handle v, VertexRemover& remover, OutputItCells fit) { - CGAL_triangulation_precondition(dimension() == 2); + CGAL_precondition(dimension() == 2); std::list hole; make_hole_2D(v, hole, remover); fill_hole_2D(hole, remover, fit); @@ -5565,7 +5565,7 @@ VertexRemover& Triangulation_3:: remove_3D(Vertex_handle v, VertexRemover& remover, OutputItCells fit) { - CGAL_triangulation_precondition(dimension() == 3); + CGAL_precondition(dimension() == 3); std::vector hole; hole.reserve(64); @@ -5624,7 +5624,7 @@ remove_3D(Vertex_handle v, VertexRemover& remover, OutputItCells fit) vmap[remover.tmp.infinite_vertex()] = infinite_vertex(); } - CGAL_triangulation_assertion(remover.tmp.dimension() == 3); + CGAL_assertion(remover.tmp.dimension() == 3); // Construct the set of vertex triples of remover.tmp // We reorient the vertex triple so that it matches those from outer_map @@ -5680,7 +5680,7 @@ remove_3D(Vertex_handle v, VertexRemover& remover, OutputItCells fit) typename Vertex_triple_Facet_map::iterator iit = inner_map.find(o_vt_f_pair.first); - CGAL_triangulation_assertion(iit != inner_map.end()); + CGAL_assertion(iit != inner_map.end()); typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit; Cell_handle i_ch = i_vt_f_pair.second.first; unsigned int i_i = i_vt_f_pair.second.second; @@ -5737,9 +5737,9 @@ Triangulation_3:: remove_and_give_new_cells(Vertex_handle v, VertexRemover& remover, OutputItCells fit) { - CGAL_triangulation_precondition(v != Vertex_handle()); - CGAL_triangulation_precondition(!is_infinite(v)); - CGAL_triangulation_expensive_precondition(tds().is_vertex(v)); + CGAL_precondition(v != Vertex_handle()); + CGAL_precondition(!is_infinite(v)); + CGAL_expensive_precondition(tds().is_vertex(v)); if(test_dim_down (v)) { @@ -5756,7 +5756,7 @@ remove_and_give_new_cells(Vertex_handle v, VertexRemover& remover, case 3: remove_3D (v, remover, fit); break; default: - CGAL_triangulation_assertion (false); + CGAL_assertion (false); } } } @@ -5772,7 +5772,7 @@ move_if_no_collision(Vertex_handle v, const Point& p, VertexRemover& remover, VertexInserter& inserter) { CGAL_assertion(remover.hidden_points_begin() == remover.hidden_points_end()); - CGAL_triangulation_precondition(!is_infinite(v)); + CGAL_precondition(!is_infinite(v)); if(v->point() == p) return v; const int dim = dimension(); @@ -5829,7 +5829,7 @@ move_if_no_collision(Vertex_handle v, const Point& p, if(i == 0) f = f->neighbor(1); - CGAL_triangulation_assertion(f->index(v) == 1); + CGAL_assertion(f->index(v) == 1); Cell_handle g= f->neighbor(0); f->set_vertex(1, g->vertex(1)); f->set_neighbor(0,g->neighbor(0)); @@ -5841,7 +5841,7 @@ move_if_no_collision(Vertex_handle v, const Point& p, if(i == 0) f_ins = f_ins->neighbor(1); - CGAL_triangulation_assertion(f_ins->index(inserted) == 1); + CGAL_assertion(f_ins->index(inserted) == 1); Cell_handle g_ins = f_ins->neighbor(0); f_ins->set_vertex(1, v); g_ins->set_vertex(0, v); @@ -6012,7 +6012,7 @@ move_if_no_collision(Vertex_handle v, const Point& p, vmap[remover.tmp.infinite_vertex()] = infinite_vertex(); } - CGAL_triangulation_assertion(remover.tmp.dimension() == 3); + CGAL_assertion(remover.tmp.dimension() == 3); // Construct the set of vertex triples of remover.tmp // We reorient the vertex triple so that it matches those from outer_map @@ -6069,7 +6069,7 @@ move_if_no_collision(Vertex_handle v, const Point& p, typename Vertex_triple_Facet_map::iterator iit = inner_map.find(o_vt_f_pair.first); - CGAL_triangulation_assertion(iit != inner_map.end()); + CGAL_assertion(iit != inner_map.end()); typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit; Cell_handle i_ch = i_vt_f_pair.second.first; unsigned int i_i = i_vt_f_pair.second.second; @@ -6138,7 +6138,7 @@ move(Vertex_handle v, const Point& p, VertexRemover& remover, VertexInserter& inserter) { CGAL_assertion(remover.hidden_points_begin() == remover.hidden_points_end()); - CGAL_triangulation_precondition(!is_infinite(v)); + CGAL_precondition(!is_infinite(v)); if(v->point() == p) return v; @@ -6164,7 +6164,7 @@ move_if_no_collision_and_give_new_cells(Vertex_handle v, const Point& p, OutputItCells fit) { CGAL_assertion(remover.hidden_points_begin() == remover.hidden_points_end()); - CGAL_triangulation_precondition(!is_infinite(v)); + CGAL_precondition(!is_infinite(v)); if(v->point() == p) return v; @@ -6233,7 +6233,7 @@ move_if_no_collision_and_give_new_cells(Vertex_handle v, const Point& p, if(i==0) f = f->neighbor(1); - CGAL_triangulation_assertion(f->index(v) == 1); + CGAL_assertion(f->index(v) == 1); Cell_handle g = f->neighbor(0); f->set_vertex(1, g->vertex(1)); f->set_neighbor(0,g->neighbor(0)); @@ -6246,7 +6246,7 @@ move_if_no_collision_and_give_new_cells(Vertex_handle v, const Point& p, if(i==0) f_ins = f_ins->neighbor(1); - CGAL_triangulation_assertion(f_ins->index(inserted) == 1); + CGAL_assertion(f_ins->index(inserted) == 1); Cell_handle g_ins = f_ins->neighbor(0); f_ins->set_vertex(1, v); g_ins->set_vertex(0, v); @@ -6465,7 +6465,7 @@ move_if_no_collision_and_give_new_cells(Vertex_handle v, const Point& p, vmap[remover.tmp.infinite_vertex()] = infinite_vertex(); } - CGAL_triangulation_assertion(remover.tmp.dimension() == 3); + CGAL_assertion(remover.tmp.dimension() == 3); // Construct the set of vertex triples of remover.tmp // We reorient the vertex triple so that it matches those from outer_map @@ -6521,7 +6521,7 @@ move_if_no_collision_and_give_new_cells(Vertex_handle v, const Point& p, typename Vertex_triple_Facet_map::iterator iit = inner_map.find(o_vt_f_pair.first); - CGAL_triangulation_assertion(iit != inner_map.end()); + CGAL_assertion(iit != inner_map.end()); typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit; Cell_handle i_ch = i_vt_f_pair.second.first; unsigned int i_i = i_vt_f_pair.second.second; @@ -6861,7 +6861,7 @@ _remove_cluster_3D(InputIterator first, InputIterator beyond, VertexRemover& rem typename Vertex_triple_Facet_map::iterator iit = inner_map.find(o_vt_f_pair.first); - CGAL_triangulation_assertion(iit != inner_map.end()); + CGAL_assertion(iit != inner_map.end()); typename Vertex_triple_Facet_map::value_type i_vt_f_pair = *iit; Cell_handle i_ch = i_vt_f_pair.second.first; unsigned int i_i = i_vt_f_pair.second.second; @@ -6949,8 +6949,8 @@ typename Triangulation_3::size_type Triangulation_3:: remove(InputIterator first, InputIterator beyond, VertexRemover& remover) { - CGAL_triangulation_precondition(!does_repeat_in_range(first, beyond)); - CGAL_triangulation_precondition(!infinite_vertex_in_range(first, beyond)); + CGAL_precondition(!does_repeat_in_range(first, beyond)); + CGAL_precondition(!infinite_vertex_in_range(first, beyond)); size_type n = number_of_vertices(); InputIterator init = first, init2 = first; @@ -6988,7 +6988,7 @@ is_valid(bool verbose, int level) const if(verbose) std::cerr << "invalid data structure" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -6997,7 +6997,7 @@ is_valid(bool verbose, int level) const if(verbose) std::cerr << "no infinite vertex" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -7047,7 +7047,7 @@ is_valid(Cell_handle c, bool verbose, int level) const std::cerr << std::endl; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -7083,7 +7083,7 @@ is_valid_finite(Cell_handle c, bool verbose, int) const << c->vertex(2)->point() << ", " << c->vertex(3)->point() << std::endl; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } break; @@ -7101,7 +7101,7 @@ is_valid_finite(Cell_handle c, bool verbose, int) const << c->vertex(1)->point() << ", " << c->vertex(2)->point() << std::endl; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } break; @@ -7123,7 +7123,7 @@ is_valid_finite(Cell_handle c, bool verbose, int) const << c->neighbor(0)->vertex(1-c->neighbor(0)->index(c))->point() << ", " << v->point() << std::endl; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } } @@ -7140,7 +7140,7 @@ is_valid_finite(Cell_handle c, bool verbose, int) const << c->neighbor(1)->vertex(1-c->neighbor(1)->index(c))->point() << ", " << v->point() << std::endl; } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } } @@ -7169,12 +7169,12 @@ test_next(const Triangulation_3& t1, // Returns false if an inequality has been found. // Precondition: c1, c2 have been registered as well as their 4 vertices. - CGAL_triangulation_precondition(t1.dimension() >= 2); - CGAL_triangulation_precondition(Cmap[c1] == c2); - CGAL_triangulation_precondition(Vmap.find(c1->vertex(0)) != Vmap.end()); - CGAL_triangulation_precondition(Vmap.find(c1->vertex(1)) != Vmap.end()); - CGAL_triangulation_precondition(Vmap.find(c1->vertex(2)) != Vmap.end()); - CGAL_triangulation_precondition(t1.dimension() == 2 || + CGAL_precondition(t1.dimension() >= 2); + CGAL_precondition(Cmap[c1] == c2); + CGAL_precondition(Vmap.find(c1->vertex(0)) != Vmap.end()); + CGAL_precondition(Vmap.find(c1->vertex(1)) != Vmap.end()); + CGAL_precondition(Vmap.find(c1->vertex(2)) != Vmap.end()); + CGAL_precondition(t1.dimension() == 2 || Vmap.find(c1->vertex(3)) != Vmap.end()); typedef Triangulation_3 Tr1; diff --git a/Triangulation_3/include/CGAL/Triangulation_3/internal/Triangulation_segment_traverser_3_impl.h b/Triangulation_3/include/CGAL/Triangulation_3/internal/Triangulation_segment_traverser_3_impl.h index 663032162a4..b93c9a3f874 100644 --- a/Triangulation_3/include/CGAL/Triangulation_3/internal/Triangulation_segment_traverser_3_impl.h +++ b/Triangulation_3/include/CGAL/Triangulation_3/internal/Triangulation_segment_traverser_3_impl.h @@ -20,10 +20,10 @@ template < class Tr, class Inc > Triangulation_segment_cell_iterator_3:: Triangulation_segment_cell_iterator_3( const Tr* tr, Vertex_handle s, Vertex_handle t ) : _tr(tr) { - CGAL_triangulation_precondition( !_tr->is_infinite(s) ); - CGAL_triangulation_precondition( !_tr->is_infinite(t) ); - CGAL_triangulation_precondition( s->point() != t->point() ); - CGAL_triangulation_precondition( _tr->dimension() >= 2 ); + CGAL_precondition( !_tr->is_infinite(s) ); + CGAL_precondition( !_tr->is_infinite(t) ); + CGAL_precondition( s->point() != t->point() ); + CGAL_precondition( _tr->dimension() >= 2 ); _source = s->point(); _target = t->point(); @@ -45,11 +45,11 @@ template < class Tr, class Inc > Triangulation_segment_cell_iterator_3:: Triangulation_segment_cell_iterator_3( const Tr* tr, Vertex_handle s, const Point& t ) : _tr(tr) { - CGAL_triangulation_precondition( !_tr->is_infinite(s) ); - CGAL_triangulation_precondition( s->point() != t ); - CGAL_triangulation_precondition( _tr->dimension() >= 2 ); - CGAL_triangulation_precondition( _tr->dimension() == 3 || - orientation( *_tr->finite_facets_begin(), t ) == COPLANAR ); + CGAL_precondition( !_tr->is_infinite(s) ); + CGAL_precondition( s->point() != t ); + CGAL_precondition( _tr->dimension() >= 2 ); + CGAL_precondition( _tr->dimension() == 3 || + orientation( *_tr->finite_facets_begin(), t ) == COPLANAR ); _source = s->point(); _target = t; @@ -71,11 +71,11 @@ template < class Tr, class Inc > Triangulation_segment_cell_iterator_3:: Triangulation_segment_cell_iterator_3( const Tr* tr, const Point& s, Vertex_handle t, Cell_handle hint ) : _tr(tr) { - CGAL_triangulation_precondition( !_tr->is_infinite(t) ); - CGAL_triangulation_precondition( s != t->point() ); - CGAL_triangulation_precondition( _tr->dimension() >= 2 ); - CGAL_triangulation_precondition( _tr->dimension() == 3 || - orientation( *_tr->finite_facets_begin(), s ) == COPLANAR ); + CGAL_precondition( !_tr->is_infinite(t) ); + CGAL_precondition( s != t->point() ); + CGAL_precondition( _tr->dimension() >= 2 ); + CGAL_precondition( _tr->dimension() == 3 || + orientation( *_tr->finite_facets_begin(), s ) == COPLANAR ); _source = s; _target = t->point(); @@ -84,7 +84,7 @@ Triangulation_segment_cell_iterator_3( const Tr* tr, const Point& s, Vertex_hand cell() = _tr->locate( s, lt(), li(), lj(), hint ); - CGAL_triangulation_postcondition( cell() != Cell_handle() ); + CGAL_postcondition( cell() != Cell_handle() ); jump_to_intersecting_cell(); } @@ -93,10 +93,10 @@ template < class Tr, class Inc > Triangulation_segment_cell_iterator_3:: Triangulation_segment_cell_iterator_3( const Tr* tr, const Point& s, const Point& t, Cell_handle hint ) : _tr(tr) { - CGAL_triangulation_precondition( s != t ); - CGAL_triangulation_precondition( _tr->dimension() >= 2 ); - CGAL_triangulation_precondition( _tr->dimension() == 3 || - coplanar( *_tr->finite_facets_begin(), _target ) ); + CGAL_precondition( s != t ); + CGAL_precondition( _tr->dimension() >= 2 ); + CGAL_precondition( _tr->dimension() == 3 || + coplanar( *_tr->finite_facets_begin(), _target ) ); _source = s; _target = t; @@ -105,7 +105,7 @@ Triangulation_segment_cell_iterator_3( const Tr* tr, const Point& s, const Point cell() = _tr->locate( s, lt(), li(), lj(), hint ); - CGAL_triangulation_postcondition( cell() != Cell_handle() ); + CGAL_postcondition( cell() != Cell_handle() ); jump_to_intersecting_cell(); } @@ -131,7 +131,7 @@ Triangulation_segment_cell_iterator_3::end() const { template < class Tr, class Inc > inline Triangulation_segment_cell_iterator_3& Triangulation_segment_cell_iterator_3::operator++() { - CGAL_triangulation_precondition( cell() != Cell_handle() ); + CGAL_precondition( cell() != Cell_handle() ); increment(); return *this; } @@ -169,8 +169,8 @@ operator!=( const SCI& sci ) const { template < class Tr, class Inc > inline bool Triangulation_segment_cell_iterator_3:: -operator==( Nullptr_t CGAL_triangulation_assertion_code(n) ) const { - CGAL_triangulation_assertion( n == NULL ); +operator==( Nullptr_t CGAL_assertion_code(n) ) const { + CGAL_assertion( n == NULL ); return cell() == Cell_handle(); } @@ -233,7 +233,7 @@ jump_to_intersecting_cell() template < class Tr, class Inc > void Triangulation_segment_cell_iterator_3:: walk_to_next() { - CGAL_triangulation_precondition( has_next() ); + CGAL_precondition( has_next() ); // Check if the target is in the current cell. int ti; @@ -463,7 +463,7 @@ Triangulation_segment_cell_iterator_3::walk_to_next_3(const Simplex& pre // For the remembering stochastic walk, we start trying with a random facet. int li = 0; - CGAL_triangulation_assertion_code( bool incell = true; ) + CGAL_assertion_code( bool incell = true; ) for( int k = 0; k < 4; ++k, ++li ) { // Skip the previous cell. @@ -485,7 +485,7 @@ Triangulation_segment_cell_iterator_3::walk_to_next_3(const Simplex& pre vert[li] = backup; continue; } - CGAL_triangulation_assertion_code( incell = false; ) + CGAL_assertion_code( incell = false; ) // Check if the target is inside the 3-wedge with // the source as apex and the facet as an intersection. @@ -547,15 +547,15 @@ Triangulation_segment_cell_iterator_3::walk_to_next_3(const Simplex& pre if(regular_case) { - CGAL_triangulation_assertion( std::get<0>(cur_after_walk)==nnext ); - CGAL_triangulation_assertion( li==outside ); - CGAL_triangulation_assertion( ! inside ); + CGAL_assertion( std::get<0>(cur_after_walk)==nnext ); + CGAL_assertion( li==outside ); + CGAL_assertion( ! inside ); } return std::make_pair(prev_after_walk, cur_after_walk); case 2: if(regular_case) - CGAL_triangulation_assertion(degenerate ); + CGAL_assertion(degenerate ); std::get<1>(prev_after_walk) = Tr::EDGE; std::get<1>(cur_after_walk) = Tr::EDGE; @@ -574,11 +574,11 @@ Triangulation_segment_cell_iterator_3::walk_to_next_3(const Simplex& pre return std::make_pair(prev_after_walk, cur_after_walk); } } - CGAL_triangulation_assertion( false ); + CGAL_assertion( false ); return std::make_pair(prev, cur); case 1: if(regular_case) - CGAL_triangulation_assertion(degenerate ); + CGAL_assertion(degenerate ); std::get<1>(prev_after_walk) = Tr::VERTEX; std::get<1>(cur_after_walk) = Tr::VERTEX; @@ -592,22 +592,22 @@ Triangulation_segment_cell_iterator_3::walk_to_next_3(const Simplex& pre return std::make_pair(prev_after_walk, cur_after_walk); } } - CGAL_triangulation_assertion( false ); + CGAL_assertion( false ); return std::make_pair(prev, cur); default: - CGAL_triangulation_assertion( false ); + CGAL_assertion( false ); return std::make_pair(prev, cur); } } // The target lies inside this cell. Simplex prev_after_walk; - CGAL_triangulation_assertion( incell ); + CGAL_assertion( incell ); switch( op[0] + op[1] + op[2] + op[3] ) { case 4: - CGAL_triangulation_assertion( pos == 6 ); + CGAL_assertion( pos == 6 ); prev_after_walk = Simplex( std::get<0>(cur), Tr::CELL, -1, -1 ); - CGAL_triangulation_assertion( (! regular_case) || inside ); + CGAL_assertion( (! regular_case) || inside ); break; case 3: @@ -626,7 +626,7 @@ Triangulation_segment_cell_iterator_3::walk_to_next_3(const Simplex& pre break; default: prev_after_walk = Simplex( std::get<0>(cur), Tr::OUTSIDE_AFFINE_HULL, -1, -1 ); - CGAL_triangulation_assertion( false ); + CGAL_assertion( false ); } Simplex cur_after_walk(Cell_handle(), Tr::OUTSIDE_AFFINE_HULL, -1, -1); @@ -637,7 +637,7 @@ template < class Tr, class Inc > void Triangulation_segment_cell_iterator_3:: walk_to_next_3_inf( int inf ) { - CGAL_triangulation_precondition( _tr->is_infinite( cell()->vertex(inf) ) ); + CGAL_precondition( _tr->is_infinite( cell()->vertex(inf) ) ); // If this cell was reached by traversal from a finite one, it must be the final cell. Cell_handle fin = cell()->neighbor(inf); @@ -664,7 +664,7 @@ walk_to_next_3_inf( int inf ) } vert[inf] = &(_source); - CGAL_triangulation_assertion( _tr->orientation( *vert[0], *vert[1], *vert[2], *vert[3] ) == POSITIVE ); + CGAL_assertion( _tr->orientation( *vert[0], *vert[1], *vert[2], *vert[3] ) == POSITIVE ); int li = 0; // Check if the line enters an adjacent infinite cell. @@ -694,7 +694,7 @@ walk_to_next_3_inf( int inf ) // The target lies behind the plane through the source and two finite vertices. // Traverse to the incident infinite cell. - CGAL_triangulation_assertion( _tr->is_infinite( next ) ); + CGAL_assertion( _tr->is_infinite( next ) ); _prev = Simplex( cell(), Tr::FACET, li, -1 ); _cur = Simplex( next, Tr::FACET, next->index( prev_cell() ), -1 ); return; @@ -725,7 +725,7 @@ walk_to_next_3_inf( int inf ) return; } } - CGAL_triangulation_assertion( false ); + CGAL_assertion( false ); return; case 1: prev_lt() = Tr::VERTEX; @@ -737,10 +737,10 @@ walk_to_next_3_inf( int inf ) return; } } - CGAL_triangulation_assertion( false ); + CGAL_assertion( false ); return; default: - CGAL_triangulation_assertion( false ); + CGAL_assertion( false ); return; } } @@ -802,7 +802,7 @@ walk_to_next_2() return; default: // The current vertex is the target. - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return; } } @@ -829,7 +829,7 @@ walk_to_next_2() _prev = Simplex( cell(), Tr::VERTEX, li(), -1 ); break; case 0: - CGAL_triangulation_assertion(false); + CGAL_assertion(false); _prev = Simplex( cell(), Tr::OUTSIDE_AFFINE_HULL, -1, -1 ); break; } @@ -929,7 +929,7 @@ walk_to_next_2() if( op == POSITIVE ) _prev = Simplex( cell(), Tr::FACET, 3, -1 ); else { - CGAL_triangulation_assertion( op == ZERO ); + CGAL_assertion( op == ZERO ); switch( o ) { case POSITIVE: _prev = Simplex( cell(), Tr::EDGE, li(), lk ); @@ -1006,7 +1006,7 @@ walk_to_next_2() this->li() = cell()->index( prev_cell()->vertex( prev_li() ) ); return; default: - CGAL_triangulation_assertion( false ); + CGAL_assertion( false ); return; } } @@ -1017,7 +1017,7 @@ walk_to_next_2() return; } default: - CGAL_triangulation_assertion( false ); + CGAL_assertion( false ); } } @@ -1025,8 +1025,8 @@ template < class Tr, class Inc > void Triangulation_segment_cell_iterator_3:: walk_to_next_2_inf( int inf ) { - CGAL_triangulation_precondition( _tr->is_infinite( cell()->vertex(3) ) ); - CGAL_triangulation_precondition( _tr->is_infinite( cell()->vertex(inf) ) ); + CGAL_precondition( _tr->is_infinite( cell()->vertex(3) ) ); + CGAL_precondition( _tr->is_infinite( cell()->vertex(inf) ) ); // If this cell was reached by traversal from a finite one, it must be the final cell. Cell_handle fin = cell()->neighbor(inf); @@ -1126,9 +1126,9 @@ typename Triangulation_segment_cell_iterator_3::Edge Triangulation_segment_cell_iterator_3::opposite_edge( Cell_handle c, int li, int lj) const { - CGAL_triangulation_precondition(li >= 0 && li < 4); - CGAL_triangulation_precondition(lj >= 0 && lj < 4); - CGAL_triangulation_precondition(li != lj); + CGAL_precondition(li >= 0 && li < 4); + CGAL_precondition(lj >= 0 && lj < 4); + CGAL_precondition(li != lj); switch (6 - li - lj) { // i + j + missing indices = 6. case 1: return Edge(c, 0, 1); @@ -1138,7 +1138,7 @@ Triangulation_segment_cell_iterator_3::opposite_edge( case 5: return Edge(c, 2, 3); } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return Edge(); } diff --git a/Triangulation_3/include/CGAL/Triangulation_cell_base_3.h b/Triangulation_3/include/CGAL/Triangulation_cell_base_3.h index 927342b96be..de2bacddbbf 100644 --- a/Triangulation_3/include/CGAL/Triangulation_cell_base_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_cell_base_3.h @@ -19,7 +19,6 @@ #include -#include #include namespace CGAL { diff --git a/Triangulation_3/include/CGAL/Triangulation_geom_traits_3.h b/Triangulation_3/include/CGAL/Triangulation_geom_traits_3.h index 479d550af63..bc9c8ff3cb6 100644 --- a/Triangulation_3/include/CGAL/Triangulation_geom_traits_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_geom_traits_3.h @@ -22,8 +22,6 @@ #include -#include - namespace CGAL { template < class Repres > diff --git a/Triangulation_3/include/CGAL/Triangulation_hierarchy_3.h b/Triangulation_3/include/CGAL/Triangulation_hierarchy_3.h index 7f8b2ce1dd3..8553a34a1b3 100644 --- a/Triangulation_3/include/CGAL/Triangulation_hierarchy_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_hierarchy_3.h @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include @@ -358,8 +358,8 @@ public: template < typename InputIterator > size_type remove_cluster(InputIterator first, InputIterator beyond) { - CGAL_triangulation_precondition(!this->does_repeat_in_range(first, beyond)); - CGAL_triangulation_precondition(!this->infinite_vertex_in_range(first, beyond)); + CGAL_precondition(!this->does_repeat_in_range(first, beyond)); + CGAL_precondition(!this->infinite_vertex_in_range(first, beyond)); size_type n = this->number_of_vertices(); std::vector vo(first, beyond), vc; int l=0; @@ -686,7 +686,7 @@ void Triangulation_hierarchy_3:: remove(Vertex_handle v) { - CGAL_triangulation_precondition(v != Vertex_handle()); + CGAL_precondition(v != Vertex_handle()); for (int l = 0; l < maxlevel; ++l) { Vertex_handle u = v->up(); hierarchy[l]->remove(v); @@ -702,8 +702,8 @@ void Triangulation_hierarchy_3:: remove_and_give_new_cells(Vertex_handle v, OutputItCells fit) { - CGAL_triangulation_precondition(v != Vertex_handle()); - CGAL_triangulation_precondition(!is_infinite(v)); + CGAL_precondition(v != Vertex_handle()); + CGAL_precondition(!is_infinite(v)); for (int l = 0; l < maxlevel; ++l) { Vertex_handle u = v->up(); if(l) hierarchy[l]->remove(v); @@ -719,7 +719,7 @@ typename Triangulation_hierarchy_3::Vertex_handle Triangulation_hierarchy_3:: move_if_no_collision(Vertex_handle v, const Point & p) { - CGAL_triangulation_precondition(!this->is_infinite(v)); + CGAL_precondition(!this->is_infinite(v)); if(v->point() == p) return v; Vertex_handle ans; for (int l = 0; l < maxlevel; ++l) { @@ -739,7 +739,7 @@ typename Triangulation_hierarchy_3::Vertex_handle Triangulation_hierarchy_3:: move(Vertex_handle v, const Point & p) { - CGAL_triangulation_precondition(!this->is_infinite(v)); + CGAL_precondition(!this->is_infinite(v)); if(v->point() == p) return v; Vertex_handle w = move_if_no_collision(v,p); if(w != v) { @@ -756,7 +756,7 @@ Triangulation_hierarchy_3:: move_if_no_collision_and_give_new_cells( Vertex_handle v, const Point & p, OutputItCells fit) { - CGAL_triangulation_precondition(!is_infinite(v)); + CGAL_precondition(!is_infinite(v)); if(v->point() == p) return v; Vertex_handle ans; for (int l = 0; l < maxlevel; ++l) { diff --git a/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h b/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h index 76b0f7572e3..9aca45fae91 100644 --- a/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include @@ -379,7 +379,7 @@ public: } // \} - bool operator==( Nullptr_t CGAL_triangulation_assertion_code(n) ) const; + bool operator==( Nullptr_t CGAL_assertion_code(n) ) const; bool operator!=( Nullptr_t n ) const; protected: @@ -422,9 +422,9 @@ private: private: inline int edgeIndex( int i, int j ) const { - CGAL_triangulation_precondition( i>=0 && i<=3 ); - CGAL_triangulation_precondition( j>=0 && j<=3 ); - CGAL_triangulation_precondition( i != j ); + CGAL_precondition( i>=0 && i<=3 ); + CGAL_precondition( j>=0 && j<=3 ); + CGAL_precondition( i != j ); return ( i==0 || j==0 ) ? i+j-1 : i+j; } diff --git a/Triangulation_3/test/Triangulation_3/test_regular_remove_3.cpp b/Triangulation_3/test/Triangulation_3/test_regular_remove_3.cpp index 1ce3881222b..f37bb096413 100644 --- a/Triangulation_3/test/Triangulation_3/test_regular_remove_3.cpp +++ b/Triangulation_3/test/Triangulation_3/test_regular_remove_3.cpp @@ -288,16 +288,14 @@ bool test_case (std::istream &is) point_set points; Cls T; - int number = 0; do { - ++number; points.insert (*pi); T.insert (*pi); } while (++pi != pend); assert(T.is_valid()); - for (int i = 0; !points.empty(); ++i) { + while(! points.empty()) { assert(T.number_of_vertices() != 0); Vertex_handle v = T.finite_vertices_begin(); set_iterator pos = points.find (v->point()); @@ -376,4 +374,3 @@ int main(int argc, char **argv) return 0; } - diff --git a/Triangulation_on_sphere_2/include/CGAL/Delaunay_triangulation_on_sphere_2.h b/Triangulation_on_sphere_2/include/CGAL/Delaunay_triangulation_on_sphere_2.h index 31158c0c9b1..9ccb879cffc 100644 --- a/Triangulation_on_sphere_2/include/CGAL/Delaunay_triangulation_on_sphere_2.h +++ b/Triangulation_on_sphere_2/include/CGAL/Delaunay_triangulation_on_sphere_2.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include @@ -261,7 +261,7 @@ public: Face_handle f = Face_handle(), std::enable_if_t::value>* = nullptr) { - CGAL_triangulation_assertion((std::is_same::value)); + CGAL_assertion((std::is_same::value)); return insert(geom_traits().construct_point_on_sphere_2_object()(p), f); } @@ -474,7 +474,7 @@ typename Triangulation_on_sphere_2::Vertex_handle Delaunay_triangulation_on_sphere_2:: insert_third(const Point& p) { - CGAL_triangulation_assertion(number_of_vertices() == 2); + CGAL_assertion(number_of_vertices() == 2); Vertex_handle v = vertices_begin(); Vertex_handle u = v->face()->neighbor(0)->vertex(0); @@ -493,10 +493,10 @@ insert_third(const Point& p) nv->set_point(p); - CGAL_triangulation_assertion_code(Face_handle f = all_edges_begin()->first;) - CGAL_triangulation_assertion(orientation_on_sphere(point(f, 0), - point(f, 1), - point(f->neighbor(0), 1)) != RIGHT_TURN); + CGAL_assertion_code(Face_handle f = all_edges_begin()->first;) + CGAL_assertion(orientation_on_sphere(point(f, 0), + point(f, 1), + point(f->neighbor(0), 1)) != RIGHT_TURN); return nv; } @@ -516,7 +516,7 @@ insert_outside_affine_hull_regular(const Point& p) const Point& p1 = point(f, 1); const Point& p2 = point(fn, 1); - CGAL_triangulation_assertion(orientation_on_sphere(p0, p1, p2) != NEGATIVE); + CGAL_assertion(orientation_on_sphere(p0, p1, p2) != NEGATIVE); Orientation orient2 = side_of_oriented_circle(p0, p1, p2, p); if(orient2 == POSITIVE) @@ -587,7 +587,7 @@ insert(const Point& p, Locate_type lt, Face_handle loc, int /*li*/) } } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return v; } @@ -606,7 +606,7 @@ insert(const Point& p, Face_handle start) return Vertex_handle(); case TOO_CLOSE: { - CGAL_triangulation_assertion(loc != Face_handle()); + CGAL_assertion(loc != Face_handle()); return loc->vertex(li); } case VERTEX: @@ -661,7 +661,7 @@ insert(InputIterator first, InputIterator beyond, points.reserve(input_points.size()); for(const P3_wit& p3wi : p3_points) { - CGAL_triangulation_assertion(p3wi.input_point_ptr != nullptr); + CGAL_assertion(p3wi.input_point_ptr != nullptr); points.push_back(*(p3wi.input_point_ptr)); } @@ -715,7 +715,7 @@ bool Delaunay_triangulation_on_sphere_2:: update_ghost_faces(Vertex_handle v, bool first) { - CGAL_triangulation_assertion(dimension() == 2); + CGAL_assertion(dimension() == 2); bool ghost_found = false; @@ -736,7 +736,7 @@ update_ghost_faces(Vertex_handle v, bool first) } else // not first { - CGAL_triangulation_assertion(v != Vertex_handle()); + CGAL_assertion(v != Vertex_handle()); Face_circulator fc = this->incident_faces(v, v->face()); Face_circulator done(fc); do @@ -763,7 +763,7 @@ void Delaunay_triangulation_on_sphere_2:: remove_1D(Vertex_handle v) { - CGAL_triangulation_precondition(v != Vertex_handle()); + CGAL_precondition(v != Vertex_handle()); tds().remove_1D(v); } @@ -792,7 +792,7 @@ void Delaunay_triangulation_on_sphere_2:: remove(Vertex_handle v) { - CGAL_triangulation_precondition(v != Vertex_handle()); + CGAL_precondition(v != Vertex_handle()); if(number_of_vertices() <= 3) tds().remove_dim_down(v); @@ -824,7 +824,7 @@ test_dim_down(Vertex_handle v) if(it4 == vertices_end()) break; - CGAL_triangulation_assertion(it != v && it2 != v && it3 != v && it4 != v); + CGAL_assertion(it != v && it2 != v && it3 != v && it4 != v); if(side_of_oriented_circle(it->point(), it2->point(), it3->point(), it4->point()) != ON_ORIENTED_BOUNDARY) return false; @@ -1134,7 +1134,7 @@ is_valid_face(Face_handle fh, bool verbose, int /*level*/) const { Orientation test = side_of_oriented_circle(fh, point(fh->vertex(i))); result = result && test == ON_ORIENTED_BOUNDARY; - CGAL_triangulation_assertion(result); + CGAL_assertion(result); } if(!result) @@ -1146,7 +1146,7 @@ is_valid_face(Face_handle fh, bool verbose, int /*level*/) const } } - CGAL_triangulation_assertion(result); + CGAL_assertion(result); return result; } @@ -1162,7 +1162,7 @@ is_valid(bool verbose, int level) const if(verbose) std::cerr << "invalid data structure" << std::endl; - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -1177,18 +1177,18 @@ is_valid(bool verbose, int level) const case 0: break; case 1: - CGAL_triangulation_assertion(this->is_plane()); + CGAL_assertion(this->is_plane()); break; case 2: for(All_faces_iterator it=all_faces_begin(); it!=all_faces_end(); ++it) { Orientation s = orientation_on_sphere(point(it, 0), point(it, 1), point(it, 2)); result = result && (s != NEGATIVE || it->is_ghost()); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); } result = result && (number_of_faces() == 2 * number_of_vertices() - 4); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); break; } @@ -1196,7 +1196,7 @@ is_valid(bool verbose, int level) const if(verbose) std::cerr << " number of vertices " << number_of_vertices() << "\t" << std::endl; - CGAL_triangulation_assertion(result); + CGAL_assertion(result); return result; } diff --git a/Triangulation_on_sphere_2/include/CGAL/Delaunay_triangulation_on_sphere_traits_2.h b/Triangulation_on_sphere_2/include/CGAL/Delaunay_triangulation_on_sphere_traits_2.h index 95c12831583..ffb5d002aa0 100644 --- a/Triangulation_on_sphere_2/include/CGAL/Delaunay_triangulation_on_sphere_traits_2.h +++ b/Triangulation_on_sphere_2/include/CGAL/Delaunay_triangulation_on_sphere_traits_2.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include @@ -101,14 +101,14 @@ public: // Check if r is on the same side of the plane orthogonal to the plane (c,p,q) // and going through c and p as q const Orientation op = _lk.coplanar_orientation_3_object()(_center, p, q, r); - CGAL_triangulation_assertion(op != COLLINEAR); + CGAL_assertion(op != COLLINEAR); if(op == NEGATIVE) return false; // Check if r is on the same side of the plane orthogonal to the plane (c,p,q) // and going through c and q as p const Orientation oq = _lk.coplanar_orientation_3_object()(_center, q, p, r); - CGAL_triangulation_assertion(oq != COLLINEAR); + CGAL_assertion(oq != COLLINEAR); if(oq == NEGATIVE) return false; diff --git a/Triangulation_on_sphere_2/include/CGAL/Geographical_coordinates_traits_2.h b/Triangulation_on_sphere_2/include/CGAL/Geographical_coordinates_traits_2.h index fd3675e4b7c..82a073dc5c6 100644 --- a/Triangulation_on_sphere_2/include/CGAL/Geographical_coordinates_traits_2.h +++ b/Triangulation_on_sphere_2/include/CGAL/Geographical_coordinates_traits_2.h @@ -16,7 +16,7 @@ #include -#include +#include #include #include diff --git a/Triangulation_on_sphere_2/include/CGAL/Projection_on_sphere_traits_3.h b/Triangulation_on_sphere_2/include/CGAL/Projection_on_sphere_traits_3.h index 4f69f9bf179..5673c7f597e 100644 --- a/Triangulation_on_sphere_2/include/CGAL/Projection_on_sphere_traits_3.h +++ b/Triangulation_on_sphere_2/include/CGAL/Projection_on_sphere_traits_3.h @@ -17,8 +17,7 @@ #include #include - -#include +#include #include namespace CGAL { diff --git a/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2.h b/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2.h index 0de37519ad3..743a1ca7026 100644 --- a/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2.h +++ b/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2.h @@ -16,7 +16,7 @@ #include -#include +#include #include #include #include @@ -417,7 +417,7 @@ public: Arc_on_sphere_2 segment_on_sphere(const Face_handle f, int i) const { - CGAL_triangulation_precondition(!is_ghost(f, i)); + CGAL_precondition(!is_ghost(f, i)); return geom_traits().construct_arc_on_sphere_2_object()(point(f, ccw(i)), point(f, cw(i))); } @@ -695,7 +695,7 @@ typename Triangulation_on_sphere_2::Face_handle Triangulation_on_sphere_2:: march_locate_1D(const Point& p, Locate_type& lt, int& li) const { - CGAL_triangulation_assertion(dimension() == 1); + CGAL_assertion(dimension() == 1); // Check if p is coplanar with the existing points first three points of the triangulation Face_handle f = all_edges_begin()->first; @@ -743,8 +743,8 @@ march_locate_2D(Face_handle f, Locate_type& lt, int& li) const { - CGAL_triangulation_precondition(dimension() == 2); - CGAL_triangulation_precondition(!is_ghost(f)); + CGAL_precondition(dimension() == 2); + CGAL_precondition(!is_ghost(f)); boost::rand48 rng; boost::uniform_smallint<> two(0, 1); @@ -973,7 +973,7 @@ march_locate_2D(Face_handle f, default: { // impossible - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return f; } } @@ -1221,21 +1221,21 @@ check_neighboring_faces() const { for(All_faces_iterator eit=all_faces_begin(); eit!=all_faces_end(); ++eit) { - CGAL_triangulation_assertion_code(const Face_handle f1 = eit->neighbor(0);) - CGAL_triangulation_assertion_code(const Face_handle f2 = eit->neighbor(1);) - CGAL_triangulation_assertion(f1->has_neighbor(eit)); - CGAL_triangulation_assertion(f2->has_neighbor(eit)); + CGAL_assertion_code(const Face_handle f1 = eit->neighbor(0);) + CGAL_assertion_code(const Face_handle f2 = eit->neighbor(1);) + CGAL_assertion(f1->has_neighbor(eit)); + CGAL_assertion(f2->has_neighbor(eit)); } } for(All_faces_iterator eit=all_faces_begin(); eit!=all_faces_end(); ++eit) { - CGAL_triangulation_assertion_code(const Face_handle f1 = eit->neighbor(0);) - CGAL_triangulation_assertion_code(const Face_handle f2 = eit->neighbor(1);) - CGAL_triangulation_assertion_code(const Face_handle f3 = eit->neighbor(2);) - CGAL_triangulation_assertion(f1->has_neighbor(eit)); - CGAL_triangulation_assertion(f2->has_neighbor(eit)); - CGAL_triangulation_assertion(f3->has_neighbor(eit)); + CGAL_assertion_code(const Face_handle f1 = eit->neighbor(0);) + CGAL_assertion_code(const Face_handle f2 = eit->neighbor(1);) + CGAL_assertion_code(const Face_handle f3 = eit->neighbor(2);) + CGAL_assertion(f1->has_neighbor(eit)); + CGAL_assertion(f2->has_neighbor(eit)); + CGAL_assertion(f3->has_neighbor(eit)); } } @@ -1257,7 +1257,7 @@ is_valid_vertex(Vertex_handle vh, bool verbose, int /*level*/) const show_face(vh->face()); } - CGAL_triangulation_assertion(false); + CGAL_assertion(false); return false; } @@ -1283,7 +1283,7 @@ is_valid(bool verbose, { const Orientation s = orientation(point(it1), point(it2), point(it3)); result = result && (s == COLLINEAR); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); ++it1; ++it2; ++it3; } } @@ -1292,7 +1292,7 @@ is_valid(bool verbose, for(All_faces_iterator it=all_faces_begin(); it!=all_faces_end(); ++it) { const Orientation s = orientation_on_sphere(point(it, 0), point(it, 1), point(it, 2)); - CGAL_triangulation_assertion(s == LEFT_TURN || is_ghost(it)); + CGAL_assertion(s == LEFT_TURN || is_ghost(it)); result = result && (s == LEFT_TURN || is_ghost(it)); } @@ -1301,7 +1301,7 @@ is_valid(bool verbose, // which does not know the number of components nor the genus result = result && (number_of_faces() == (2 * number_of_vertices() - 4)); - CGAL_triangulation_assertion(result); + CGAL_assertion(result); } return result; @@ -1340,7 +1340,7 @@ std::istream& operator>>(std::istream& is, Triangulation_on_sphere_2& tr) { tr.file_input(is); - CGAL_triangulation_assertion(tr.is_valid()); + CGAL_assertion(tr.is_valid()); return is; } diff --git a/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2/IO/OFF.h b/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2/IO/OFF.h index fb5ba3d6605..3995430c2d9 100644 --- a/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2/IO/OFF.h +++ b/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2/IO/OFF.h @@ -14,7 +14,7 @@ #include -#include +#include #include #include @@ -94,7 +94,7 @@ bool write_OFF(std::ostream& os, index_of_vertex[vh] = i; } - CGAL_triangulation_assertion(i == n); + CGAL_assertion(i == n); size_type number_of_triangles = 0; for(Face_iterator fit = dt.all_faces_begin() ; fit != dt.all_faces_end() ; ++fit) diff --git a/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2/internal/arc_on_sphere_2_subsampling.h b/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2/internal/arc_on_sphere_2_subsampling.h index 10ca5b89fc7..fbe52979939 100644 --- a/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2/internal/arc_on_sphere_2_subsampling.h +++ b/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2/internal/arc_on_sphere_2_subsampling.h @@ -15,7 +15,7 @@ #include -#include +#include #include #ifdef CGAL_EIGEN3_ENABLED @@ -103,7 +103,7 @@ void subsample_arc_on_sphere_2(const typename Kernel::Circle_3& circle, if(source > target) target += 2*CGAL_PI; - CGAL_triangulation_assertion(target > source); + CGAL_assertion(target > source); const double radius = sqrt(circle.squared_radius()); const double edge_len = (target - source) * radius; @@ -115,7 +115,7 @@ void subsample_arc_on_sphere_2(const typename Kernel::Circle_3& circle, for(int i=0; i(circle.center(), radius, current_theta, b1, b2); } *out_pts++ = compute_point(circle.center(), radius, target, b1, b2); diff --git a/Triangulation_on_sphere_2/include/CGAL/Triangulation_sphere_line_face_circulator_2.h b/Triangulation_on_sphere_2/include/CGAL/Triangulation_sphere_line_face_circulator_2.h index e863d91a638..aa7ffa1ba47 100644 --- a/Triangulation_on_sphere_2/include/CGAL/Triangulation_sphere_line_face_circulator_2.h +++ b/Triangulation_on_sphere_2/include/CGAL/Triangulation_sphere_line_face_circulator_2.h @@ -14,7 +14,7 @@ #include -#include +#include namespace CGAL { @@ -347,7 +347,7 @@ inline bool Triangulation_sphere_line_face_circulator_2:: operator==(Nullptr_t CGAL_assertion_code(n)) const { - CGAL_triangulation_assertion(n == NULL); + CGAL_assertion(n == NULL); return pos == Face_handle(); } @@ -356,7 +356,7 @@ inline bool Triangulation_sphere_line_face_circulator_2:: operator!=(Nullptr_t n) const { - CGAL_triangulation_assertion(n == NULL); + CGAL_assertion(n == NULL); return !(*this == n); } diff --git a/Visibility_2/test/Visibility_2/include/CGAL/test_utils.h b/Visibility_2/test/Visibility_2/include/CGAL/test_utils.h index 63596be4174..a57dee947cf 100644 --- a/Visibility_2/test/Visibility_2/include/CGAL/test_utils.h +++ b/Visibility_2/test/Visibility_2/include/CGAL/test_utils.h @@ -858,7 +858,6 @@ typename Arrangement_2::Face_const_handle construct_biggest_arr_with_no_holes( Ccb_halfedge_const_circulator curr; Face_const_iterator fit; - int cnt(0); for (fit = arr_in.faces_begin() ; fit != arr_in.faces_end() ; fit++) { if (fit->has_outer_ccb()) { Ccb_halfedge_const_circulator circ = fit->outer_ccb(); @@ -868,7 +867,6 @@ typename Arrangement_2::Face_const_handle construct_biggest_arr_with_no_holes( curr_max_circ = circ; } } - cnt++; } std::vector segments; diff --git a/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_print_report.h b/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_print_report.h index 3f58af9a3bb..63819bc0afc 100644 --- a/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_print_report.h +++ b/Voronoi_diagram_2/test/Voronoi_diagram_2/include/vda_print_report.h @@ -329,6 +329,8 @@ void print_report(const VDA& vda, const Projector& project, std::cout << "# of Voronoi cells: " << n_all << std::endl; std::cout << "# of Voronoi cells with empty interior: " << n_empty << std::endl; +#else + CGAL_USE(n_vert); CGAL_USE(n_all); CGAL_USE(n_empty); #endif std::cout << "is Voronoi diagram valid? " diff --git a/Weights/include/CGAL/Weights/tangent_weights.h b/Weights/include/CGAL/Weights/tangent_weights.h index 03c8e91ad5b..da4c87d0fdd 100644 --- a/Weights/include/CGAL/Weights/tangent_weights.h +++ b/Weights/include/CGAL/Weights/tangent_weights.h @@ -461,7 +461,7 @@ namespace Weights { const auto v1 = construct_vector_2(q, r); const auto v2 = construct_vector_2(q, p); - const auto A = internal::area_2(traits, p, q, r); + const auto A = internal::positive_area_2(traits, p, q, r); CGAL_assertion(A != FT(0)); // three points are identical! const auto S = scalar_product_2(v1, v2); m_w_base = -tangent_half_angle(m_d_r, m_d_p, A, S);