Skip to content

feat: using dpf instead of reader in "results" module #1300

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

Draft
wants to merge 91 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
987447c
Initial commit
germa89 Jul 27, 2022
86a9a6b
Implementing RST properties.
germa89 Aug 5, 2022
545224f
Adding many ``nodal_***`` methods.
germa89 Aug 6, 2022
4613453
Replacing reader class with new one to check.
germa89 Aug 6, 2022
7304cdd
Adding static case example
germa89 Aug 7, 2022
867dc11
Reorganising examples
germa89 Aug 7, 2022
9bb50ec
Using DPF Result class
germa89 Aug 11, 2022
902215d
Adding some unit tests.
germa89 Aug 11, 2022
92f8943
Big second revision v(2.0)
germa89 Aug 11, 2022
478f259
Adding to requirements
germa89 Aug 11, 2022
d3d419f
Added some switching properties (`_mode_rst`)
germa89 Sep 16, 2022
1b22690
Adding ECT to ignored words
germa89 Sep 16, 2022
174d68c
Merge branch 'main' into feat/using-dpf-for-results
germa89 Sep 16, 2022
19cd8fb
Merge branch 'main' into feat/using-dpf-for-results
germa89 Sep 16, 2022
9bbed37
Fixing set docstring.
germa89 Sep 19, 2022
41e9d11
Adding canonical examples.
germa89 Sep 19, 2022
3ecc8fd
Fixing typo in post
germa89 Sep 19, 2022
d7c3936
Adding ``element_stress`` and refactoring to use core and not post.
germa89 Sep 20, 2022
79a5510
broken code backup
germa89 Oct 5, 2022
12ad51d
Skipping logic implemented in DPF
germa89 Oct 6, 2022
dd3d90b
Adding more examples and section title.
germa89 Oct 6, 2022
d4c015e
Renaming and reordering canonical examples
germa89 Oct 6, 2022
a05cb51
Unit tests
germa89 Oct 6, 2022
b5afcba
Fixing stress tests, adding parametrization on direction.
germa89 Oct 7, 2022
1274686
Implemented results:
germa89 Oct 7, 2022
46a41cd
Allow magicwords definition when instantiating CommandListingOutput c…
germa89 Oct 14, 2022
ce51dcd
Wraping ``set,list`` with the command output listing class
germa89 Oct 14, 2022
b6c0152
Exposing ``set`` in post_processing using ``mapdl.set("list")``
germa89 Oct 14, 2022
79196ea
Updating docs
germa89 Oct 14, 2022
96d7708
Improving docs
germa89 Oct 14, 2022
7e3c4ce
Fixing lathe issue.
germa89 Oct 14, 2022
5b11f91
making sure were the argument is a string
germa89 Oct 14, 2022
737bb98
Fixing table references
germa89 Oct 14, 2022
60998b8
Adding PyDPF to the documentation mapping
germa89 Oct 14, 2022
56d1e1b
Adding more cannonical examples
germa89 Oct 14, 2022
5b157d9
Fixing unit test
germa89 Oct 14, 2022
c8fe42f
Exposing 'columns_names'.
germa89 Oct 14, 2022
a626426
Fixing building issue.
germa89 Oct 14, 2022
bede0b1
Main DPF workflow and architecture implemented.
germa89 Oct 14, 2022
0e136c1
Implementing unit tests
germa89 Oct 14, 2022
8abff6f
Merge branch 'feat/-adding-set-to-post' into feat/using-dpf-for-results
germa89 Oct 14, 2022
3181996
Renaming method set to step
germa89 Oct 14, 2022
d4067c8
Merge branch 'feat/-adding-set-to-post' into feat/using-dpf-for-results
germa89 Oct 14, 2022
36a069b
removing test_dpf file
germa89 Oct 17, 2022
f0f98da
Merge branch 'main' into feat/using-dpf-for-results
germa89 Oct 17, 2022
746ab9f
added axisymmetric example
germa89 Oct 18, 2022
c08d431
Implemented distributed methods, available results, etc...
germa89 Oct 18, 2022
0025818
Keeping previous MAPDL structure
germa89 Oct 18, 2022
93e0fc4
Some docstring fixes
germa89 Oct 19, 2022
a62a3b6
Adding more examples
germa89 Oct 19, 2022
132a4de
bypassing everything if DPF is installed.
germa89 Oct 19, 2022
d6d73e0
Making sure we update the Model when we instantiate (maybe it is bett…
germa89 Oct 19, 2022
86c3d2d
initializing model because of reader
germa89 Oct 19, 2022
f6c1524
Adding cyclic and mesh tests
germa89 Oct 19, 2022
c54f0bb
simplifying RST loading
germa89 Oct 19, 2022
04a22c3
Assuming DPF is always remote.
germa89 Oct 19, 2022
82b0881
Merge branch 'main' into feat/using-dpf-for-results
germa89 Oct 25, 2022
7c3eada
Adding connect to server function
germa89 Oct 25, 2022
7b919d8
supporting docker images for cicd
germa89 Oct 26, 2022
ba4cce0
Merge branch 'main' into feat/using-dpf-for-results
germa89 Oct 26, 2022
6b8890e
merging test_dpf and test_result
germa89 Nov 2, 2022
84a2110
Merge branch 'main' into feat/using-dpf-for-results
germa89 Nov 2, 2022
53f1ab8
Attempting to implement local logic.
germa89 Nov 16, 2022
afa858b
Merge branch 'main' into feat/using-dpf-for-results
germa89 Nov 21, 2022
c65647e
Merge branch 'main' into feat/using-dpf-for-results
germa89 Dec 22, 2022
4dce037
adding get_mapdl_envvar
germa89 Dec 22, 2022
855c065
Adding on_docker check
germa89 Dec 22, 2022
9ca373f
Fixing typos
germa89 Dec 22, 2022
9d04678
Setting default dpf for building the gallery.
germa89 Dec 22, 2022
15cdd1c
Merge branch 'main' into feat/using-dpf-for-results
germa89 Dec 28, 2022
f34920b
chore: merge remote-tracking branch 'origin/main' into feat/using-dpf…
germa89 May 20, 2025
25ae201
ci: auto fixes from pre-commit.com hooks.
pre-commit-ci[bot] May 20, 2025
e0e03cc
chore: adding changelog file 1300.miscellaneous.md [dependabot-skip]
pyansys-ci-bot May 20, 2025
6b17936
feat: finishing previous merge
germa89 May 20, 2025
5a97f16
fix: update copyright notices and improve comments in source and test…
germa89 May 20, 2025
fd788a2
Merge branch 'feat/using-dpf-for-results' of https://github.com/ansys…
germa89 May 20, 2025
cba2fe0
refactor: reorganize canonical examples into __init__.py
germa89 May 20, 2025
0811fdc
fix: update import path for _MapdlCore and modify file upload logic i…
germa89 May 20, 2025
7de8bb2
chore: adding changelog file 1300.miscellaneous.md [dependabot-skip]
pyansys-ci-bot May 20, 2025
e512ac0
fix: enable DPFResult to check if the DPF server is on the same machi…
germa89 May 22, 2025
ef0dc5f
refactor: improve validation logic in test_result.py and update selec…
germa89 May 22, 2025
a771adc
refactor: enhance error reporting in pytest output for better debugging
germa89 May 22, 2025
8322eec
chore: merge remote-tracking branch 'origin/main' into feat/using-dpf…
germa89 May 22, 2025
08b7371
fix: avoid circular import
germa89 May 22, 2025
82d117c
feat: add DPF dependency checks and conditional imports in result han…
germa89 May 23, 2025
f4551b2
chore: merge remote-tracking branch 'origin/main' into feat/using-dpf…
germa89 May 23, 2025
bf602ec
fix: update DPF import path and enhance type hints in result handling
germa89 May 23, 2025
c492605
refactor: remove assert
germa89 May 23, 2025
2239284
fix: remote working mode
germa89 May 23, 2025
6315e06
fix: update Dockerfiles and docker-compose files to use v25.2-ubuntu-…
germa89 May 28, 2025
749ef51
chore: merge remote-tracking branch 'origin/main' into feat/using-dpf…
germa89 Jun 2, 2025
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
1 change: 1 addition & 0 deletions doc/changelog.d/1300.miscellaneous.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat: using dpf instead of reader in "results" module
5 changes: 3 additions & 2 deletions src/ansys/mapdl/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@
# Import related globals
_HAS_ATP: bool = is_installed("ansys.tools.path")
_HAS_CLICK: bool = is_installed("click")
_HAS_PIM: bool = is_installed("ansys.platform.instancemanagement")
_HAS_DPF: bool = is_installed("ansys.dpf.core")
_HAS_MATPLOTLIB: bool = is_installed("matplotlib")
_HAS_PANDAS: bool = is_installed("pandas")
_HAS_PIM: bool = is_installed("ansys.platform.instancemanagement")
_HAS_PYANSYS_REPORT: bool = is_installed("ansys.tools.report")
_HAS_PYVISTA: bool = is_installed("pyvista")
_HAS_REQUESTS: bool = is_installed("requests")
_HAS_TQDM: bool = is_installed("tqdm")
_HAS_MATPLOTLIB: bool = is_installed("matplotlib")
_HAS_VISUALIZER: bool = (
is_installed("ansys.tools.visualization_interface") and _HAS_MATPLOTLIB
)
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/mapdl/core/_commands/post1_/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ def set(
``to_array`` on the object returning from ``mapdl.set("list")``.

sbstep
Substep number (within Lstep). Defaults to the last substep of the
Substep number (within ``Lstep``). Defaults to the last substep of the
load step (except in a buckling or modal analysis). For a buckling
(``ANTYPE,BUCKLE``) or modal (``ANTYPE,MODAL``) analysis, ``Sbstep``
corresponds to the mode number. Specify ``Sbstep = LAST`` to store the
Expand Down
7 changes: 5 additions & 2 deletions src/ansys/mapdl/core/examples/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from .downloads import (
from ansys.mapdl.core.examples.downloads import (
download_bracket,
download_cfx_mapping_example_data,
download_manifold_example_data,
)
from .verif_files import vmfiles

# Canonical Examples
from ansys.mapdl.core.examples.examples import *
from ansys.mapdl.core.examples.verif_files import vmfiles
19 changes: 17 additions & 2 deletions src/ansys/mapdl/core/examples/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,25 @@
import os

# get location of this folder and the example files
dir_path: str = os.path.dirname(os.path.realpath(__file__))
__dir_path: str = os.path.dirname(os.path.realpath(__file__))

# add any files you'd like to import here. For example:
wing_model: str = os.path.join(dir_path, "wing.dat")
wing_model: str = os.path.join(__dir_path, "wing.dat")

# Verification files
from ansys.mapdl.core.examples.verif_files import vmfiles

laterally_loaded_tapered_support_structure = vmfiles["vm5"]
pinched_cylinder = vmfiles["vm6"]
transient_thermal_stress_in_a_cylinder = vmfiles["vm33"]
elongation_of_a_solid_bar = vmfiles["vm37"]
natural_frequency_of_a_piezoelectric_transducer = vmfiles["vm175"]
frequency_response_of_electrical_input_admittance = vmfiles["vm176"]
electrothermal_microactuator_analysis = vmfiles["vm223"]
piezoelectric_rectangular_strip_under_pure_bending_load = vmfiles["vm231"]
transient_response_of_a_ball_impacting_a_flexible_surface = vmfiles["vm65"]
threed_nonaxisymmetric_vibration_of_a_stretched_membrane = vmfiles["vm155"]
modal_analysis_of_a_cyclic_symmetric_annular_plate = vmfiles["vm244"]

# be sure to add the input file directly in this directory
# This way, files can be loaded with:
Expand Down
26 changes: 24 additions & 2 deletions src/ansys/mapdl/core/mapdl_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@ def __init__(

self._info = Information(self)

# DPF
self._dpf_result: "DPFResult | None" = None

def _after_run(self, _command: str) -> None:
pass

Expand Down Expand Up @@ -1049,7 +1052,11 @@ def graphics_backend(self, value: GraphicsBackend):
@property
@requires_package("ansys.mapdl.reader", softerror=True)
def result(self):
"""Binary interface to the result file using :class:`ansys.mapdl.reader.rst.Result`.
"""Binary interface to the result file using ``ansys-dpf-core`` or
``ansys-mapdl-reader``.

If `ansys-dpf-core` is not installed, then a :class:`ansys.mapdl.reader.rst.Result`
object is returned.

Returns
-------
Expand Down Expand Up @@ -1083,12 +1090,27 @@ def result(self):
NSL : Nodal displacements
RF : Nodal reaction forces
"""
from ansys.mapdl.core import _HAS_DPF

if _HAS_DPF:
from ansys.mapdl.core.reader import DPFResult

if self._dpf_result is None:
# create a DPFResult object
self._dpf_result = DPFResult(None, mapdl=self)

return self._dpf_result

from ansys.mapdl.reader import read_binary
from ansys.mapdl.reader.rst import Result

if not self._local:
# download to temporary directory
save_path = os.path.join(tempfile.gettempdir())
save_path = os.path.join(
tempfile.gettempdir(), f"ansys_tmp_{random_string()}"
)
if not os.path.exists(save_path):
os.mkdir(save_path)
result_path = self.download_result(save_path)
else:
if self._distributed_result_file and self._result_file:
Expand Down
Empty file modified src/ansys/mapdl/core/mapdl_grpc.py
100644 → 100755
Empty file.
32 changes: 16 additions & 16 deletions src/ansys/mapdl/core/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ def _edof_rst(self, item, it1num=""):
def nodal_temperature(self) -> np.ndarray:
"""The nodal temperature of the current result.

Equilvanent MAPDL command:
Equivalent MAPDL command:
``PRNSOL, TEMP``

Notes
Expand Down Expand Up @@ -944,7 +944,7 @@ def plot_nodal_temperature(self, show_node_numbering=False, **kwargs):
def nodal_displacement(self, component="NORM") -> np.ndarray:
"""Nodal X, Y, or Z structural displacement.

Equilvanent MAPDL command:
Equivalent MAPDL command:

* ``PRNSOL, U, X``

Expand Down Expand Up @@ -1067,7 +1067,7 @@ def plot_nodal_displacement(
def nodal_rotation(self, component="ALL") -> np.ndarray:
"""Nodal X, Y, or Z structural rotation

Equilvanent MAPDL commands:
Equivalent MAPDL commands:

* ``PRNSOL, ROT, X``
* ``PRNSOL, ROT, Y``
Expand Down Expand Up @@ -1180,7 +1180,7 @@ def element_displacement(self, component="ALL", option="AVG") -> np.ndarray:
One value per element. Either minimum, maximum, or average of
all nodes in each element.

Equilvanent MAPDL commands:
Equivalent MAPDL commands:

* ``ETABLE,VALUES,U,X``
* ``PRETAB,VALUES`` or ``*VGET,TMP,ELEM,1,ETAB,VALUES``
Expand Down Expand Up @@ -1324,7 +1324,7 @@ def element_stress(self, component, option="AVG") -> np.ndarray:
One value per element. Either minimum, maximum, or average of
all nodes in each element.

Equilvanent MAPDL commands:
Equivalent MAPDL commands:

* ``ETABLE,VALUES,S,X``
* ``PRETAB,VALUES`` or ``*VGET,TMP,ELEM,1,ETAB,VALUES``
Expand Down Expand Up @@ -1467,7 +1467,7 @@ def element_temperature(self, option="AVG") -> np.ndarray:
One value per element. Either minimum, maximum, or average of
all nodes in each element.

Equilvanent MAPDL commands:
Equivalent MAPDL commands:

* ``ETABLE,VALUES,TEMP``
* ``PRETAB,VALUES`` or ``*VGET,TMP,ELEM,1,ETAB,VALUES``
Expand Down Expand Up @@ -1558,7 +1558,7 @@ def plot_element_temperature(
def nodal_pressure(self) -> np.ndarray:
"""The nodal pressure of the current result.

Equilvanent MAPDL command:
Equivalent MAPDL command:
``PRNSOL, PRES``

Notes
Expand Down Expand Up @@ -1640,7 +1640,7 @@ def plot_nodal_pressure(self, show_node_numbering=False, **kwargs):
def nodal_voltage(self) -> np.ndarray:
"""The nodal voltage of the current result.

Equilvanent MAPDL command:
Equivalent MAPDL command:

* ``PRNSOL, PRES``

Expand Down Expand Up @@ -1729,7 +1729,7 @@ def plot_nodal_voltage(self, show_node_numbering=False, **kwargs):
def nodal_component_stress(self, component) -> np.ndarray:
"""Nodal component stress.

Equilvanent MAPDL commands:
Equivalent MAPDL commands:

* ``VGET, PARM, NODE, , S, X``
* ``PRNSOL, S, COMP``
Expand Down Expand Up @@ -1821,7 +1821,7 @@ def plot_nodal_component_stress(
def nodal_principal_stress(self, component) -> np.ndarray:
"""Nodal principal stress.

Equilvanent MAPDL commands:
Equivalent MAPDL commands:

* ``*VGET, PARM, NODE, , S, 1``
* ``PRNSOL, S, PRIN``
Expand Down Expand Up @@ -1914,7 +1914,7 @@ def plot_nodal_principal_stress(
def nodal_stress_intensity(self) -> np.ndarray:
"""The nodal stress intensity of the current result.

Equilvanent MAPDL command: ``PRNSOL, S, PRIN``
Equivalent MAPDL command: ``PRNSOL, S, PRIN``

Notes
-----
Expand Down Expand Up @@ -2000,7 +2000,7 @@ def plot_nodal_stress_intensity(self, show_node_numbering=False, **kwargs):
def nodal_eqv_stress(self) -> np.ndarray:
"""The nodal equivalent stress of the current result.

Equilvanent MAPDL command: ``PRNSOL, S, PRIN``
Equivalent MAPDL command: ``PRNSOL, S, PRIN``

Returns
-------
Expand Down Expand Up @@ -2098,7 +2098,7 @@ def nodal_total_component_strain(self, component) -> np.ndarray:

Includes elastic, plastic, and creep strain.

Equilvanent MAPDL commands:
Equivalent MAPDL commands:

* ``*VGET, PARM, NODE, , EPTO, X``

Expand Down Expand Up @@ -2195,7 +2195,7 @@ def nodal_total_principal_strain(self, component) -> np.ndarray:

Includes elastic, plastic, and creep strain.

Equilvanent MAPDL command:
Equivalent MAPDL command:

* ``*VGET,PARM,NODE,,EPTO,1``

Expand Down Expand Up @@ -2293,7 +2293,7 @@ def plot_nodal_total_principal_strain(
def nodal_total_strain_intensity(self) -> np.ndarray:
"""The total nodal strain intensity of the current result.

Equilvanent MAPDL command:
Equivalent MAPDL command:

* ``PRNSOL, EPTO, PRIN``

Expand Down Expand Up @@ -2383,7 +2383,7 @@ def plot_nodal_total_strain_intensity(self, show_node_numbering=False, **kwargs)
def nodal_total_eqv_strain(self) -> np.ndarray:
"""The total nodal equivalent strain of the current result.

Equilvanent MAPDL command:
Equivalent MAPDL command:

* ``PRNSOL, EPTO, PRIN``

Expand Down
23 changes: 23 additions & 0 deletions src/ansys/mapdl/core/reader/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from .result import DPFResult
Loading
Loading