From: Jean-Paul Pelteret Date: Fri, 25 Sep 2015 15:59:08 +0000 (+0200) Subject: Added test for DoFTools::locally_relevant_dofs_per_subdomain. X-Git-Tag: v8.4.0-rc2~358^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1671%2Fhead;p=dealii.git Added test for DoFTools::locally_relevant_dofs_per_subdomain. Note: Usual caveats wrt. METIS apply here (see https://github.com/dealii/dealii/pull/1412). --- diff --git a/tests/dofs/locally_relevant_dofs_per_subdomain_01.cc b/tests/dofs/locally_relevant_dofs_per_subdomain_01.cc new file mode 100644 index 0000000000..562a8dc221 --- /dev/null +++ b/tests/dofs/locally_relevant_dofs_per_subdomain_01.cc @@ -0,0 +1,103 @@ +// --------------------------------------------------------------------- +// +// 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +template +void write_mesh (const parallel::shared::Triangulation &tria, + const char *filename_) +{ + DataOut data_out; + data_out.attach_triangulation (tria); + Vector subdomain (tria.n_active_cells()); + for (unsigned int i=0; i +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); + + dof_handler.distribute_dofs (fe); + + //write_mesh(tr, "mesh"); + + const std::vector 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(); +} diff --git a/tests/dofs/locally_relevant_dofs_per_subdomain_01.with_metis=true.mpirun=3.output b/tests/dofs/locally_relevant_dofs_per_subdomain_01.with_metis=true.mpirun=3.output new file mode 100644 index 0000000000..522808a53b --- /dev/null +++ b/tests/dofs/locally_relevant_dofs_per_subdomain_01.with_metis=true.mpirun=3.output @@ -0,0 +1,23 @@ + +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:: + +