From: Daniel Arndt Date: Thu, 23 May 2019 15:26:52 +0000 (-0400) Subject: Fix GridIn::read_msh X-Git-Tag: v9.1.1~4^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F8280%2Fhead;p=dealii.git Fix GridIn::read_msh --- diff --git a/source/grid/grid_in.cc b/source/grid/grid_in.cc index 35c46344bb..6f5a04eedd 100644 --- a/source/grid/grid_in.cc +++ b/source/grid/grid_in.cc @@ -1780,49 +1780,35 @@ GridIn::read_msh(std::istream &in) >> cell_type; // ELM-TYPE } - switch (gmsh_file_format) + if (gmsh_file_format < 20) { - case 10: - { - in >> material_id // REG-PHYS - >> dummy // reg_elm - >> nod_num; - break; - } - - case 20: - { - // read the tags; ignore all but the first one which we will - // interpret as the material_id (for cells) or boundary_id - // (for faces) - unsigned int n_tags; - in >> n_tags; - if (n_tags > 0) - in >> material_id; - else - material_id = 0; - - for (unsigned int i = 1; i < n_tags; ++i) - in >> dummy; - - nod_num = GeometryInfo::vertices_per_cell; - - break; - } - - case 40: - case 41: - { - // ignore tag - int tag; - in >> tag; - nod_num = GeometryInfo::vertices_per_cell; - break; - } + in >> material_id // REG-PHYS + >> dummy // reg_elm + >> nod_num; + } + else if (gmsh_file_format < 40) + { + // read the tags; ignore all but the first one which we will + // interpret as the material_id (for cells) or boundary_id + // (for faces) + unsigned int n_tags; + in >> n_tags; + if (n_tags > 0) + in >> material_id; + else + material_id = 0; + for (unsigned int i = 1; i < n_tags; ++i) + in >> dummy; - default: - AssertThrow(false, ExcNotImplemented()); + nod_num = GeometryInfo::vertices_per_cell; + } + else + { + // ignore tag + int tag; + in >> tag; + nod_num = GeometryInfo::vertices_per_cell; } @@ -1978,23 +1964,14 @@ GridIn::read_msh(std::istream &in) { // read the indices of nodes given unsigned int node_index = 0; - switch (gmsh_file_format) + if (gmsh_file_format < 20) { - case 10: - { - for (unsigned int i = 0; i < nod_num; ++i) - in >> node_index; - break; - } - case 20: - case 40: - case 41: - { - in >> node_index; - break; - } - default: - Assert(false, ExcInternalError()); + for (unsigned int i = 0; i < nod_num; ++i) + in >> node_index; + } + else + { + in >> node_index; } // we only care about boundary indicators assigned to individual