]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Rename two variables.
authorDavid Wells <drwells@email.unc.edu>
Fri, 19 Feb 2021 20:45:32 +0000 (15:45 -0500)
committerDavid Wells <drwells@email.unc.edu>
Mon, 8 Mar 2021 20:06:02 +0000 (15:06 -0500)
source/grid/grid_in.cc
source/grid/grid_out.cc

index 777b33619cf3252cf7a205522b1a178abec84317..d21c4804213b803030f916721a62205eabf777a4 100644 (file)
@@ -228,9 +228,10 @@ GridIn<dim, spacedim>::read_vtk(std::istream &in)
         {
           for (unsigned int count = 0; count < n_geometric_objects; count++)
             {
-              unsigned int type;
-              in >> type;
+              unsigned int n_vertices;
+              in >> n_vertices;
 
+              // VTK_TETRA is 10, VTK_HEXAHEDRON is 12
               if (cell_types[count] == 10 || cell_types[count] == 12)
                 {
                   if (cell_types[count] == 10)
@@ -244,14 +245,15 @@ GridIn<dim, spacedim>::read_vtk(std::istream &in)
                                 subcelldata.boundary_lines.size() == 0,
                               ExcNotImplemented());
 
-                  cells.emplace_back(type);
+                  cells.emplace_back(n_vertices);
 
-                  for (unsigned int j = 0; j < type; j++) // loop to feed data
+                  for (unsigned int j = 0; j < n_vertices;
+                       j++) // loop to feed data
                     in >> cells.back().vertices[j];
 
                   cells.back().material_id = 0;
                 }
-
+              // VTK_TRIANGLE is 5, VTK_QUAD is 9
               else if (cell_types[count] == 5 || cell_types[count] == 9)
                 {
                   if (cell_types[count] == 5)
@@ -264,19 +266,20 @@ GridIn<dim, spacedim>::read_vtk(std::istream &in)
                   AssertThrow(subcelldata.boundary_lines.size() == 0,
                               ExcNotImplemented());
 
-                  subcelldata.boundary_quads.emplace_back(type);
+                  subcelldata.boundary_quads.emplace_back(n_vertices);
 
-                  for (unsigned int j = 0; j < type;
+                  for (unsigned int j = 0; j < n_vertices;
                        j++) // loop to feed the data to the boundary
                     in >> subcelldata.boundary_quads.back().vertices[j];
 
                   subcelldata.boundary_quads.back().material_id = 0;
                 }
+              // VTK_LINE is 3
               else if (cell_types[count] == 3)
                 {
-                  subcelldata.boundary_lines.emplace_back(type);
+                  subcelldata.boundary_lines.emplace_back(n_vertices);
 
-                  for (unsigned int j = 0; j < type;
+                  for (unsigned int j = 0; j < n_vertices;
                        j++) // loop to feed the data to the boundary
                     in >> subcelldata.boundary_lines.back().vertices[j];
 
@@ -294,9 +297,10 @@ GridIn<dim, spacedim>::read_vtk(std::istream &in)
         {
           for (unsigned int count = 0; count < n_geometric_objects; count++)
             {
-              unsigned int type;
-              in >> type;
+              unsigned int n_vertices;
+              in >> n_vertices;
 
+              // VTK_TRIANGLE is 5, VTK_QUAD is 9
               if (cell_types[count] == 5 || cell_types[count] == 9)
                 {
                   // we assume that the file contains first all cells,
@@ -309,21 +313,22 @@ GridIn<dim, spacedim>::read_vtk(std::istream &in)
                   if (cell_types[count] == 9)
                     is_quad_or_hex_mesh = true;
 
-                  cells.emplace_back(type);
+                  cells.emplace_back(n_vertices);
 
-                  for (unsigned int j = 0; j < type; j++) // loop to feed data
+                  for (unsigned int j = 0; j < n_vertices;
+                       j++) // loop to feed data
                     in >> cells.back().vertices[j];
 
                   cells.back().material_id = 0;
                 }
-
+              // VTK_LINE is 3
               else if (cell_types[count] == 3)
                 {
                   // If this is encountered, the pointer comes out of the loop
                   // and starts processing boundaries.
-                  subcelldata.boundary_lines.emplace_back(type);
+                  subcelldata.boundary_lines.emplace_back(n_vertices);
 
-                  for (unsigned int j = 0; j < type;
+                  for (unsigned int j = 0; j < n_vertices;
                        j++) // loop to feed the data to the boundary
                     {
                       in >> subcelldata.boundary_lines.back().vertices[j];
index 49a22c7a6f781c317bce595a264e8d83aad9a7ee..1faad255aac05f9ecc59cb39a256683992404e50 100644 (file)
@@ -3429,7 +3429,8 @@ GridOut::write_vtk(const Triangulation<dim, spacedim> &tria,
    *
    * see also: https://vtk.org/wp-content/uploads/2015/04/file-formats.pdf
    */
-  static const std::array<int, 8> table = {{1, 3, 5, 9, 10, 14, 13, 12}};
+  static const std::array<int, 8> deal_to_vtk_cell_type =
+    {{1, 3, 5, 9, 10, 14, 13, 12}};
 
   // write cells.
   if (vtk_flags.output_cells)
@@ -3490,19 +3491,22 @@ GridOut::write_vtk(const Triangulation<dim, spacedim> &tria,
   if (vtk_flags.output_cells)
     {
       for (const auto &cell : tria.active_cell_iterators())
-        out << table[static_cast<int>(cell->reference_cell())] << ' ';
+        out << deal_to_vtk_cell_type[static_cast<int>(cell->reference_cell())]
+            << ' ';
       out << '\n';
     }
   if (vtk_flags.output_faces)
     {
       for (const auto &face : faces)
-        out << table[static_cast<int>(face->reference_cell())] << ' ';
+        out << deal_to_vtk_cell_type[static_cast<int>(face->reference_cell())]
+            << ' ';
       out << '\n';
     }
   if (vtk_flags.output_edges)
     {
       for (const auto &edge : edges)
-        out << table[static_cast<int>(edge->reference_cell())] << ' ';
+        out << deal_to_vtk_cell_type[static_cast<int>(edge->reference_cell())]
+            << ' ';
     }
   out << "\n\nCELL_DATA " << n_cells << '\n'
       << "SCALARS MaterialID int 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.