From 52bc80ff7414f599dbfb6efc7808ec4c451c2d20 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Fri, 3 Jun 2022 08:33:21 -0400 Subject: [PATCH] Fix up test --- tests/bits/point_value_03.cc | 25 +++---- ....output => point_value_03.mpirun=1.output} | 0 tests/bits/point_value_03.mpirun=7.output | 69 +++++++++++++++++++ ...h_petsc_with_complex=false.mpirun=7.output | 9 --- ...th_petsc_with_complex=true.mpirun=1.output | 9 --- ...th_petsc_with_complex=true.mpirun=7.output | 9 --- 6 files changed, 80 insertions(+), 41 deletions(-) rename tests/bits/{point_value_03.with_petsc=true.with_petsc_with_complex=false.mpirun=1.output => point_value_03.mpirun=1.output} (100%) create mode 100644 tests/bits/point_value_03.mpirun=7.output delete mode 100644 tests/bits/point_value_03.with_petsc=true.with_petsc_with_complex=false.mpirun=7.output delete mode 100644 tests/bits/point_value_03.with_petsc=true.with_petsc_with_complex=true.mpirun=1.output delete mode 100644 tests/bits/point_value_03.with_petsc=true.with_petsc_with_complex=true.mpirun=7.output diff --git a/tests/bits/point_value_03.cc b/tests/bits/point_value_03.cc index 8439fb112c..738b2e8b5a 100644 --- a/tests/bits/point_value_03.cc +++ b/tests/bits/point_value_03.cc @@ -26,6 +26,7 @@ #include #include +#include #include @@ -44,7 +45,7 @@ #include "../tests.h" -using VectorType = LinearAlgebraPETSc::MPI::Vector; +using VectorType = LinearAlgebra::distributed::Vector; template class MySquareFunction : public Function @@ -129,15 +130,15 @@ check() static const MySquareFunction function; - - IndexSet locally_owned_dofs; - VectorType v; - locally_owned_dofs = dof.locally_owned_dofs(); + const IndexSet locally_owned_dofs = dof.locally_owned_dofs(); + const IndexSet locally_relevant_dofs = + DoFTools::extract_locally_relevant_dofs(dof); - v.reinit(locally_owned_dofs, MPI_COMM_WORLD); + v.reinit(locally_owned_dofs, locally_relevant_dofs, MPI_COMM_WORLD); VectorTools::interpolate(dof, function, v); + v.update_ghost_values(); // v = 1.; @@ -158,32 +159,28 @@ check() } Vector value(1); const auto & mapping = get_default_linear_mapping(tria); - GridTools::Cache cache(tria, mapping); - typename Triangulation::active_cell_iterator cell_hint{}; - std::vector marked_vertices = {}; - const double tolerance = 1.e-10; for (unsigned int i = 0; i < 3; ++i) { { bool point_in_locally_owned_cell = false; value(0) = 0; { - auto cell_and_ref_point = GridTools::find_active_cell_around_point( - cache, p[i], cell_hint, marked_vertices, tolerance); + auto cell_and_ref_point = + GridTools::find_active_cell_around_point(mapping, dof, p[i]); if (cell_and_ref_point.first.state() == IteratorState::valid) { - cell_hint = cell_and_ref_point.first; point_in_locally_owned_cell = cell_and_ref_point.first->is_locally_owned(); } } if (point_in_locally_owned_cell) { - VectorTools::point_value(dof, v, p[i], value); + VectorTools::point_value(mapping, dof, v, p[i], value); } } value(0) = Utilities::MPI::sum(value(0), MPI_COMM_WORLD); deallog << -value(0) << std::endl; + std::cout << value(0) << std::endl; Assert(std::abs(value(0) - function.value(p[i])) < 2e-4, ExcInternalError()); diff --git a/tests/bits/point_value_03.with_petsc=true.with_petsc_with_complex=false.mpirun=1.output b/tests/bits/point_value_03.mpirun=1.output similarity index 100% rename from tests/bits/point_value_03.with_petsc=true.with_petsc_with_complex=false.mpirun=1.output rename to tests/bits/point_value_03.mpirun=1.output diff --git a/tests/bits/point_value_03.mpirun=7.output b/tests/bits/point_value_03.mpirun=7.output new file mode 100644 index 0000000000..0dbd1afdc4 --- /dev/null +++ b/tests/bits/point_value_03.mpirun=7.output @@ -0,0 +1,69 @@ + +DEAL:0:2d::-1.000 +DEAL:0:2d::-1.500 +DEAL:0:2d::-1.222 +DEAL:0:2d::OK +DEAL:0:3d::-1.000 +DEAL:0:3d::-1.750 +DEAL:0:3d::-1.333 +DEAL:0:3d::OK + +DEAL:1:2d::-1.000 +DEAL:1:2d::-1.500 +DEAL:1:2d::-1.222 +DEAL:1:2d::OK +DEAL:1:3d::-1.000 +DEAL:1:3d::-1.750 +DEAL:1:3d::-1.333 +DEAL:1:3d::OK + + +DEAL:2:2d::-1.000 +DEAL:2:2d::-1.500 +DEAL:2:2d::-1.222 +DEAL:2:2d::OK +DEAL:2:3d::-1.000 +DEAL:2:3d::-1.750 +DEAL:2:3d::-1.333 +DEAL:2:3d::OK + + +DEAL:3:2d::-1.000 +DEAL:3:2d::-1.500 +DEAL:3:2d::-1.222 +DEAL:3:2d::OK +DEAL:3:3d::-1.000 +DEAL:3:3d::-1.750 +DEAL:3:3d::-1.333 +DEAL:3:3d::OK + + +DEAL:4:2d::-1.000 +DEAL:4:2d::-1.500 +DEAL:4:2d::-1.222 +DEAL:4:2d::OK +DEAL:4:3d::-1.000 +DEAL:4:3d::-1.750 +DEAL:4:3d::-1.333 +DEAL:4:3d::OK + + +DEAL:5:2d::-1.000 +DEAL:5:2d::-1.500 +DEAL:5:2d::-1.222 +DEAL:5:2d::OK +DEAL:5:3d::-1.000 +DEAL:5:3d::-1.750 +DEAL:5:3d::-1.333 +DEAL:5:3d::OK + + +DEAL:6:2d::-1.000 +DEAL:6:2d::-1.500 +DEAL:6:2d::-1.222 +DEAL:6:2d::OK +DEAL:6:3d::-1.000 +DEAL:6:3d::-1.750 +DEAL:6:3d::-1.333 +DEAL:6:3d::OK + diff --git a/tests/bits/point_value_03.with_petsc=true.with_petsc_with_complex=false.mpirun=7.output b/tests/bits/point_value_03.with_petsc=true.with_petsc_with_complex=false.mpirun=7.output deleted file mode 100644 index 2a7da639d8..0000000000 --- a/tests/bits/point_value_03.with_petsc=true.with_petsc_with_complex=false.mpirun=7.output +++ /dev/null @@ -1,9 +0,0 @@ - -DEAL:0:2d::-1.000 -DEAL:0:2d::-1.500 -DEAL:0:2d::-1.222 -DEAL:0:2d::OK -DEAL:0:3d::-1.000 -DEAL:0:3d::-1.750 -DEAL:0:3d::-1.333 -DEAL:0:3d::OK diff --git a/tests/bits/point_value_03.with_petsc=true.with_petsc_with_complex=true.mpirun=1.output b/tests/bits/point_value_03.with_petsc=true.with_petsc_with_complex=true.mpirun=1.output deleted file mode 100644 index 435c47dfb7..0000000000 --- a/tests/bits/point_value_03.with_petsc=true.with_petsc_with_complex=true.mpirun=1.output +++ /dev/null @@ -1,9 +0,0 @@ - -DEAL:0:2d::(-1.000,0.000) -DEAL:0:2d::(-1.500,0.000) -DEAL:0:2d::(-1.222,0.000) -DEAL:0:2d::OK -DEAL:0:3d::(-1.000,0.000) -DEAL:0:3d::(-1.750,0.000) -DEAL:0:3d::(-1.333,0.000) -DEAL:0:3d::OK diff --git a/tests/bits/point_value_03.with_petsc=true.with_petsc_with_complex=true.mpirun=7.output b/tests/bits/point_value_03.with_petsc=true.with_petsc_with_complex=true.mpirun=7.output deleted file mode 100644 index 435c47dfb7..0000000000 --- a/tests/bits/point_value_03.with_petsc=true.with_petsc_with_complex=true.mpirun=7.output +++ /dev/null @@ -1,9 +0,0 @@ - -DEAL:0:2d::(-1.000,0.000) -DEAL:0:2d::(-1.500,0.000) -DEAL:0:2d::(-1.222,0.000) -DEAL:0:2d::OK -DEAL:0:3d::(-1.000,0.000) -DEAL:0:3d::(-1.750,0.000) -DEAL:0:3d::(-1.333,0.000) -DEAL:0:3d::OK -- 2.39.5