From 74a3b3caded250d3519d6a1064e8d12f8b631541 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 23 May 2019 11:26:52 -0400 Subject: [PATCH] Fix GridIn::read_msh --- source/grid/grid_in.cc | 89 ++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 56 deletions(-) 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 -- 2.39.5