]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Minor cleanups. 9799/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 2 Apr 2020 16:08:38 +0000 (10:08 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Sat, 4 Apr 2020 15:38:34 +0000 (09:38 -0600)
source/grid/grid_in.cc

index cf8639fc6e6ef7398c386ce5fa953f8dc0a63dd6..11a3881fde80b15a8ec4393ffc27fbecac3cf9af 100644 (file)
@@ -371,17 +371,14 @@ GridIn<dim, spacedim>::read_vtk(std::istream &in)
                       // Now see if we know about this type of data set,
                       // if not, just ignore everything till the next SCALARS
                       // keyword
-                      std::string set = "";
-                      in >> keyword;
-                      for (const auto &set_cmp : data_sets)
-                        if (keyword == set_cmp)
-                          {
-                            set = keyword;
-                            break;
-                          }
-                      if (set.empty())
+                      std::string field_name;
+                      in >> field_name;
+                      if (std::find(data_sets.begin(),
+                                    data_sets.end(),
+                                    field_name) == data_sets.end())
+                        // The data set here is not one of the ones we know, so
                         // keep ignoring everything until the next SCALARS
-                        // keyword
+                        // keyword.
                         continue;
 
                       // Now we got somewhere. Proceed from here.
@@ -394,13 +391,13 @@ GridIn<dim, spacedim>::read_vtk(std::istream &in)
                       AssertThrow(
                         keyword == "LOOKUP_TABLE",
                         ExcMessage(
-                          "While reading VTK file, missing keyword LOOKUP_TABLE"));
+                          "While reading VTK file, missing keyword 'LOOKUP_TABLE'."));
 
                       in >> keyword;
                       AssertThrow(
                         keyword == "default",
                         ExcMessage(
-                          "While reading VTK file, missing keyword default"));
+                          "While reading VTK file, missing keyword 'default'."));
 
                       // read material or manifold ids first for all cells,
                       // then for all faces, and finally for all lines. the
@@ -411,10 +408,10 @@ GridIn<dim, spacedim>::read_vtk(std::istream &in)
                         {
                           double id;
                           in >> id;
-                          if (set == "MaterialID")
+                          if (field_name == "MaterialID")
                             cells[i].material_id =
                               static_cast<types::material_id>(id);
-                          else if (set == "ManifoldID")
+                          else if (field_name == "ManifoldID")
                             cells[i].manifold_id =
                               static_cast<types::manifold_id>(id);
                           else
@@ -427,10 +424,10 @@ GridIn<dim, spacedim>::read_vtk(std::istream &in)
                             {
                               double id;
                               in >> id;
-                              if (set == "MaterialID")
+                              if (field_name == "MaterialID")
                                 boundary_quad.material_id =
                                   static_cast<types::material_id>(id);
-                              else if (set == "ManifoldID")
+                              else if (field_name == "ManifoldID")
                                 boundary_quad.manifold_id =
                                   static_cast<types::manifold_id>(id);
                               else
@@ -440,10 +437,10 @@ GridIn<dim, spacedim>::read_vtk(std::istream &in)
                             {
                               double id;
                               in >> id;
-                              if (set == "MaterialID")
+                              if (field_name == "MaterialID")
                                 boundary_line.material_id =
                                   static_cast<types::material_id>(id);
-                              else if (set == "ManifoldID")
+                              else if (field_name == "ManifoldID")
                                 boundary_line.manifold_id =
                                   static_cast<types::manifold_id>(id);
                               else
@@ -456,10 +453,10 @@ GridIn<dim, spacedim>::read_vtk(std::istream &in)
                             {
                               double id;
                               in >> id;
-                              if (set == "MaterialID")
+                              if (field_name == "MaterialID")
                                 boundary_line.material_id =
                                   static_cast<types::material_id>(id);
-                              else if (set == "ManifoldID")
+                              else if (field_name == "ManifoldID")
                                 boundary_line.manifold_id =
                                   static_cast<types::manifold_id>(id);
                               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.