Skip to content

Commit 16f69e4

Browse files
authored
Merge branch 'master' into maint/order_operators_init
2 parents ec26082 + f5172bf commit 16f69e4

File tree

625 files changed

+1160
-677
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

625 files changed

+1160
-677
lines changed

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ body:
6161
label: Which DPF/Ansys version are you using?
6262
multiple: false
6363
options:
64+
- 'Ansys 2024 R1'
65+
- 'Ansys 2023 R2'
6466
- 'DPF Server 2023.2.pre1'
6567
- 'DPF Server 2023.2.pre0'
6668
- 'Ansys 2023 R1'
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: 🎓 Adding an example
2+
description: Proposing a new example for the library
3+
title: "Example proposal: ..."
4+
labels: ["example"]
5+
assignees: [""]
6+
7+
body:
8+
9+
- type: textarea
10+
id: example-description
11+
attributes:
12+
label: '📝 Description of the example'
13+
placeholder: Describe what example you devised and why it is useful for the project.
14+
15+
validations:
16+
required: true
17+
18+
- type: textarea
19+
id: example-files
20+
attributes:
21+
label: '📁 Files needed for running the example'
22+
placeholder: >
23+
Drag and drop the files used in your example, together with the script employed.
24+
Test the example files before uploading to ensure they at least run on your machine.
25+
Add any additional comments/explanations that maintainers may need for running the example.
26+
If you have issues uploading your files because of the file extension/type, upload them
27+
as a .zip file.
28+
validations:
29+
required: true
30+
31+
- type: dropdown
32+
id: os-name
33+
attributes:
34+
label: '💻 Which operating system are you using?'
35+
multiple: false
36+
options:
37+
- 'Windows'
38+
- 'MacOS'
39+
- 'Linux'
40+
validations:
41+
required: true
42+
43+
- type: textarea
44+
id: ansys-version
45+
attributes:
46+
label: '📀 Which ANSYS version are you using?'
47+
placeholder: Indicate the ANSYS version of the products you are using.
48+
49+
validations:
50+
required: false
51+
52+
- type: dropdown
53+
id: python-version
54+
attributes:
55+
label: '🐍 Which Python version are you using?'
56+
description: Run `python --version` to verify your Python version
57+
multiple: false
58+
options:
59+
- '3.7'
60+
- '3.8'
61+
- '3.9'
62+
- '3.10'
63+
- '3.11'
64+
validations:
65+
required: true
66+
67+
- type: textarea
68+
id: installed-packages
69+
attributes:
70+
label: '📦 Installed packages'
71+
description: Run `python -m pip freeze` to list installed packages
72+
placeholder: Paste the output of `python -m pip freeze` here.
73+
render: shell
74+
validations:
75+
required: true

src/ansys/dpf/core/config.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,25 @@ class Config:
3434
Server with the channel connected to the remote or local instance. The default is
3535
``None``, in which case an attempt is made to use the global server.
3636
37+
Examples
38+
--------
39+
Create an operator configuration, instantiate the operator and
40+
run it with the configuration.
41+
42+
>>> from ansys.dpf import core as dpf
43+
>>> config_add = dpf.Config("add")
44+
>>> config_add.set_work_by_index_option(True)
45+
>>> op = dpf.operators.math.add(config=config_add)
46+
47+
Modify the copy of an operator's configuration and set it as current config
48+
of the operator.
49+
50+
>>> from ansys.dpf import core as dpf
51+
>>> op = dpf.operators.math.add()
52+
>>> config_add = op.config
53+
>>> config_add.set_work_by_index_option(True)
54+
>>> op.config = config_add
55+
3756
"""
3857

3958
def __init__(self, operator_name=None, config=None, server=None, spec=None):
@@ -144,6 +163,18 @@ def set_config_option(self, config_name, config_value):
144163
Value to give to a configuration option.
145164
config_name : str
146165
Name of the configuration option.
166+
167+
Examples
168+
--------
169+
Modify the copy of an operator's configuration and set it as current config
170+
of the operator.
171+
172+
>>> from ansys.dpf import core as dpf
173+
>>> op = dpf.operators.math.add()
174+
>>> config_add = op.config
175+
>>> config_add.set_config_option(config_name="work_by_index", config_value=True)
176+
>>> op.config = config_add
177+
147178
"""
148179
return self.__set_config_option__(config_value, config_name)
149180

src/ansys/dpf/core/core.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,6 @@ def upload_file_in_tmp_folder(file_path, new_file_name=None, server=None):
9797
server_file_path : str
9898
path generated server side
9999
100-
Examples
101-
--------
102-
>>> from ansys.dpf import core as dpf
103-
>>> from ansys.dpf.core import examples
104-
>>> server = dpf.start_local_server(config=dpf.AvailableServerConfigs.GrpcServer,
105-
... as_global=False)
106-
>>> file_path = dpf.upload_file_in_tmp_folder(examples.find_static_rst(), server=server)
107-
108100
Notes
109101
-----
110102
Is not implemented for usage with type(server)=
@@ -162,17 +154,6 @@ def download_file(server_file_path, to_client_file_path, server=None):
162154
Server with channel connected to the remote or local instance. When
163155
``None``, attempts to use the global server.
164156
165-
Examples
166-
--------
167-
>>> from ansys.dpf import core as dpf
168-
>>> from ansys.dpf.core import examples
169-
>>> server = dpf.start_local_server(config=dpf.AvailableServerConfigs.GrpcServer,
170-
... as_global=False)
171-
>>> file_path = dpf.upload_file_in_tmp_folder(examples.find_static_rst(), server=server)
172-
>>> dpf.download_file(file_path, examples.find_static_rst(), server=server)
173-
<BLANKLINE>
174-
...
175-
176157
Notes
177158
-----
178159
Is not implemented for usage with type(server)=

src/ansys/dpf/core/dpf_operator.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,12 +474,26 @@ def config(self):
474474
"""Copy of the operator's current configuration.
475475
476476
You can modify the copy of the configuration and then use ``operator.config = new_config``
477-
or create an operator with the new configuration as a parameter.
477+
or instantiate an operator with the new configuration as a parameter.
478+
479+
For information on an operator's options, see the documentation for that operator.
478480
479481
Returns
480482
----------
481483
:class:`ansys.dpf.core.config.Config`
482484
Copy of the operator's current configuration.
485+
486+
Examples
487+
--------
488+
Modify the copy of an operator's configuration and set it as current config
489+
of the operator.
490+
491+
>>> from ansys.dpf import core as dpf
492+
>>> op = dpf.operators.math.add()
493+
>>> config_add = op.config
494+
>>> config_add.set_work_by_index_option(True)
495+
>>> op.config = config_add
496+
483497
"""
484498
config = self._api.operator_get_config(self)
485499
return Config(config=config, server=self._server, spec=self._spec)

0 commit comments

Comments
 (0)