Skip to content

Commit

Permalink
updates in the DataSources api reference
Browse files Browse the repository at this point in the history
  • Loading branch information
luisaFelixSalles committed Oct 10, 2024
1 parent 30e411f commit 2d863c3
Showing 1 changed file with 2 additions and 75 deletions.
77 changes: 2 additions & 75 deletions src/ansys/dpf/core/data_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,33 +202,6 @@ def add_file_path(
Files not added as main result files are accessory files, which contain accessory
information not present in the main result files.
Parameters
----------
filepath :
Path of the file.
key :
Extension of the file, which is used as a key for choosing the correct
plugin when a result is requested by an operator. The default is ``""``,
in which case the key is found directly.
is_domain :
Whether the file path is the domain path. The default is ``False``.
domain_id :
Domain ID for the distributed files. The default is ``0``. For this
parameter to be taken into account, ``domain_path=True`` must be set.
Examples
--------
Add an accessory file to the DataSources object
>>> from ansys.dpf import core as dpf
>>>
>>> # Create the DataSources object
>>> my_data_sources = dpf.DataSources()
>>> # Define the path where the main result file can be found
>>> my_data_sources.set_result_file_path(filepath='/tmp/file.cas', key='cas')
>>> # Add the additional result file to the DataSources object
>>> my_data_sources.add_file_path(filepath='/tmp/ds.dat', key='dat')
"""
# The filename needs to be a fully qualified file name
if not os.path.dirname(filepath):
Expand All @@ -250,35 +223,7 @@ def add_file_path(
def add_domain_file_path(
self, filepath: Union[str, os.PathLike], key: str, domain_id: int
) -> None:
"""Add a file path to the data sources in the given domain.
Files not added as main result files are accessory files, which contain accessory
information not present in the main result files.
Parameters
----------
filepath :
Path of the file.
key :
Extension of the file, which is used as a key for choosing the correct
plugin when a result is requested by an operator.
domain_id :
Domain ID for the distributed files.
Examples
--------
Add an accessory file to its domain
>>> from ansys.dpf import core as dpf
>>>
>>> # Create the DataSources object
>>> my_data_sources = dpf.DataSources()
>>> # Define the path where the main result data can be found and specify its domain
>>> my_data_sources.set_domain_result_file_path(path='/tmp/ds.cas', key='cas', domain_id=1)
>>> # Add the additional result data to the DataSources object and specify its domain
>>> my_data_sources.add_domain_file_path(filepath='/tmp/ds.dat', key="dat", domain_id=1)
"""
"""Add a file path to the data sources in the given domain."""
# The filename needs to be a fully qualified file name
if not os.path.dirname(filepath):
# append local path
Expand All @@ -293,25 +238,7 @@ def add_file_path_for_specified_result(
key: Optional[str] = "",
result_key: Optional[str] = "",
):
"""Add a file path for a specified result file key to the data sources.
This method can be used when results files with different keys (extensions) are
contained in the data sources. For example, a solve using two different solvers
could generate two different sets of files.
Parameters
----------
filepath :
Path of the file.
key :
Extension of the file, which is used as a key for choosing the correct
plugin when a result is requested by an operator. The default is ``""``,
in which case the key is found directly.
result_key :
Extension of the results file that the specified file path belongs to.
The default is ``""``, in which case the key is found directly.
"""
"""Add a file path for a specified result file key to the data sources."""
# The filename needs to be a fully qualified file name
if not os.path.dirname(filepath):
# append local path
Expand Down

0 comments on commit 2d863c3

Please sign in to comment.