|
23 | 23 | """
|
24 | 24 | mesh_scoping_factory.
|
25 | 25 |
|
26 |
| -Contains functions to simplify creating mesh scopings. |
| 26 | +Contains functions to simplify creating a mesh scoping. |
27 | 27 | """
|
28 | 28 |
|
| 29 | +from __future__ import annotations |
| 30 | + |
| 31 | +from typing import TYPE_CHECKING |
| 32 | + |
| 33 | +if TYPE_CHECKING: # pragma: nocover |
| 34 | + from ansys.dpf.core.server_types import AnyServerType |
| 35 | + from ansys.dpf.core.scoping import IdVectorType |
| 36 | + from ansys.dpf.core.model import Model |
| 37 | + |
29 | 38 | from ansys.dpf.core import Scoping
|
30 | 39 | from ansys.dpf.core.common import locations
|
31 | 40 |
|
32 | 41 |
|
33 |
| -def nodal_scoping(node_ids, server=None): |
34 |
| - """Create a specific nodal :class:`ansys.dpf.core.Scoping` associated with a mesh. |
| 42 | +def nodal_scoping(node_ids: IdVectorType, server: AnyServerType = None) -> Scoping: |
| 43 | + """Create a nodal :class:`ansys.dpf.core.Scoping` defining a list of node IDs. |
35 | 44 |
|
36 | 45 | Parameters
|
37 | 46 | ----------
|
38 |
| - node_ids : list[int] |
39 |
| - List of IDs for the nodes. |
40 |
| - server : DpfServer, optional |
| 47 | + node_ids: |
| 48 | + List of node IDs. |
| 49 | + server: |
41 | 50 | Server with the channel connected to the remote or local instance.
|
42 | 51 | The default is ``None``, in which case an attempt is made to use the
|
43 | 52 | global server.
|
44 | 53 |
|
45 | 54 | Returns
|
46 | 55 | -------
|
47 |
| - scoping : Scoping |
| 56 | + scoping: |
| 57 | + A nodal scoping containing the node IDs provided. |
48 | 58 | """
|
49 | 59 | scoping = Scoping(server=server, ids=node_ids, location=locations.nodal)
|
50 | 60 | return scoping
|
51 | 61 |
|
52 | 62 |
|
53 |
| -def elemental_scoping(element_ids, server=None): |
54 |
| - """Create a specific elemental :class:`ansys.dpf.core.Scoping` associated with a mesh. |
| 63 | +def elemental_scoping(element_ids: IdVectorType, server: AnyServerType = None) -> Scoping: |
| 64 | + """Create an elemental :class:`ansys.dpf.core.Scoping` defining a list of element IDs. |
55 | 65 |
|
56 | 66 | Parameters
|
57 | 67 | ----------
|
58 |
| - element_ids : list[int] |
59 |
| - List of IDs for the elements. |
60 |
| - server : DpfServer, optional |
| 68 | + element_ids: |
| 69 | + List of element IDs. |
| 70 | + server: |
61 | 71 | Server with the channel connected to the remote or local instance.
|
62 | 72 | The default is ``None``, in which case an attempt is made to use the
|
63 | 73 | global server.
|
64 | 74 |
|
65 | 75 | Returns
|
66 | 76 | -------
|
67 |
| - scoping : Scoping |
| 77 | + scoping: |
| 78 | + An elemental scoping containing the element IDs provided. |
68 | 79 | """
|
69 | 80 | scoping = Scoping(server=server, ids=element_ids, location=locations.elemental)
|
70 | 81 | return scoping
|
71 | 82 |
|
72 | 83 |
|
73 |
| -def face_scoping(face_ids, server=None): |
74 |
| - """Create a specific face :class:`ansys.dpf.core.Scoping` associated with a mesh. |
| 84 | +def face_scoping(face_ids: IdVectorType, server: AnyServerType = None) -> Scoping: |
| 85 | + """Create a face :class:`ansys.dpf.core.Scoping`defining a list of face IDs. |
75 | 86 |
|
76 | 87 | Parameters
|
77 | 88 | ----------
|
78 |
| - face_ids : list[int] |
79 |
| - List of IDs for the faces. |
80 |
| - server : DpfServer, optional |
| 89 | + face_ids: |
| 90 | + List of face IDs. |
| 91 | + server: |
81 | 92 | Server with the channel connected to the remote or local instance.
|
82 | 93 | The default is ``None``, in which case an attempt is made to use the
|
83 | 94 | global server.
|
84 | 95 |
|
85 | 96 | Returns
|
86 | 97 | -------
|
87 |
| - scoping : Scoping |
| 98 | + scoping: |
| 99 | + A face scoping containing the face IDs provided. |
88 | 100 | """
|
89 | 101 | scoping = Scoping(server=server, ids=face_ids, location=locations.faces)
|
90 | 102 | return scoping
|
91 | 103 |
|
92 | 104 |
|
93 |
| -def named_selection_scoping(named_selection_name, model, server=None): |
94 |
| - """Create a specific :class:`ansys.dpf.core.Scoping` associated with a specified model's mesh. |
| 105 | +def named_selection_scoping( |
| 106 | + named_selection_name: str, model: Model, server: AnyServerType = None |
| 107 | +) -> Scoping: |
| 108 | + """Create a :class:`ansys.dpf.core.Scoping` based on a named selection in a model. |
95 | 109 |
|
96 | 110 | Parameters
|
97 | 111 | ----------
|
98 |
| - named_selection_name : str |
| 112 | + named_selection_name: |
99 | 113 | Name of the named selection.
|
100 |
| - server : DpfServer, optional |
101 |
| - Server with the channel connected to the remote or local instance. |
102 |
| - The default is ``None``, in which case an attempt is made to use the |
103 |
| - global server. |
| 114 | + model: |
| 115 | + Model where the named selection exists. |
104 | 116 |
|
105 | 117 | Returns
|
106 | 118 | -------
|
107 |
| - scoping : Scoping |
| 119 | + scoping: |
| 120 | + A scoping containing the IDs of the entities in the named selection. |
| 121 | + The location depends on the type of entities targeted by the named selection. |
108 | 122 | """
|
109 | 123 | return model.metadata.named_selection(named_selection_name)
|
0 commit comments