From dee0415a68adcc983769a7fe5e550a18d0416276 Mon Sep 17 00:00:00 2001 From: amola Date: Mon, 11 Apr 2016 12:13:08 +0200 Subject: [PATCH] Added a test for the new read_ucd option that treats identifiers in a ucd file as manifold_ids instead of boundary_ids --- tests/grid/grid_in_ucd_01.cc | 80 +++++++++++++++++++++++++++++ tests/grid/grid_in_ucd_01.output | 67 ++++++++++++++++++++++++ tests/grid/grids/kcs_initial.inp | 87 ++++++++++++++++++++++++++++++++ 3 files changed, 234 insertions(+) create mode 100644 tests/grid/grid_in_ucd_01.cc create mode 100644 tests/grid/grid_in_ucd_01.output create mode 100644 tests/grid/grids/kcs_initial.inp diff --git a/tests/grid/grid_in_ucd_01.cc b/tests/grid/grid_in_ucd_01.cc new file mode 100644 index 0000000000..5bb58fad2e --- /dev/null +++ b/tests/grid/grid_in_ucd_01.cc @@ -0,0 +1,80 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2002 - 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. +// +// --------------------------------------------------------------------- + + +// read in a 2d file in the UNV format used by the Salome program + +// the meshes used here were generated by Valentin Zingan using the Salome +// mesh generator + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +std::ofstream logfile("output"); + + + +int main () +{ + deallog << std::setprecision (2); + logfile << std::setprecision (2); + deallog.attach(logfile); + deallog.threshold_double(1.e-10); + std::string name(std::string(SOURCE_DIR "/grids/kcs_initial.inp")); + //deallog<<"Filename: "< tria; + GridIn<2,3> gi; + gi.attach_triangulation (tria); + gi.read_ucd(in, true); + deallog << '\t' << tria.n_vertices() + << '\t' << tria.n_cells() + << std::endl; + + + deallog << "Material IDs: " << std::endl; + Triangulation<2,3>::active_cell_iterator cell = tria.begin_active(); + Triangulation<2,3>::active_cell_iterator endc = tria.end(); + for ( ; cell!= endc;++cell) + { + deallog << cell << " " << int(cell->material_id()) << std::endl; + } + + deallog << "Manifold IDs: " << std::endl; + cell = tria.begin_active(); + for ( ; cell!= endc;++cell) + { + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->face(f)->manifold_id() != numbers::flat_manifold_id) + deallog << cell << " (" << f <<") "<< int(cell->face(f)->manifold_id()) << std::endl; + } + +} + diff --git a/tests/grid/grid_in_ucd_01.output b/tests/grid/grid_in_ucd_01.output new file mode 100644 index 0000000000..e5d6b6a38c --- /dev/null +++ b/tests/grid/grid_in_ucd_01.output @@ -0,0 +1,67 @@ + +DEAL:: 34 25 +DEAL::Material IDs: +DEAL::0.0 1 +DEAL::0.1 1 +DEAL::0.2 1 +DEAL::0.3 2 +DEAL::0.4 2 +DEAL::0.5 3 +DEAL::0.6 4 +DEAL::0.7 4 +DEAL::0.8 4 +DEAL::0.9 4 +DEAL::0.10 4 +DEAL::0.11 4 +DEAL::0.12 4 +DEAL::0.13 4 +DEAL::0.14 4 +DEAL::0.15 4 +DEAL::0.16 4 +DEAL::0.17 4 +DEAL::0.18 4 +DEAL::0.19 4 +DEAL::0.20 4 +DEAL::0.21 1 +DEAL::0.22 1 +DEAL::0.23 4 +DEAL::0.24 4 +DEAL::Manifold IDs: +DEAL::0.0 (1) 18 +DEAL::0.0 (3) 19 +DEAL::0.1 (3) 19 +DEAL::0.2 (1) 18 +DEAL::0.3 (0) 16 +DEAL::0.3 (1) 17 +DEAL::0.3 (3) 16 +DEAL::0.4 (1) 15 +DEAL::0.4 (2) 16 +DEAL::0.4 (3) 17 +DEAL::0.5 (0) 13 +DEAL::0.5 (1) 12 +DEAL::0.5 (2) 13 +DEAL::0.5 (3) 13 +DEAL::0.6 (1) 19 +DEAL::0.6 (3) 11 +DEAL::0.7 (1) 19 +DEAL::0.8 (0) 11 +DEAL::0.9 (0) 11 +DEAL::0.9 (2) 11 +DEAL::0.9 (3) 11 +DEAL::0.10 (1) 14 +DEAL::0.10 (3) 16 +DEAL::0.12 (1) 14 +DEAL::0.12 (2) 13 +DEAL::0.13 (0) 13 +DEAL::0.13 (3) 11 +DEAL::0.14 (2) 13 +DEAL::0.16 (0) 11 +DEAL::0.17 (0) 11 +DEAL::0.19 (1) 16 +DEAL::0.20 (1) 16 +DEAL::0.20 (3) 19 +DEAL::0.21 (1) 17 +DEAL::0.21 (3) 18 +DEAL::0.22 (1) 19 +DEAL::0.22 (3) 17 +DEAL::0.24 (1) 11 diff --git a/tests/grid/grids/kcs_initial.inp b/tests/grid/grids/kcs_initial.inp new file mode 100644 index 0000000000..469a853090 --- /dev/null +++ b/tests/grid/grids/kcs_initial.inp @@ -0,0 +1,87 @@ +34 52 0 0 0 +1 0.233952 0 0.0172 +2 0.219291 0.006185 0.0172 +3 0.214756 0 0.0172 +4 0.209957 0.003 0.0172 +5 -0.006 0.00805 0.0172 +6 -0.006 0 0.0172 +7 -0.006 0.0161 0.0172 +8 -0.006 0.0084 0.011958 +9 -0.006 0.013797 0.013413 +10 -0.006 0 0.0113 +11 0.005113 0 0.004851 +12 0.005113 0 0.003365 +13 0.005113 0.000639 0.004486 +14 0.005113 0.000639 0.00373 +15 0.216029 0.002376 0.010571 +16 0.22945834421289 0 0.00943694750372 +17 0.230499 0 0.000642 +18 0.23529840549092 0 0.00260966243817 +19 0.235745 0 0.008086 +20 0.2185 0 0 +21 0.01161726287471 0.00057366498052 0.00748083704474 +22 0.00773432552832 0 0.0057658270482 +23 0.008009 0 0.001835 +24 0.011542 0 0.000411 +25 0.008008591 0.00096099091633 0.0031822245215 +26 0.0080086 0.00054284658333 0.00467962845833 +27 0.011242 0.014323 0.011434 +28 0.011243 0.0161 0.0172 +29 0.011243 0 0.0172 +30 0.207765 0.003715 0.00537 +31 0.207765 0 0 +32 0.011243 0.0080500 0.0172 +33 0.01033902567866 0.00044581553509 0.00547065538496 +34 0.01026017094477 0.00128639760878 0.00259302066343 +1 1 quad 1 2 4 3 +2 1 quad 4 2 28 32 +3 1 quad 3 4 32 29 +4 2 quad 5 7 9 8 +5 2 quad 5 8 10 6 +6 3 quad 11 13 14 12 +7 4 quad 1 16 15 2 +8 4 quad 2 15 27 28 +9 4 quad 16 17 20 15 +10 4 quad 16 19 18 17 +11 4 quad 10 8 21 22 +12 4 quad 33 21 24 34 +13 4 quad 22 26 13 11 +14 4 quad 23 12 14 25 +15 4 quad 14 13 26 25 +16 4 quad 25 26 33 34 +17 4 quad 15 20 31 30 +18 4 quad 30 31 24 21 +19 4 quad 21 27 15 30 +20 4 quad 27 21 8 9 +21 4 quad 28 27 9 7 +22 1 quad 29 32 5 6 +23 1 quad 32 28 7 5 +24 4 quad 22 21 33 26 +25 4 quad 23 25 34 24 +26 11 line 1 16 +27 11 line 16 19 +28 11 line 19 18 +29 11 line 18 17 +30 11 line 17 20 +31 11 line 20 31 +32 11 line 31 24 +33 11 line 24 23 +34 11 line 23 12 +35 12 line 12 11 +36 13 line 11 13 +37 13 line 13 14 +38 13 line 14 12 +39 14 line 11 22 +40 14 line 22 10 +41 15 line 10 6 +42 16 line 7 9 +43 16 line 9 8 +44 16 line 8 10 +45 17 line 6 5 +46 17 line 5 7 +47 18 line 6 29 +48 18 line 29 3 +49 18 line 3 1 +50 19 line 7 28 +51 19 line 28 2 +52 19 line 2 1 -- 2.39.5