Skip to content

Commit

Permalink
Partial fix
Browse files Browse the repository at this point in the history
  • Loading branch information
schnellerhase committed Jan 2, 2025
1 parent fdcf20d commit 2c49df3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cpp/dolfinx/multigrid/inclusion.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ inclusion_mapping(const dolfinx::mesh::Mesh<T>& mesh_from,
{
std::ranges::subrange vertex_from(std::next(x_from.begin(), 3 * i),
std::next(x_from.begin(), 3 * (i + 1)));
for (std::int64_t j = 0; j < im_to.size_local() + im_to.num_ghosts(); j++)
for (std::int64_t j = 0; j < im_to.size_local(); j++) // + im_to.num_ghosts() TODO
{
std::ranges::subrange vertex_to(std::next(x_to.begin(), 3 * j),
std::next(x_to.begin(), 3 * (j + 1)));
Expand Down
26 changes: 15 additions & 11 deletions cpp/test/multigrid/inclusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ void CHECK_inclusion_map(const dolfinx::mesh::Mesh<T>& from,
if (local[0] == -1)
continue;

std::cout << "(" << from.geometry().x()[3 * local[0]] << ", "
<< from.geometry().x()[3 * local[0] + 1] << ", "
<< from.geometry().x()[3 * local[0] + 2] << ") == ("
<< global_x_to[3 * map[i]] << ", " << global_x_to[3 * map[i] + 1]
<< ", " << global_x_to[3 * map[i] + 2] << ")" << std::endl;
CHECK(std::abs(from.geometry().x()[3 * local[0]] - global_x_to[3 * map[i]])
< std::numeric_limits<T>::epsilon());
CHECK(std::abs(from.geometry().x()[3 * local[0] + 1]
Expand All @@ -74,7 +79,7 @@ void CHECK_inclusion_map(const dolfinx::mesh::Mesh<T>& from,
}

/// Performs one uniform refinement and checks the inclusion map between coarse
/// and fine mesh against the (provided) list.
/// and fine mesh.
template <std::floating_point T>
void TEST_inclusion(dolfinx::mesh::Mesh<T>&& mesh_coarse)
{
Expand All @@ -101,15 +106,14 @@ TEMPLATE_TEST_CASE("Inclusion (triangle)", "[multigrid][inclusion]", double,
float)
{
TEST_inclusion(dolfinx::mesh::create_rectangle<TestType>(
MPI_COMM_WORLD, {{{0, 0}, {1, 1}}}, {1, 1}, mesh::CellType::triangle));
MPI_COMM_WORLD, {{{0, 0}, {1, 1}}}, {2, 2}, mesh::CellType::triangle));
}

// TODO: fix!
// TEMPLATE_TEST_CASE("Inclusion (tetrahedron)", "[multigrid][inclusion]",
// double,
// float)
// {
// TEST_inclusion(dolfinx::mesh::create_box<TestType>(
// MPI_COMM_WORLD, {{{0, 0, 0}, {1, 1, 1}}}, {1, 1, 1},
// mesh::CellType::tetrahedron));
// }
TEMPLATE_TEST_CASE("Inclusion (tetrahedron)", "[multigrid][inclusion]", double,
float)
{
// TODO: n = {2, 2, 2} fails
TEST_inclusion(dolfinx::mesh::create_box<TestType>(
MPI_COMM_WORLD, {{{0, 0, 0}, {1, 1, 1}}}, {1, 1, 1},
mesh::CellType::tetrahedron));
}

0 comments on commit 2c49df3

Please sign in to comment.