Skip to content

Commit 3eb4157

Browse files
changes in the add_upstream path and add_domain_file_path functions
1 parent 15b624e commit 3eb4157

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

src/ansys/dpf/core/data_sources.py

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,19 +425,44 @@ def add_file_path_for_specified_result(self, filepath, key="", result_key=""):
425425
self, str(filepath), key, result_key
426426
)
427427

428-
def add_upstream(self, upstream_data_sources, result_key=""):
429-
"""Add upstream data sources.
428+
def add_upstream(
429+
self, upstream_data_sources: DataSources, result_key: Optional[str] = ""
430+
) -> None:
431+
"""Add upstream data sources to the main DataSources object.
430432
431433
This is used to add a set of path creating an upstream for
432434
recursive workflows.
433435
434436
Parameters
435437
----------
436-
upstream_data_sources : DataSources
438+
upstream_data_sources
437439
Set of paths creating an upstream for recursive workflows.
438440
439-
result_key: str, optional
441+
result_key
440442
Extension of the result file group with which this upstream belongs
443+
Examples
444+
--------
445+
Add an upstream data to the main DataSources object of an expansion analysis
446+
447+
>>> from ansys.dpf import core as dpf
448+
>>> from ansys.dpf.core import examples
449+
>>>
450+
>>> # Download the result files
451+
>>> paths = examples.download_msup_files_to_dict()
452+
>>> # Create the main DataSources object
453+
>>> my_data_sources = dpf.DataSources()
454+
>>> # Define the path where the main result data can be found
455+
>>> my_data_sources.set_result_file_path(filepath=paths["rfrq"], key='rfrq')
456+
>>>
457+
>>> # Create the DataSources object for the upstream data
458+
>>> my_data_sources_upstream = dpf.DataSources()
459+
>>> # Define the path where the main upstream data can be found
460+
>>> my_data_sources_upstream.set_result_file_path(filepath=paths["mode"], key='mode')
461+
>>> # Add the additional upstream data to the upstream DataSources object
462+
>>> my_data_sources_upstream.add_file_path(filepath=paths["rst"], key='rst')
463+
>>>
464+
>>> # Add the upstream DataSources to the main DataSources object
465+
>>> my_data_sources.add_upstream(upstream_data_sources=my_data_sources_upstream)
441466
442467
"""
443468
if result_key == "":

0 commit comments

Comments
 (0)