Skip to content

Commit

Permalink
changes in the add_upstream path and add_domain_file_path functions
Browse files Browse the repository at this point in the history
  • Loading branch information
luisaFelixSalles committed Oct 21, 2024
1 parent 15b624e commit 3eb4157
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions src/ansys/dpf/core/data_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,19 +425,44 @@ def add_file_path_for_specified_result(self, filepath, key="", result_key=""):
self, str(filepath), key, result_key
)

def add_upstream(self, upstream_data_sources, result_key=""):
"""Add upstream data sources.
def add_upstream(
self, upstream_data_sources: DataSources, result_key: Optional[str] = ""
) -> None:
"""Add upstream data sources to the main DataSources object.
This is used to add a set of path creating an upstream for
recursive workflows.
Parameters
----------
upstream_data_sources : DataSources
upstream_data_sources
Set of paths creating an upstream for recursive workflows.
result_key: str, optional
result_key
Extension of the result file group with which this upstream belongs
Examples
--------
Add an upstream data to the main DataSources object of an expansion analysis
>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>>
>>> # Download the result files
>>> paths = examples.download_msup_files_to_dict()
>>> # Create the main DataSources object
>>> my_data_sources = dpf.DataSources()
>>> # Define the path where the main result data can be found
>>> my_data_sources.set_result_file_path(filepath=paths["rfrq"], key='rfrq')
>>>
>>> # Create the DataSources object for the upstream data
>>> my_data_sources_upstream = dpf.DataSources()
>>> # Define the path where the main upstream data can be found
>>> my_data_sources_upstream.set_result_file_path(filepath=paths["mode"], key='mode')
>>> # Add the additional upstream data to the upstream DataSources object
>>> my_data_sources_upstream.add_file_path(filepath=paths["rst"], key='rst')
>>>
>>> # Add the upstream DataSources to the main DataSources object
>>> my_data_sources.add_upstream(upstream_data_sources=my_data_sources_upstream)
"""
if result_key == "":
Expand Down

0 comments on commit 3eb4157

Please sign in to comment.