From f4ca993578801b8ff59afc1f16477b9ed74e7536 Mon Sep 17 00:00:00 2001 From: grahambenharper Date: Mon, 3 Feb 2020 11:31:12 -0700 Subject: [PATCH] Add a test to verify the write_svg boundary id functionality --- tests/grid/grid_out_svg_01.output | 5 +- tests/grid/grid_out_svg_02.output | 7 +- tests/grid/grid_out_svg_02.output.2 | 9 +-- tests/grid/grid_out_svg_02.output.avx512 | 9 +-- tests/grid/grid_out_svg_03.cc | 69 ++++++++++++++++++++ tests/grid/grid_out_svg_03.output | 82 ++++++++++++++++++++++++ 6 files changed, 168 insertions(+), 13 deletions(-) create mode 100644 tests/grid/grid_out_svg_03.cc create mode 100644 tests/grid/grid_out_svg_03.output diff --git a/tests/grid/grid_out_svg_01.output b/tests/grid/grid_out_svg_01.output index 8d06fe9537..1e362a5abc 100644 --- a/tests/grid/grid_out_svg_01.output +++ b/tests/grid/grid_out_svg_01.output @@ -9,6 +9,7 @@ text{font-family:Helvetica; text-anchor:middle; fill:rgb(25,25,25)} line{stroke:rgb(25,25,25); stroke-width:4} path{fill:none; stroke:rgb(25,25,25); stroke-width:2} + circle{fill:white; stroke:black; stroke-width:2} path.p0{fill:rgb(0,102,255); stroke:rgb(25,25,25); stroke-width:2} path.ps0{fill:rgb(0,77,191); stroke:rgb(20,20,20); stroke-width:2} @@ -233,12 +234,12 @@ - + cell label cell_level. cell_index, material_id - azimuth: 0°, polar: 0° + azimuth: 0°, polar: 0° level_number diff --git a/tests/grid/grid_out_svg_02.output b/tests/grid/grid_out_svg_02.output index bd24a300a3..7cf4ecf42e 100644 --- a/tests/grid/grid_out_svg_02.output +++ b/tests/grid/grid_out_svg_02.output @@ -9,6 +9,7 @@ text{font-family:Helvetica; text-anchor:middle; fill:rgb(25,25,25)} line{stroke:rgb(25,25,25); stroke-width:4} path{fill:none; stroke:rgb(25,25,25); stroke-width:2} + circle{fill:white; stroke:black; stroke-width:2} path.p0{fill:rgb(0,102,255); stroke:rgb(25,25,25); stroke-width:2} path.ps0{fill:rgb(0,77,191); stroke:rgb(20,20,20); stroke-width:2} @@ -3231,14 +3232,14 @@ - + cell label cell_level. cell_index, material_id, subdomain_id, level_subdomain_id - azimuth: 0°, polar: 60° + azimuth: 0°, polar: 60° level_number @@ -3253,4 +3254,4 @@ 4 max - \ No newline at end of file + diff --git a/tests/grid/grid_out_svg_02.output.2 b/tests/grid/grid_out_svg_02.output.2 index 07b5cf11af..e3acaeb4d8 100644 --- a/tests/grid/grid_out_svg_02.output.2 +++ b/tests/grid/grid_out_svg_02.output.2 @@ -9,6 +9,7 @@ text{font-family:Helvetica; text-anchor:middle; fill:rgb(25,25,25)} line{stroke:rgb(25,25,25); stroke-width:4} path{fill:none; stroke:rgb(25,25,25); stroke-width:2} + circle{fill:white; stroke:black; stroke-width:2} path.p0{fill:rgb(0,102,255); stroke:rgb(25,25,25); stroke-width:2} path.ps0{fill:rgb(0,77,191); stroke:rgb(20,20,20); stroke-width:2} @@ -3295,14 +3296,14 @@ - + cell label - level_number, + cell_level. cell_index, material_id, subdomain_id, level_subdomain_id - azimuth: 0°, polar: 60° + azimuth: 0°, polar: 60° level_number @@ -3317,4 +3318,4 @@ 4 max - \ No newline at end of file + diff --git a/tests/grid/grid_out_svg_02.output.avx512 b/tests/grid/grid_out_svg_02.output.avx512 index d59b051743..e26b65c043 100644 --- a/tests/grid/grid_out_svg_02.output.avx512 +++ b/tests/grid/grid_out_svg_02.output.avx512 @@ -9,6 +9,7 @@ text{font-family:Helvetica; text-anchor:middle; fill:rgb(25,25,25)} line{stroke:rgb(25,25,25); stroke-width:4} path{fill:none; stroke:rgb(25,25,25); stroke-width:2} + circle{fill:white; stroke:black; stroke-width:2} path.p0{fill:rgb(0,102,255); stroke:rgb(25,25,25); stroke-width:2} path.ps0{fill:rgb(0,77,191); stroke:rgb(20,20,20); stroke-width:2} @@ -3231,14 +3232,14 @@ - + cell label - level_number, + cell_level. cell_index, material_id, subdomain_id, level_subdomain_id - azimuth: 0°, polar: 60° + azimuth: 0°, polar: 60° level_number @@ -3253,4 +3254,4 @@ 4 max - \ No newline at end of file + diff --git a/tests/grid/grid_out_svg_03.cc b/tests/grid/grid_out_svg_03.cc new file mode 100644 index 0000000000..1b19209bac --- /dev/null +++ b/tests/grid/grid_out_svg_03.cc @@ -0,0 +1,69 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2013 - 2018 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.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + +#include +#include +#include +#include +#include +#include + +#include "../tests.h" + + +using namespace dealii; + +Triangulation<2, 2> +create_grid() +{ + Triangulation<2, 2> triangulation; + + double inner_radius = .5; + double outer_radius = 1.; + + Point<2> center(0., 0.); + + GridGenerator::half_hyper_shell( + triangulation, Point<2>(), inner_radius, outer_radius, 0, true); + + Triangulation<2>::active_cell_iterator + + cell = triangulation.begin_active(), + endc = triangulation.end(); + + return triangulation; +} + +int +main() +{ + initlog(); + + GridOut grid_out; + GridOutFlags::Svg svg_flags; + + svg_flags.coloring = GridOutFlags::Svg::level_number; + svg_flags.label_boundary_id = true; + svg_flags.background = GridOutFlags::Svg::transparent; + svg_flags.label_level_number = true; + svg_flags.label_cell_index = true; + svg_flags.draw_legend = true; + svg_flags.draw_colorbar = true; + + grid_out.set_flags(svg_flags); + grid_out.write_svg(create_grid(), deallog.get_file_stream()); + + return 0; +} diff --git a/tests/grid/grid_out_svg_03.output b/tests/grid/grid_out_svg_03.output new file mode 100644 index 0000000000..080e7721ac --- /dev/null +++ b/tests/grid/grid_out_svg_03.output @@ -0,0 +1,82 @@ + + + + + + + + + + + 0.0 + + + 3 + + + 1 + + + 0 + + 0.1 + + + 1 + + + 0 + + 0.2 + + + 1 + + + 0 + + 0.3 + + + 1 + + + 0 + + 0.4 + + + 2 + + + 1 + + + 0 + + + + cell label + cell_level. + cell_index + edge label + boundary_id + azimuth: 0°, polar: 0° + + + level_number + + 0 max min + + \ No newline at end of file -- 2.39.5