From: bangerth Date: Mon, 11 Nov 2013 00:43:42 +0000 (+0000) Subject: Add another test. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2397f8b820edff121ba9c65843521cecffcc292e;p=dealii-svn.git Add another test. git-svn-id: https://svn.dealii.org/trunk@31614 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/base/graph_coloring_06.cc b/tests/base/graph_coloring_06.cc new file mode 100644 index 0000000000..d8ea3f24cb --- /dev/null +++ b/tests/base/graph_coloring_06.cc @@ -0,0 +1,100 @@ +// --------------------------------------------------------------------- +// $Id: graph_coloring_02.cc 30045 2013-07-18 19:18:00Z maier $ +// +// Copyright (C) 2003 - 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. +// +// --------------------------------------------------------------------- + + + +// Output the sizes of colors + + +#include "../tests.h" +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +template +std::vector get_conflict_indices_cfem( + typename DoFHandler::active_cell_iterator const &it) +{ + std::vector local_dof_indices(it->get_fe().dofs_per_cell); + it->get_dof_indices(local_dof_indices); + + return local_dof_indices; +} + +template +void check() +{ + deallog << "dim=" << dim << std::endl; + + // Create the Triangulation and the DoFHandler + Triangulation triangulation; + GridGenerator::hyper_cube(triangulation, -1, 1); + triangulation.refine_global(2); + FE_Q fe(2); + DoFHandler dof_handler(triangulation); + dof_handler.distribute_dofs(fe); + + // Create an adapted mesh + for (unsigned int l=0; l<11-2*dim; ++l) + { + typename DoFHandler::active_cell_iterator + cell = dof_handler.begin_active(); + for (; cellcenter().distance (Point()) < cell->diameter()) + cell->set_refine_flag(); + triangulation.execute_coarsening_and_refinement(); + } + dof_handler.distribute_dofs(fe); + + deallog << "Total number of cells = " << triangulation.n_active_cells() + << std::endl; + + // Create the coloring + std::vector::active_cell_iterator> > + coloring + = GraphColoring::make_graph_coloring(dof_handler.begin_active(), + dof_handler.end(), + std_cxx1x::function + (typename DoFHandler::active_cell_iterator const &)> + (&get_conflict_indices_cfem)); + + for (unsigned int color=0; color (); + check<2> (); + check<3> (); + + return 0; +} diff --git a/tests/base/graph_coloring_06.output b/tests/base/graph_coloring_06.output new file mode 100644 index 0000000000..3cf0fd2476 --- /dev/null +++ b/tests/base/graph_coloring_06.output @@ -0,0 +1,37 @@ + +DEAL::dim=1 +DEAL::Total number of cells = 22 +DEAL::11 +DEAL::11 +DEAL::dim=2 +DEAL::Total number of cells = 100 +DEAL::12 +DEAL::12 +DEAL::10 +DEAL::13 +DEAL::13 +DEAL::13 +DEAL::13 +DEAL::14 +DEAL::dim=3 +DEAL::Total number of cells = 1184 +DEAL::67 +DEAL::58 +DEAL::46 +DEAL::45 +DEAL::64 +DEAL::67 +DEAL::63 +DEAL::57 +DEAL::55 +DEAL::55 +DEAL::65 +DEAL::69 +DEAL::54 +DEAL::65 +DEAL::59 +DEAL::64 +DEAL::63 +DEAL::64 +DEAL::54 +DEAL::50