-
Notifications
You must be signed in to change notification settings - Fork 708
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
Changes from all commits
96ca9d2
ea9f882
809a0b7
4dab4bc
7e9d3d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nothing is missing, indeed :) This is actually tested in |
||
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(); | ||
} |
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:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?There was a problem hiding this comment.
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 fromfullydistributed_grids
togrids
, without modify its content.Is it fine to reference it also from other folders than
grids
?