diff --git a/src/ansys/dpf/core/examples/ASimpleBar.rst b/src/ansys/dpf/core/examples/ASimpleBar.rst deleted file mode 100644 index 29cb8cdb78..0000000000 Binary files a/src/ansys/dpf/core/examples/ASimpleBar.rst and /dev/null differ diff --git a/src/ansys/dpf/core/examples/__init__.py b/src/ansys/dpf/core/examples/__init__.py index fab9a1710c..32a59f0d89 100644 --- a/src/ansys/dpf/core/examples/__init__.py +++ b/src/ansys/dpf/core/examples/__init__.py @@ -1,2 +1,47 @@ from .examples import * from .downloads import * + + +# called if module. fails +def __getattr__(name): + if name == "simple_bar": + global simple_bar + simple_bar = find_simple_bar() + return simple_bar + elif name == "static_rst": + global static_rst + static_rst = find_static_rst() + return static_rst + elif name == "complex_rst": + global complex_rst + complex_rst = find_complex_rst() + return complex_rst + elif name == "multishells_rst": + global multishells_rst + multishells_rst = find_multishells_rst() + return multishells_rst + elif name == "electric_therm": + global electric_therm + electric_therm = find_electric_therm() + return electric_therm + elif name == "steady_therm": + global steady_therm + steady_therm = find_steady_therm() + return steady_therm + elif name == "transient_therm": + global transient_therm + transient_therm = find_transient_therm() + return transient_therm + elif name == "msup_transient": + global msup_transient + msup_transient = find_msup_transient() + return msup_transient + elif name == "simple_cyclic": + global simple_cyclic + simple_cyclic = find_simple_cyclic() + return simple_cyclic + elif name == "distributed_msup_folder": + global distributed_msup_folder + distributed_msup_folder = find_distributed_msup_folder() + return distributed_msup_folder + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") diff --git a/src/ansys/dpf/core/examples/complex.rst b/src/ansys/dpf/core/examples/complex.rst deleted file mode 100644 index 0a0484f4a6..0000000000 Binary files a/src/ansys/dpf/core/examples/complex.rst and /dev/null differ diff --git a/src/ansys/dpf/core/examples/downloads.py b/src/ansys/dpf/core/examples/downloads.py index 166403ecdb..dc5117803a 100644 --- a/src/ansys/dpf/core/examples/downloads.py +++ b/src/ansys/dpf/core/examples/downloads.py @@ -1601,3 +1601,366 @@ def download_cfx_mixing_elbow( return_local_path, ) return {"cas": file, "dat": file} + + +def find_simple_bar(should_upload: bool = True, server=None, return_local_path=False) -> str: + """Make the result file available server side, if the server is remote the file is uploaded + server side. Returns the path on the file. + + 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 + -------- + + >>> from ansys.dpf.core import examples + >>> path = examples.find_simple_bar() + >>> path + 'C:/Users/user/AppData/local/temp/ASimpleBar.rst' + + """ + return _download_file( + "result_files", "ASimpleBar.rst", should_upload, server, return_local_path + ) + + +def find_static_rst(should_upload: bool = True, server=None, return_local_path=False) -> str: + """Make the result file available server side, if the server is remote the file is uploaded + server side. Returns the path on the file. + + 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 + -------- + + >>> from ansys.dpf.core import examples + >>> path = examples.find_static_rst() + >>> path + 'C:/Users/user/AppData/local/temp/static.rst' + + """ + return _download_file("result_files", "static.rst", should_upload, server, return_local_path) + + +def find_complex_rst(should_upload: bool = True, server=None, return_local_path=False) -> str: + """Make the result file available server side, if the server is remote the file is uploaded + server side. Returns the path on the file. + + 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 + -------- + + >>> from ansys.dpf.core import examples + >>> path = examples.find_complex_rst() + >>> path + 'C:/Users/user/AppData/local/temp/complex.rst' + + """ + return _download_file("result_files", "complex.rst", should_upload, server, return_local_path) + + +def find_multishells_rst(should_upload: bool = True, server=None, return_local_path=False) -> str: + """Make the result file available server side, if the server is remote the file is uploaded + server side. Returns the path on the file. + + 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 + -------- + + >>> from ansys.dpf.core import examples + >>> path = examples.find_multishells_rst() + >>> path + 'C:/Users/user/AppData/local/temp/model_with_ns.rst' + + """ + return _download_file( + "result_files", "model_with_ns.rst", should_upload, server, return_local_path + ) + + +def find_electric_therm(should_upload: bool = True, server=None, return_local_path=False) -> str: + """Make the result file available server side, if the server is remote the file is uploaded + server side. Returns the path on the file. + + 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 + -------- + + >>> from ansys.dpf.core import examples + >>> path = examples.find_electric_therm() + >>> path + 'C:/Users/user/AppData/local/temp/rth_electric.rth' + + """ + return _download_file( + "result_files/rth", "rth_electric.rth", should_upload, server, return_local_path + ) + + +def find_steady_therm(should_upload: bool = True, server=None, return_local_path=False) -> str: + """Make the result file available server side, if the server is remote the file is uploaded + server side. Returns the path on the file. + + 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 + -------- + + >>> from ansys.dpf.core import examples + >>> path = examples.find_steady_therm() + >>> path + 'C:/Users/user/AppData/local/temp/rth_steady.rth' + + """ + return _download_file( + "result_files/rth", "rth_steady.rth", should_upload, server, return_local_path + ) + + +def find_transient_therm(should_upload: bool = True, server=None, return_local_path=False) -> str: + """Make the result file available server side, if the server is remote the file is uploaded + server side. Returns the path on the file. + + 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 + -------- + + >>> from ansys.dpf.core import examples + >>> path = examples.find_transient_therm() + >>> path + 'C:/Users/user/AppData/local/temp/rth_transient.rth' + + """ + return _download_file( + "result_files/rth", "rth_transient.rth", should_upload, server, return_local_path + ) + + +def find_msup_transient(should_upload: bool = True, server=None, return_local_path=False) -> str: + """Make the result file available server side, if the server is remote the file is uploaded + server side. Returns the path on the file. + + 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 + -------- + + >>> from ansys.dpf.core import examples + >>> path = examples.find_msup_transient() + >>> path + 'C:/Users/user/AppData/local/temp/msup_transient_plate1.rst' + + """ + return _download_file( + "result_files", "msup_transient_plate1.rst", should_upload, server, return_local_path + ) + + +def find_simple_cyclic(should_upload: bool = True, server=None, return_local_path=False) -> str: + """Make the result file available server side, if the server is remote the file is uploaded + server side. Returns the path on the file. + + 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 + -------- + + >>> from ansys.dpf.core import examples + >>> path = examples.find_simple_cyclic() + >>> path + 'C:/Users/user/AppData/local/temp/file_cyclic.rst' + + """ + return _download_file( + "result_files", "file_cyclic.rst", should_upload, server, return_local_path + ) + + +def find_distributed_msup_folder( + should_upload: bool = True, server=None, return_local_path=False +) -> str: + """Make the result file available server side, if the server is remote the file is uploaded + server side. Returns the path on the file. + + 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 + -------- + + >>> from ansys.dpf.core import examples + >>> path = examples.find_distributed_msup_folder() + >>> path + 'C:/Users/user/AppData/local/temp/msup_distributed' + + """ + # In this case we return the path to the folder with all the downloaded files + _download_file( + "result_files/msup_distributed", "file0.mode", should_upload, server, return_local_path + ) + _download_file( + "result_files/msup_distributed", "file0.rst", should_upload, server, return_local_path + ) + _download_file( + "result_files/msup_distributed", "file1.mode", should_upload, server, return_local_path + ) + _download_file( + "result_files/msup_distributed", "file1.rst", should_upload, server, return_local_path + ) + _download_file( + "result_files/msup_distributed", + "file_load_1.rfrq", + should_upload, + server, + return_local_path, + ) + path = _download_file( + "result_files/msup_distributed", + "file_load_2.rfrq", + should_upload, + server, + return_local_path, + ) + return os.path.dirname(path) diff --git a/src/ansys/dpf/core/examples/examples.py b/src/ansys/dpf/core/examples/examples.py index a85da77728..c583b03135 100644 --- a/src/ansys/dpf/core/examples/examples.py +++ b/src/ansys/dpf/core/examples/examples.py @@ -7,32 +7,12 @@ """ import os -import inspect from ansys.dpf.core import server as server_module from ansys.dpf.core.core import upload_file_in_tmp_folder from ansys.dpf.core import path_utilities from ansys.dpf.core import DataSources -if os.environ.get("DPF_DOCKER", "").lower() == "true": - # must pass a path that can be accessed by a docker image with - # this directory mounted at the repository level for CI - _module_path = r"/dpf/ansys/dpf/core/examples/" -else: - _module_path = os.path.dirname(inspect.getfile(inspect.currentframe())) - -# this files can be imported with from `ansys.dpf.core import examples`: -simple_bar = os.path.join(_module_path, "ASimpleBar.rst") -static_rst = os.path.join(_module_path, "static.rst") -complex_rst = os.path.join(_module_path, "complex.rst") -multishells_rst = os.path.join(_module_path, "model_with_ns.rst") -electric_therm = os.path.join(_module_path, "rth", "rth_electric.rth") -steady_therm = os.path.join(_module_path, "rth", "rth_steady.rth") -transient_therm = os.path.join(_module_path, "rth", "rth_transient.rth") -msup_transient = os.path.join(_module_path, "msup_transient_plate1.rst") -simple_cyclic = os.path.join(_module_path, "file_cyclic.rst") -distributed_msup_folder = os.path.join(_module_path, "msup_distributed") - def get_example_required_minimum_dpf_version(file: os.PathLike) -> str: """Returns the minimal DPF server version required to run the example, as declared in a note. @@ -103,328 +83,6 @@ def find_files(local_path, should_upload=True, server=None, return_local_path=Fa return path_utilities.to_server_os(local_path, server) -def find_simple_bar(should_upload: bool = True, server=None, return_local_path=False) -> str: - """Make the result file available server side, if the server is remote the file is uploaded - server side. Returns the path on the file. - - 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 - -------- - - >>> from ansys.dpf.core import examples - >>> path = examples.find_simple_bar() - >>> path - 'C:/Users/user/AppData/local/temp/ASimpleBar.rst' - - """ - return find_files(simple_bar, should_upload, server, return_local_path) - - -def find_static_rst(should_upload: bool = True, server=None, return_local_path=False) -> str: - """Make the result file available server side, if the server is remote the file is uploaded - server side. Returns the path on the file. - - 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 - -------- - - >>> from ansys.dpf.core import examples - >>> path = examples.find_static_rst() - >>> path - 'C:/Users/user/AppData/local/temp/static.rst' - - """ - return find_files(static_rst, should_upload, server, return_local_path) - - -def find_complex_rst(should_upload: bool = True, server=None, return_local_path=False) -> str: - """Make the result file available server side, if the server is remote the file is uploaded - server side. Returns the path on the file. - - 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 - -------- - - >>> from ansys.dpf.core import examples - >>> path = examples.find_complex_rst() - >>> path - 'C:/Users/user/AppData/local/temp/complex.rst' - - """ - return find_files(complex_rst, should_upload, server, return_local_path) - - -def find_multishells_rst(should_upload: bool = True, server=None, return_local_path=False) -> str: - """Make the result file available server side, if the server is remote the file is uploaded - server side. Returns the path on the file. - - 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 - -------- - - >>> from ansys.dpf.core import examples - >>> path = examples.find_multishells_rst() - >>> path - 'C:/Users/user/AppData/local/temp/model_with_ns.rst' - - """ - return find_files(multishells_rst, should_upload, server, return_local_path) - - -def find_electric_therm(should_upload: bool = True, server=None, return_local_path=False) -> str: - """Make the result file available server side, if the server is remote the file is uploaded - server side. Returns the path on the file. - - 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 - -------- - - >>> from ansys.dpf.core import examples - >>> path = examples.find_electric_therm() - >>> path - 'C:/Users/user/AppData/local/temp/rth_electric.rth' - - """ - return find_files(electric_therm, should_upload, server, return_local_path) - - -def find_steady_therm(should_upload: bool = True, server=None, return_local_path=False) -> str: - """Make the result file available server side, if the server is remote the file is uploaded - server side. Returns the path on the file. - - 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 - -------- - - >>> from ansys.dpf.core import examples - >>> path = examples.find_steady_therm() - >>> path - 'C:/Users/user/AppData/local/temp/rth_steady.rst' - - """ - return find_files(steady_therm, should_upload, server, return_local_path) - - -def find_transient_therm(should_upload: bool = True, server=None, return_local_path=False) -> str: - """Make the result file available server side, if the server is remote the file is uploaded - server side. Returns the path on the file. - - 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 - -------- - - >>> from ansys.dpf.core import examples - >>> path = examples.find_transient_therm() - >>> path - 'C:/Users/user/AppData/local/temp/rth_transient.rst' - - """ - return find_files(transient_therm, should_upload, server, return_local_path) - - -def find_msup_transient(should_upload: bool = True, server=None, return_local_path=False) -> str: - """Make the result file available server side, if the server is remote the file is uploaded - server side. Returns the path on the file. - - 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 - -------- - - >>> from ansys.dpf.core import examples - >>> path = examples.find_msup_transient() - >>> path - 'C:/Users/user/AppData/local/temp/msup_transient_plate1.rst' - - """ - return find_files(msup_transient, should_upload, server, return_local_path) - - -def find_simple_cyclic(should_upload: bool = True, server=None, return_local_path=False) -> str: - """Make the result file available server side, if the server is remote the file is uploaded - server side. Returns the path on the file. - - 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 - -------- - - >>> from ansys.dpf.core import examples - >>> path = examples.find_simple_cyclic() - >>> path - 'C:/Users/user/AppData/local/temp/file_cyclic.rst' - - """ - return find_files(simple_cyclic, should_upload, server, return_local_path) - - -def find_distributed_msup_folder( - should_upload: bool = True, server=None, return_local_path=False -) -> str: - """Make the result file available server side, if the server is remote the file is uploaded - server side. Returns the path on the file. - - 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 - -------- - - >>> from ansys.dpf.core import examples - >>> path = examples.find_distributed_msup_folder() - >>> path - 'C:/Users/user/AppData/local/temp/msup_distributed' - - """ - return find_files(distributed_msup_folder, should_upload, server, return_local_path) - - def fluid_axial_model() -> DataSources: """Download the files and create a DataSources. diff --git a/src/ansys/dpf/core/examples/file_cyclic.rst b/src/ansys/dpf/core/examples/file_cyclic.rst deleted file mode 100644 index a3572f7314..0000000000 Binary files a/src/ansys/dpf/core/examples/file_cyclic.rst and /dev/null differ diff --git a/src/ansys/dpf/core/examples/model_with_ns.rst b/src/ansys/dpf/core/examples/model_with_ns.rst deleted file mode 100644 index acbb9cdefa..0000000000 Binary files a/src/ansys/dpf/core/examples/model_with_ns.rst and /dev/null differ diff --git a/src/ansys/dpf/core/examples/msup_distributed/file0.mode b/src/ansys/dpf/core/examples/msup_distributed/file0.mode deleted file mode 100644 index caf8c7336b..0000000000 Binary files a/src/ansys/dpf/core/examples/msup_distributed/file0.mode and /dev/null differ diff --git a/src/ansys/dpf/core/examples/msup_distributed/file0.rst b/src/ansys/dpf/core/examples/msup_distributed/file0.rst deleted file mode 100644 index 6e1e4d65f9..0000000000 Binary files a/src/ansys/dpf/core/examples/msup_distributed/file0.rst and /dev/null differ diff --git a/src/ansys/dpf/core/examples/msup_distributed/file1.mode b/src/ansys/dpf/core/examples/msup_distributed/file1.mode deleted file mode 100644 index 5c41345d69..0000000000 Binary files a/src/ansys/dpf/core/examples/msup_distributed/file1.mode and /dev/null differ diff --git a/src/ansys/dpf/core/examples/msup_distributed/file1.rst b/src/ansys/dpf/core/examples/msup_distributed/file1.rst deleted file mode 100644 index 3532d1749c..0000000000 Binary files a/src/ansys/dpf/core/examples/msup_distributed/file1.rst and /dev/null differ diff --git a/src/ansys/dpf/core/examples/msup_distributed/file_load_1.rfrq b/src/ansys/dpf/core/examples/msup_distributed/file_load_1.rfrq deleted file mode 100644 index f539c410fd..0000000000 Binary files a/src/ansys/dpf/core/examples/msup_distributed/file_load_1.rfrq and /dev/null differ diff --git a/src/ansys/dpf/core/examples/msup_distributed/file_load_2.rfrq b/src/ansys/dpf/core/examples/msup_distributed/file_load_2.rfrq deleted file mode 100644 index 8db0759e5e..0000000000 Binary files a/src/ansys/dpf/core/examples/msup_distributed/file_load_2.rfrq and /dev/null differ diff --git a/src/ansys/dpf/core/examples/msup_transient_plate1.rst b/src/ansys/dpf/core/examples/msup_transient_plate1.rst deleted file mode 100644 index 4fc219ff78..0000000000 Binary files a/src/ansys/dpf/core/examples/msup_transient_plate1.rst and /dev/null differ diff --git a/src/ansys/dpf/core/examples/rth/rth_electric.rth b/src/ansys/dpf/core/examples/rth/rth_electric.rth deleted file mode 100644 index a7152cdca4..0000000000 Binary files a/src/ansys/dpf/core/examples/rth/rth_electric.rth and /dev/null differ diff --git a/src/ansys/dpf/core/examples/rth/rth_steady.rth b/src/ansys/dpf/core/examples/rth/rth_steady.rth deleted file mode 100644 index d78f36264b..0000000000 Binary files a/src/ansys/dpf/core/examples/rth/rth_steady.rth and /dev/null differ diff --git a/src/ansys/dpf/core/examples/rth/rth_transient.rth b/src/ansys/dpf/core/examples/rth/rth_transient.rth deleted file mode 100644 index 57c579618d..0000000000 Binary files a/src/ansys/dpf/core/examples/rth/rth_transient.rth and /dev/null differ diff --git a/src/ansys/dpf/core/examples/static.rst b/src/ansys/dpf/core/examples/static.rst deleted file mode 100644 index c7c8524f8d..0000000000 Binary files a/src/ansys/dpf/core/examples/static.rst and /dev/null differ diff --git a/src/ansys/dpf/core/examples/testing/allKindOfComplexity.rst b/src/ansys/dpf/core/examples/testing/allKindOfComplexity.rst deleted file mode 100644 index 6be5534dc7..0000000000 Binary files a/src/ansys/dpf/core/examples/testing/allKindOfComplexity.rst and /dev/null differ diff --git a/tests/conftest.py b/tests/conftest.py index f4e7cedd4d..6834150fcb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -93,7 +93,7 @@ def allkindofcomplexity(): @pytest.fixture() def simple_bar(): """Resolve the path of the "ASimpleBar.rst" result file.""" - return resolve_test_file("ASimpleBar.rst", "", "simple_bar") + return examples.find_simple_bar() @pytest.fixture() @@ -129,13 +129,13 @@ def simple_rst(): @pytest.fixture() def multishells(): """Resolve the path of the "rst_operators/multishells.rst" result file.""" - return resolve_test_file("model_with_ns.rst", "", "multishells_rst") + return examples.find_multishells_rst() @pytest.fixture() def complex_model(): """Resolve the path of the "complex/fileComplex.rst" result file.""" - return resolve_test_file("complex.rst", "", "complex_rst") + return examples.find_complex_rst() @pytest.fixture() @@ -145,13 +145,13 @@ def plate_msup(): Originally: UnitTestDataFiles/DataProcessing/expansion/msup/Transient/plate1/file.rst """ - return resolve_test_file("msup_transient_plate1.rst", "", "msup_transient") + return examples.find_msup_transient() @pytest.fixture() def model_with_ns(): """Resolve the path of the "model_with_ns.rst" result file.""" - return resolve_test_file("model_with_ns.rst", "", "multishells_rst") + return examples.find_multishells_rst() @pytest.fixture() diff --git a/tests/test_examples.py b/tests/test_examples.py index 493dd87ff2..d58450fcd3 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -3,7 +3,6 @@ import pytest -from conftest import running_docker from ansys.dpf import core as dpf from ansys.dpf.core import Model from ansys.dpf.core import DataSources @@ -127,10 +126,6 @@ def test_find_examples(example, server_type_remote_process): Model(path, server=server_type_remote_process).metadata.result_info, dpf.ResultInfo, ) - assert path != getattr(globals()["examples"], example) - server_type_remote_process.local_server = True - path = func(server=server_type_remote_process, return_local_path=running_docker) - assert path == getattr(globals()["examples"], example) def test_delete_downloaded_files(): @@ -140,10 +135,6 @@ def test_delete_downloaded_files(): assert not os.path.exists(path) path = examples.download_multi_stage_cyclic_result(return_local_path=True) assert os.path.exists(path) - assert os.path.exists(examples.simple_bar) - assert os.path.exists(examples.static_rst) - assert os.path.exists(examples.complex_rst) - assert os.path.exists(examples.distributed_msup_folder) def test_get_example_required_minimum_dpf_version(tmp_path): diff --git a/tests/test_multi_server.py b/tests/test_multi_server.py index 2c6b6aa840..9a3bc48990 100644 --- a/tests/test_multi_server.py +++ b/tests/test_multi_server.py @@ -4,7 +4,6 @@ from ansys.dpf import core as dpf from ansys.dpf.core import examples, server_types, server -from ansys.dpf.core.errors import ServerTypeError from ansys.dpf.core.server_factory import ServerConfig, CommunicationProtocols if conftest.SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_6_0: @@ -39,37 +38,31 @@ def other_remote_server(request): @pytest.fixture() def static_models(local_server, other_remote_server): - try: - upload = dpf.upload_file_in_tmp_folder(examples.static_rst, server=other_remote_server) - except ServerTypeError: - upload = examples.static_rst + static_rst_path_local = examples.find_static_rst(server=local_server) + static_rst_path_remote = examples.find_static_rst(server=other_remote_server) return ( - dpf.Model(upload, server=other_remote_server), - dpf.Model(examples.find_static_rst(server=local_server), server=local_server), + dpf.Model(static_rst_path_remote, server=other_remote_server), + dpf.Model(static_rst_path_local, server=local_server), ) @pytest.fixture() def transient_models(local_server, other_remote_server): - try: - upload = dpf.upload_file_in_tmp_folder(examples.msup_transient, server=other_remote_server) - except ServerTypeError: - upload = examples.msup_transient + msup_transient_path_local = examples.find_msup_transient(server=local_server) + msup_transient_path_remote = examples.find_msup_transient(server=other_remote_server) return ( - dpf.Model(upload, server=other_remote_server), - dpf.Model(examples.find_msup_transient(server=local_server), server=local_server), + dpf.Model(msup_transient_path_remote, server=other_remote_server), + dpf.Model(msup_transient_path_local, server=local_server), ) @pytest.fixture() def cyc_models(local_server, other_remote_server): - try: - upload = dpf.upload_file_in_tmp_folder(examples.simple_cyclic, server=other_remote_server) - except ServerTypeError: - upload = examples.simple_cyclic + simple_cyclic_path_local = examples.find_simple_cyclic(server=local_server) + simple_cyclic_path_remote = examples.find_simple_cyclic(server=local_server) return ( - dpf.Model(upload, server=other_remote_server), - dpf.Model(examples.find_simple_cyclic(server=local_server), server=local_server), + dpf.Model(simple_cyclic_path_remote, server=other_remote_server), + dpf.Model(simple_cyclic_path_local, server=local_server), )