From: Timo Heister Date: Mon, 9 Sep 2013 21:37:53 +0000 (+0000) Subject: add new test for multigrid an slit geometry X-Git-Tag: v8.1.0~839 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b1abc2605c2e124e3547b49bd9a93b0197efb52;p=dealii.git add new test for multigrid an slit geometry git-svn-id: https://svn.dealii.org/trunk@30663 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/mpi/mg_06.cc b/tests/mpi/mg_06.cc new file mode 100644 index 0000000000..107bc7a331 --- /dev/null +++ b/tests/mpi/mg_06.cc @@ -0,0 +1,165 @@ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- + + + +// test to show bug when using hyper_cube_slit: +/* +An error occurred in line <1858> of file in function + void dealii::internal::DoFHandler::Policy::{anonymous}::communicate_mg_dof_indices_on_marked_cells(const dealii::DoFHandler&, const std::map >&, const std::vector&, const std::vector&, unsigned int) [with int dim = 2, int spacedim = 2] +The violated condition was: + senders.find(status.MPI_SOURCE)!=senders.end() +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_06/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_slit(tr,-1,1); + tr.refine_global(2); + + for (unsigned int ii=0;ii<15;++ii) + { + deallog << "loop " << ii << std::endl; + + 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_06/ncpu_7/cmp/generic b/tests/mpi/mg_06/ncpu_7/cmp/generic new file mode 100644 index 0000000000..f0286f9afd --- /dev/null +++ b/tests/mpi/mg_06/ncpu_7/cmp/generic @@ -0,0 +1,119 @@ + +DEAL:0:2d::loop 0 +DEAL:0:2d::loop 1 +DEAL:0:2d::loop 2 +DEAL:0:2d::loop 3 +DEAL:0:2d::loop 4 +DEAL:0:2d::loop 5 +DEAL:0:2d::loop 6 +DEAL:0:2d::loop 7 +DEAL:0:2d::loop 8 +DEAL:0:2d::loop 9 +DEAL:0:2d::loop 10 +DEAL:0:2d::loop 11 +DEAL:0:2d::loop 12 +DEAL:0:2d::loop 13 +DEAL:0:2d::loop 14 +DEAL:0:2d::OK + +DEAL:1:2d::loop 0 +DEAL:1:2d::loop 1 +DEAL:1:2d::loop 2 +DEAL:1:2d::loop 3 +DEAL:1:2d::loop 4 +DEAL:1:2d::loop 5 +DEAL:1:2d::loop 6 +DEAL:1:2d::loop 7 +DEAL:1:2d::loop 8 +DEAL:1:2d::loop 9 +DEAL:1:2d::loop 10 +DEAL:1:2d::loop 11 +DEAL:1:2d::loop 12 +DEAL:1:2d::loop 13 +DEAL:1:2d::loop 14 + + +DEAL:2:2d::loop 0 +DEAL:2:2d::loop 1 +DEAL:2:2d::loop 2 +DEAL:2:2d::loop 3 +DEAL:2:2d::loop 4 +DEAL:2:2d::loop 5 +DEAL:2:2d::loop 6 +DEAL:2:2d::loop 7 +DEAL:2:2d::loop 8 +DEAL:2:2d::loop 9 +DEAL:2:2d::loop 10 +DEAL:2:2d::loop 11 +DEAL:2:2d::loop 12 +DEAL:2:2d::loop 13 +DEAL:2:2d::loop 14 + + +DEAL:3:2d::loop 0 +DEAL:3:2d::loop 1 +DEAL:3:2d::loop 2 +DEAL:3:2d::loop 3 +DEAL:3:2d::loop 4 +DEAL:3:2d::loop 5 +DEAL:3:2d::loop 6 +DEAL:3:2d::loop 7 +DEAL:3:2d::loop 8 +DEAL:3:2d::loop 9 +DEAL:3:2d::loop 10 +DEAL:3:2d::loop 11 +DEAL:3:2d::loop 12 +DEAL:3:2d::loop 13 +DEAL:3:2d::loop 14 + + +DEAL:4:2d::loop 0 +DEAL:4:2d::loop 1 +DEAL:4:2d::loop 2 +DEAL:4:2d::loop 3 +DEAL:4:2d::loop 4 +DEAL:4:2d::loop 5 +DEAL:4:2d::loop 6 +DEAL:4:2d::loop 7 +DEAL:4:2d::loop 8 +DEAL:4:2d::loop 9 +DEAL:4:2d::loop 10 +DEAL:4:2d::loop 11 +DEAL:4:2d::loop 12 +DEAL:4:2d::loop 13 +DEAL:4:2d::loop 14 + + +DEAL:5:2d::loop 0 +DEAL:5:2d::loop 1 +DEAL:5:2d::loop 2 +DEAL:5:2d::loop 3 +DEAL:5:2d::loop 4 +DEAL:5:2d::loop 5 +DEAL:5:2d::loop 6 +DEAL:5:2d::loop 7 +DEAL:5:2d::loop 8 +DEAL:5:2d::loop 9 +DEAL:5:2d::loop 10 +DEAL:5:2d::loop 11 +DEAL:5:2d::loop 12 +DEAL:5:2d::loop 13 +DEAL:5:2d::loop 14 + + +DEAL:6:2d::loop 0 +DEAL:6:2d::loop 1 +DEAL:6:2d::loop 2 +DEAL:6:2d::loop 3 +DEAL:6:2d::loop 4 +DEAL:6:2d::loop 5 +DEAL:6:2d::loop 6 +DEAL:6:2d::loop 7 +DEAL:6:2d::loop 8 +DEAL:6:2d::loop 9 +DEAL:6:2d::loop 10 +DEAL:6:2d::loop 11 +DEAL:6:2d::loop 12 +DEAL:6:2d::loop 13 +DEAL:6:2d::loop 14 +