From: Wolfgang Bangerth Date: Tue, 15 Aug 2017 17:20:38 +0000 (-0600) Subject: Add a test. X-Git-Tag: v9.0.0-rc1~1237^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=caa675281b13b621f7ef2a3f89899a3f1204762c;p=dealii.git Add a test. --- diff --git a/tests/sharedtria/tria_custom_refine01_cxx11.cc b/tests/sharedtria/tria_custom_refine01_cxx11.cc new file mode 100644 index 0000000000..a8e8bda186 --- /dev/null +++ b/tests/sharedtria/tria_custom_refine01_cxx11.cc @@ -0,0 +1,89 @@ +// --------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------- + + +// create a shared tria mesh and distribute with a custom function +// +// this is like the tria_custom_refine01 test except that it attaches +// a lambda function rather than a (bound) function pointer to the +// signal + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include + + + +template +void test() +{ + parallel::shared::Triangulation shared_tria(MPI_COMM_WORLD,typename Triangulation::MeshSmoothing + (Triangulation::limit_level_difference_at_vertices), true, + parallel::shared::Triangulation::partition_custom_signal); + shared_tria.signals.post_refinement.connect ([&shared_tria]() + { + const unsigned int nproc = Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD); + + typename Triangulation::active_cell_iterator + cell = shared_tria.begin_active(); + for (unsigned int i=0; i < shared_tria.n_active_cells(); ++i) + { + unsigned int j=0; + if (i<4) + j=1; + else if (i<8) + j=2; + + cell->set_subdomain_id(j % nproc); + ++cell; + } + }); + + + GridGenerator::hyper_L(shared_tria); + shared_tria.refine_global(); + typename Triangulation::active_cell_iterator it = shared_tria.begin_active(); + it->set_refine_flag(); + shared_tria.execute_coarsening_and_refinement (); + + deallog << "(CellId,subdomain_id) for each active cell:" << std::endl; + typename Triangulation::active_cell_iterator + cell = shared_tria.begin_active(), + endc = shared_tria.end(); + for (; cell!=endc; ++cell) + if (cell->subdomain_id() != numbers::artificial_subdomain_id) + deallog << "(" << cell->id().to_string() << "," << cell->subdomain_id() << ")" << 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(); + + deallog << "OK" << std::endl; +} + diff --git a/tests/sharedtria/tria_custom_refine01_cxx11.mpirun=3.output b/tests/sharedtria/tria_custom_refine01_cxx11.mpirun=3.output new file mode 100644 index 0000000000..2ae81a1f79 --- /dev/null +++ b/tests/sharedtria/tria_custom_refine01_cxx11.mpirun=3.output @@ -0,0 +1,172 @@ + +DEAL:0:2d::(CellId,subdomain_id) for each active cell: +DEAL:0:2d::(0_1:1,1) +DEAL:0:2d::(0_1:2,1) +DEAL:0:2d::(0_1:3,1) +DEAL:0:2d::(1_1:2,2) +DEAL:0:2d::(2_1:0,2) +DEAL:0:2d::(2_1:1,0) +DEAL:0:2d::(2_1:2,0) +DEAL:0:2d::(2_1:3,0) +DEAL:0:2d::(0_2:00,0) +DEAL:0:2d::(0_2:01,0) +DEAL:0:2d::(0_2:02,0) +DEAL:0:2d::(0_2:03,0) +DEAL:0:3d::(CellId,subdomain_id) for each active cell: +DEAL:0:3d::(0_1:1,1) +DEAL:0:3d::(0_1:2,1) +DEAL:0:3d::(0_1:3,1) +DEAL:0:3d::(0_1:4,1) +DEAL:0:3d::(0_1:5,2) +DEAL:0:3d::(0_1:6,2) +DEAL:0:3d::(0_1:7,2) +DEAL:0:3d::(1_1:0,2) +DEAL:0:3d::(1_1:1,0) +DEAL:0:3d::(1_1:2,0) +DEAL:0:3d::(1_1:3,0) +DEAL:0:3d::(1_1:4,0) +DEAL:0:3d::(1_1:5,0) +DEAL:0:3d::(1_1:6,0) +DEAL:0:3d::(1_1:7,0) +DEAL:0:3d::(2_1:0,0) +DEAL:0:3d::(2_1:1,0) +DEAL:0:3d::(2_1:2,0) +DEAL:0:3d::(2_1:3,0) +DEAL:0:3d::(2_1:4,0) +DEAL:0:3d::(2_1:5,0) +DEAL:0:3d::(2_1:6,0) +DEAL:0:3d::(2_1:7,0) +DEAL:0:3d::(3_1:0,0) +DEAL:0:3d::(3_1:1,0) +DEAL:0:3d::(3_1:2,0) +DEAL:0:3d::(3_1:3,0) +DEAL:0:3d::(3_1:4,0) +DEAL:0:3d::(3_1:5,0) +DEAL:0:3d::(3_1:6,0) +DEAL:0:3d::(3_1:7,0) +DEAL:0:3d::(4_1:0,0) +DEAL:0:3d::(4_1:1,0) +DEAL:0:3d::(4_1:2,0) +DEAL:0:3d::(4_1:3,0) +DEAL:0:3d::(4_1:4,0) +DEAL:0:3d::(4_1:5,0) +DEAL:0:3d::(4_1:6,0) +DEAL:0:3d::(4_1:7,0) +DEAL:0:3d::(5_1:0,0) +DEAL:0:3d::(5_1:1,0) +DEAL:0:3d::(5_1:2,0) +DEAL:0:3d::(5_1:3,0) +DEAL:0:3d::(5_1:4,0) +DEAL:0:3d::(5_1:5,0) +DEAL:0:3d::(5_1:6,0) +DEAL:0:3d::(5_1:7,0) +DEAL:0:3d::(6_1:0,0) +DEAL:0:3d::(6_1:1,0) +DEAL:0:3d::(6_1:2,0) +DEAL:0:3d::(6_1:3,0) +DEAL:0:3d::(6_1:4,0) +DEAL:0:3d::(6_1:5,0) +DEAL:0:3d::(6_1:6,0) +DEAL:0:3d::(6_1:7,0) +DEAL:0:3d::(0_2:00,0) +DEAL:0:3d::(0_2:01,0) +DEAL:0:3d::(0_2:02,0) +DEAL:0:3d::(0_2:03,0) +DEAL:0:3d::(0_2:04,0) +DEAL:0:3d::(0_2:05,0) +DEAL:0:3d::(0_2:06,0) +DEAL:0:3d::(0_2:07,0) +DEAL:0::OK + +DEAL:1:2d::(CellId,subdomain_id) for each active cell: +DEAL:1:2d::(0_1:1,1) +DEAL:1:2d::(0_1:2,1) +DEAL:1:2d::(0_1:3,1) +DEAL:1:2d::(1_1:0,1) +DEAL:1:2d::(1_1:1,2) +DEAL:1:2d::(1_1:2,2) +DEAL:1:2d::(1_1:3,2) +DEAL:1:2d::(2_1:0,2) +DEAL:1:2d::(2_1:1,0) +DEAL:1:2d::(0_2:01,0) +DEAL:1:2d::(0_2:02,0) +DEAL:1:2d::(0_2:03,0) +DEAL:1:3d::(CellId,subdomain_id) for each active cell: +DEAL:1:3d::(0_1:1,1) +DEAL:1:3d::(0_1:2,1) +DEAL:1:3d::(0_1:3,1) +DEAL:1:3d::(0_1:4,1) +DEAL:1:3d::(0_1:5,2) +DEAL:1:3d::(0_1:6,2) +DEAL:1:3d::(0_1:7,2) +DEAL:1:3d::(1_1:0,2) +DEAL:1:3d::(1_1:2,0) +DEAL:1:3d::(1_1:4,0) +DEAL:1:3d::(1_1:6,0) +DEAL:1:3d::(2_1:0,0) +DEAL:1:3d::(2_1:1,0) +DEAL:1:3d::(2_1:2,0) +DEAL:1:3d::(2_1:3,0) +DEAL:1:3d::(4_1:0,0) +DEAL:1:3d::(4_1:1,0) +DEAL:1:3d::(4_1:4,0) +DEAL:1:3d::(4_1:5,0) +DEAL:1:3d::(5_1:0,0) +DEAL:1:3d::(5_1:4,0) +DEAL:1:3d::(0_2:01,0) +DEAL:1:3d::(0_2:02,0) +DEAL:1:3d::(0_2:03,0) +DEAL:1:3d::(0_2:04,0) +DEAL:1:3d::(0_2:05,0) +DEAL:1:3d::(0_2:06,0) +DEAL:1:3d::(0_2:07,0) +DEAL:1::OK + + +DEAL:2:2d::(CellId,subdomain_id) for each active cell: +DEAL:2:2d::(0_1:1,1) +DEAL:2:2d::(0_1:2,1) +DEAL:2:2d::(0_1:3,1) +DEAL:2:2d::(1_1:0,1) +DEAL:2:2d::(1_1:1,2) +DEAL:2:2d::(1_1:2,2) +DEAL:2:2d::(1_1:3,2) +DEAL:2:2d::(2_1:0,2) +DEAL:2:2d::(2_1:1,0) +DEAL:2:2d::(2_1:2,0) +DEAL:2:2d::(2_1:3,0) +DEAL:2:3d::(CellId,subdomain_id) for each active cell: +DEAL:2:3d::(0_1:1,1) +DEAL:2:3d::(0_1:2,1) +DEAL:2:3d::(0_1:3,1) +DEAL:2:3d::(0_1:4,1) +DEAL:2:3d::(0_1:5,2) +DEAL:2:3d::(0_1:6,2) +DEAL:2:3d::(0_1:7,2) +DEAL:2:3d::(1_1:0,2) +DEAL:2:3d::(1_1:1,0) +DEAL:2:3d::(1_1:2,0) +DEAL:2:3d::(1_1:3,0) +DEAL:2:3d::(1_1:4,0) +DEAL:2:3d::(1_1:5,0) +DEAL:2:3d::(1_1:6,0) +DEAL:2:3d::(1_1:7,0) +DEAL:2:3d::(2_1:0,0) +DEAL:2:3d::(2_1:1,0) +DEAL:2:3d::(2_1:2,0) +DEAL:2:3d::(2_1:3,0) +DEAL:2:3d::(3_1:0,0) +DEAL:2:3d::(3_1:2,0) +DEAL:2:3d::(4_1:0,0) +DEAL:2:3d::(4_1:1,0) +DEAL:2:3d::(4_1:4,0) +DEAL:2:3d::(4_1:5,0) +DEAL:2:3d::(5_1:0,0) +DEAL:2:3d::(5_1:4,0) +DEAL:2:3d::(6_1:0,0) +DEAL:2:3d::(6_1:1,0) +DEAL:2:3d::(0_2:05,0) +DEAL:2:3d::(0_2:06,0) +DEAL:2:3d::(0_2:07,0) +DEAL:2::OK +