From: heister Date: Tue, 29 Apr 2014 22:59:43 +0000 (+0000) Subject: test sharedtria: renumbering X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e1792aa904310dd523ab1b654616ff762276a3e;p=dealii-svn.git test sharedtria: renumbering git-svn-id: https://svn.dealii.org/branches/branch_sharedtria@32861 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/sharedtria/dof_02.cc b/tests/sharedtria/dof_02.cc new file mode 100644 index 0000000000..9eb546b0fd --- /dev/null +++ b/tests/sharedtria/dof_02.cc @@ -0,0 +1,153 @@ +// --------------------------------------------------------------------- +// $Id: dof_handler_number_cache.cc 31761 2013-11-22 14:42:37Z heister $ +// +// Copyright (C) 2008 - 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. +// +// --------------------------------------------------------------------- + + + +// check number cache for shared_tria with renumbering + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +template +void test() +{ + parallel::shared::Triangulation + triangulation (MPI_COMM_WORLD); + + FESystem fe (FE_Q(3),2, + FE_DGQ(1),1); + + DoFHandler dof_handler (triangulation); + + GridGenerator::hyper_cube(triangulation); + triangulation.refine_global (2); + + const unsigned int n_refinements[] = { 0, 4, 3, 2 }; + for (unsigned int i=0; i flags (triangulation.n_active_cells(), false); + for (unsigned int k=0; k::active_cell_iterator + cell = triangulation.begin_active(); + cell != triangulation.end(); ++cell) + { + if (flags[index]) + cell->set_refine_flag(); + ++index; + } + + Assert (index <= triangulation.n_active_cells(), ExcInternalError()); + + // flag all other cells for coarsening + // (this should ensure that at least + // some of them will actually be + // coarsened) + index=0; + for (typename Triangulation::active_cell_iterator + cell = triangulation.begin_active(); + cell != triangulation.end(); ++cell) + { + if (!flags[index]) + cell->set_coarsen_flag(); + ++index; + } + + triangulation.execute_coarsening_and_refinement (); + dof_handler.distribute_dofs (fe); + DoFRenumbering::component_wise(dof_handler); + + deallog + << "n_dofs: " << dof_handler.n_dofs() << std::endl + << "n_locally_owned_dofs: " << dof_handler.n_locally_owned_dofs() << std::endl; + + deallog << "n_locally_owned_dofs_per_processor: "; + std::vector v = dof_handler.n_locally_owned_dofs_per_processor(); + unsigned int sum = 0; + for (unsigned int i=0;i(); + deallog.pop(); + + deallog.push("3d"); + test<3>(); + deallog.pop(); +} diff --git a/tests/sharedtria/dof_02.mpirun=3.output b/tests/sharedtria/dof_02.mpirun=3.output new file mode 100644 index 0000000000..2a1c50622f --- /dev/null +++ b/tests/sharedtria/dof_02.mpirun=3.output @@ -0,0 +1,50 @@ + +DEAL:0:2d::n_dofs: 818 +DEAL:0:2d::n_locally_owned_dofs: 818 +DEAL:0:2d::n_locally_owned_dofs_per_processor: 289 232 297 sum: 818 +DEAL:0:2d::n_dofs: 1754 +DEAL:0:2d::n_locally_owned_dofs: 1754 +DEAL:0:2d::n_locally_owned_dofs_per_processor: 566 607 581 sum: 1754 +DEAL:0:2d::n_dofs: 3056 +DEAL:0:2d::n_locally_owned_dofs: 3056 +DEAL:0:2d::n_locally_owned_dofs_per_processor: 1018 992 1046 sum: 3056 +DEAL:0:3d::n_dofs: 13282 +DEAL:0:3d::n_locally_owned_dofs: 13282 +DEAL:0:3d::n_locally_owned_dofs_per_processor: 4428 4262 4592 sum: 13282 +DEAL:0:3d::n_dofs: 41826 +DEAL:0:3d::n_locally_owned_dofs: 41826 +DEAL:0:3d::n_locally_owned_dofs_per_processor: 13741 14200 13885 sum: 41826 + +DEAL:1:2d::n_dofs: 818 +DEAL:1:2d::n_locally_owned_dofs: 818 +DEAL:1:2d::n_locally_owned_dofs_per_processor: 289 232 297 sum: 818 +DEAL:1:2d::n_dofs: 1754 +DEAL:1:2d::n_locally_owned_dofs: 1754 +DEAL:1:2d::n_locally_owned_dofs_per_processor: 566 607 581 sum: 1754 +DEAL:1:2d::n_dofs: 3056 +DEAL:1:2d::n_locally_owned_dofs: 3056 +DEAL:1:2d::n_locally_owned_dofs_per_processor: 1018 992 1046 sum: 3056 +DEAL:1:3d::n_dofs: 13282 +DEAL:1:3d::n_locally_owned_dofs: 13282 +DEAL:1:3d::n_locally_owned_dofs_per_processor: 4428 4262 4592 sum: 13282 +DEAL:1:3d::n_dofs: 41826 +DEAL:1:3d::n_locally_owned_dofs: 41826 +DEAL:1:3d::n_locally_owned_dofs_per_processor: 13741 14200 13885 sum: 41826 + + +DEAL:2:2d::n_dofs: 818 +DEAL:2:2d::n_locally_owned_dofs: 818 +DEAL:2:2d::n_locally_owned_dofs_per_processor: 289 232 297 sum: 818 +DEAL:2:2d::n_dofs: 1754 +DEAL:2:2d::n_locally_owned_dofs: 1754 +DEAL:2:2d::n_locally_owned_dofs_per_processor: 566 607 581 sum: 1754 +DEAL:2:2d::n_dofs: 3056 +DEAL:2:2d::n_locally_owned_dofs: 3056 +DEAL:2:2d::n_locally_owned_dofs_per_processor: 1018 992 1046 sum: 3056 +DEAL:2:3d::n_dofs: 13282 +DEAL:2:3d::n_locally_owned_dofs: 13282 +DEAL:2:3d::n_locally_owned_dofs_per_processor: 4428 4262 4592 sum: 13282 +DEAL:2:3d::n_dofs: 41826 +DEAL:2:3d::n_locally_owned_dofs: 41826 +DEAL:2:3d::n_locally_owned_dofs_per_processor: 13741 14200 13885 sum: 41826 + diff --git a/tests/sharedtria/dof_02.output b/tests/sharedtria/dof_02.output new file mode 100644 index 0000000000..d0742843fd --- /dev/null +++ b/tests/sharedtria/dof_02.output @@ -0,0 +1,16 @@ + +DEAL:0:2d::n_dofs: 818 +DEAL:0:2d::n_locally_owned_dofs: 818 +DEAL:0:2d::n_locally_owned_dofs_per_processor: 818 sum: 818 +DEAL:0:2d::n_dofs: 1754 +DEAL:0:2d::n_locally_owned_dofs: 1754 +DEAL:0:2d::n_locally_owned_dofs_per_processor: 1754 sum: 1754 +DEAL:0:2d::n_dofs: 3056 +DEAL:0:2d::n_locally_owned_dofs: 3056 +DEAL:0:2d::n_locally_owned_dofs_per_processor: 3056 sum: 3056 +DEAL:0:3d::n_dofs: 13282 +DEAL:0:3d::n_locally_owned_dofs: 13282 +DEAL:0:3d::n_locally_owned_dofs_per_processor: 13282 sum: 13282 +DEAL:0:3d::n_dofs: 41826 +DEAL:0:3d::n_locally_owned_dofs: 41826 +DEAL:0:3d::n_locally_owned_dofs_per_processor: 41826 sum: 41826