From 449a5dc11188cf81b14b80920a117631c6aa0909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 22 Jan 2024 13:36:02 +0100 Subject: [PATCH] Misc minor doc / code fixes --- .../CGAL/Isosurfacing_3/Cartesian_grid_3.h | 25 ++++--------------- .../Explicit_Cartesian_grid_domain_3.h | 9 ++++--- .../Implicit_Cartesian_grid_domain_3.h | 2 +- .../Isosurfacing_3/internal/Grid_topology_3.h | 6 ++++- .../Isosurfacing_3/test_dual_contouring.cpp | 2 +- 5 files changed, 18 insertions(+), 26 deletions(-) diff --git a/Isosurfacing_3/include/CGAL/Isosurfacing_3/Cartesian_grid_3.h b/Isosurfacing_3/include/CGAL/Isosurfacing_3/Cartesian_grid_3.h index e1159439eea..8f78909e184 100644 --- a/Isosurfacing_3/include/CGAL/Isosurfacing_3/Cartesian_grid_3.h +++ b/Isosurfacing_3/include/CGAL/Isosurfacing_3/Cartesian_grid_3.h @@ -145,43 +145,28 @@ public: /** * \return the number of grid vertices in the `x` direction */ - std::size_t xdim() const - { - return m_sizes[0]; - } + std::size_t xdim() const { return m_sizes[0]; } /** * \return the number of grid vertices in the `y` direction */ - std::size_t ydim() const - { - return m_sizes[1]; - } + std::size_t ydim() const { return m_sizes[1]; } /** * \return the number of grid vertices in the `z` direction */ - std::size_t zdim() const - { - return m_sizes[2]; - } + std::size_t zdim() const { return m_sizes[2]; } /** * \return the bounding box of the %Cartesian grid. */ - const Bbox_3& bbox() const - { - return m_bbox; - } + const Bbox_3& bbox() const { return m_bbox; } /** * \return the spacing of the %Cartesian grid, that is a vector whose coordinates are * the grid steps in the `x`, `y`, and `z` directions, respectively */ - const std::array& spacing() const - { - return m_spacing; - } + const std::array& spacing() const { return m_spacing; } /** * \brief gets the geometric position of the grid vertex described by a set of indices. diff --git a/Isosurfacing_3/include/CGAL/Isosurfacing_3/Explicit_Cartesian_grid_domain_3.h b/Isosurfacing_3/include/CGAL/Isosurfacing_3/Explicit_Cartesian_grid_domain_3.h index 7494d78f9ac..f8438cc2003 100644 --- a/Isosurfacing_3/include/CGAL/Isosurfacing_3/Explicit_Cartesian_grid_domain_3.h +++ b/Isosurfacing_3/include/CGAL/Isosurfacing_3/Explicit_Cartesian_grid_domain_3.h @@ -26,14 +26,17 @@ namespace Isosurfacing { /** * \ingroup IS_Domains_grp * - * \cgalModels{IsosurfacingDomainWithGradient_3} + * \cgalModels{IsosurfacingDomain_3,IsosurfacingDomainWithGradient_3} * * \brief A domain that represents an explicitly stored %Cartesian grid. * + * \warning The domain keeps a pointer to the `grid` object, hence users must ensure that + * the lifetime of the `grid` object exceeds that of the object returned by this function. + * * \tparam Grid must be a `CGAL::Isosurfacing::Cartesian_grid_3` whose `GeomTraits` template parameter * is a model of `IsosurfacingTraits_3`. * \tparam Gradient the type of the gradient functor. It must be a model of `CopyConstructible` - * and implement `GeomTraits::Vector_3 operator()(const GeomTraits::Point_3& point) const`. + * and implement `%Grid::GeomTraits::Vector_3 operator()(const %Grid::GeomTraits::Point_3& point) const`. * * \sa `CGAL::Isosurfacing::create_explicit_Cartesian_grid_domain()` */ @@ -84,7 +87,7 @@ public: * \tparam Grid must be a `CGAL::Isosurfacing::Cartesian_grid_3` whose `GeomTraits` template parameter * is a model of `IsosurfacingTraits_3`. * \tparam Gradient the type of the gradient functor. It must be a model of `CopyConstructible` - * and implement `GeomTraits::Vector_3 operator()(const GeomTraits::Point_3& point) const`. + * and implement `%Grid::Geom_traits::Vector_3 operator()(const GeomTraits::Point_3& point) const * * \param grid the %Cartesian grid containing input data * \param gradient a function giving the value of the gradient of the implicit function at each discretization point diff --git a/Isosurfacing_3/include/CGAL/Isosurfacing_3/Implicit_Cartesian_grid_domain_3.h b/Isosurfacing_3/include/CGAL/Isosurfacing_3/Implicit_Cartesian_grid_domain_3.h index 0a982bdade7..40b7099d5fa 100644 --- a/Isosurfacing_3/include/CGAL/Isosurfacing_3/Implicit_Cartesian_grid_domain_3.h +++ b/Isosurfacing_3/include/CGAL/Isosurfacing_3/Implicit_Cartesian_grid_domain_3.h @@ -29,7 +29,7 @@ namespace Isosurfacing { /** * \ingroup IS_Domains_grp * - * \cgalModels{IsosurfacingDomainWithGradient_3} + * \cgalModels{IsosurfacingDomain_3,IsosurfacingDomainWithGradient_3} * * \brief A domain that represents a %Cartesian grid that discretizes an implicit function. * diff --git a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Grid_topology_3.h b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Grid_topology_3.h index 3d9b1d4c30c..0c991c4a4c0 100644 --- a/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Grid_topology_3.h +++ b/Isosurfacing_3/include/CGAL/Isosurfacing_3/internal/Grid_topology_3.h @@ -16,6 +16,8 @@ #include #include + +#include #include #ifdef CGAL_LINKED_WITH_TBB @@ -60,7 +62,9 @@ public: : size_i{size_i}, size_j{size_j}, size_k{size_k} - { } + { + CGAL_precondition(size_i > 0 && size_j > 0 && size_k > 0); + } // gets a container with the two vertices incident to edge e Vertices_incident_to_edge incident_vertices(const Edge_descriptor& e) const diff --git a/Isosurfacing_3/test/Isosurfacing_3/test_dual_contouring.cpp b/Isosurfacing_3/test/Isosurfacing_3/test_dual_contouring.cpp index 24992757ca6..440041e7ff8 100644 --- a/Isosurfacing_3/test/Isosurfacing_3/test_dual_contouring.cpp +++ b/Isosurfacing_3/test/Isosurfacing_3/test_dual_contouring.cpp @@ -23,7 +23,7 @@ using Grid = CGAL::Isosurfacing::Cartesian_grid_3; using Point_range = std::vector; using Polygon_range = std::vector >; -int main(int, char**) +int main(int argc, char** argv) { const Vector spacing(0.002, 0.002, 0.02); const CGAL::Bbox_3 bbox = {-1, -1, -1, 1, 1, 1};