From 8134ec919ebd5977c2f7409c9f6912b99cf6ccd8 Mon Sep 17 00:00:00 2001 From: bangerth Date: Sun, 24 Oct 2010 19:40:28 +0000 Subject: [PATCH] Make sure we don't even try to refine anisotropically in case of distributed meshes. git-svn-id: https://svn.dealii.org/trunk@22463 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/distributed/tria.cc | 10 +++ tests/distributed_grids/anisotropic.cc | 79 +++++++++++++++++++ .../distributed_grids/anisotropic/cmp/generic | 70 ++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 tests/distributed_grids/anisotropic.cc create mode 100644 tests/distributed_grids/anisotropic/cmp/generic diff --git a/deal.II/deal.II/source/distributed/tria.cc b/deal.II/deal.II/source/distributed/tria.cc index dfcdf874f7..479041b782 100644 --- a/deal.II/deal.II/source/distributed/tria.cc +++ b/deal.II/deal.II/source/distributed/tria.cc @@ -2469,6 +2469,16 @@ namespace parallel cell->clear_refine_flag (); cell->clear_coarsen_flag (); } + else + // if this is a cell we do + // own, make sure they are + // not refined + // anisotropically since we + // don't support this + if (cell->refine_flag_set()) + Assert (cell->refine_flag_set() == + RefinementPossibilities::isotropic_refinement, + ExcMessage ("This class does not support anisotropic refinement")); diff --git a/tests/distributed_grids/anisotropic.cc b/tests/distributed_grids/anisotropic.cc new file mode 100644 index 0000000000..b08cd16bd0 --- /dev/null +++ b/tests/distributed_grids/anisotropic.cc @@ -0,0 +1,79 @@ +//--------------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2008, 2009, 2010 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. +// +//--------------------------------------------------------------------------- + + +// Test that anisotropic refinement really doesn't work + +#include "../tests.h" +#include "coarse_grid_common.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +template +void test(std::ostream& /*out*/) +{ + parallel::distributed::Triangulation tr(MPI_COMM_WORLD); + + GridGenerator::hyper_cube(tr); + tr.begin_active()->set_refine_flag(RefinementCase::cut_x); + + try + { + tr.execute_coarsening_and_refinement (); + } + catch (const ExcMessage &e) + { + deallog << "Caught exception:" << std::endl; + deallog << e.what() << std::endl; + } +} + + +int main(int argc, char *argv[]) +{ +#ifdef DEAL_II_COMPILER_SUPPORTS_MPI + MPI_Init (&argc,&argv); +#else + (void)argc; + (void)argv; +#endif + + std::ofstream logfile("2d_refinement_01/output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + // we want to catch exceptions + // instead of aborting the program + deal_II_exceptions::disable_abort_on_exception(); + + deallog.push("2d"); + test<2>(logfile); + deallog.pop(); + deallog.push("2d"); + test<3>(logfile); + deallog.pop(); + +#ifdef DEAL_II_COMPILER_SUPPORTS_MPI + MPI_Finalize(); +#endif +} diff --git a/tests/distributed_grids/anisotropic/cmp/generic b/tests/distributed_grids/anisotropic/cmp/generic new file mode 100644 index 0000000000..16cc49d4ae --- /dev/null +++ b/tests/distributed_grids/anisotropic/cmp/generic @@ -0,0 +1,70 @@ + +DEAL:2d::Checksum: 167510149 + + + + + + + + + + + + + + + + + + + + + + + 1.25000002e-02 1.25000002e-02 0.00000000e+00 + 4.87500012e-01 1.25000002e-02 0.00000000e+00 + 1.25000002e-02 4.87500012e-01 0.00000000e+00 + 4.87500012e-01 4.87500012e-01 0.00000000e+00 + 5.12499988e-01 1.25000002e-02 0.00000000e+00 + 9.87500012e-01 1.25000002e-02 0.00000000e+00 + 5.12499988e-01 4.87500012e-01 0.00000000e+00 + 9.87500012e-01 4.87500012e-01 0.00000000e+00 + 1.25000002e-02 5.12499988e-01 0.00000000e+00 + 4.87500012e-01 5.12499988e-01 0.00000000e+00 + 1.25000002e-02 9.87500012e-01 0.00000000e+00 + 4.87500012e-01 9.87500012e-01 0.00000000e+00 + 5.12499988e-01 5.12499988e-01 0.00000000e+00 + 9.87500012e-01 5.12499988e-01 0.00000000e+00 + 5.12499988e-01 9.87500012e-01 0.00000000e+00 + 9.87500012e-01 9.87500012e-01 0.00000000e+00 + + + + + 0 1 2 3 + 4 5 6 7 + 8 9 10 11 + 12 13 14 15 + + + 4 8 12 16 + + + 8 8 8 8 + + + + + 0 0 0 0 + + + 0 0 0 0 + + + + + + + + -- 2.39.5