Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ansys/mapdl/reader/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ def read_binary(filename, **kwargs):
return CyclicResult(filename)

if read_mesh:
result._store_mesh()
flag_vtk_parse = kwargs.pop('flag_vtk_parse', True)
result._store_mesh(flag_vtk_parse)

return result

Expand Down
35 changes: 22 additions & 13 deletions ansys/mapdl/reader/rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,14 @@ class Result(AnsysBinary):
----------
filename : str, optional
Filename of the ANSYS binary result file.

ignore_cyclic : bool, optional
Ignores any cyclic properties.

read_mesh : bool, optional
Debug parameter. Set to False to disable reading in the
mesh from the result file.
parse_vtk : bool, optional
Set to ``False`` to skip the parsing the mesh as a VTK
UnstructuredGrid, which might take a long time for large models.

Examples
--------
Expand All @@ -94,10 +95,8 @@ class Result(AnsysBinary):
ELEMENT_INDEX_TABLE_KEYS = ELEMENT_INDEX_TABLE_KEYS
ELEMENT_RESULT_NCOMP = ELEMENT_RESULT_NCOMP

def __init__(self, filename, read_mesh=True, **kwargs):
"""Loads basic result information from result file and
initializes result object.
"""
def __init__(self, filename, read_mesh=True, parse_vtk=True, **kwargs):
"""Load basic result information from result file and init the rst object."""
self.filename = filename
self._cfile = AnsysFile(filename)
self._resultheader = self._read_result_header()
Expand Down Expand Up @@ -130,11 +129,11 @@ def __init__(self, filename, read_mesh=True, **kwargs):
# store mesh for later retrieval
self._mesh = None
if read_mesh:
self._store_mesh()
self._store_mesh(parse_vtk)

@property
def mesh(self):
"""Mesh from result file
"""Mesh from result file.

Examples
--------
Expand Down Expand Up @@ -1549,9 +1548,15 @@ def dict_to_arr(index_dict):
'keyopts': keyopts,
'ekey': np.array(ekey)}

def _store_mesh(self):
"""Store the mesh from the result file"""
def _store_mesh(self, parse_vtk=True):
"""Store the mesh from the result file.

Parameters
----------
parse_vtk : bool, optional
Set to ``False`` to skip the parsing the mesh as a VTK
UnstructuredGrid, which might take a long time for large models.
"""
# Node information
nnod = self._geometry_header['nnod']
nnum = np.empty(nnod, np.int32)
Expand Down Expand Up @@ -1582,9 +1587,13 @@ def _store_mesh(self):
self._mesh = Mesh(nnum, nodes, elem, elem_off,
self._element_table['ekey'],
node_comps=ncomp, elem_comps=ecomp)
self.quadgrid = self._mesh._parse_vtk(null_unallowed=True,
fix_midside=False)
self.grid = self.quadgrid.linear_copy()
if parse_vtk:
self.quadgrid = self._mesh._parse_vtk(null_unallowed=True,
fix_midside=False)
self.grid = self.quadgrid.linear_copy()
else:
self.quadgrid = None
self.grid = None

# identify nodes that are actually in the solution
self._insolution = np.in1d(self._mesh.nnum, self._resultheader['neqv'],
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def build_extensions(self):

if platform.system() == 'Darwin':
mac_version, _, _ = platform.mac_ver()
major, minor, patch = [int(n) for n in mac_version.split('.')]
minor = [int(n) for n in mac_version.split('.')][1]

# libstdc++ is deprecated in recent versions of XCode
if minor >= 9:
Expand Down