--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2008 - 2013, 2015 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.
+//
+// ---------------------------------------------------------------------
+
+
+// Test DoFTools::locally_relevant_dofs_per_subdomain
+// using a refined shared triangulation
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/tensor.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/distributed/shared_tria.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_out.h>
+#include <deal.II/dofs/dof_handler.h>
+#include <deal.II/fe/fe_system.h>
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/fe/fe_dgq.h>
+#include <deal.II/numerics/data_out.h>
+#include <deal.II/dofs/dof_tools.h>
+
+#include <fstream>
+
+template <int dim, int spacedim>
+void write_mesh (const parallel::shared::Triangulation<dim,spacedim> &tria,
+ const char *filename_)
+{
+ DataOut<dim> data_out;
+ data_out.attach_triangulation (tria);
+ Vector<float> subdomain (tria.n_active_cells());
+ for (unsigned int i=0; i<subdomain.size(); ++i)
+ subdomain(i) = tria.locally_owned_subdomain();
+ data_out.add_data_vector (subdomain, "subdomain");
+
+ data_out.build_patches ();
+ const std::string filename = (filename_ +
+ Utilities::int_to_string
+ (tria.locally_owned_subdomain(), 4));
+ {
+ std::ofstream output ((filename + ".vtu").c_str());
+ data_out.write_vtu (output);
+ }
+}
+
+
+
+template<int dim>
+void test()
+{
+ parallel::shared::Triangulation<dim>
+ triangulation (MPI_COMM_WORLD);
+
+ FESystem<dim> fe (FE_Q<dim>(3),2,
+ FE_DGQ<dim>(1),1);
+
+ DoFHandler<dim> dof_handler (triangulation);
+
+ GridGenerator::hyper_cube(triangulation);
+ triangulation.refine_global (2);
+
+ dof_handler.distribute_dofs (fe);
+
+ //write_mesh(tr, "mesh");
+
+ const std::vector<IndexSet> locally_relevant_dofs_per_subdomain
+ = DoFTools::locally_relevant_dofs_per_subdomain (dof_handler);
+
+ deallog
+ << "locally_relevant_dofs on subdomain "
+ << triangulation.locally_owned_subdomain()
+ << ": ";
+ locally_relevant_dofs_per_subdomain[triangulation.locally_owned_subdomain()].print(deallog);
+ deallog
+ << "\n" << std::endl;
+}
+
+
+int main(int argc, char *argv[])
+{
+ Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
+ MPILogInitAll all;
+
+ deallog.push("2d");
+ test<2>();
+ deallog.pop();
+ deallog.push("3d");
+ test<3>();
+ deallog.pop();
+}
--- /dev/null
+
+DEAL:0:2d::locally_relevant_dofs on subdomain 0: {[0,182], [186,229], [274,354]}
+DEAL:0:2d::
+
+DEAL:0:3d::locally_relevant_dofs on subdomain 0: {[0,2028], [2355,2622], [2895,3011], [3133,3136], [3184,4118], [4131,4155], [4236,4241], [4246,4257], [4461,4704]}
+DEAL:0:3d::
+
+
+DEAL:1:2d::locally_relevant_dofs on subdomain 1: {[6,7], [36,43], [48,51], 65, [70,73], [88,273], 275, [278,307], [310,311], [316,319], [336,354], [357,358], [363,366], [383,401]}
+DEAL:1:2d::
+
+DEAL:1:3d::locally_relevant_dofs on subdomain 1: {[8,15], [32,47], [104,111], [140,143], [156,167], [208,215], [244,245], [258,267], [308,315], 342, [351,356], [385,392], [417,679], [684,687], [700,711], [752,759], [788,791], [804,815], [856,863], [890,891], [900,905], [934,941], [968,969], [978,985], [1014,1021], [1046,1283], [1286,1287], [1298,1303], [1336,1339], 1365, [1372,1375], [1398,1401], 1427, [1434,1439], [1462,1465], 1491, [1498,1503], [1526,1533], [1558,3217], [3220,3221], [3224,3229], [3238,3241], 3243, [3246,3249], [3256,3259], [3264,3267], [3280,3291], [3332,3339], [3366,3367], [3376,3383], [3412,3419], [3444,3715], 3717, [3720,3721], [3728,3731], 3733, [3736,3737], [3746,3747], [3756,3763], [3792,3799], [3904,4048], [4069,4076], [4101,4905]}
+DEAL:1:3d::
+
+
+
+DEAL:2:2d::locally_relevant_dofs on subdomain 2: {[4,7], [20,23], [36,43], [48,51], [64,207], [230,251], [274,401]}
+DEAL:2:2d::
+
+DEAL:2:3d::locally_relevant_dofs on subdomain 2: {[4,7], [12,15], [28,31], [44,47], [56,63], [88,95], [138,139], [142,143], [152,155], [164,167], [172,175], [192,199], [240,416], [419,420], [427,428], [437,444], [469,476], 506, [511,512], [517,520], [537,544], [573,679], [682,683], [686,687], [696,699], [708,711], [716,719], [736,743], [786,787], [790,791], [800,803], [812,815], [820,823], [840,847], [888,1045], 1047, [1052,1053], [1058,1061], [1078,1085], 1115, [1120,1121], [1126,1129], [1146,1153], [1182,1608], [1611,1612], [1619,1620], 1626, [1631,1632], [1637,1656], 1658, [1663,1664], 1670, [1675,1676], [1681,1704], [1709,1712], [1725,1728], [1737,1744], [1769,1776], [1811,1812], [1821,1824], [1829,1832], [1849,1856], [1889,2028], [2035,2036], [2065,2068], [2135,2136], [2145,2148], [2153,2156], [2173,2180], [2213,2216], [2221,2236], [2245,2260], [2293,2354], [2357,2358], [2367,2370], [2375,2378], [2395,2402], [2437,2438], [2447,2450], [2455,2458], [2475,2482], [2515,2622], [2625,2626], [2635,2638], [2643,2646], [2663,2670], [2705,2706], [2715,2718], [2723,2726], [2743,2750], [2783,4905]}
+DEAL:2:3d::
+
+