ansys / ansys/pymapdl-reader

Reading 2023R1 CDB files fails

Open
#351 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
60
Forks
32
Avg merge
5h 50m
Merged PRs (30d)
8

Description

The following code fails:

```py
from ansys.mapdl.reader.archive import Archive
archive = Archive(r'2Blocks2023R2.cdb')
```
Traceback:
```text
IndexError Traceback (most recent call last)
Cell In[7], line 1
----> 1 archive = Archive(r'/Users/german.ayuso/pymapdl/tmp/2Blocks2023R2.cdb')

File ~/pymapdl/.venv_macos/lib/python3.10/site-packages/ansys/mapdl/reader/archive.py:148, in Archive.__init__(self, filename, read_parameters, parse_vtk, force_linear, allowable_types, null_unallowed, verbose, name, read_eblock)
145 self._null_unallowed = null_unallowed
147 if parse_vtk:
--> 148 self._grid = self._parse_vtk(allowable_types, force_linear, null_unallowed)

File ~/pymapdl/.venv_macos/lib/python3.10/site-packages/ansys/mapdl/reader/mesh.py:185, in Mesh._parse_vtk(self, allowable_types, force_linear, null_unallowed, fix_midside, additional_checking)
183 # ANSYS element type to VTK map
184 type_ref = np.empty(2 << 16, np.int32) # 131072
--> 185 type_ref[self._ekey[:, 0]] = etype_map[self._ekey[:, 1]]
187 if allowable_types is None or 200 in allowable_types:
188 for etype_ind, etype in self._ekey:
189 # MESH200

IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
```

CDB File:

Contributor guide

Open the contributing guide

Research direction

Start with Archive.__init__ in archive.py and Mesh._parse_vtk in mesh.py, following the failing type_ref[self._ekey[:, 0]] lookup shown in the traceback. Reproduce the failure with the referenced 2023R1 CDB file, then verify that reading it completes without the IndexError and add a regression test if the repository’s tests cover this parser.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.