From: David Wells Date: Fri, 19 Feb 2021 20:45:32 +0000 (-0500) Subject: Rename two variables. X-Git-Tag: v9.3.0-rc1~358^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b02839f4384e703f9ab6dea16af69f4ec78089fe;p=dealii.git Rename two variables. --- diff --git a/source/grid/grid_in.cc b/source/grid/grid_in.cc index 777b33619c..d21c480421 100644 --- a/source/grid/grid_in.cc +++ b/source/grid/grid_in.cc @@ -228,9 +228,10 @@ GridIn::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::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::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::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::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]; diff --git a/source/grid/grid_out.cc b/source/grid/grid_out.cc index 49a22c7a6f..1faad255aa 100644 --- a/source/grid/grid_out.cc +++ b/source/grid/grid_out.cc @@ -3429,7 +3429,8 @@ GridOut::write_vtk(const Triangulation &tria, * * see also: https://vtk.org/wp-content/uploads/2015/04/file-formats.pdf */ - static const std::array table = {{1, 3, 5, 9, 10, 14, 13, 12}}; + static const std::array 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 &tria, if (vtk_flags.output_cells) { for (const auto &cell : tria.active_cell_iterators()) - out << table[static_cast(cell->reference_cell())] << ' '; + out << deal_to_vtk_cell_type[static_cast(cell->reference_cell())] + << ' '; out << '\n'; } if (vtk_flags.output_faces) { for (const auto &face : faces) - out << table[static_cast(face->reference_cell())] << ' '; + out << deal_to_vtk_cell_type[static_cast(face->reference_cell())] + << ' '; out << '\n'; } if (vtk_flags.output_edges) { for (const auto &edge : edges) - out << table[static_cast(edge->reference_cell())] << ' '; + out << deal_to_vtk_cell_type[static_cast(edge->reference_cell())] + << ' '; } out << "\n\nCELL_DATA " << n_cells << '\n' << "SCALARS MaterialID int 1\n"