Skip to content

Commit 3a2ded7

Browse files
committed
add modal cyclic example file
1 parent a71472e commit 3a2ded7

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

src/ansys/dpf/core/examples/downloads.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,3 +1005,39 @@ def download_harmonic_clamped_pipe(
10051005
10061006
"""
10071007
return _download_file("harmonic", "clamped_pipe.rst", should_upload, server, return_local_path)
1008+
1009+
1010+
def download_modal_cyclic(should_upload: bool = True, server=None, return_local_path=False) -> str:
1011+
"""Download an example result file from a cyclic modal analysis and
1012+
return the download path.
1013+
If the server is remote (or doesn't share memory), the file is uploaded or made available
1014+
on the server side.
1015+
1016+
Examples files are downloaded to a persistent cache to avoid
1017+
re-downloading the same file twice.
1018+
1019+
Parameters
1020+
----------
1021+
should_upload : bool, optional (default True)
1022+
Whether the file should be uploaded server side when the server is remote.
1023+
server : server.DPFServer, optional
1024+
Server with channel connected to the remote or local instance. When
1025+
``None``, attempts to use the global server.
1026+
return_local_path: bool, optional
1027+
If ``True``, the local path is returned as is, without uploading, nor searching
1028+
for mounted volumes.
1029+
1030+
Returns
1031+
-------
1032+
str
1033+
Path to the example file.
1034+
1035+
Examples
1036+
--------
1037+
Download an example result file and return the path of the file
1038+
1039+
>>> from ansys.dpf.core import examples
1040+
>>> path = examples.download_modal_cyclic()
1041+
1042+
"""
1043+
return _download_file("cyclic", "modal_cyclic.rst", should_upload, server, return_local_path)

tests/test_examples.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ def test_download_harmonic_clamped_pipe():
4949
assert isinstance(Model(path), Model)
5050

5151

52+
def test_download_modal_cyclic():
53+
path = examples.download_modal_cyclic()
54+
assert isinstance(Model(path), Model)
55+
56+
5257
list_examples = [
5358
"simple_bar",
5459
"static_rst",

0 commit comments

Comments
 (0)