Skip to content

Commit 9a9ab89

Browse files
changes in the result_files property method
1 parent fec71a1 commit 9a9ab89

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

src/ansys/dpf/core/data_sources.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,64 @@ def result_files(self):
555555
----------
556556
list
557557
List of result files.
558+
559+
Examples
560+
--------
561+
If you use the :func:`set_result_file_path() <ansys.dpf.core.data_sources.DataSources.set_result_file_path>`
562+
function, it will return only the file path given as an argument to this function.
563+
564+
>>> from ansys.dpf import core as dpf
565+
>>>
566+
>>> # Create the DataSources object
567+
>>> my_data_sources = dpf.DataSources()
568+
>>> # Define the path where the main result file can be found
569+
>>> my_data_sources.set_result_file_path(filepath='/tmp/file.cas', key='cas')
570+
>>> # Add the additional result file to the DataSources object
571+
>>> my_data_sources.add_file_path(filepath='/tmp/ds.dat', key='dat')
572+
>>> # Get the path to the main result file
573+
>>> my_data_sources.result_files
574+
['/tmp/file.cas']
575+
576+
If you added an upstream result file, it is not listed in the main ``DataSources`` object. You have to
577+
check directly in the ``DataSources`` object created to define the upstream data.
578+
579+
>>> from ansys.dpf import core as dpf
580+
>>>
581+
>>> # Create the main DataSources object with a main file path
582+
>>> my_data_sources = dpf.DataSources(result_path='/tmp/file.rfrq')
583+
>>>
584+
>>> # Create the DataSources object for the upstream data
585+
>>> my_data_sources_upstream = dpf.DataSources(result_path='/tmp/file.mode')
586+
>>> # Add the additional upstream data to the upstream DataSources object
587+
>>> my_data_sources_upstream.add_file_path(filepath='/tmp/file.rst', key='rst')
588+
>>>
589+
>>> # Add the upstream DataSources to the main DataSources object
590+
>>> my_data_sources.add_upstream(upstream_data_sources=my_data_sources_upstream)
591+
>>>
592+
>>> # Get the path to the main result file of the main DataSources object
593+
>>> my_data_sources.result_files
594+
['/tmp/file.rfrq']
595+
596+
If you are checking the DataSources object created to define the upstream data, only the first one is listed.
597+
598+
>>> # Get the path to the upstream file of the upstream DataSources object
599+
>>> my_data_sources_upstream.result_files
600+
['/tmp/file.mode']
601+
602+
If you have a ``DataSources`` object with more than one domain, a empty list is returned.
603+
604+
>>> from ansys.dpf import core as dpf
605+
>>>
606+
>>> # Create the DataSources object
607+
>>> my_data_sources = dpf.DataSources()
608+
>>> # Define the path where the main result data can be found and specify its domain
609+
>>> my_data_sources.set_domain_result_file_path(path='/tmp/file0.rst', key='rst', domain_id=0)
610+
>>> my_data_sources.set_domain_result_file_path(path='/tmp/file1.rst', key='rst', domain_id=1)
611+
>>>
612+
>>> # Get the path to the main result files of the DataSources object
613+
>>> my_data_sources.result_files
614+
[None, None]
615+
558616
"""
559617
result_key = self.result_key
560618
if result_key == "":

0 commit comments

Comments
 (0)