From e894b79b025f7034142890e2360501197f2d9b2e Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 23 Mar 2015 13:58:07 -0500 Subject: [PATCH] Add tests for previous two commits. --- tests/deal.II/grid_out_08.cc | 101 +++++++++++++++++++++++++++++++ tests/deal.II/grid_out_08.output | 31 ++++++++++ tests/deal.II/grid_out_09.cc | 101 +++++++++++++++++++++++++++++++ tests/deal.II/grid_out_09.output | 97 +++++++++++++++++++++++++++++ 4 files changed, 330 insertions(+) create mode 100644 tests/deal.II/grid_out_08.cc create mode 100644 tests/deal.II/grid_out_08.output create mode 100644 tests/deal.II/grid_out_09.cc create mode 100644 tests/deal.II/grid_out_09.output diff --git a/tests/deal.II/grid_out_08.cc b/tests/deal.II/grid_out_08.cc new file mode 100644 index 0000000000..17a3f93a06 --- /dev/null +++ b/tests/deal.II/grid_out_08.cc @@ -0,0 +1,101 @@ +// --------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------- + + +// test GridOut::write_vtu for 1d meshes in 3d + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +std::ofstream logfile("output"); + + +void test () +{ + Triangulation<1,3> tria; + + const unsigned int dim = 1; + static const Point<3> vertices_1[] + = { + Point<3>(0,0,0), Point<3>(1,0,0), Point<3>(1,0,0), Point<3>(1,1,0), + Point<3>(1,1,0), Point<3>(0,1,0), Point<3>(0,1,0), Point<3>(0,0,0), + Point<3>(0,0,1), Point<3>(1,0,1), Point<3>(1,0,1), Point<3>(1,1,1), + Point<3>(1,1,1), Point<3>(0,1,1), Point<3>(0,1,1), Point<3>(0,0,1), + Point<3>(0,0,0), Point<3>(0,0,1), Point<3>(1,0,0), Point<3>(1,0,1), + Point<3>(1,1,0), Point<3>(1,1,1), Point<3>(0,1,0), Point<3>(0,1,1) + }; + const unsigned int n_vertices = sizeof(vertices_1) / sizeof(vertices_1[0]); + const std::vector > vertices (&vertices_1[0], &vertices_1[n_vertices]); + + static const int cell_vertices[][GeometryInfo::vertices_per_cell] + = { { 0, 1}, + { 2, 3}, + { 4, 5}, + { 6, 7}, + { 8, 9}, + { 10, 11}, + { 12, 13}, + { 14, 15}, + { 16, 17}, + { 18, 19}, + { 20, 21}, + { 22, 23} + }; + const unsigned int n_cells = sizeof(cell_vertices) / sizeof(cell_vertices[0]); + std::vector > cells (n_cells, CellData()); + + for (unsigned int i=0; i::vertices_per_cell; + ++j) + cells[i].vertices[j] = cell_vertices[i][j]; + cells[i].material_id = 0; + } + tria.create_triangulation ( vertices, + cells, + SubCellData()); + + tria.refine_global (1); + + GridOut grid_out; + grid_out.write_vtu (tria, logfile); +} + + +int main () +{ + deallog << std::setprecision (2); + logfile << std::setprecision (2); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test (); +} + diff --git a/tests/deal.II/grid_out_08.output b/tests/deal.II/grid_out_08.output new file mode 100644 index 0000000000..e32b8886e5 --- /dev/null +++ b/tests/deal.II/grid_out_08.output @@ -0,0 +1,31 @@ + + + + + + + + +AQAAAIAEAACABAAARwAAAA==eNpjYMAHHtiTJv6BTHF08wiJfyBS/AGJ4uT6g9RwIgRoHS7o4ujhQUicWJpUcwdLPFM7PxBrP6n++GBPn3imXT4GAB9TYe0= + + + + + +AQAAAMAAAADAAAAAVQAAAA==eNoNw4kSgVAAAMDnliNXRUQ5c4T//7t2ZzaEEDp27dl34NCRYyMnTp05N3bh0pVrNyamZm7dmbv3YOHRk6WVZy9evXn3Ye3Tl28/Nn79+bcFIK8EaQ== + + +AQAAAGAAAABgAAAAOAAAAA==eNoNwwEGgEAQAMCVJElOkiQnJ0mS/v+6ZpgqImobWzt7B5Ojk7OLq5vZ3eLh6eXt4+vnD1GgAlk= + + +AQAAABgAAAAYAAAACwAAAA==eNpjZsYOAAOcAEk= + + + + + + + diff --git a/tests/deal.II/grid_out_09.cc b/tests/deal.II/grid_out_09.cc new file mode 100644 index 0000000000..ed124f3ebc --- /dev/null +++ b/tests/deal.II/grid_out_09.cc @@ -0,0 +1,101 @@ +// --------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------- + + +// test GridOut::write_gnuplot for 1d meshes in 3d + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +std::ofstream logfile("output"); + + +void test () +{ + Triangulation<1,3> tria; + + const unsigned int dim = 1; + static const Point<3> vertices_1[] + = { + Point<3>(0,0,0), Point<3>(1,0,0), Point<3>(1,0,0), Point<3>(1,1,0), + Point<3>(1,1,0), Point<3>(0,1,0), Point<3>(0,1,0), Point<3>(0,0,0), + Point<3>(0,0,1), Point<3>(1,0,1), Point<3>(1,0,1), Point<3>(1,1,1), + Point<3>(1,1,1), Point<3>(0,1,1), Point<3>(0,1,1), Point<3>(0,0,1), + Point<3>(0,0,0), Point<3>(0,0,1), Point<3>(1,0,0), Point<3>(1,0,1), + Point<3>(1,1,0), Point<3>(1,1,1), Point<3>(0,1,0), Point<3>(0,1,1) + }; + const unsigned int n_vertices = sizeof(vertices_1) / sizeof(vertices_1[0]); + const std::vector > vertices (&vertices_1[0], &vertices_1[n_vertices]); + + static const int cell_vertices[][GeometryInfo::vertices_per_cell] + = { { 0, 1}, + { 2, 3}, + { 4, 5}, + { 6, 7}, + { 8, 9}, + { 10, 11}, + { 12, 13}, + { 14, 15}, + { 16, 17}, + { 18, 19}, + { 20, 21}, + { 22, 23} + }; + const unsigned int n_cells = sizeof(cell_vertices) / sizeof(cell_vertices[0]); + std::vector > cells (n_cells, CellData()); + + for (unsigned int i=0; i::vertices_per_cell; + ++j) + cells[i].vertices[j] = cell_vertices[i][j]; + cells[i].material_id = 0; + } + tria.create_triangulation ( vertices, + cells, + SubCellData()); + + tria.refine_global (1); + + GridOut grid_out; + grid_out.write_gnuplot (tria, logfile); +} + + +int main () +{ + deallog << std::setprecision (2); + logfile << std::setprecision (2); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test (); +} + diff --git a/tests/deal.II/grid_out_09.output b/tests/deal.II/grid_out_09.output new file mode 100644 index 0000000000..ec91b4ac98 --- /dev/null +++ b/tests/deal.II/grid_out_09.output @@ -0,0 +1,97 @@ + +0.0 0.0 0.0 1 0 +0.50 0.0 0.0 1 0 + + +0.50 0.0 0.0 1 0 +1.0 0.0 0.0 1 0 + + +1.0 0.0 0.0 1 0 +1.0 0.50 0.0 1 0 + + +1.0 0.50 0.0 1 0 +1.0 1.0 0.0 1 0 + + +1.0 1.0 0.0 1 0 +0.50 1.0 0.0 1 0 + + +0.50 1.0 0.0 1 0 +0.0 1.0 0.0 1 0 + + +0.0 1.0 0.0 1 0 +0.0 0.50 0.0 1 0 + + +0.0 0.50 0.0 1 0 +0.0 0.0 0.0 1 0 + + +0.0 0.0 1.0 1 0 +0.50 0.0 1.0 1 0 + + +0.50 0.0 1.0 1 0 +1.0 0.0 1.0 1 0 + + +1.0 0.0 1.0 1 0 +1.0 0.50 1.0 1 0 + + +1.0 0.50 1.0 1 0 +1.0 1.0 1.0 1 0 + + +1.0 1.0 1.0 1 0 +0.50 1.0 1.0 1 0 + + +0.50 1.0 1.0 1 0 +0.0 1.0 1.0 1 0 + + +0.0 1.0 1.0 1 0 +0.0 0.50 1.0 1 0 + + +0.0 0.50 1.0 1 0 +0.0 0.0 1.0 1 0 + + +0.0 0.0 0.0 1 0 +0.0 0.0 0.50 1 0 + + +0.0 0.0 0.50 1 0 +0.0 0.0 1.0 1 0 + + +1.0 0.0 0.0 1 0 +1.0 0.0 0.50 1 0 + + +1.0 0.0 0.50 1 0 +1.0 0.0 1.0 1 0 + + +1.0 1.0 0.0 1 0 +1.0 1.0 0.50 1 0 + + +1.0 1.0 0.50 1 0 +1.0 1.0 1.0 1 0 + + +0.0 1.0 0.0 1 0 +0.0 1.0 0.50 1 0 + + +0.0 1.0 0.50 1 0 +0.0 1.0 1.0 1 0 + + -- 2.39.5