Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix report #46

Merged
merged 3 commits into from
Jun 20, 2021
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
94 changes: 62 additions & 32 deletions ansys/mapdl/reader/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
import scooby
import pyvista
import numpy as np
import vtk

VTK9 = vtk.vtkVersion().GetVTKMajorVersion() >= 9
from pyvista._vtk import VTK9


def vtk_cell_info(grid, force_int64=True, shift_offset=True):
Expand Down Expand Up @@ -65,39 +63,71 @@ def vtk_cell_info(grid, force_int64=True, shift_offset=True):


class Report(scooby.Report):
"""A class for custom scooby.Report."""

def __init__(self, additional=None, ncol=3, text_width=80, sort=False,
gpu=True):
"""Generate a :class:`scooby.Report` instance.

Parameters
----------
additional : list(ModuleType), list(str)
List of packages or package names to add to output information.

ncol : int, optional
Number of package-columns in html table; only has effect if
``mode='HTML'`` or ``mode='html'``. Defaults to 3.
"""Generate an environment and software report.

text_width : int, optional
The text width for non-HTML display modes

sort : bool, optional
Alphabetically sort the packages
Parameters
----------
additional : list(ModuleType), list(str)
List of packages or package names to add to output information.

ncol : int, optional
Number of package-columns in html table; only has effect if
``mode='HTML'`` or ``mode='html'``. Defaults to 3.

text_width : int, optional
The text width for non-HTML display modes.

sort : bool, optional
Alphabetically sort the packages.

gpu : bool, optional
Gather information about the GPU. Defaults to ``True`` but if
experiencing rendering issues, pass ``False`` to safely
generate a report.

Examples
--------
>>> from ansys.mapdl import reader as pymapdl_reader
>>> print(pymapdl_reader.Report())
-----------------------------------------------------------------
PyMAPDL-Reader Software and Environment Report
-----------------------------------------------------------------
Date: Sat Jun 19 14:52:00 2021 MDT
|
OS : Linux
CPU(s) : 16
Machine : x86_64
Architecture : 64bit
RAM : 62.8 GiB
Environment : Python
NVIDIA Corporation : GPU Vendor
NVIDIA Quadro P2000/PCIe/SSE2 : GPU Renderer
4.5.0 NVIDIA 465.27 : GPU Version
|
Python 3.8.5 (default, May 27 2021, 13:30:53) [GCC 9.3.0]
|
pyvista : 0.31.1
vtk : 9.0.1
numpy : 1.20.3
appdirs : 1.4.4
ansys.mapdl.reader : 0.51.dev0
tqdm : 4.61.1
matplotlib : 3.4.2
ansys.mapdl.core : 0.59.dev0
scipy : 1.6.3
-----------------------------------------------------------------

gpu : bool
Gather information about the GPU. Defaults to ``True`` but if
experiencing renderinng issues, pass ``False`` to safely generate
a report.
"""

"""
def __init__(self, additional=None, ncol=3, text_width=79, sort=False,
gpu=True):
"""Generate a :class:`scooby.Report` instance."""
# Mandatory packages.
core = ['pyansys', 'pyvista', 'vtk', 'numpy', 'scipy',
'appdirs', 'ansys.mapdl.core']
core = ['pyvista', 'vtk', 'numpy', 'appdirs',
'ansys.mapdl.reader', 'tqdm', 'matplotlib']

# Optional packages.
optional = ['matplotlib', 'ansys.mapdl.corba']
optional = ['matplotlib', 'ansys.mapdl.core', 'scipy']

# Information about the GPU - bare except in case there is a rendering
# bug that the user is trying to report.
Expand All @@ -113,9 +143,10 @@ def __init__(self, additional=None, ncol=3, text_width=80, sort=False,
optional=optional, ncol=ncol,
text_width=text_width, sort=sort,
extra_meta=extra_meta)
self._text_width = text_width

def __repr__(self):
add_text = '-'*79 + '\nPyMAPDL-Reader Software and Environment Report'
add_text = '-'*self.text_width + '\nPyMAPDL-Reader Software and Environment Report'
return add_text + super().__repr__()


Expand All @@ -141,7 +172,6 @@ def _configure_pyvista():
pv.rcParams["cmap"] = "jet"
pv.rcParams["font"]["family"] = "courier"
pv.rcParams["title"] = "pyansys"
return


def break_apart_surface(surf, force_linear=True):
Expand Down
1 change: 1 addition & 0 deletions doc/source/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ PyMAPDL-Reader classes, functions, and attributes.
full
mesh_quality
rst
misc
8 changes: 8 additions & 0 deletions doc/source/api/misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. _ref_misc_api:

*********************
Miscellaneous Classes
*********************
.. autoclass:: ansys.mapdl.reader.Report
:members:
:noindex:
1 change: 0 additions & 1 deletion doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ straightforward API coupled with C libraries based on header files
provided by ANSYS.

The ``ansys-mapdl-reader`` module supports the following formats:

- ``*.rst`` - Structural analysis result file
- ``*.rth`` - Thermal analysis result file
- ``*.emat`` - Element matrice data file
Expand Down