From 6235bb7042579c1b39fefe7ecd250bb5cdadb82e Mon Sep 17 00:00:00 2001 From: Alex Kaszynski Date: Fri, 27 May 2022 14:13:07 -0600 Subject: [PATCH 1/2] skip when missing tshape --- ansys/mapdl/reader/mesh.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ansys/mapdl/reader/mesh.py b/ansys/mapdl/reader/mesh.py index f6215065..a9e52d62 100644 --- a/ansys/mapdl/reader/mesh.py +++ b/ansys/mapdl/reader/mesh.py @@ -168,16 +168,20 @@ def _parse_vtk(self, allowable_types=None, force_linear=False, type_ref = np.empty(2 << 16, np.int32) # 131072 type_ref[self._ekey[:, 0]] = etype_map[self._ekey[:, 1]] - # special treatment for MESH200 if allowable_types is None or 200 in allowable_types: for etype_ind, etype in self._ekey: + + # MESH200 if etype == 200 and etype_ind in self.key_option: # keyoption 1 contains various cell types # map them to the corresponding type (see elements.py) mapped = MESH200_MAP[self.key_option[etype_ind][0][1]] type_ref[etype_ind] = mapped - if etype == 170: # TARGE170 specifics + # TARGE170 specifics + if etype == 170: + if etype_ind not in self.tshape_key: + continue tshape_num = self.tshape_key[etype_ind] if tshape_num >= 19: # weird bug when 'PILO' can be 99 instead of 19. tshape_num = 19 From 3ef953cb38d2b0c1a5c5771537f9bac430f1ee87 Mon Sep 17 00:00:00 2001 From: Alex Kaszynski Date: Fri, 27 May 2022 14:13:46 -0600 Subject: [PATCH 2/2] add pragma --- ansys/mapdl/reader/mesh.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ansys/mapdl/reader/mesh.py b/ansys/mapdl/reader/mesh.py index a9e52d62..6af8f822 100644 --- a/ansys/mapdl/reader/mesh.py +++ b/ansys/mapdl/reader/mesh.py @@ -180,7 +180,8 @@ def _parse_vtk(self, allowable_types=None, force_linear=False, # TARGE170 specifics if etype == 170: - if etype_ind not in self.tshape_key: + # edge case where missing element within the tshape_key + if etype_ind not in self.tshape_key: # pragma: no cover continue tshape_num = self.tshape_key[etype_ind] if tshape_num >= 19: # weird bug when 'PILO' can be 99 instead of 19.