Skip to content

Commit

Permalink
feat: Add cache directory to AppVeyor configuration
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
acgetchell committed Nov 6, 2023
1 parent 28e4629 commit dca7340
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 34 deletions.
1 change: 1 addition & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ environment:
cache:
- c:\Users\appveyor\AppData\Local\vcpkg\archives\
- c:\tools\vcpkg\packages\
- c:\tools\vcpkg\installed\

install:
# Setup vcpkg
Expand Down
28 changes: 10 additions & 18 deletions include/Foliated_triangulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 <int dimension, ContainerType Container>
void debug_print_cells(Container&& t_cells)
/// @param cell The cell to print neighbors of
template <int dimension>
void print_neighboring_cells(Cell_handle_t<dimension> cell)
{
for (auto cells = std::forward<Container>(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<dimension>(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
Expand Down Expand Up @@ -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
Expand Down
41 changes: 25 additions & 16 deletions tests/Foliated_triangulation_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ SCENARIO("FoliatedTriangulation free functions" *
Point_t<3>{ 0, 0, 1},
Point_t<3>{RADIUS_2, RADIUS_2, RADIUS_2}
};
vector<std::size_t> timevalues{1, 1, 1, 2};
vector<std::size_t> timevalues{1, 1, 1, 2};
auto vertices = make_causal_vertices<3>(Vertices, timevalues);
FoliatedTriangulation_3 triangulation(vertices);
auto print = [&triangulation](auto& vertex) {
Expand Down Expand Up @@ -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<size_t> timevalue{1, 2, 2, 2, 2, 3};
vector<size_t> 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
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -416,7 +425,7 @@ SCENARIO("FoliatedTriangulation_3 initialization" *
Point_t<3>{ 0, 0, 1},
Point_t<3>{RADIUS_2, RADIUS_2, RADIUS_2}
};
vector<std::size_t> timevalues{1, 1, 1, 2};
vector<std::size_t> timevalues{1, 1, 1, 2};
auto vertices = make_causal_vertices<3>(Vertices, timevalues);
FoliatedTriangulation_3 const triangulation(vertices);
THEN("Triangulation is valid and foliated.")
Expand Down Expand Up @@ -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<std::size_t> timevalues{1, 1, 1, 2};
vector<std::size_t> 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.")
Expand Down Expand Up @@ -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<std::size_t> timevalues{1, 1, 1, std::numeric_limits<int>::max()};
vector<std::size_t> timevalues{1, 1, 1, std::numeric_limits<int>::max()};
auto causal_vertices = make_causal_vertices<3>(vertices, timevalues);
FoliatedTriangulation_3 const triangulation(causal_vertices);
THEN("The vertex is fixed on construction.")
Expand All @@ -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<std::size_t> timevalues{0, 2, 2, 2};
vector<std::size_t> 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.")
Expand All @@ -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<std::size_t> timevalues{0, 0, 2, 2};
vector<std::size_t> 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.")
Expand All @@ -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<std::size_t> timevalues{1, 1, 1, 1};
vector<std::size_t> 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.")
Expand All @@ -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<std::size_t> timevalues{1, 1, 1, 2, 2, 3};
vector<std::size_t> 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()};
Expand Down Expand Up @@ -866,7 +875,7 @@ SCENARIO("FoliatedTriangulation_3 functions from Delaunay3" *
Point_t<3>{2, 0, 0},
Point_t<3>{0, 3, 0}
};
vector<std::size_t> timevalues{1, 1, 1, 2, 2, 3};
vector<std::size_t> 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.")
Expand Down Expand Up @@ -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<std::size_t> timevalues{1, 1, 1, 2};
vector<std::size_t> timevalues{1, 1, 1, 2};
auto causal_vertices = make_causal_vertices<3>(vertices, timevalues);
FoliatedTriangulation_3 triangulation(causal_vertices);
REQUIRE(triangulation.is_initialized());
Expand Down

0 comments on commit dca7340

Please sign in to comment.