From 3f8f767b03525c2e157d898bd0d14915fd43252e Mon Sep 17 00:00:00 2001 From: heister Date: Fri, 14 Oct 2011 15:09:11 +0000 Subject: [PATCH] new test for Triangulation::load()/save() that fails git-svn-id: https://svn.dealii.org/trunk@24600 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/mpi/p4est_save_03.cc | 205 ++++++++++++++++++++ tests/mpi/p4est_save_03/ncpu_10/cmp/generic | 10 + tests/mpi/p4est_save_03/ncpu_4/cmp/generic | 10 + 3 files changed, 225 insertions(+) create mode 100644 tests/mpi/p4est_save_03.cc create mode 100644 tests/mpi/p4est_save_03/ncpu_10/cmp/generic create mode 100644 tests/mpi/p4est_save_03/ncpu_4/cmp/generic diff --git a/tests/mpi/p4est_save_03.cc b/tests/mpi/p4est_save_03.cc new file mode 100644 index 0000000000..03fbbdcdde --- /dev/null +++ b/tests/mpi/p4est_save_03.cc @@ -0,0 +1,205 @@ +//--------------------------------------------------------------------------- +// $Id: p4est_2d_refine_02.cc 23906 2011-07-01 14:59:13Z bangerth $ +// Version: $Name$ +// +// Copyright (C) 2009, 2010, 2011 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//--------------------------------------------------------------------------- + + +// save and load a triangulation with two solution vectors +// crashes right now + +#include "../tests.h" +#include "coarse_grid_common.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + + +#include + +#include + + + +template +void test() +{ + unsigned int myid = Utilities::System::get_this_mpi_process (MPI_COMM_WORLD); + + if (Utilities::System::get_this_mpi_process (MPI_COMM_WORLD) == 0) + deallog << "hyper_cube" << std::endl; + + std::string filename = + (std::string("p4est_save_03/ncpu_") + Utilities::int_to_string(Utilities::System::get_n_mpi_processes (MPI_COMM_WORLD)) + "/dat"); + { + parallel::distributed::Triangulation tr(MPI_COMM_WORLD); + + GridGenerator::hyper_cube(tr); + + tr.refine_global(2); + for (typename Triangulation::active_cell_iterator + cell = tr.begin_active(); + cell != tr.end(); ++cell) + if (!cell->is_ghost() && !cell->is_artificial()) + if (cell->center().norm() < 0.3) + { + cell->set_refine_flag(); + } + + tr.execute_coarsening_and_refinement (); + + FE_Q fe(1); + DoFHandler dh(tr); + + dh.distribute_dofs(fe); + + IndexSet locally_owned_dofs = dh.locally_owned_dofs (); + IndexSet locally_relevant_dofs; + + DoFTools::extract_locally_relevant_dofs (dh,locally_relevant_dofs); + + PETScWrappers::MPI::Vector solution(MPI_COMM_WORLD,locally_owned_dofs,locally_relevant_dofs); + PETScWrappers::MPI::Vector solution2(MPI_COMM_WORLD,locally_owned_dofs,locally_relevant_dofs); + + parallel::distributed::SolutionTransfer soltrans(dh); + parallel::distributed::SolutionTransfer soltrans2(dh); + + for (unsigned int i=0;i tr(MPI_COMM_WORLD); + + GridGenerator::hyper_cube(tr); + tr.load(filename.c_str()); + FE_Q fe(1); + DoFHandler dh(tr); + + dh.distribute_dofs(fe); + + IndexSet locally_owned_dofs = dh.locally_owned_dofs (); + IndexSet locally_relevant_dofs; + + DoFTools::extract_locally_relevant_dofs (dh,locally_relevant_dofs); + + PETScWrappers::MPI::Vector solution(MPI_COMM_WORLD,locally_owned_dofs); + PETScWrappers::MPI::Vector solution2(MPI_COMM_WORLD,locally_owned_dofs); + parallel::distributed::SolutionTransfer soltrans(dh); + parallel::distributed::SolutionTransfer soltrans2(dh); + solution = 2; + soltrans.deserialize(solution); + soltrans2.deserialize(solution2); + + for (unsigned int i=0;i(); + deallog.pop(); + } + else + test<2>(); + + +#ifdef DEAL_II_COMPILER_SUPPORTS_MPI + //MPI_Finalize(); + PetscFinalize(); + +#endif +} diff --git a/tests/mpi/p4est_save_03/ncpu_10/cmp/generic b/tests/mpi/p4est_save_03/ncpu_10/cmp/generic new file mode 100644 index 0000000000..8b71035d8d --- /dev/null +++ b/tests/mpi/p4est_save_03/ncpu_10/cmp/generic @@ -0,0 +1,10 @@ + +DEAL:0:2d::hyper_cube +DEAL:0:2d::#cells = 19 +DEAL:0:2d::cells(0) = 1 +DEAL:0:2d::Checksum: 136119115 +DEAL:0:2d::#cells = 19 +DEAL:0:2d::cells(0) = 1 +DEAL:0:2d::Checksum: 136119115 +DEAL:0:2d::sum: 435.000 +DEAL:0:2d::OK diff --git a/tests/mpi/p4est_save_03/ncpu_4/cmp/generic b/tests/mpi/p4est_save_03/ncpu_4/cmp/generic new file mode 100644 index 0000000000..d6287bcc89 --- /dev/null +++ b/tests/mpi/p4est_save_03/ncpu_4/cmp/generic @@ -0,0 +1,10 @@ + +DEAL:0:2d::hyper_cube +DEAL:0:2d::#cells = 19 +DEAL:0:2d::cells(0) = 10 +DEAL:0:2d::Checksum: 136119115 +DEAL:0:2d::#cells = 19 +DEAL:0:2d::cells(0) = 10 +DEAL:0:2d::Checksum: 136119115 +DEAL:0:2d::sum: 435.000 +DEAL:0:2d::OK -- 2.39.5