From dca73409bbfc72f4548dd9c92bd69203482463a5 Mon Sep 17 00:00:00 2001 From: Adam Getchell Date: Mon, 6 Nov 2023 11:03:09 -0800 Subject: [PATCH] feat: Add cache directory to AppVeyor configuration The cache directory `c:\tools\vcpkg\installed\` has been added to the AppVeyor configuration file `.appveyor.yml`. This change ensures that the installed packages are cached and can be reused in subsequent builds, improving build performance. refactor: Refactor print_cell function in Foliated_triangulation.hpp The `print_cell` function in the `Foliated_triangulation.hpp` file has been refactored. The function now correctly prints the timevalues of each vertex in the cell and the resulting cell info. feat: Add print_neighboring_cells function in Foliated_triangulation.hpp A new function `print_neighboring_cells` has been added to the `Foliated_triangulation.hpp` file. This function allows printing neighboring cells of a given cell in a triangulation. test: Update test cases for FoliatedTriangulation functions Several test cases have been updated for the `FoliatedTriangulation` functions. The changes ensure that containers of cells are printed correctly and that neighbors of a chosen cell can be printed as expected. Additionally, some test cases have been modified to improve code readability and consistency. fix: Fix vertex error detection in Detecting and fixing problems with vertices and cells tests In the "Detecting and fixing problems with vertices and cells" tests, vertex error detection has been fixed. Previously, an incorrect condition was used which resulted in false positives for detecting vertex errors. The fix ensures accurate detection of vertex errors. chore: Update dependencies for Delaunay3 functions from FoliatedTriangulation_3 Dependencies have been updated for Delaunay3 functions used by FoliatedTriangulation_3. This update ensures compatibility with newer versions of external libraries or frameworks being used. docs: Update documentation for FoliatedTriangulation_3 functions Documentation for the FoliatedTriangulation_3 functions has been updated to reflect recent changes and improvements. This update improves the accuracy and clarity of the documentation, making it easier for developers to understand and use these functions. refactor: Improve code readability in FoliatedTriangulation_test.cpp Code readability has been improved in the `FoliatedTriangulation_test.cpp` file. This includes better indentation, consistent naming conventions, and removing unnecessary comments or code blocks. These changes make the code easier to read and understand. --- .appveyor.yml | 1 + include/Foliated_triangulation.hpp | 28 +++++++----------- tests/Foliated_triangulation_test.cpp | 41 ++++++++++++++++----------- 3 files changed, 36 insertions(+), 34 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 4915c710c..ec6870443 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -26,6 +26,7 @@ environment: cache: - c:\Users\appveyor\AppData\Local\vcpkg\archives\ - c:\tools\vcpkg\packages\ + - c:\tools\vcpkg\installed\ install: # Setup vcpkg diff --git a/include/Foliated_triangulation.hpp b/include/Foliated_triangulation.hpp index 052945c7c..9e04c4313 100644 --- a/include/Foliated_triangulation.hpp +++ b/include/Foliated_triangulation.hpp @@ -645,7 +645,7 @@ namespace foliated_triangulations cell->vertex(j)->info()); } fmt::print("---\n"); - } + } // print_cell /// @brief Print timevalues of each vertex in the cell and the resulting /// cell->info() @@ -661,26 +661,18 @@ namespace foliated_triangulations } } // print_cells - /// @brief Write to debug log timevalues of each vertex in the cell and the - /// resulting cell->info + /// @brief Print neighboring cells /// @tparam dimension The dimensionality of the simplices - /// @param t_cells The cells to write to debug log - template - void debug_print_cells(Container&& t_cells) + /// @param cell The cell to print neighbors of + template + void print_neighboring_cells(Cell_handle_t cell) { - for (auto cells = std::forward(t_cells); - auto const& cell : cells) + for (int j = 0; j < dimension + 1; ++j) { - spdlog::debug("Cell info => {}\n", cell->info()); - for (int j = 0; j < dimension + 1; ++j) - { - spdlog::debug("Vertex({}) Point: ({}) Timevalue: {}\n", j, - utilities::point_to_str(cell->vertex(j)->point()), - cell->vertex(j)->info()); - } - spdlog::debug("---\n"); + fmt::print("Neighboring cell {}:", j); + print_cell(cell->neighbor(j)); } - } // debug_print_cells + } // print_neighboring_cells /// @brief Print edge /// @details An edge is represented by a cell and two indices which refer @@ -893,7 +885,7 @@ namespace foliated_triangulations } // j } // i return causal_vertices; - } // make_foliated_ball + } // make_foliated_ball /// @brief Make a Delaunay triangulation /// @tparam dimension Dimensionality of the Delaunay triangulation diff --git a/tests/Foliated_triangulation_test.cpp b/tests/Foliated_triangulation_test.cpp index 74c105b36..f5288d219 100644 --- a/tests/Foliated_triangulation_test.cpp +++ b/tests/Foliated_triangulation_test.cpp @@ -173,7 +173,7 @@ SCENARIO("FoliatedTriangulation free functions" * Point_t<3>{ 0, 0, 1}, Point_t<3>{RADIUS_2, RADIUS_2, RADIUS_2} }; - vector timevalues{1, 1, 1, 2}; + vector timevalues{1, 1, 1, 2}; auto vertices = make_causal_vertices<3>(Vertices, timevalues); FoliatedTriangulation_3 triangulation(vertices); auto print = [&triangulation](auto& vertex) { @@ -276,7 +276,7 @@ SCENARIO("FoliatedTriangulation free functions" * Point_t<3>{ 0, -INV_SQRT_2, INV_SQRT_2}, Point_t<3>{ 0, 0, 2} }; - vector timevalue{1, 2, 2, 2, 2, 3}; + vector timevalue{1, 2, 2, 2, 2, 3}; auto causal_vertices = make_causal_vertices<3>(vertices, timevalue); FoliatedTriangulation_3 const triangulation(causal_vertices, 0, 1); // Verify we have 6 vertices, 13 edges, 12 facets, and 4 cells @@ -377,12 +377,21 @@ SCENARIO("FoliatedTriangulation free functions" * } } } - WHEN("A container of cells is printed.") + } + WHEN("A container of cells is printed.") + { + THEN("The container is printed correctly.") { - THEN("The container is printed correctly.") - { - foliated_triangulations::print_cells<3>(triangulation.get_cells()); - } + foliated_triangulations::print_cells<3>(triangulation.get_cells()); + } + } + WHEN("We choose a cell in the triangulation.") + { + auto cell = triangulation.get_cells().at(0); + THEN("We can print it's neighbors.") + { + foliated_triangulations::print_cell<3>(cell); + foliated_triangulations::print_neighboring_cells<3>(cell); } } } @@ -416,7 +425,7 @@ SCENARIO("FoliatedTriangulation_3 initialization" * Point_t<3>{ 0, 0, 1}, Point_t<3>{RADIUS_2, RADIUS_2, RADIUS_2} }; - vector timevalues{1, 1, 1, 2}; + vector timevalues{1, 1, 1, 2}; auto vertices = make_causal_vertices<3>(Vertices, timevalues); FoliatedTriangulation_3 const triangulation(vertices); THEN("Triangulation is valid and foliated.") @@ -632,7 +641,7 @@ SCENARIO("Detecting and fixing problems with vertices and cells" * Point_t<3>{ 0, 0, 1}, Point_t<3>{RADIUS_2, RADIUS_2, RADIUS_2} }; - vector timevalues{1, 1, 1, 2}; + vector timevalues{1, 1, 1, 2}; auto vertices = make_causal_vertices<3>(Vertices, timevalues); FoliatedTriangulation_3 triangulation(vertices); THEN("No errors in the vertices are detected.") @@ -719,7 +728,7 @@ SCENARIO("Detecting and fixing problems with vertices and cells" * Point_t<3>{ 0, 0, 1}, Point_t<3>{RADIUS_2, RADIUS_2, RADIUS_2} }; - vector timevalues{1, 1, 1, std::numeric_limits::max()}; + vector timevalues{1, 1, 1, std::numeric_limits::max()}; auto causal_vertices = make_causal_vertices<3>(vertices, timevalues); FoliatedTriangulation_3 const triangulation(causal_vertices); THEN("The vertex is fixed on construction.") @@ -737,7 +746,7 @@ SCENARIO("Detecting and fixing problems with vertices and cells" * Point_t<3>{1, 0, 0}, Point_t<3>{0, 0, 1} }; - vector timevalues{0, 2, 2, 2}; + vector timevalues{0, 2, 2, 2}; auto causal_vertices = make_causal_vertices<3>(vertices, timevalues); FoliatedTriangulation_3 const triangulation(causal_vertices); THEN("The vertex is fixed on construction.") @@ -757,7 +766,7 @@ SCENARIO("Detecting and fixing problems with vertices and cells" * Point_t<3>{1, 0, 0}, Point_t<3>{0, 0, 1} }; - vector timevalues{0, 0, 2, 2}; + vector timevalues{0, 0, 2, 2}; auto causal_vertices = make_causal_vertices<3>(vertices, timevalues); FoliatedTriangulation_3 const triangulation(causal_vertices); THEN("The vertices are fixed on construction.") @@ -783,7 +792,7 @@ SCENARIO("Detecting and fixing problems with vertices and cells" * Point_t<3>{0, 0, 1}, Point_t<3>{0, 0, -1} }; - vector timevalues{1, 1, 1, 1}; + vector timevalues{1, 1, 1, 1}; auto causal_vertices = make_causal_vertices<3>(vertices, timevalues); FoliatedTriangulation_3 const triangulation(causal_vertices); THEN("The vertex error is detected.") @@ -805,7 +814,7 @@ SCENARIO("Detecting and fixing problems with vertices and cells" * Point_t<3>{2, 0, 0}, Point_t<3>{0, 3, 0} }; - vector timevalues{1, 1, 1, 2, 2, 3}; + vector timevalues{1, 1, 1, 2, 2, 3}; auto causal_vertices = make_causal_vertices<3>(vertices, timevalues); Delaunay_t<3> const delaunay_triangulation{causal_vertices.begin(), causal_vertices.end()}; @@ -866,7 +875,7 @@ SCENARIO("FoliatedTriangulation_3 functions from Delaunay3" * Point_t<3>{2, 0, 0}, Point_t<3>{0, 3, 0} }; - vector timevalues{1, 1, 1, 2, 2, 3}; + vector timevalues{1, 1, 1, 2, 2, 3}; auto causal_vertices = make_causal_vertices<3>(vertices, timevalues); FoliatedTriangulation_3 triangulation(causal_vertices); THEN("The Foliated triangulation is initially wrong.") @@ -926,7 +935,7 @@ SCENARIO("FoliatedTriangulation_3 functions from Delaunay3" * Point_t<3>{ 0, 0, 1}, Point_t<3>{RADIUS_2, RADIUS_2, RADIUS_2} }; - vector timevalues{1, 1, 1, 2}; + vector timevalues{1, 1, 1, 2}; auto causal_vertices = make_causal_vertices<3>(vertices, timevalues); FoliatedTriangulation_3 triangulation(causal_vertices); REQUIRE(triangulation.is_initialized());