From: turcksin Date: Wed, 18 Sep 2013 15:22:33 +0000 (+0000) Subject: Add a test for graph_coloring. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bafc0cc3c1abc25e3f2e15e64af9ade392869eae;p=dealii-svn.git Add a test for graph_coloring. git-svn-id: https://svn.dealii.org/trunk@30797 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/base/graph_coloring.h b/deal.II/include/deal.II/base/graph_coloring.h index 47c4a0826b..843e57f15a 100644 --- a/deal.II/include/deal.II/base/graph_coloring.h +++ b/deal.II/include/deal.II/base/graph_coloring.h @@ -28,8 +28,7 @@ DEAL_II_NAMESPACE_OPEN -// Currently graph_coloring only works for on uniform mesh, with a uniform -// order for the polynomials, and only for continuous FE. +// Currently graph_coloring only works only for continuous FE and without hp. namespace graph_coloring { /** diff --git a/tests/base/graph_coloring_01.cc b/tests/base/graph_coloring_01.cc index d53a51d32c..eaefb06b95 100644 --- a/tests/base/graph_coloring_01.cc +++ b/tests/base/graph_coloring_01.cc @@ -1,5 +1,5 @@ // --------------------------------------------------------------------- -// $Id: graph_coloring.cc 30045 2013-07-18 19:18:00Z maier $ +// $Id: graph_coloring_01.cc 30045 2013-07-18 19:18:00Z maier $ // // Copyright (C) 2003 - 2013 by the deal.II authors // diff --git a/tests/base/graph_coloring_02.cc b/tests/base/graph_coloring_02.cc new file mode 100644 index 0000000000..431d0f7f3e --- /dev/null +++ b/tests/base/graph_coloring_02.cc @@ -0,0 +1,84 @@ +// --------------------------------------------------------------------- +// $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. +// +// --------------------------------------------------------------------- + + + +// Check that graph coloring works on adapted mesh with a uniform polynomial +// order. + + +#include "../tests.h" +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +template +void check() +{ + // Create the Triangulation and the DoFHandler + Triangulation triangulation; + GridGenerator::hyper_cube(triangulation); + triangulation.refine_global(2); + FE_Q fe(2); + DoFHandler dof_handler(triangulation); + dof_handler.distribute_dofs(fe); + + // Create an adapted mesh + typename DoFHandler::active_cell_iterator + cell = dof_handler.begin_active(); + for (; cellcenter()[0]==0.625) && (cell->center()[1]==0.625)) + cell->set_refine_flag(); + } + triangulation.execute_coarsening_and_refinement(); + dof_handler.distribute_dofs(fe); + + // Create the coloring + std::vector::active_cell_iterator> > coloring( + graph_coloring::make_graph_coloring(dof_handler.begin_active(),dof_handler.end())); + + // Output the coloring + for (unsigned int color=0; colorcenter()[j]<<" "; + deallog< (); + + return 0; +} diff --git a/tests/base/graph_coloring_02/cmp/generic b/tests/base/graph_coloring_02/cmp/generic new file mode 100644 index 0000000000..2e67434274 --- /dev/null +++ b/tests/base/graph_coloring_02/cmp/generic @@ -0,0 +1,13 @@ + +DEAL::Color: 0 +DEAL::0.6250 0.3750 0.1250 0.6250 0.8750 0.8750 +DEAL::Color: 1 +DEAL::0.3750 0.6250 0.6250 0.1250 +DEAL::Color: 2 +DEAL::0.5625 0.5625 0.1250 0.1250 +DEAL::Color: 3 +DEAL::0.3750 0.1250 0.8750 0.6250 0.5625 0.6875 0.8750 0.1250 0.1250 0.8750 +DEAL::Color: 4 +DEAL::0.1250 0.3750 0.6875 0.6875 0.8750 0.3750 0.3750 0.8750 +DEAL::Color: 5 +DEAL::0.3750 0.3750 0.6875 0.5625 0.6250 0.8750