From 4c65d902d746469399cca98e8a3e484d11911998 Mon Sep 17 00:00:00 2001 From: heister Date: Tue, 29 Apr 2014 22:36:03 +0000 Subject: [PATCH] test number_cache for shared_tria git-svn-id: https://svn.dealii.org/branches/branch_sharedtria@32859 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/sharedtria/dof_01.cc | 151 ++++++++++++++++++++++++ tests/sharedtria/dof_01.mpirun=3.output | 16 +++ tests/sharedtria/dof_01.output | 16 +++ 3 files changed, 183 insertions(+) create mode 100644 tests/sharedtria/dof_01.cc create mode 100644 tests/sharedtria/dof_01.mpirun=3.output create mode 100644 tests/sharedtria/dof_01.output diff --git a/tests/sharedtria/dof_01.cc b/tests/sharedtria/dof_01.cc new file mode 100644 index 0000000000..e844631cec --- /dev/null +++ b/tests/sharedtria/dof_01.cc @@ -0,0 +1,151 @@ +// --------------------------------------------------------------------- +// $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 + +#include "../tests.h" +#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); + + 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_01.mpirun=3.output b/tests/sharedtria/dof_01.mpirun=3.output new file mode 100644 index 0000000000..892356f24e --- /dev/null +++ b/tests/sharedtria/dof_01.mpirun=3.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: 1874 +DEAL:0:2d::n_locally_owned_dofs: 1874 +DEAL:0:2d::n_locally_owned_dofs_per_processor: 1874 sum: 1874 +DEAL:0:2d::n_dofs: 2800 +DEAL:0:2d::n_locally_owned_dofs: 2800 +DEAL:0:2d::n_locally_owned_dofs_per_processor: 2800 sum: 2800 +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: 42960 +DEAL:0:3d::n_locally_owned_dofs: 42960 +DEAL:0:3d::n_locally_owned_dofs_per_processor: 42960 sum: 42960 diff --git a/tests/sharedtria/dof_01.output b/tests/sharedtria/dof_01.output new file mode 100644 index 0000000000..d0742843fd --- /dev/null +++ b/tests/sharedtria/dof_01.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 -- 2.39.5