From 63d70dd64207bf8b2c523dd0f6612c2102b73fd4 Mon Sep 17 00:00:00 2001 From: heister Date: Mon, 24 Jun 2013 08:26:03 +0000 Subject: [PATCH] add tests git-svn-id: https://svn.dealii.org/trunk@29860 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/grid/cell_id_01.cc | 76 +++++++++ tests/grid/cell_id_01/cmp/generic | 271 ++++++++++++++++++++++++++++++ tests/grid/cell_id_02.cc | 77 +++++++++ tests/grid/cell_id_02/cmp/generic | 27 +++ 4 files changed, 451 insertions(+) create mode 100644 tests/grid/cell_id_01.cc create mode 100644 tests/grid/cell_id_01/cmp/generic create mode 100644 tests/grid/cell_id_02.cc create mode 100644 tests/grid/cell_id_02/cmp/generic diff --git a/tests/grid/cell_id_01.cc b/tests/grid/cell_id_01.cc new file mode 100644 index 0000000000..fc03510197 --- /dev/null +++ b/tests/grid/cell_id_01.cc @@ -0,0 +1,76 @@ +//---------------------------- refine_and_coarsen_3d.cc --------------------------- +// $Id: refine_and_coarsen_for_parents_02.cc 23710 2011-05-17 04:50:10Z bangerth $ +// Version: $Name$ +// +// Copyright (C) 2010 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//----------------------- refine_and_coarsen_for_parents_02.cc ---------------------- + + +// check CellId + +#include "../tests.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + + +template +void check (TRIA & tr) +{ + typename TRIA::cell_iterator cell = tr.begin(), + endc = tr.end(); + + for (; cell!=endc; ++cell) + { + deallog << cell->level() << " " << cell->index() << " " << cell->id() << std::endl; + } + + deallog << "OK" << std::endl; +} + + +int main (int argc, char *argv[]) +{ + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv); + + initlog(__FILE__); + deal_II_exceptions::disable_abort_on_exception(); + + { + Triangulation<2> tria; + GridGenerator::hyper_cube (tria); + tria.refine_global (2); + tria.begin_active()->set_refine_flag(); + tria.execute_coarsening_and_refinement(); + check(tria); + } + + { + Triangulation<3> tria; + GridGenerator::subdivided_hyper_cube (tria, 3); + tria.refine_global (1); + check(tria); + } + + +} + + + diff --git a/tests/grid/cell_id_01/cmp/generic b/tests/grid/cell_id_01/cmp/generic new file mode 100644 index 0000000000..d19bf13894 --- /dev/null +++ b/tests/grid/cell_id_01/cmp/generic @@ -0,0 +1,271 @@ + +DEAL::0 0 0_0: +DEAL::1 0 0_1:0 +DEAL::1 1 0_1:1 +DEAL::1 2 0_1:2 +DEAL::1 3 0_1:3 +DEAL::2 0 0_2:00 +DEAL::2 1 0_2:01 +DEAL::2 2 0_2:02 +DEAL::2 3 0_2:03 +DEAL::2 4 0_2:10 +DEAL::2 5 0_2:11 +DEAL::2 6 0_2:12 +DEAL::2 7 0_2:13 +DEAL::2 8 0_2:20 +DEAL::2 9 0_2:21 +DEAL::2 10 0_2:22 +DEAL::2 11 0_2:23 +DEAL::2 12 0_2:30 +DEAL::2 13 0_2:31 +DEAL::2 14 0_2:32 +DEAL::2 15 0_2:33 +DEAL::3 0 0_3:000 +DEAL::3 1 0_3:001 +DEAL::3 2 0_3:002 +DEAL::3 3 0_3:003 +DEAL::OK +DEAL::0 0 0_0: +DEAL::0 1 1_0: +DEAL::0 2 2_0: +DEAL::0 3 3_0: +DEAL::0 4 4_0: +DEAL::0 5 5_0: +DEAL::0 6 6_0: +DEAL::0 7 7_0: +DEAL::0 8 8_0: +DEAL::0 9 9_0: +DEAL::0 10 10_0: +DEAL::0 11 11_0: +DEAL::0 12 12_0: +DEAL::0 13 13_0: +DEAL::0 14 14_0: +DEAL::0 15 15_0: +DEAL::0 16 16_0: +DEAL::0 17 17_0: +DEAL::0 18 18_0: +DEAL::0 19 19_0: +DEAL::0 20 20_0: +DEAL::0 21 21_0: +DEAL::0 22 22_0: +DEAL::0 23 23_0: +DEAL::0 24 24_0: +DEAL::0 25 25_0: +DEAL::0 26 26_0: +DEAL::1 0 0_1:0 +DEAL::1 1 0_1:1 +DEAL::1 2 0_1:2 +DEAL::1 3 0_1:3 +DEAL::1 4 0_1:4 +DEAL::1 5 0_1:5 +DEAL::1 6 0_1:6 +DEAL::1 7 0_1:7 +DEAL::1 8 1_1:0 +DEAL::1 9 1_1:1 +DEAL::1 10 1_1:2 +DEAL::1 11 1_1:3 +DEAL::1 12 1_1:4 +DEAL::1 13 1_1:5 +DEAL::1 14 1_1:6 +DEAL::1 15 1_1:7 +DEAL::1 16 2_1:0 +DEAL::1 17 2_1:1 +DEAL::1 18 2_1:2 +DEAL::1 19 2_1:3 +DEAL::1 20 2_1:4 +DEAL::1 21 2_1:5 +DEAL::1 22 2_1:6 +DEAL::1 23 2_1:7 +DEAL::1 24 3_1:0 +DEAL::1 25 3_1:1 +DEAL::1 26 3_1:2 +DEAL::1 27 3_1:3 +DEAL::1 28 3_1:4 +DEAL::1 29 3_1:5 +DEAL::1 30 3_1:6 +DEAL::1 31 3_1:7 +DEAL::1 32 4_1:0 +DEAL::1 33 4_1:1 +DEAL::1 34 4_1:2 +DEAL::1 35 4_1:3 +DEAL::1 36 4_1:4 +DEAL::1 37 4_1:5 +DEAL::1 38 4_1:6 +DEAL::1 39 4_1:7 +DEAL::1 40 5_1:0 +DEAL::1 41 5_1:1 +DEAL::1 42 5_1:2 +DEAL::1 43 5_1:3 +DEAL::1 44 5_1:4 +DEAL::1 45 5_1:5 +DEAL::1 46 5_1:6 +DEAL::1 47 5_1:7 +DEAL::1 48 6_1:0 +DEAL::1 49 6_1:1 +DEAL::1 50 6_1:2 +DEAL::1 51 6_1:3 +DEAL::1 52 6_1:4 +DEAL::1 53 6_1:5 +DEAL::1 54 6_1:6 +DEAL::1 55 6_1:7 +DEAL::1 56 7_1:0 +DEAL::1 57 7_1:1 +DEAL::1 58 7_1:2 +DEAL::1 59 7_1:3 +DEAL::1 60 7_1:4 +DEAL::1 61 7_1:5 +DEAL::1 62 7_1:6 +DEAL::1 63 7_1:7 +DEAL::1 64 8_1:0 +DEAL::1 65 8_1:1 +DEAL::1 66 8_1:2 +DEAL::1 67 8_1:3 +DEAL::1 68 8_1:4 +DEAL::1 69 8_1:5 +DEAL::1 70 8_1:6 +DEAL::1 71 8_1:7 +DEAL::1 72 9_1:0 +DEAL::1 73 9_1:1 +DEAL::1 74 9_1:2 +DEAL::1 75 9_1:3 +DEAL::1 76 9_1:4 +DEAL::1 77 9_1:5 +DEAL::1 78 9_1:6 +DEAL::1 79 9_1:7 +DEAL::1 80 10_1:0 +DEAL::1 81 10_1:1 +DEAL::1 82 10_1:2 +DEAL::1 83 10_1:3 +DEAL::1 84 10_1:4 +DEAL::1 85 10_1:5 +DEAL::1 86 10_1:6 +DEAL::1 87 10_1:7 +DEAL::1 88 11_1:0 +DEAL::1 89 11_1:1 +DEAL::1 90 11_1:2 +DEAL::1 91 11_1:3 +DEAL::1 92 11_1:4 +DEAL::1 93 11_1:5 +DEAL::1 94 11_1:6 +DEAL::1 95 11_1:7 +DEAL::1 96 12_1:0 +DEAL::1 97 12_1:1 +DEAL::1 98 12_1:2 +DEAL::1 99 12_1:3 +DEAL::1 100 12_1:4 +DEAL::1 101 12_1:5 +DEAL::1 102 12_1:6 +DEAL::1 103 12_1:7 +DEAL::1 104 13_1:0 +DEAL::1 105 13_1:1 +DEAL::1 106 13_1:2 +DEAL::1 107 13_1:3 +DEAL::1 108 13_1:4 +DEAL::1 109 13_1:5 +DEAL::1 110 13_1:6 +DEAL::1 111 13_1:7 +DEAL::1 112 14_1:0 +DEAL::1 113 14_1:1 +DEAL::1 114 14_1:2 +DEAL::1 115 14_1:3 +DEAL::1 116 14_1:4 +DEAL::1 117 14_1:5 +DEAL::1 118 14_1:6 +DEAL::1 119 14_1:7 +DEAL::1 120 15_1:0 +DEAL::1 121 15_1:1 +DEAL::1 122 15_1:2 +DEAL::1 123 15_1:3 +DEAL::1 124 15_1:4 +DEAL::1 125 15_1:5 +DEAL::1 126 15_1:6 +DEAL::1 127 15_1:7 +DEAL::1 128 16_1:0 +DEAL::1 129 16_1:1 +DEAL::1 130 16_1:2 +DEAL::1 131 16_1:3 +DEAL::1 132 16_1:4 +DEAL::1 133 16_1:5 +DEAL::1 134 16_1:6 +DEAL::1 135 16_1:7 +DEAL::1 136 17_1:0 +DEAL::1 137 17_1:1 +DEAL::1 138 17_1:2 +DEAL::1 139 17_1:3 +DEAL::1 140 17_1:4 +DEAL::1 141 17_1:5 +DEAL::1 142 17_1:6 +DEAL::1 143 17_1:7 +DEAL::1 144 18_1:0 +DEAL::1 145 18_1:1 +DEAL::1 146 18_1:2 +DEAL::1 147 18_1:3 +DEAL::1 148 18_1:4 +DEAL::1 149 18_1:5 +DEAL::1 150 18_1:6 +DEAL::1 151 18_1:7 +DEAL::1 152 19_1:0 +DEAL::1 153 19_1:1 +DEAL::1 154 19_1:2 +DEAL::1 155 19_1:3 +DEAL::1 156 19_1:4 +DEAL::1 157 19_1:5 +DEAL::1 158 19_1:6 +DEAL::1 159 19_1:7 +DEAL::1 160 20_1:0 +DEAL::1 161 20_1:1 +DEAL::1 162 20_1:2 +DEAL::1 163 20_1:3 +DEAL::1 164 20_1:4 +DEAL::1 165 20_1:5 +DEAL::1 166 20_1:6 +DEAL::1 167 20_1:7 +DEAL::1 168 21_1:0 +DEAL::1 169 21_1:1 +DEAL::1 170 21_1:2 +DEAL::1 171 21_1:3 +DEAL::1 172 21_1:4 +DEAL::1 173 21_1:5 +DEAL::1 174 21_1:6 +DEAL::1 175 21_1:7 +DEAL::1 176 22_1:0 +DEAL::1 177 22_1:1 +DEAL::1 178 22_1:2 +DEAL::1 179 22_1:3 +DEAL::1 180 22_1:4 +DEAL::1 181 22_1:5 +DEAL::1 182 22_1:6 +DEAL::1 183 22_1:7 +DEAL::1 184 23_1:0 +DEAL::1 185 23_1:1 +DEAL::1 186 23_1:2 +DEAL::1 187 23_1:3 +DEAL::1 188 23_1:4 +DEAL::1 189 23_1:5 +DEAL::1 190 23_1:6 +DEAL::1 191 23_1:7 +DEAL::1 192 24_1:0 +DEAL::1 193 24_1:1 +DEAL::1 194 24_1:2 +DEAL::1 195 24_1:3 +DEAL::1 196 24_1:4 +DEAL::1 197 24_1:5 +DEAL::1 198 24_1:6 +DEAL::1 199 24_1:7 +DEAL::1 200 25_1:0 +DEAL::1 201 25_1:1 +DEAL::1 202 25_1:2 +DEAL::1 203 25_1:3 +DEAL::1 204 25_1:4 +DEAL::1 205 25_1:5 +DEAL::1 206 25_1:6 +DEAL::1 207 25_1:7 +DEAL::1 208 26_1:0 +DEAL::1 209 26_1:1 +DEAL::1 210 26_1:2 +DEAL::1 211 26_1:3 +DEAL::1 212 26_1:4 +DEAL::1 213 26_1:5 +DEAL::1 214 26_1:6 +DEAL::1 215 26_1:7 +DEAL::OK diff --git a/tests/grid/cell_id_02.cc b/tests/grid/cell_id_02.cc new file mode 100644 index 0000000000..bc99d587e8 --- /dev/null +++ b/tests/grid/cell_id_02.cc @@ -0,0 +1,77 @@ +//---------------------------- refine_and_coarsen_3d.cc --------------------------- +// $Id: refine_and_coarsen_for_parents_02.cc 23710 2011-05-17 04:50:10Z bangerth $ +// Version: $Name$ +// +// Copyright (C) 2010 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//----------------------- refine_and_coarsen_for_parents_02.cc ---------------------- + + +// check CellId + +#include "../tests.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +template +void check (TRIA & tr) +{ + typename TRIA::cell_iterator cell = tr.begin(), + endc = tr.end(); + + + for (; cell!=endc; ++cell) + { + std::ostringstream outb; + outb << cell->id(); + CellId tmp; + std::istringstream in(outb.str()); + in >> tmp; + deallog << cell->level() << " " << cell->index() << " " << cell->id() << " " << tmp << std::endl; + } + + + CellId empty; + + Assert(tr.begin()->id() != tr.begin_active()->id(), ExcInternalError()); + Assert(tr.begin()->id() != empty, ExcInternalError()); + Assert(tr.begin()->id() == tr.begin()->id(), ExcInternalError()); + + deallog << "OK" << std::endl; +} + + +int main (int argc, char *argv[]) +{ + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv); + + initlog(__FILE__); + deal_II_exceptions::disable_abort_on_exception(); + + Triangulation<2> tria; + GridGenerator::hyper_cube (tria); + tria.refine_global (2); + tria.begin_active()->set_refine_flag(); + tria.execute_coarsening_and_refinement(); + check(tria); +} + + + diff --git a/tests/grid/cell_id_02/cmp/generic b/tests/grid/cell_id_02/cmp/generic new file mode 100644 index 0000000000..e469858627 --- /dev/null +++ b/tests/grid/cell_id_02/cmp/generic @@ -0,0 +1,27 @@ + +DEAL::0 0 0_0: 0_0: +DEAL::1 0 0_1:0 0_1:0 +DEAL::1 1 0_1:1 0_1:1 +DEAL::1 2 0_1:2 0_1:2 +DEAL::1 3 0_1:3 0_1:3 +DEAL::2 0 0_2:00 0_2:00 +DEAL::2 1 0_2:01 0_2:01 +DEAL::2 2 0_2:02 0_2:02 +DEAL::2 3 0_2:03 0_2:03 +DEAL::2 4 0_2:10 0_2:10 +DEAL::2 5 0_2:11 0_2:11 +DEAL::2 6 0_2:12 0_2:12 +DEAL::2 7 0_2:13 0_2:13 +DEAL::2 8 0_2:20 0_2:20 +DEAL::2 9 0_2:21 0_2:21 +DEAL::2 10 0_2:22 0_2:22 +DEAL::2 11 0_2:23 0_2:23 +DEAL::2 12 0_2:30 0_2:30 +DEAL::2 13 0_2:31 0_2:31 +DEAL::2 14 0_2:32 0_2:32 +DEAL::2 15 0_2:33 0_2:33 +DEAL::3 0 0_3:000 0_3:000 +DEAL::3 1 0_3:001 0_3:001 +DEAL::3 2 0_3:002 0_3:002 +DEAL::3 3 0_3:003 0_3:003 +DEAL::OK -- 2.39.5