Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test serialization for serial and shared triangulations #15649

Merged
merged 5 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/copy_distributed_tria_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_description.h>

#include "./tests.h"
#include "../grid/tests.h"
Copy link
Member

@peterrum peterrum Jul 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

@pcafrica pcafrica Jul 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests.h file has just been moved from fullydistributed_grids to grids, without modify its content.

Is it fine to reference it also from other folders than grids?


using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/copy_distributed_tria_02.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_description.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/copy_distributed_tria_03.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <deal.II/grid/grid_tools.h>
#include <deal.II/grid/tria.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/copy_serial_tria_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_description.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/copy_serial_tria_02.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_description.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/copy_serial_tria_03.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_description.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/copy_serial_tria_04.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_description.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/copy_serial_tria_05.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_description.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/copy_serial_tria_06.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include <deal.II/matrix_free/matrix_free.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/copy_serial_tria_07.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <deal.II/grid/grid_tools.h>
#include <deal.II/grid/tria.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/copy_serial_tria_08.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <deal.II/grid/grid_tools.h>
#include <deal.II/grid/tria.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/copy_serial_tria_09.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_description.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/copy_serial_tria_10.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_description.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/copy_serial_tria_11.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_description.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/copy_serial_tria_12.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_description.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include <boost/archive/text_oarchive.hpp>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/memory_consumption_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <deal.II/grid/grid_tools.h>
#include <deal.II/grid/tria.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/repartitioning_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include <deal.II/numerics/data_out.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/repartitioning_02.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include <deal.II/numerics/data_out.h>

#include "tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/repartitioning_03.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#include <deal.II/numerics/data_out.h>

#include "tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/repartitioning_04.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#include <deal.II/numerics/data_out.h>

#include "tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/repartitioning_05.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include <deal.II/numerics/data_out.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/repartitioning_06.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

#include <deal.II/numerics/data_out.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/repartitioning_07.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#include <deal.II/numerics/data_out.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/repartitioning_08.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

#include <deal.II/numerics/data_out.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/save_load_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#include <deal.II/lac/la_parallel_vector.h>

#include "./tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
2 changes: 1 addition & 1 deletion tests/fullydistributed_grids/solution_transfer_01.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#include <deal.II/numerics/vector_tools.h>

#include "../tests.h"
#include "../grid/tests.h"

using namespace dealii;

Expand Down
85 changes: 85 additions & 0 deletions tests/grid/save_load_01.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// ---------------------------------------------------------------------
//
// Copyright (C) 2008 - 2023 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.
//
// ---------------------------------------------------------------------



// Test Triangulation::load()/save().
// Create a triangulation, save it and load it.
// The initial and the loaded triangulations must be the same.

#include <deal.II/dofs/dof_handler.h>
#include <deal.II/dofs/dof_tools.h>

#include <deal.II/fe/fe_q.h>

#include <deal.II/grid/grid_generator.h>
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_description.h>

#include <deal.II/lac/vector.h>

#include "./tests.h"

using namespace dealii;

template <int dim, typename TriangulationType>
void
test(TriangulationType &triangulation)
{
const std::string filename = "save_load_" + std::to_string(dim) + "d_out";

triangulation.save(filename);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But here we should test vectors sometime in the future ;) What is missing for that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing is missing, indeed :)

This is actually tested in grids/serialization_01.cc.

deallog.push("save");
print_statistics(triangulation, false);
deallog.pop();

triangulation.clear();

triangulation.load(filename);
deallog.push("load");
print_statistics(triangulation, false);
deallog.pop();
}


int
main(int argc, char **argv)
{
initlog();

deallog.push("2d");
{
constexpr int dim = 2;

Triangulation<dim> triangulation;
GridGenerator::hyper_cube(triangulation);
triangulation.refine_global(3);

test<dim>(triangulation);
}
deallog.pop();

deallog.push("3d");
{
constexpr int dim = 3;

Triangulation<dim> triangulation;
GridGenerator::hyper_cube(triangulation);
triangulation.refine_global(3);

test<dim>(triangulation);
}
deallog.pop();
}
21 changes: 21 additions & 0 deletions tests/grid/save_load_01.output
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

DEAL:2d:save::n_levels: 4
DEAL:2d:save::n_cells: 85
DEAL:2d:save::n_active_cells: 64
DEAL:2d:save::has_hanging_nodes: false
DEAL:2d:save::
DEAL:2d:load::n_levels: 4
DEAL:2d:load::n_cells: 85
DEAL:2d:load::n_active_cells: 64
DEAL:2d:load::has_hanging_nodes: false
DEAL:2d:load::
DEAL:3d:save::n_levels: 4
DEAL:3d:save::n_cells: 585
DEAL:3d:save::n_active_cells: 512
DEAL:3d:save::has_hanging_nodes: false
DEAL:3d:save::
DEAL:3d:load::n_levels: 4
DEAL:3d:load::n_cells: 585
DEAL:3d:load::n_active_cells: 512
DEAL:3d:load::has_hanging_nodes: false
DEAL:3d:load::