From 4bcec1f74919bfd9dd983ecce413888470660226 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 10 Jul 2017 15:16:33 -0600 Subject: [PATCH] Add some more converted tests. --- ...cally_relevant_dofs_per_subdomain_01_hp.cc | 107 ++++++++++++ ...main_01_hp.with_metis=true.mpirun=3.output | 23 +++ ...in_01_hp.with_metis=true.mpirun=3.output.2 | 23 +++ ...in_01_hp.with_metis=true.mpirun=3.output.3 | 23 +++ ...in_01_hp.with_metis=true.mpirun=3.output.4 | 23 +++ .../locally_owned_dofs_per_subdomain_hp.cc | 63 +++++++ ...wned_dofs_per_subdomain_hp.mpirun=2.output | 19 ++ .../integrate_difference_04_hp.cc | 164 ++++++++++++++++++ ...linos=true.with_metis=true.mpirun=1.output | 20 +++ ...linos=true.with_metis=true.mpirun=3.output | 62 +++++++ 10 files changed, 527 insertions(+) create mode 100644 tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.cc create mode 100644 tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.with_metis=true.mpirun=3.output create mode 100644 tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.with_metis=true.mpirun=3.output.2 create mode 100644 tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.with_metis=true.mpirun=3.output.3 create mode 100644 tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.with_metis=true.mpirun=3.output.4 create mode 100644 tests/mpi/locally_owned_dofs_per_subdomain_hp.cc create mode 100644 tests/mpi/locally_owned_dofs_per_subdomain_hp.mpirun=2.output create mode 100644 tests/vector_tools/integrate_difference_04_hp.cc create mode 100644 tests/vector_tools/integrate_difference_04_hp.with_trilinos=true.with_metis=true.mpirun=1.output create mode 100644 tests/vector_tools/integrate_difference_04_hp.with_trilinos=true.with_metis=true.mpirun=3.output diff --git a/tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.cc b/tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.cc new file mode 100644 index 0000000000..4808cdbd14 --- /dev/null +++ b/tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.cc @@ -0,0 +1,107 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2008 - 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 +// +// like the test without _hp, but for a hp::DoFHandler + +#include "../tests.h" +#include +#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); + + hp::FECollection fe; + fe.push_back (FESystem (FE_Q(3),2, + FE_DGQ(1),1)); + + hp::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_hp.with_metis=true.mpirun=3.output b/tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.with_metis=true.mpirun=3.output new file mode 100644 index 0000000000..522808a53b --- /dev/null +++ b/tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.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:: + + diff --git a/tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.with_metis=true.mpirun=3.output.2 b/tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.with_metis=true.mpirun=3.output.2 new file mode 100644 index 0000000000..b0ead8fc73 --- /dev/null +++ b/tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.with_metis=true.mpirun=3.output.2 @@ -0,0 +1,23 @@ + +DEAL:0:2d::locally_relevant_dofs on subdomain 0: {[0,150], 152, [155,156], [159,160], [169,172], [187,188], [197,200], [213,275], [280,283], [296,299], 313, [320,323], [336,401]} +DEAL:0:2d:: + +DEAL:0:3d::locally_relevant_dofs on subdomain 0: {[0,2554], [2659,2665], [2674,2687], [2813,2815], [2818,2823], [2860,3030], [3097,3099], [3102,3107], [3202,3724], [3728,3730], [3733,3738], [3743,4012], [4027,4029], [4032,4037], [4206,4211], [4216,4227], [4410,4533], [4658,4781]} +DEAL:0:3d:: + + +DEAL:1:2d::locally_relevant_dofs on subdomain 1: {[0,5], [7,9], [12,33], [62,67], [84,275], [278,279], [282,283], [288,291], [312,335], 338, [343,346], [363,379], 381, [386,387]} +DEAL:1:2d:: + +DEAL:1:3d::locally_relevant_dofs on subdomain 1: {[0,1497], [1569,3455], [3465,3650], [3713,4595], [4658,4843]} +DEAL:1:3d:: + + + +DEAL:2:2d::locally_relevant_dofs on subdomain 2: {[0,103], [151,184], [213,232], [255,256], [276,401]} +DEAL:2:2d:: + +DEAL:2:3d::locally_relevant_dofs on subdomain 2: {[6,7], 12, [53,56], [131,132], 134, [143,146], [151,152], [157,160], [177,184], [221,226], [231,238], [241,252], [261,276], [313,383], [385,387], [390,391], [394,395], [404,405], [460,461], [464,465], [474,477], [484,485], [490,493], [510,517], [556,557], [560,561], [570,573], [582,585], [590,593], [610,617], [658,811], [814,815], [820,835], [840,843], [860,875], [900,1695], 1698, 1704, [1709,1710], [1715,1716], [1719,1722], [1727,1734], [1736,1738], [1741,1742], [1745,1746], [1751,1752], [1765,1780], [1785,1788], [1805,1820], [1845,1868], [1877,1900], [1925,1983], [1986,1987], [1992,2007], [2010,2011], [2024,2039], [2064,2237], [2240,2245], [2250,2253], [2258,2261], [2266,2277], [2286,2293], [2302,2309], [2342,2554], [2557,2562], [2567,2570], [2575,2578], [2583,2594], [2603,2610], [2619,2626], [2659,4905]} +DEAL:2:3d:: + + diff --git a/tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.with_metis=true.mpirun=3.output.3 b/tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.with_metis=true.mpirun=3.output.3 new file mode 100644 index 0000000000..83e9cb9946 --- /dev/null +++ b/tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.with_metis=true.mpirun=3.output.3 @@ -0,0 +1,23 @@ + +DEAL:0:2d::locally_relevant_dofs on subdomain 0: {[0,150], 152, [155,156], [159,160], [169,172], [187,188], [197,200], [213,275], [280,283], [296,299], 313, [320,323], [336,401]} +DEAL:0:2d:: + +DEAL:0:3d::locally_relevant_dofs on subdomain 0: {[0,1717], [1730,1738], [1748,1780], [1808,2000], [2081,2142], [2205,2284], [2365,2426], [2489,2834], [3021,3082], [3269,3565], [3670,3749], [3830,3897], [3966,4018], [4072,4453], [4694,4746]} +DEAL:0:3d:: + + +DEAL:1:2d::locally_relevant_dofs on subdomain 1: {[0,5], [7,9], [12,33], [62,67], [84,275], [278,279], [282,283], [288,291], [312,335], 338, [343,346], [363,379], 381, [386,387]} +DEAL:1:2d:: + +DEAL:1:3d::locally_relevant_dofs on subdomain 1: {[8,13], [30,43], [100,107], [134,135], [146,151], [184,187], [215,217], [230,239], [278,285], 311, [316,319], [338,341], [366,537], [541,543], [554,563], [598,605], [633,635], [646,655], [690,697], [722,3272], [3275,3276], [3279,3284], [3293,3296], [3298,3300], 3304, [3309,3312], [3323,3461], [3466,3469], [3482,3493], [3534,3541], [3570,3573], [3586,3597], [3638,3645], [3672,3673], [3682,3689], [3718,3725], [3752,3753], [3762,3769], [3798,3805], [3830,4071], 4073, [4076,4077], [4086,4087], [4096,4103], [4132,4139], 4165, [4168,4169], [4178,4179], [4188,4195], [4224,4231], [4256,4373], [4376,4377], [4386,4393], [4422,4429], [4456,4457], [4466,4473], [4502,4509], [4536,4537], [4546,4553], [4582,4589], [4616,4617], [4626,4633], [4662,4669], [4694,4905]} +DEAL:1:3d:: + + + +DEAL:2:2d::locally_relevant_dofs on subdomain 2: {[0,103], [151,184], [213,232], [255,256], [276,401]} +DEAL:2:2d:: + +DEAL:2:3d::locally_relevant_dofs on subdomain 2: {[0,1106], [1403,1544], [1687,1890], [1921,2204], [2489,2630], [2773,3020], [3269,4905]} +DEAL:2:3d:: + + diff --git a/tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.with_metis=true.mpirun=3.output.4 b/tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.with_metis=true.mpirun=3.output.4 new file mode 100644 index 0000000000..70002dd561 --- /dev/null +++ b/tests/dofs/locally_relevant_dofs_per_subdomain_01_hp.with_metis=true.mpirun=3.output.4 @@ -0,0 +1,23 @@ + +DEAL:0:2d::locally_relevant_dofs on subdomain 0: {[0,124], [129,132], [145,148], [163,164], [173,176], [189,231], 233, [240,243], [256,273], 275, [306,312], [317,320], [333,401]} +DEAL:0:2d:: + +DEAL:0:3d::locally_relevant_dofs on subdomain 0: {[0,1921], [1925,2048], [2067,2472], [2553,2614], [2677,2685], [2695,2703], [2713,2774], [2961,3022], [3209,3453], [3638,3772], [3912,4059], [4220,4231], [4338,4506], [4640,4772]} +DEAL:0:3d:: + + +DEAL:1:2d::locally_relevant_dofs on subdomain 1: {[0,53], [104,105], [125,376]} +DEAL:1:2d:: + +DEAL:1:3d::locally_relevant_dofs on subdomain 1: {[2,3], [6,7], [10,11], [14,15], [20,23], [36,39], [52,55], [60,63], [72,79], [136,238], 240, 242, [247,250], [257,260], [265,266], [275,282], [327,392], [395,396], [399,400], [405,408], [421,424], [429,432], [441,448], [497,570], 572, [577,580], [585,586], [595,602], [639,1055], [1058,1059], [1062,1063], [1068,1071], [1084,1087], [1092,1095], [1104,1111], [1160,1227], 1229, [1234,1237], [1242,1243], [1252,1259], [1296,1342], [1345,1346], [1349,1350], [1355,1358], [1371,1374], [1379,1382], [1391,1398], [1447,1514], 1516, [1521,1524], [1529,1530], [1539,1546], [1583,3208], 3210, 3212, [3219,3220], [3225,3235], 3237, [3242,3243], [3248,3271], [3274,3275], [3278,3279], [3284,3287], [3296,3299], [3308,3311], [3320,3327], [3376,3453], [3456,3457], [3460,3461], [3466,3469], [3478,3481], [3490,3493], [3502,3509], [3558,3637], [3640,3641], [3646,3649], [3658,3661], [3670,3677], [3718,3772], [3775,3776], [3781,3784], [3793,3796], [3805,3812], [3853,4337], 4339, [4344,4345], [4350,4355], 4357, [4362,4363], [4368,4373], [4376,4377], [4382,4385], [4394,4397], [4406,4413], [4454,4506], [4509,4510], [4515,4518], [4527,4530], [4539,4546], [4587,4639], [4642,4643], [4648,4651], [4660,4663], [4672,4679], [4720,4772], [4775,4776], [4781,4784], [4793,4796], [4805,4812], [4853,4905]} +DEAL:1:3d:: + + + +DEAL:2:2d::locally_relevant_dofs on subdomain 2: {1, [4,5], [8,9], [14,17], [34,53], [56,57], [62,65], [82,124], [131,132], [161,168], [173,176], 190, [195,198], [213,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, [151,154], [163,166], [171,174], [191,198], [239,392], [397,400], [413,416], [425,432], [457,464], 498, [505,508], [513,514], [531,538], [571,685], 688, 691, [700,703], [712,713], [718,719], [736,743], 786, 789, [798,799], [808,809], [814,815], [832,835], [876,931], 933, [938,939], [944,945], [962,965], 995, [1000,1001], [1006,1007], [1024,1027], [1060,1063], [1076,1079], [1088,1095], [1120,1127], 1161, [1168,1171], [1174,1175], [1188,1195], [1228,1342], [1347,1350], [1363,1366], [1375,1382], [1407,1414], 1448, [1455,1458], [1461,1462], [1475,1482], [1515,1633], 1635, [1638,1752], 1754, [1759,1766], 1772, [1777,1784], [1789,2066], 2068, [2073,2074], [2079,2087], 2089, [2094,2095], [2100,2108], [2111,2112], [2121,2124], [2129,2132], [2149,2156], [2269,2332], [2337,2344], [2353,2360], [2395,2396], [2405,2408], [2413,2416], [2433,2440], [2553,2614], [2677,3022], [3085,3146], [3209,4905]} +DEAL:2:3d:: + + diff --git a/tests/mpi/locally_owned_dofs_per_subdomain_hp.cc b/tests/mpi/locally_owned_dofs_per_subdomain_hp.cc new file mode 100644 index 0000000000..68a072828a --- /dev/null +++ b/tests/mpi/locally_owned_dofs_per_subdomain_hp.cc @@ -0,0 +1,63 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2016 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. +// +// --------------------------------------------------------------------- + + +// DoFTools::locally_owned_dofs_per_subdomain wrongly sized the array +// it returns when we have some processors that don't own any cells +// +// like the test without _hp, but for a hp::DoFHandler + +#include "../tests.h" +#include +#include +#include +#include +#include + + +template +void test () +{ + parallel::shared::Triangulation triangulation(MPI_COMM_WORLD); + GridGenerator::hyper_cube(triangulation, -1.0, 1.0); + + hp::FECollection fe; + fe.push_back (FE_Q (1)); + hp::DoFHandler dof_handler (triangulation); + dof_handler.distribute_dofs(fe); + + // this used to crash here: + const IndexSet locally_owned_dofs = dof_handler.locally_owned_dofs(); + + deallog << "dim=" << dim + << std::endl + << "rank=" << Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) + << std::endl + << " n_dofs=" << dof_handler.n_dofs() + << std::endl + << " n_locally_owned_dofs=" + << locally_owned_dofs.n_elements() + << std::endl; +} + +int main (int argc, char **argv) +{ + Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, testing_max_num_threads()); + + MPILogInitAll all; + + test<2>(); + test<3>(); +} diff --git a/tests/mpi/locally_owned_dofs_per_subdomain_hp.mpirun=2.output b/tests/mpi/locally_owned_dofs_per_subdomain_hp.mpirun=2.output new file mode 100644 index 0000000000..481ba49a0d --- /dev/null +++ b/tests/mpi/locally_owned_dofs_per_subdomain_hp.mpirun=2.output @@ -0,0 +1,19 @@ + +DEAL:0::dim=2 +DEAL:0::rank=0 +DEAL:0:: n_dofs=4 +DEAL:0:: n_locally_owned_dofs=4 +DEAL:0::dim=3 +DEAL:0::rank=0 +DEAL:0:: n_dofs=8 +DEAL:0:: n_locally_owned_dofs=8 + +DEAL:1::dim=2 +DEAL:1::rank=1 +DEAL:1:: n_dofs=4 +DEAL:1:: n_locally_owned_dofs=0 +DEAL:1::dim=3 +DEAL:1::rank=1 +DEAL:1:: n_dofs=8 +DEAL:1:: n_locally_owned_dofs=0 + diff --git a/tests/vector_tools/integrate_difference_04_hp.cc b/tests/vector_tools/integrate_difference_04_hp.cc new file mode 100644 index 0000000000..2cad4420dc --- /dev/null +++ b/tests/vector_tools/integrate_difference_04_hp.cc @@ -0,0 +1,164 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2003 - 2016 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 integrate_difference and compute_global_error in parallel +// see integrate_difference_02.cc for the serial version +// +// like the test without _hp, but for a hp::DoFHandler + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace dealii; + + +// x+y+z, x^2+y^2, z+xy +// div = 1+2y+1 +template +class Ref : public Function +{ +public: + Ref() + :Function(dim) + {} + + double value (const Point &p, const unsigned int c) const + { + if (c==0) + return p[0]+p[1]+((dim==3)?p[2]:0.0); + if (c==1) + return p[0]*p[0]+p[1]*p[1]; + if (c==2) + return p[2]+p[0]*p[1]; + return 0.0; + } +}; + + + +template +void test(VectorTools::NormType norm, double value, double exp = 2.0) +{ + parallel::shared::Triangulation tria(MPI_COMM_WORLD); + GridGenerator::hyper_cube(tria); + tria.refine_global(3); + + hp::FECollection fe; + fe.push_back (FESystem (FE_Q(4),dim)); + hp::DoFHandler dofh(tria); + dofh.distribute_dofs(fe); + + TrilinosWrappers::MPI::Vector interpolated(dofh.locally_owned_dofs(), + MPI_COMM_WORLD); + + VectorTools::interpolate(dofh, Ref(), interpolated); + + IndexSet relevant_set; + DoFTools::extract_locally_relevant_dofs (dofh, relevant_set); + TrilinosWrappers::MPI::Vector solution(relevant_set, MPI_COMM_WORLD); + solution = interpolated; + + Vector cellwise_errors (tria.n_active_cells()); + hp::QCollection quadrature; + quadrature.push_back (QIterated (QTrapez<1>(), 5)); + + const dealii::Function *w = nullptr; + VectorTools::integrate_difference (dofh, + solution, + ZeroFunction(dim), + cellwise_errors, + quadrature, + norm, + w, + exp); + + const double error + = VectorTools::compute_global_error(tria, cellwise_errors, norm, exp); + + const double difference = std::abs(error-value); + deallog << "computed: " << error + << " expected: " << value + << " difference: " << difference + << std::endl; + Assert(difference<2e-3, ExcMessage("Error in integrate_difference")); +} + +template +void test() +{ + deallog << "Hdiv_seminorm:" << std::endl; + // sqrt(\int (div f)^2 = sqrt(\int (1+2y+1)^2) + test(VectorTools::Hdiv_seminorm, 2.0*std::sqrt(7.0/3.0)); + + deallog << "L2_norm:" << std::endl; + // sqrt(\int_\Omega f^2) = sqrt(\int (x+y+z)^2+(x^2+y^2)^2+(z+xy)^2) + test(VectorTools::L2_norm, std::sqrt(229.0/60.0)); + + deallog << "H1_seminorm:" << std::endl; + // sqrt( \int sum_k | d/dxi f_k |_0^2 ) + // = sqrt( \int 3+ (2x)^2+(2y)^2 + y^2+x^2+1 + // = sqrt( 22/3 ) + test(VectorTools::H1_seminorm, std::sqrt(22.0/3.0)); + + deallog << "H1_norm:" << std::endl; + test(VectorTools::H1_norm, std::sqrt(229.0/60.0+22.0/3.0)); + + deallog << "L1_norm:" << std::endl; + test(VectorTools::L1_norm, 35.0/12.0); + + deallog << "Linfty_norm:" << std::endl; + test(VectorTools::Linfty_norm, 3.0); + + deallog << "mean:" << std::endl; + // int -(x+y+z + x^2+y^2 + z+xy) + test(VectorTools::mean, -35.0/12.0); + + deallog << "Lp_norm:" << std::endl; + // (int (x+y+z)^p+(x^2+y^2)^p+(z+xy)^p) ) ^ 1./p + // = std::pow(9937.0/1680.0, 1.0/3.0) + test(VectorTools::Lp_norm, std::pow(9937.0/1680.0, 1.0/3.0), 3.0); + + deallog << "W1p_seminorm:" << std::endl; + // ( \int_K sum_k | d/dxi f_k |_0^2^(p/2) )^1/p + // ( integrate 3^(3/2) + ((2x)^2+(2y)^2)^(3/2) + (y^2+x^2+1)^(3/2) ) ^1/p + // = (12.4164) ^1/3 = 2.31560 + test(VectorTools::W1p_seminorm, 2.31560, 3.0); + + deallog << "OK" << std::endl; +} + + +int main (int argc, char **argv) +{ + Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, 1); + MPILogInitAll log; + test<3>(); +} diff --git a/tests/vector_tools/integrate_difference_04_hp.with_trilinos=true.with_metis=true.mpirun=1.output b/tests/vector_tools/integrate_difference_04_hp.with_trilinos=true.with_metis=true.mpirun=1.output new file mode 100644 index 0000000000..d207d6bd50 --- /dev/null +++ b/tests/vector_tools/integrate_difference_04_hp.with_trilinos=true.with_metis=true.mpirun=1.output @@ -0,0 +1,20 @@ + +DEAL:0::Hdiv_seminorm: +DEAL:0::computed: 3.05512 expected: 3.05505 difference: 6.81923e-05 +DEAL:0::L2_norm: +DEAL:0::computed: 1.95390 expected: 1.95363 difference: 0.000266581 +DEAL:0::H1_seminorm: +DEAL:0::computed: 2.70821 expected: 2.70801 difference: 0.000192324 +DEAL:0::H1_norm: +DEAL:0::computed: 3.33947 expected: 3.33916 difference: 0.000311941 +DEAL:0::L1_norm: +DEAL:0::computed: 2.91688 expected: 2.91667 difference: 0.000208333 +DEAL:0::Linfty_norm: +DEAL:0::computed: 3.00000 expected: 3.00000 difference: 0.00000 +DEAL:0::mean: +DEAL:0::computed: -2.91688 expected: -2.91667 difference: 0.000208333 +DEAL:0::Lp_norm: +DEAL:0::computed: 1.80879 expected: 1.80849 difference: 0.000304641 +DEAL:0::W1p_seminorm: +DEAL:0::computed: 2.31582 expected: 2.31560 difference: 0.000216381 +DEAL:0::OK diff --git a/tests/vector_tools/integrate_difference_04_hp.with_trilinos=true.with_metis=true.mpirun=3.output b/tests/vector_tools/integrate_difference_04_hp.with_trilinos=true.with_metis=true.mpirun=3.output new file mode 100644 index 0000000000..0039dfb2b8 --- /dev/null +++ b/tests/vector_tools/integrate_difference_04_hp.with_trilinos=true.with_metis=true.mpirun=3.output @@ -0,0 +1,62 @@ + +DEAL:0::Hdiv_seminorm: +DEAL:0::computed: 3.05512 expected: 3.05505 difference: 6.81923e-05 +DEAL:0::L2_norm: +DEAL:0::computed: 1.95390 expected: 1.95363 difference: 0.000266581 +DEAL:0::H1_seminorm: +DEAL:0::computed: 2.70821 expected: 2.70801 difference: 0.000192324 +DEAL:0::H1_norm: +DEAL:0::computed: 3.33947 expected: 3.33916 difference: 0.000311941 +DEAL:0::L1_norm: +DEAL:0::computed: 2.91688 expected: 2.91667 difference: 0.000208333 +DEAL:0::Linfty_norm: +DEAL:0::computed: 3.00000 expected: 3.00000 difference: 0.00000 +DEAL:0::mean: +DEAL:0::computed: -2.91688 expected: -2.91667 difference: 0.000208333 +DEAL:0::Lp_norm: +DEAL:0::computed: 1.80879 expected: 1.80849 difference: 0.000304641 +DEAL:0::W1p_seminorm: +DEAL:0::computed: 2.31582 expected: 2.31560 difference: 0.000216381 +DEAL:0::OK + +DEAL:1::Hdiv_seminorm: +DEAL:1::computed: 3.05512 expected: 3.05505 difference: 6.81923e-05 +DEAL:1::L2_norm: +DEAL:1::computed: 1.95390 expected: 1.95363 difference: 0.000266581 +DEAL:1::H1_seminorm: +DEAL:1::computed: 2.70821 expected: 2.70801 difference: 0.000192324 +DEAL:1::H1_norm: +DEAL:1::computed: 3.33947 expected: 3.33916 difference: 0.000311941 +DEAL:1::L1_norm: +DEAL:1::computed: 2.91688 expected: 2.91667 difference: 0.000208333 +DEAL:1::Linfty_norm: +DEAL:1::computed: 3.00000 expected: 3.00000 difference: 0.00000 +DEAL:1::mean: +DEAL:1::computed: -2.91688 expected: -2.91667 difference: 0.000208333 +DEAL:1::Lp_norm: +DEAL:1::computed: 1.80879 expected: 1.80849 difference: 0.000304641 +DEAL:1::W1p_seminorm: +DEAL:1::computed: 2.31582 expected: 2.31560 difference: 0.000216381 +DEAL:1::OK + + +DEAL:2::Hdiv_seminorm: +DEAL:2::computed: 3.05512 expected: 3.05505 difference: 6.81923e-05 +DEAL:2::L2_norm: +DEAL:2::computed: 1.95390 expected: 1.95363 difference: 0.000266581 +DEAL:2::H1_seminorm: +DEAL:2::computed: 2.70821 expected: 2.70801 difference: 0.000192324 +DEAL:2::H1_norm: +DEAL:2::computed: 3.33947 expected: 3.33916 difference: 0.000311941 +DEAL:2::L1_norm: +DEAL:2::computed: 2.91688 expected: 2.91667 difference: 0.000208333 +DEAL:2::Linfty_norm: +DEAL:2::computed: 3.00000 expected: 3.00000 difference: 0.00000 +DEAL:2::mean: +DEAL:2::computed: -2.91688 expected: -2.91667 difference: 0.000208333 +DEAL:2::Lp_norm: +DEAL:2::computed: 1.80879 expected: 1.80849 difference: 0.000304641 +DEAL:2::W1p_seminorm: +DEAL:2::computed: 2.31582 expected: 2.31560 difference: 0.000216381 +DEAL:2::OK + -- 2.39.5