From 96ca9d2287c26782e5c58523aeeab965fc16415d Mon Sep 17 00:00:00 2001 From: Pasquale Africa Date: Tue, 4 Jul 2023 19:40:41 +0000 Subject: [PATCH] Move fullydistributed_grids/tests.h to grid/ --- .../copy_distributed_tria_01.cc | 2 +- .../copy_distributed_tria_02.cc | 2 +- .../copy_distributed_tria_03.cc | 2 +- .../copy_serial_tria_01.cc | 2 +- .../copy_serial_tria_02.cc | 2 +- .../copy_serial_tria_03.cc | 2 +- .../copy_serial_tria_04.cc | 2 +- .../copy_serial_tria_05.cc | 2 +- .../copy_serial_tria_06.cc | 2 +- .../copy_serial_tria_07.cc | 2 +- .../copy_serial_tria_08.cc | 2 +- .../copy_serial_tria_09.cc | 2 +- .../copy_serial_tria_10.cc | 2 +- .../copy_serial_tria_11.cc | 2 +- .../copy_serial_tria_12.cc | 2 +- .../copy_serial_tria_grouped_01.cc | 2 +- .../memory_consumption_01.cc | 2 +- .../repartitioning_01.cc | 2 +- .../repartitioning_02.cc | 2 +- .../repartitioning_03.cc | 2 +- .../repartitioning_04.cc | 2 +- .../repartitioning_05.cc | 2 +- .../repartitioning_06.cc | 2 +- .../repartitioning_07.cc | 2 +- .../repartitioning_08.cc | 2 +- tests/fullydistributed_grids/save_load_01.cc | 2 +- .../solution_transfer_01.cc | 2 +- tests/grid/tests.h | 78 +++++++++++++++++++ 28 files changed, 105 insertions(+), 27 deletions(-) create mode 100644 tests/grid/tests.h diff --git a/tests/fullydistributed_grids/copy_distributed_tria_01.cc b/tests/fullydistributed_grids/copy_distributed_tria_01.cc index e6186debf6..73b19384a1 100644 --- a/tests/fullydistributed_grids/copy_distributed_tria_01.cc +++ b/tests/fullydistributed_grids/copy_distributed_tria_01.cc @@ -30,7 +30,7 @@ #include #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/copy_distributed_tria_02.cc b/tests/fullydistributed_grids/copy_distributed_tria_02.cc index 06335095a6..c0376fde7d 100644 --- a/tests/fullydistributed_grids/copy_distributed_tria_02.cc +++ b/tests/fullydistributed_grids/copy_distributed_tria_02.cc @@ -30,7 +30,7 @@ #include #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/copy_distributed_tria_03.cc b/tests/fullydistributed_grids/copy_distributed_tria_03.cc index ff259256e9..d207fd3ab2 100644 --- a/tests/fullydistributed_grids/copy_distributed_tria_03.cc +++ b/tests/fullydistributed_grids/copy_distributed_tria_03.cc @@ -30,7 +30,7 @@ #include #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/copy_serial_tria_01.cc b/tests/fullydistributed_grids/copy_serial_tria_01.cc index 398e860135..d698fda036 100644 --- a/tests/fullydistributed_grids/copy_serial_tria_01.cc +++ b/tests/fullydistributed_grids/copy_serial_tria_01.cc @@ -30,7 +30,7 @@ #include #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/copy_serial_tria_02.cc b/tests/fullydistributed_grids/copy_serial_tria_02.cc index 1a4bb2c713..1b6fc41024 100644 --- a/tests/fullydistributed_grids/copy_serial_tria_02.cc +++ b/tests/fullydistributed_grids/copy_serial_tria_02.cc @@ -30,7 +30,7 @@ #include #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/copy_serial_tria_03.cc b/tests/fullydistributed_grids/copy_serial_tria_03.cc index 300c207073..1e7f6a5214 100644 --- a/tests/fullydistributed_grids/copy_serial_tria_03.cc +++ b/tests/fullydistributed_grids/copy_serial_tria_03.cc @@ -31,7 +31,7 @@ #include #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/copy_serial_tria_04.cc b/tests/fullydistributed_grids/copy_serial_tria_04.cc index 5ac5d93174..4bccf5921e 100644 --- a/tests/fullydistributed_grids/copy_serial_tria_04.cc +++ b/tests/fullydistributed_grids/copy_serial_tria_04.cc @@ -30,7 +30,7 @@ #include #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/copy_serial_tria_05.cc b/tests/fullydistributed_grids/copy_serial_tria_05.cc index f896389554..c4deaef27b 100644 --- a/tests/fullydistributed_grids/copy_serial_tria_05.cc +++ b/tests/fullydistributed_grids/copy_serial_tria_05.cc @@ -31,7 +31,7 @@ #include #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/copy_serial_tria_06.cc b/tests/fullydistributed_grids/copy_serial_tria_06.cc index 726855343b..61a579ffd9 100644 --- a/tests/fullydistributed_grids/copy_serial_tria_06.cc +++ b/tests/fullydistributed_grids/copy_serial_tria_06.cc @@ -34,7 +34,7 @@ #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/copy_serial_tria_07.cc b/tests/fullydistributed_grids/copy_serial_tria_07.cc index 0b7f7e2edd..043da5f5db 100644 --- a/tests/fullydistributed_grids/copy_serial_tria_07.cc +++ b/tests/fullydistributed_grids/copy_serial_tria_07.cc @@ -30,7 +30,7 @@ #include #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/copy_serial_tria_08.cc b/tests/fullydistributed_grids/copy_serial_tria_08.cc index c5d8785987..afd7d1fa6a 100644 --- a/tests/fullydistributed_grids/copy_serial_tria_08.cc +++ b/tests/fullydistributed_grids/copy_serial_tria_08.cc @@ -30,7 +30,7 @@ #include #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/copy_serial_tria_09.cc b/tests/fullydistributed_grids/copy_serial_tria_09.cc index 96c1d64dd4..a342679cea 100644 --- a/tests/fullydistributed_grids/copy_serial_tria_09.cc +++ b/tests/fullydistributed_grids/copy_serial_tria_09.cc @@ -31,7 +31,7 @@ #include #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/copy_serial_tria_10.cc b/tests/fullydistributed_grids/copy_serial_tria_10.cc index a0a5685414..d9f3a442a9 100644 --- a/tests/fullydistributed_grids/copy_serial_tria_10.cc +++ b/tests/fullydistributed_grids/copy_serial_tria_10.cc @@ -33,7 +33,7 @@ #include #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/copy_serial_tria_11.cc b/tests/fullydistributed_grids/copy_serial_tria_11.cc index 5584d5d40d..12f42b78da 100644 --- a/tests/fullydistributed_grids/copy_serial_tria_11.cc +++ b/tests/fullydistributed_grids/copy_serial_tria_11.cc @@ -30,7 +30,7 @@ #include #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/copy_serial_tria_12.cc b/tests/fullydistributed_grids/copy_serial_tria_12.cc index d07ad85552..56d7c21a62 100644 --- a/tests/fullydistributed_grids/copy_serial_tria_12.cc +++ b/tests/fullydistributed_grids/copy_serial_tria_12.cc @@ -30,7 +30,7 @@ #include #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/copy_serial_tria_grouped_01.cc b/tests/fullydistributed_grids/copy_serial_tria_grouped_01.cc index 324bedcf01..53e1ac910f 100644 --- a/tests/fullydistributed_grids/copy_serial_tria_grouped_01.cc +++ b/tests/fullydistributed_grids/copy_serial_tria_grouped_01.cc @@ -34,7 +34,7 @@ #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/memory_consumption_01.cc b/tests/fullydistributed_grids/memory_consumption_01.cc index 0df6a307bd..9f6b9cc9e0 100644 --- a/tests/fullydistributed_grids/memory_consumption_01.cc +++ b/tests/fullydistributed_grids/memory_consumption_01.cc @@ -29,7 +29,7 @@ #include #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/repartitioning_01.cc b/tests/fullydistributed_grids/repartitioning_01.cc index 630bc2bb36..aa7b688198 100644 --- a/tests/fullydistributed_grids/repartitioning_01.cc +++ b/tests/fullydistributed_grids/repartitioning_01.cc @@ -34,7 +34,7 @@ #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/repartitioning_02.cc b/tests/fullydistributed_grids/repartitioning_02.cc index 671e117b54..9cac419836 100644 --- a/tests/fullydistributed_grids/repartitioning_02.cc +++ b/tests/fullydistributed_grids/repartitioning_02.cc @@ -34,7 +34,7 @@ #include -#include "tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/repartitioning_03.cc b/tests/fullydistributed_grids/repartitioning_03.cc index 985fc1a613..ec32f1f30d 100644 --- a/tests/fullydistributed_grids/repartitioning_03.cc +++ b/tests/fullydistributed_grids/repartitioning_03.cc @@ -37,7 +37,7 @@ #include -#include "tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/repartitioning_04.cc b/tests/fullydistributed_grids/repartitioning_04.cc index f705b2a784..34385f857d 100644 --- a/tests/fullydistributed_grids/repartitioning_04.cc +++ b/tests/fullydistributed_grids/repartitioning_04.cc @@ -37,7 +37,7 @@ #include -#include "tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/repartitioning_05.cc b/tests/fullydistributed_grids/repartitioning_05.cc index 0eaf287974..c7d97ef9b5 100644 --- a/tests/fullydistributed_grids/repartitioning_05.cc +++ b/tests/fullydistributed_grids/repartitioning_05.cc @@ -34,7 +34,7 @@ #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/repartitioning_06.cc b/tests/fullydistributed_grids/repartitioning_06.cc index 6b6ffe95a2..28b24ac13c 100644 --- a/tests/fullydistributed_grids/repartitioning_06.cc +++ b/tests/fullydistributed_grids/repartitioning_06.cc @@ -35,7 +35,7 @@ #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/repartitioning_07.cc b/tests/fullydistributed_grids/repartitioning_07.cc index 7894b08aae..1aaa5655b3 100644 --- a/tests/fullydistributed_grids/repartitioning_07.cc +++ b/tests/fullydistributed_grids/repartitioning_07.cc @@ -33,7 +33,7 @@ #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/repartitioning_08.cc b/tests/fullydistributed_grids/repartitioning_08.cc index 400a0afca7..81b53ee080 100644 --- a/tests/fullydistributed_grids/repartitioning_08.cc +++ b/tests/fullydistributed_grids/repartitioning_08.cc @@ -35,7 +35,7 @@ #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/save_load_01.cc b/tests/fullydistributed_grids/save_load_01.cc index c47123c6d0..4d5ee17fd6 100644 --- a/tests/fullydistributed_grids/save_load_01.cc +++ b/tests/fullydistributed_grids/save_load_01.cc @@ -32,7 +32,7 @@ #include -#include "./tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/fullydistributed_grids/solution_transfer_01.cc b/tests/fullydistributed_grids/solution_transfer_01.cc index 0aedae0de2..a25f7950cf 100644 --- a/tests/fullydistributed_grids/solution_transfer_01.cc +++ b/tests/fullydistributed_grids/solution_transfer_01.cc @@ -32,7 +32,7 @@ #include -#include "../tests.h" +#include "../grid/tests.h" using namespace dealii; diff --git a/tests/grid/tests.h b/tests/grid/tests.h new file mode 100644 index 0000000000..a138f5fd3c --- /dev/null +++ b/tests/grid/tests.h @@ -0,0 +1,78 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2019 - 2022 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + +#ifndef dealii_grid_tests_h +#define dealii_grid_tests_h + +#include "../tests.h" + + +template +void +print_statistics(const Triangulation &tria, bool do_mg = false) +{ + deallog << "n_levels: " << tria.n_levels() << std::endl; + deallog << "n_cells: " << tria.n_cells() << std::endl; + deallog << "n_active_cells: " << tria.n_active_cells() + << std::endl; + deallog << "has_hanging_nodes: " + << (tria.has_hanging_nodes() ? "true" : "false") << std::endl; + + if (do_mg) + { + for (auto level = 0u; level < tria.n_levels(); ++level) + deallog << "n_cells on level=" << level << ": " + << tria.n_cells(level) << std::endl; + + for (auto level = 0u; level < tria.n_levels(); ++level) + deallog << "n_active_cells on level=" << level << ": " + << tria.n_active_cells(level) << std::endl; + } + + deallog << std::endl; +} + +template +void +print_statistics(const DoFHandler &dof_handler, + bool do_mg = false) +{ + deallog << "n_dofs: " << dof_handler.n_dofs() + << std::endl; + deallog << "n_locally_owned_dofs: " + << dof_handler.n_locally_owned_dofs() << std::endl; + deallog << "has_hanging_nodes: " + << (dof_handler.get_triangulation().has_hanging_nodes() ? "true" : + "false") + << std::endl; + + const auto n_levels = dof_handler.get_triangulation().n_levels(); + + if (do_mg) + { + for (auto level = 0u; level < n_levels; ++level) + deallog << "n_dofs on level=" << level << ": " + << dof_handler.n_dofs(level) << std::endl; + + for (auto level = 0u; level < n_levels; ++level) + deallog << "n_locally_owned_mg_dofs on level=" << level << ": " + << dof_handler.locally_owned_mg_dofs(level).n_elements() + << std::endl; + } + + deallog << std::endl; +} + +#endif -- 2.39.5