From 1c9067a9be42bd5b2342645aabffc16392691cd8 Mon Sep 17 00:00:00 2001 From: heister Date: Mon, 2 Sep 2013 18:51:39 +0000 Subject: [PATCH] simplify (failing) test git-svn-id: https://svn.dealii.org/trunk@30549 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/mpi/mg_05.cc | 164 ++++++++++++++++++++++++++++ tests/mpi/mg_05/ncpu_10/cmp/generic | 39 +++++++ 2 files changed, 203 insertions(+) create mode 100644 tests/mpi/mg_05.cc create mode 100644 tests/mpi/mg_05/ncpu_10/cmp/generic diff --git a/tests/mpi/mg_05.cc b/tests/mpi/mg_05.cc new file mode 100644 index 0000000000..a4880bbefb --- /dev/null +++ b/tests/mpi/mg_05.cc @@ -0,0 +1,164 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2009 - 2013 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 at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + + +// simplify test to show bug: missing level dofs: +/* +An error occurred in line <126> of file in function + void test() [with int dim = 2] +The violated condition was: + cell->neighbor(f)->level_subdomain_id()<100 +The name and call sequence of the exception was: + ExcInternalError() +Additional Information: +(none) +*/ + +#include "../tests.h" +#include "coarse_grid_common.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +template +void output(parallel::distributed::Triangulation &tr) +{ + const std::string filename = ("mg_05/mesh." + + Utilities::int_to_string + (tr.locally_owned_subdomain(), 4) + + ".svg"); + std::ofstream stream(filename.c_str()); + /* + GridOutFlags::XFig flags; + flags.color_by = GridOutFlags::XFig::level_subdomain_id; + GridOut out; + out.set_flags(flags); + + out.write_xfig(tr, stream); + */ + GridOut grid_out; + GridOutFlags::Svg svg_flags; + svg_flags.coloring = GridOutFlags::Svg::subdomain_id; + svg_flags.label_material_id = false; + svg_flags.label_level_number = false; + svg_flags.label_cell_index = false; + svg_flags.label_subdomain_id = false; + svg_flags.label_level_subdomain_id = true; + svg_flags.background = GridOutFlags::Svg::transparent; + svg_flags.polar_angle = 60; + svg_flags.convert_level_number_to_height = true; + grid_out.set_flags(svg_flags); + grid_out.write_svg(tr, stream); + + +} + +template +void test() +{ + unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); + + parallel::distributed::Triangulation tr(MPI_COMM_WORLD, + Triangulation::none, + parallel::distributed::Triangulation::construct_multigrid_hierarchy); + GridGenerator::hyper_cube(tr); + tr.refine_global(3); + + for (unsigned int ii=0;ii<5;++ii) + { + typename Triangulation::active_cell_iterator + cell = tr.begin_active(), + endc = tr.end(); + + for (; cell!=endc; ++cell) + if (std::rand()%42==1) + cell->set_refine_flag (); + + tr.execute_coarsening_and_refinement (); + + DoFHandler dofh(tr); + + //output(tr); + + static const FE_Q fe(1); + dofh.distribute_dofs (fe); + dofh.distribute_mg_dofs (fe); + + { + for (unsigned int lvl=0; lvl::cell_iterator + cell = dofh.begin(lvl), + endc = dofh.end(lvl); + + for (; cell!=endc; ++cell) + { + if (cell->level_subdomain_id()!=tr.locally_owned_subdomain()) + continue; + for (unsigned int f=0;f::faces_per_cell;++f) + { + if (cell->at_boundary(f)) + continue; + + deallog << cell->neighbor(f)->level_subdomain_id() << std::endl; + // is cell level-artificial? + Assert(cell->neighbor(f)->level_subdomain_id()<100, ExcInternalError()); + + std::vector dofs(fe.n_dofs_per_cell()); + cell->neighbor(f)->get_mg_dof_indices(dofs); + for (unsigned int i=0;i(); + deallog.pop(); +} diff --git a/tests/mpi/mg_05/ncpu_10/cmp/generic b/tests/mpi/mg_05/ncpu_10/cmp/generic new file mode 100644 index 0000000000..0f6b464ff2 --- /dev/null +++ b/tests/mpi/mg_05/ncpu_10/cmp/generic @@ -0,0 +1,39 @@ + +DEAL:0:2d::hyper_cube +DEAL:0:2d::level 0: - - - - | +DEAL:0:2d::OK + +DEAL:1:2d::level 0: 0 1 2 3 | +DEAL:1:2d::level 1: 0 1 2 3 | 1 4 3 5 | 2 3 6 7 | 3 5 7 8 | +DEAL:1:2d::level 2: 0 1 2 3 | 1 4 3 5 | 2 3 6 7 | 3 5 7 8 | 4 9 5 10 | 9 - 10 - | 5 10 8 13 | 10 - 13 - | 6 7 15 16 | 7 8 16 17 | 15 16 - - | 16 17 - - | 8 13 17 21 | 13 - 21 - | 17 21 - - | 21 - - - | + + +DEAL:2:2d::level 0: - - - - | + + +DEAL:3:2d::level 0: 0 1 2 3 | +DEAL:3:2d::level 1: 0 1 2 3 | 1 4 3 5 | 2 3 6 7 | 3 5 7 8 | +DEAL:3:2d::level 2: - 1 - 3 | 1 4 3 5 | - 3 - 7 | 3 5 7 8 | 4 9 5 10 | 9 11 10 12 | 5 10 8 13 | 10 12 13 14 | - 7 - 16 | 7 8 16 17 | - 16 - - | 16 17 - - | 8 13 17 21 | 13 14 21 22 | 17 21 - - | 21 22 - - | + + +DEAL:4:2d::level 0: - - - - | + + +DEAL:5:2d::level 0: - - - - | + + +DEAL:6:2d::level 0: 0 1 2 3 | +DEAL:6:2d::level 1: 0 1 2 3 | 1 4 3 5 | 2 3 6 7 | 3 5 7 8 | +DEAL:6:2d::level 2: - - 2 3 | - - 3 5 | 2 3 6 7 | 3 5 7 8 | - - 5 10 | - - 10 - | 5 10 8 13 | 10 - 13 - | 6 7 15 16 | 7 8 16 17 | 15 16 18 19 | 16 17 19 20 | 8 13 17 21 | 13 - 21 - | 17 21 20 23 | 21 - 23 - | + + +DEAL:7:2d::level 0: - - - - | + + +DEAL:8:2d::level 0: 0 1 2 3 | +DEAL:8:2d::level 1: 0 1 2 3 | 1 4 3 5 | 2 3 6 7 | 3 5 7 8 | +DEAL:8:2d::level 2: - - - 3 | - - 3 5 | - 3 - 7 | 3 5 7 8 | - - 5 10 | - - 10 12 | 5 10 8 13 | 10 12 13 14 | - 7 - 16 | 7 8 16 17 | - 16 - 19 | 16 17 19 20 | 8 13 17 21 | 13 14 21 22 | 17 21 20 23 | 21 22 23 24 | + + +DEAL:9:2d::level 0: - - - - | + -- 2.39.5