]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use the same color edges as for nodes in the tutorial graph. 9342/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 15 Jan 2020 20:21:31 +0000 (13:21 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 15 Jan 2020 20:28:42 +0000 (13:28 -0700)
doc/doxygen/scripts/steps.pl

index 2fb8f0be46a89b6a7e1c67425d3c15ded3f06a2e..1c66735f1b2b205dcc89524de162fff42a035eb9 100644 (file)
@@ -26,13 +26,24 @@ while (my $line = <TUTORIAL>)
   print $line;
 }
 
-# List of additional node attributes to highlight purpose and state of the example
+# List of additional node and edge attributes to highlight purpose and state of
+# a tutorial or code gallery program
+my %colors = (
+ "basic"          => 'green',
+ "techniques"     => 'orange',
+ "fluids"         => 'yellow2',
+ "solids"         => 'lightblue',
+ "time dependent" => 'blue',
+ "unfinished"     => 'black',
+ "code-gallery"   => 'black',
+    );
+
 my %style = (
- "basic"          => ',height=.8,width=.8,shape="octagon",fillcolor="green"',
- "techniques"     => ',height=.35,width=.35,fillcolor="orange"',
- "fluids"         => ',height=.25,width=.25,fillcolor="yellow"',
- "solids"         => ',height=.25,width=.25,fillcolor="lightblue"',
- "time dependent" => ',height=.25,width=.25,fillcolor="blue"',
+ "basic"          => ',height=.8,width=.8,shape="octagon"',
+ "techniques"     => ',height=.35,width=.35',
+ "fluids"         => ',height=.25,width=.25',
+ "solids"         => ',height=.25,width=.25',
+ "time dependent" => ',height=.25,width=.25',
  "unfinished"     => ',height=.25,width=.25,style="dashed"',
  "code-gallery"   => ',height=.08,width=.125,shape="circle"',
     );
@@ -63,6 +74,7 @@ EOT
 # command line arguments denoting the tutorial programs
 
 my $step;
+my %kind_map;
 foreach $step (@ARGV)
 {
     # read first line of tooltip file
@@ -91,8 +103,10 @@ foreach $step (@ARGV)
       my $number = $step;
       $number =~ s/^.*-//;
 
+      $kind_map{"Step$number"} = $kind;
+
       printf "  Step$number [label=\"$number\", URL=\"\\ref step_$number\", tooltip=\"$tooltip\"";
-      print "$style{$kind}";
+      print "$style{$kind},fillcolor=\"$colors{$kind}\"";
     }
     else
     {
@@ -103,6 +117,8 @@ foreach $step (@ARGV)
       my $tag = $name;
       $tag =~ s/[^a-zA-Z]/_/g;
 
+      $kind_map{"code_gallery_$tag"} = "code-gallery";
+
       printf "  code_gallery_$tag [label=\"\", URL=\"\\ref code_gallery_$tag\", tooltip=\"$tooltip\"";
       my $kind = "code-gallery";
       print "$style{$kind}";
@@ -146,11 +162,24 @@ foreach $step (@ARGV)
     foreach $source (split ' ', $buildson) {
         $source =~ s/step-/Step/g;
         print "  $source -> $destination";
+
+        my $edge_attributes = "";
+
+        # Determine the style of the arrow that connects
+        # the two nodes. If the two nodes are of the same
+        # kind, use the same color as the nodes as this makes
+        # reading the flow of the graph a bit easier.
+        if ($kind_map{$source} eq $kind_map{$destination})
+        {
+            $edge_attributes = "color=\"$colors{$kind_map{$source}}\",";
+        }
+
+        # If the destination is a code gallery program, used a dashed line
         if ($destination =~ /code_gallery/)
         {
-            print " [style=\"dashed\", arrowhead=\"empty\"]";
+            $edge_attributes .= "style=\"dashed\", arrowhead=\"empty\",";
         }
-        print "\n";
+        print " [$edge_attributes]\n";
     }
 }
 
@@ -204,7 +233,7 @@ foreach $kind (keys %style)
 {
     my $escaped_kind = $kind;
     $escaped_kind =~ s/[^a-zA-Z]/_/g;
-    printf "  $escaped_kind [label=\"\" $style{$kind}];\n";
+    printf "  $escaped_kind [label=\"\" $style{$kind}, fillcolor=\"$colors{$kind}\"];\n";
     printf "  fake_$escaped_kind [label=\"$kind_descriptions{$kind}\", shape=plaintext];\n";
     printf "  $escaped_kind -- fake_$escaped_kind [style=dotted, arrowhead=odot, arrowsize=1];\n";
 }

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.