From: Wolfgang Bangerth Date: Thu, 2 Apr 2020 16:08:38 +0000 (-0600) Subject: Minor cleanups. X-Git-Tag: v9.2.0-rc1~296^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed2fc413cd121aaa57e79ef33067cf0afe19d2da;p=dealii.git Minor cleanups. --- diff --git a/source/grid/grid_in.cc b/source/grid/grid_in.cc index cf8639fc6e..11a3881fde 100644 --- a/source/grid/grid_in.cc +++ b/source/grid/grid_in.cc @@ -371,17 +371,14 @@ GridIn::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::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::read_vtk(std::istream &in) { double id; in >> id; - if (set == "MaterialID") + if (field_name == "MaterialID") cells[i].material_id = static_cast(id); - else if (set == "ManifoldID") + else if (field_name == "ManifoldID") cells[i].manifold_id = static_cast(id); else @@ -427,10 +424,10 @@ GridIn::read_vtk(std::istream &in) { double id; in >> id; - if (set == "MaterialID") + if (field_name == "MaterialID") boundary_quad.material_id = static_cast(id); - else if (set == "ManifoldID") + else if (field_name == "ManifoldID") boundary_quad.manifold_id = static_cast(id); else @@ -440,10 +437,10 @@ GridIn::read_vtk(std::istream &in) { double id; in >> id; - if (set == "MaterialID") + if (field_name == "MaterialID") boundary_line.material_id = static_cast(id); - else if (set == "ManifoldID") + else if (field_name == "ManifoldID") boundary_line.manifold_id = static_cast(id); else @@ -456,10 +453,10 @@ GridIn::read_vtk(std::istream &in) { double id; in >> id; - if (set == "MaterialID") + if (field_name == "MaterialID") boundary_line.material_id = static_cast(id); - else if (set == "ManifoldID") + else if (field_name == "ManifoldID") boundary_line.manifold_id = static_cast(id); else