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

Modal cyclic example file #911

Merged
merged 1 commit into from
Apr 21, 2023
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
36 changes: 36 additions & 0 deletions src/ansys/dpf/core/examples/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,3 +1005,39 @@ def download_harmonic_clamped_pipe(

"""
return _download_file("harmonic", "clamped_pipe.rst", should_upload, server, return_local_path)


def download_modal_cyclic(should_upload: bool = True, server=None, return_local_path=False) -> str:
"""Download an example result file from a cyclic modal analysis and
return the download path.
If the server is remote (or doesn't share memory), the file is uploaded or made available
on the server side.

Examples files are downloaded to a persistent cache to avoid
re-downloading the same file twice.

Parameters
----------
should_upload : bool, optional (default True)
Whether the file should be uploaded server side when the server is remote.
server : server.DPFServer, optional
Server with channel connected to the remote or local instance. When
``None``, attempts to use the global server.
return_local_path: bool, optional
If ``True``, the local path is returned as is, without uploading, nor searching
for mounted volumes.

Returns
-------
str
Path to the example file.

Examples
--------
Download an example result file and return the path of the file

>>> from ansys.dpf.core import examples
>>> path = examples.download_modal_cyclic()

"""
return _download_file("cyclic", "modal_cyclic.rst", should_upload, server, return_local_path)
5 changes: 5 additions & 0 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ def test_download_harmonic_clamped_pipe():
assert isinstance(Model(path), Model)


def test_download_modal_cyclic():
path = examples.download_modal_cyclic()
assert isinstance(Model(path), Model)


list_examples = [
"simple_bar",
"static_rst",
Expand Down