From: Bruno Turcksin Date: Wed, 18 Sep 2013 21:09:09 +0000 (+0000) Subject: Add test for graph_coloring. X-Git-Tag: v8.1.0~771 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=309abafdf00bad1fa62df01d1b3fce38f61c4f17;p=dealii.git Add test for graph_coloring. git-svn-id: https://svn.dealii.org/trunk@30809 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 843e57f15a..f21b407a90 100644 --- a/deal.II/include/deal.II/base/graph_coloring.h +++ b/deal.II/include/deal.II/base/graph_coloring.h @@ -1,8 +1,8 @@ // --------------------------------------------------------------------- -// $Id: work_stream.h 30494 2013-08-26 10:04:44Z kronbichler $ +// $Id: graph_coloring.h 30494 2013-08-26 10:04:44Z kronbichler $ // -// Copyright (C) 2008 - 2013 by the deal.II authors +// Copyright (C) 2013 by the deal.II authors // // This file is part of the deal.II library. // @@ -28,7 +28,7 @@ DEAL_II_NAMESPACE_OPEN -// Currently graph_coloring only works only for continuous FE and without hp. +// Currently graph_coloring only works only for continuous FE. namespace graph_coloring { /** diff --git a/tests/base/graph_coloring_03.cc b/tests/base/graph_coloring_03.cc new file mode 100644 index 0000000000..92f889ebf5 --- /dev/null +++ b/tests/base/graph_coloring_03.cc @@ -0,0 +1,86 @@ +// --------------------------------------------------------------------- +// $Id: graph_coloring_03.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 hp-mesh. + + +#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); + hp::FECollection fe_collection; + for (unsigned int degree=1; degree<4; ++degree) + fe_collection.push_back(FE_Q(degree)); + hp::DoFHandler dof_handler(triangulation); + typename hp::DoFHandler::active_cell_iterator + cell = dof_handler.begin_active(); + for (unsigned int degree=1; cell!=dof_handler.end(); ++cell,++degree) + cell->set_active_fe_index(degree%3); + dof_handler.distribute_dofs(fe_collection); + + // Create an adapted mesh + for (cell=dof_handler.begin_active(); cellcenter()[0]==0.625) && (cell->center()[1]==0.625)) + cell->set_refine_flag(); + + triangulation.execute_coarsening_and_refinement(); + dof_handler.distribute_dofs(fe_collection); + + // 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_03/cmp/generic b/tests/base/graph_coloring_03/cmp/generic new file mode 100644 index 0000000000..2e67434274 --- /dev/null +++ b/tests/base/graph_coloring_03/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