]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a test to verify the write_svg boundary id functionality
authorgrahambenharper <grahambenharper@gmail.com>
Mon, 3 Feb 2020 18:31:12 +0000 (11:31 -0700)
committergrahambenharper <grahambenharper@gmail.com>
Fri, 7 Feb 2020 16:25:49 +0000 (09:25 -0700)
tests/grid/grid_out_svg_01.output
tests/grid/grid_out_svg_02.output
tests/grid/grid_out_svg_02.output.2
tests/grid/grid_out_svg_02.output.avx512
tests/grid/grid_out_svg_03.cc [new file with mode: 0644]
tests/grid/grid_out_svg_03.output [new file with mode: 0644]

index 8d06fe95379e67b6f828d18b497ad9184958fe80..1e362a5abc03312ce3dfc240102da5ce29a88da3 100644 (file)
@@ -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}
   <line x1="695" y1="537" x2="710" y2="500"/>
 
  <!-- legend -->
- <rect x="1000" y="80" width="320" height="165"/>
+ <rect x="1000" y="80" width="320" height="215"/>
  <text x="1013" y="107" style="text-anchor:start; font-weight:bold; font-size:18px">cell label</text>
   <text x="1020" y="134" style="text-anchor:start; font-style:oblique; font-size:18px">cell_level.</text>
   <text x="1020" y="161" style="text-anchor:start; font-style:oblique; font-size:18px">cell_index,</text>
   <text x="1020" y="188" style="text-anchor:start; font-style:oblique; font-size:18px">material_id</text>
-  <text x="1000" y="274" style="text-anchor:start; font-size:18px">azimuth: 0°, polar: 0°</text>
+  <text x="1000" y="328" style="text-anchor:start; font-size:18px">azimuth: 0°, polar: 0°</text>
 
  <!-- colorbar -->
  <text x="1000" y="356" style="text-anchor:start; font-weight:bold; font-size:18px">level_number</text>
index bd24a300a31775e7854be1910a05bf8aeb6b3410..7cf4ecf42e7ed43cc461b80c2c3871e60cc308d8 100644 (file)
@@ -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}
   <line x1="1344" y1="247" x2="1342" y2="241"/>
 
  <!-- legend -->
- <rect x="2000" y="96" width="386" height="199"/>
+ <rect x="2000" y="96" width="386" height="259"/>
  <text x="2015" y="128" style="text-anchor:start; font-weight:bold; font-size:21px">cell label</text>
   <text x="2024" y="159" style="text-anchor:start; font-style:oblique; font-size:21px">cell_level.</text>
   <text x="2024" y="191" style="text-anchor:start; font-style:oblique; font-size:21px">cell_index,</text>
   <text x="2024" y="222" style="text-anchor:start; font-style:oblique; font-size:21px">material_id,</text>
   <text x= "2024" y="254" style="text-anchor:start; font-style:oblique; font-size:21px">subdomain_id,</text>
   <text x= "2024" y="285" style="text-anchor:start; font-style:oblique; font-size:21px">level_subdomain_id</text>
-  <text x="2000" y="322" style="text-anchor:start; font-size:21px">azimuth: 0°, polar: 60°</text>
+  <text x="2000" y="385" style="text-anchor:start; font-size:21px">azimuth: 0°, polar: 60°</text>
 
  <!-- colorbar -->
  <text x="2000" y="429" style="text-anchor:start; font-weight:bold; font-size:21px">level_number</text>
   <rect class="r4" x="2000" y="446" width="30" height="132"/>
   <text x="2045.00" y="519.000" style="text-anchor:start; font-size:21px; font-weight:bold">4 max</text>
 
-</svg>
\ No newline at end of file
+</svg>
index 07b5cf11afd57beea97f0ab3f895247cfb7580e1..e3acaeb4d853758e124de5b1a21f6035fdbc0a0f 100644 (file)
@@ -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}
   <line x1="1338" y1="246" x2="1342" y2="241"/>
 
  <!-- legend -->
- <rect x="2000" y="96" width="386" height="199"/>
+ <rect x="2000" y="96" width="386" height="259"/>
  <text x="2015" y="128" style="text-anchor:start; font-weight:bold; font-size:21px">cell label</text>
-  <text x="2024" y="159" style="text-anchor:start; font-style:oblique; font-size:21px">level_number,</text>
+  <text x="2024" y="159" style="text-anchor:start; font-style:oblique; font-size:21px">cell_level.</text>
   <text x="2024" y="191" style="text-anchor:start; font-style:oblique; font-size:21px">cell_index,</text>
   <text x="2024" y="222" style="text-anchor:start; font-style:oblique; font-size:21px">material_id,</text>
   <text x= "2024" y="254" style="text-anchor:start; font-style:oblique; font-size:21px">subdomain_id,</text>
   <text x= "2024" y="285" style="text-anchor:start; font-style:oblique; font-size:21px">level_subdomain_id</text>
-  <text x="2000" y="322" style="text-anchor:start; font-size:21px">azimuth: 0°, polar: 60°</text>
+  <text x="2000" y="385" style="text-anchor:start; font-size:21px">azimuth: 0°, polar: 60°</text>
 
  <!-- colorbar -->
  <text x="2000" y="429" style="text-anchor:start; font-weight:bold; font-size:21px">level_number</text>
   <rect class="r4" x="2000" y="446" width="30" height="132"/>
   <text x="2045.00" y="519.000" style="text-anchor:start; font-size:21px; font-weight:bold">4 max</text>
 
-</svg>
\ No newline at end of file
+</svg>
index d59b05174364bc0997d7c88261b6cb5dda95a519..e26b65c04300d13cbfc01bb4438cfdbf053c0fdc 100644 (file)
@@ -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}
   <line x1="1344" y1="247" x2="1342" y2="241"/>
 
  <!-- legend -->
- <rect x="2000" y="96" width="386" height="199"/>
+ <rect x="2000" y="96" width="386" height="259"/>
  <text x="2015" y="128" style="text-anchor:start; font-weight:bold; font-size:21px">cell label</text>
-  <text x="2024" y="159" style="text-anchor:start; font-style:oblique; font-size:21px">level_number,</text>
+  <text x="2024" y="159" style="text-anchor:start; font-style:oblique; font-size:21px">cell_level.</text>
   <text x="2024" y="191" style="text-anchor:start; font-style:oblique; font-size:21px">cell_index,</text>
   <text x="2024" y="222" style="text-anchor:start; font-style:oblique; font-size:21px">material_id,</text>
   <text x= "2024" y="254" style="text-anchor:start; font-style:oblique; font-size:21px">subdomain_id,</text>
   <text x= "2024" y="285" style="text-anchor:start; font-style:oblique; font-size:21px">level_subdomain_id</text>
-  <text x="2000" y="322" style="text-anchor:start; font-size:21px">azimuth: 0°, polar: 60°</text>
+  <text x="2000" y="385" style="text-anchor:start; font-size:21px">azimuth: 0°, polar: 60°</text>
 
  <!-- colorbar -->
  <text x="2000" y="429" style="text-anchor:start; font-weight:bold; font-size:21px">level_number</text>
   <rect class="r4" x="2000" y="446" width="30" height="132"/>
   <text x="2045.00" y="519.000" style="text-anchor:start; font-size:21px; font-weight:bold">4 max</text>
 
-</svg>
\ No newline at end of file
+</svg>
diff --git a/tests/grid/grid_out_svg_03.cc b/tests/grid/grid_out_svg_03.cc
new file mode 100644 (file)
index 0000000..1b19209
--- /dev/null
@@ -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 <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_out.h>
+#include <deal.II/grid/manifold_lib.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+
+#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 (file)
index 0000000..080e772
--- /dev/null
@@ -0,0 +1,82 @@
+
+<svg width="876" height="1000" xmlns="http://www.w3.org/2000/svg" version="1.1">
+
+
+<!-- internal style sheet -->
+<style type="text/css"><![CDATA[
+ rect.background{fill:none}
+ rect{fill:none; stroke:rgb(25,25,25); stroke-width:2}
+ 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}
+ rect.r0{fill:rgb(0,102,255); stroke:rgb(25,25,25); stroke-width:2}
+]]></style>
+
+ <rect class="background" width="476" height="1000"/>
+  <!-- cells -->
+  <path class="p0" d="M 38 920 L 285 840 L 162 670 L 38 710 L 38 920"/>
+  <text x="131" y="818" style="font-size:67px">0.0</text>
+  <line x1="38" y1="920" x2="38" y2="710"/>
+    <circle cx="38" cy="815" r="33" />
+    <text x="38" y="815" style="font-size:33px" dominant-baseline="middle">3</text>
+  <line x1="38" y1="920" x2="285" y2="840"/>
+    <circle cx="162" cy="880" r="33" />
+    <text x="162" y="880" style="font-size:33px" dominant-baseline="middle">1</text>
+  <line x1="38" y1="710" x2="162" y2="670"/>
+    <circle cx="100" cy="690" r="34" />
+    <text x="100" y="690" style="font-size:34px" dominant-baseline="middle">0</text>
+  <path class="p0" d="M 285 840 L 438 630 L 238 565 L 162 670 L 285 840"/>
+  <text x="281" y="710" style="font-size:68px">0.1</text>
+  <line x1="285" y1="840" x2="438" y2="630"/>
+    <circle cx="362" cy="735" r="34" />
+    <text x="362" y="735" style="font-size:34px" dominant-baseline="middle">1</text>
+  <line x1="162" y1="670" x2="238" y2="565"/>
+    <circle cx="200" cy="617" r="35" />
+    <text x="200" y="617" style="font-size:35px" dominant-baseline="middle">0</text>
+  <path class="p0" d="M 438 630 L 438 370 L 238 435 L 238 565 L 438 630"/>
+  <text x="338" y="535" style="font-size:69px">0.2</text>
+  <line x1="438" y1="630" x2="438" y2="370"/>
+    <circle cx="438" cy="500" r="34" />
+    <text x="438" y="500" style="font-size:34px" dominant-baseline="middle">1</text>
+  <line x1="238" y1="565" x2="238" y2="435"/>
+    <circle cx="238" cy="500" r="35" />
+    <text x="238" y="500" style="font-size:35px" dominant-baseline="middle">0</text>
+  <path class="p0" d="M 438 370 L 285 160 L 162 330 L 238 435 L 438 370"/>
+  <text x="281" y="358" style="font-size:68px">0.3</text>
+  <line x1="438" y1="370" x2="285" y2="160"/>
+    <circle cx="362" cy="265" r="33" />
+    <text x="362" y="265" style="font-size:33px" dominant-baseline="middle">1</text>
+  <line x1="238" y1="435" x2="162" y2="330"/>
+    <circle cx="200" cy="383" r="34" />
+    <text x="200" y="383" style="font-size:34px" dominant-baseline="middle">0</text>
+  <path class="p0" d="M 285 160 L 38 80 L 38 290 L 162 330 L 285 160"/>
+  <text x="131" y="249" style="font-size:67px">0.4</text>
+  <line x1="38" y1="80" x2="38" y2="290"/>
+    <circle cx="38" cy="185" r="33" />
+    <text x="38" y="185" style="font-size:33px" dominant-baseline="middle">2</text>
+  <line x1="285" y1="160" x2="38" y2="80"/>
+    <circle cx="162" cy="120" r="32" />
+    <text x="162" y="120" style="font-size:32px" dominant-baseline="middle">1</text>
+  <line x1="162" y1="330" x2="38" y2="290"/>
+    <circle cx="100" cy="310" r="33" />
+    <text x="100" y="310" style="font-size:33px" dominant-baseline="middle">0</text>
+
+ <!-- legend -->
+ <rect x="476" y="80" width="320" height="215"/>
+ <text x="489" y="107" style="text-anchor:start; font-weight:bold; font-size:18px">cell label</text>
+  <text x="496" y="134" style="text-anchor:start; font-style:oblique; font-size:18px">cell_level.</text>
+  <text x="496" y="161" style="text-anchor:start; font-style:oblique; font-size:18px">cell_index</text>
+ <text x="489" y="188" style="text-anchor:start; font-weight:bold; font-size:18px">edge label</text>
+  <text x= "496" y="215" style="text-anchor:start; font-style:oblique; font-size:18px">boundary_id</text>
+  <text x="476" y="328" style="text-anchor:start; font-size:18px">azimuth: 0°, polar: 0°</text>
+
+ <!-- colorbar -->
+ <text x="476" y="356" style="text-anchor:start; font-weight:bold; font-size:18px">level_number</text>
+  <rect class="r0" x="476" y="370" width="25" height="550"/>
+  <text x="513.500" y="651.000" style="text-anchor:start; font-size:18px; font-weight:bold">0 max min</text>
+
+</svg>
\ No newline at end of file

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.