]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify some code.
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 2 Nov 2021 23:50:52 +0000 (17:50 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 5 Nov 2021 03:48:48 +0000 (21:48 -0600)
source/base/data_out_base.cc

index dabc8849cdefa39e6b899ef7af6790db5621e1af..df32f54bb86d2a70bd7ecf92a18c499cf03a173b 100644 (file)
@@ -3980,38 +3980,20 @@ namespace DataOutBase
                     Assert(n_subdivisions == 1, ExcNotImplemented());
 
                     // Draw the tetrahedron as a two collections of lines.
-                    out << get_node_location(patch, 0) << ' ';
-                    output_point_data(0);
-                    out << '\n';
-
-                    out << get_node_location(patch, 1) << ' ';
-                    output_point_data(1);
-                    out << '\n';
-
-                    out << get_node_location(patch, 2) << ' ';
-                    output_point_data(2);
-                    out << '\n';
-
-                    out << get_node_location(patch, 0) << ' ';
-                    output_point_data(0);
-                    out << '\n';
-
-                    out << get_node_location(patch, 3) << ' ';
-                    output_point_data(3);
-                    out << '\n';
-
-                    out << get_node_location(patch, 2) << ' ';
-                    output_point_data(2);
-                    out << '\n';
+                    for (const unsigned int v : {0, 1, 2, 0, 3, 2})
+                      {
+                        out << get_node_location(patch, v) << ' ';
+                        output_point_data(v);
+                        out << '\n';
+                      }
                     out << '\n'; // end of first line
 
-                    out << get_node_location(patch, 3) << ' ';
-                    output_point_data(3);
-                    out << '\n';
-
-                    out << get_node_location(patch, 1) << ' ';
-                    output_point_data(1);
-                    out << '\n';
+                    for (const unsigned int v : {3, 1})
+                      {
+                        out << get_node_location(patch, v) << ' ';
+                        output_point_data(v);
+                        out << '\n';
+                      }
                     out << '\n'; // end of second line
                   }
                 else if (patch.reference_cell == ReferenceCells::Pyramid)
@@ -4019,106 +4001,53 @@ namespace DataOutBase
                     Assert(n_subdivisions == 1, ExcNotImplemented());
 
                     // Draw the pyramid as a two collections of lines.
-                    out << get_node_location(patch, 0) << ' ';
-                    output_point_data(0);
-                    out << '\n';
-
-                    out << get_node_location(patch, 1) << ' ';
-                    output_point_data(1);
-                    out << '\n';
-
-                    out << get_node_location(patch, 2) << ' ';
-                    output_point_data(2);
-                    out << '\n';
-
-                    out << get_node_location(patch, 3) << ' ';
-                    output_point_data(3);
-                    out << '\n';
-
-                    out << get_node_location(patch, 0) << ' ';
-                    output_point_data(0);
-                    out << '\n';
-
-                    out << get_node_location(patch, 4) << ' ';
-                    output_point_data(4);
-                    out << '\n';
-
-                    out << get_node_location(patch, 1) << ' ';
-                    output_point_data(1);
-                    out << '\n';
+                    for (const unsigned int v : {0, 1, 2, 3, 0, 4, 1})
+                      {
+                        out << get_node_location(patch, v) << ' ';
+                        output_point_data(v);
+                        out << '\n';
+                      }
                     out << '\n'; // end of first line
 
-                    out << get_node_location(patch, 2) << ' ';
-                    output_point_data(2);
-                    out << '\n';
-
-                    out << get_node_location(patch, 4) << ' ';
-                    output_point_data(4);
-                    out << '\n';
-
-                    out << get_node_location(patch, 3) << ' ';
-                    output_point_data(2);
-                    out << '\n';
+                    for (const unsigned int v : {2, 4, 3})
+                      {
+                        out << get_node_location(patch, v) << ' ';
+                        output_point_data(v);
+                        out << '\n';
+                      }
                     out << '\n'; // end of second line
                   }
                 else if (patch.reference_cell == ReferenceCells::Wedge)
                   {
                     Assert(n_subdivisions == 1, ExcNotImplemented());
 
-                    // Draw the pyramid as three collections of
+                    // Draw the wedge as three collections of
                     // lines. The first one wraps around the base,
                     // goes up to the top, and wraps around that. The
                     // second and third are just individual lines
                     // going from base to top.
-                    out << get_node_location(patch, 0) << ' ';
-                    output_point_data(0);
-                    out << '\n';
-
-                    out << get_node_location(patch, 1) << ' ';
-                    output_point_data(1);
-                    out << '\n';
-
-                    out << get_node_location(patch, 2) << ' ';
-                    output_point_data(2);
-                    out << '\n';
-
-                    out << get_node_location(patch, 0) << ' ';
-                    output_point_data(0);
-                    out << '\n';
-
-                    out << get_node_location(patch, 3) << ' ';
-                    output_point_data(3);
-                    out << '\n';
-
-                    out << get_node_location(patch, 4) << ' ';
-                    output_point_data(4);
-                    out << '\n';
-
-                    out << get_node_location(patch, 5) << ' ';
-                    output_point_data(5);
-                    out << '\n';
-
-                    out << get_node_location(patch, 3) << ' ';
-                    output_point_data(3);
-                    out << '\n';
+                    for (const unsigned int v : {0, 1, 2, 0, 3, 4, 5, 3})
+                      {
+                        out << get_node_location(patch, v) << ' ';
+                        output_point_data(v);
+                        out << '\n';
+                      }
                     out << '\n'; // end of first line
 
-                    out << get_node_location(patch, 1) << ' ';
-                    output_point_data(1);
-                    out << '\n';
-
-                    out << get_node_location(patch, 4) << ' ';
-                    output_point_data(4);
-                    out << '\n';
+                    for (const unsigned int v : {1, 4})
+                      {
+                        out << get_node_location(patch, v) << ' ';
+                        output_point_data(v);
+                        out << '\n';
+                      }
                     out << '\n'; // end of second line
 
-                    out << get_node_location(patch, 2) << ' ';
-                    output_point_data(1);
-                    out << '\n';
-
-                    out << get_node_location(patch, 5) << ' ';
-                    output_point_data(4);
-                    out << '\n';
+                    for (const unsigned int v : {2, 5})
+                      {
+                        out << get_node_location(patch, v) << ' ';
+                        output_point_data(v);
+                        out << '\n';
+                      }
                     out << '\n'; // end of second line
                   }
                 else

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.