Module containing selection classes.
Selection#
- class ansys.dpf.post.selection.TimeFreqSelection(server: BaseServer | None = None)#
Define a time/frequency selection.
Translate time/frequency selection types (index, sets, time/frequency values) into DPF known entities.
- select_time_freq_indices(time_freq_indices: List[int])#
Select time frequency sets by their indices (zero-based indexing).
- select_time_freq_sets(time_freq_sets: List[int])#
Select time frequency sets by their cumulative sets (one-based indexing).
- select_with_scoping(scoping: Scoping)#
Directly sets the scoping as the time/freq selection.
- Parameters:
scoping (
Scoping
) – Scoping to use for time/freq selection.
- select_time_freq_values(time_freq_values: List[float] | ndarray | Field)#
Select time frequency sets by their values (one-based indexing).
- apply_to(simulation: Simulation)#
Performs the currently defined selection on the given Simulation.
- Parameters:
simulation (
Simulation
) – PyDPF-Post Simulation to apply the selection on.- Return type:
IDs of the entities obtained after applying the selection.
- class ansys.dpf.post.selection.SpatialSelection(scoping: Scoping | None = None, server: BaseServer | None = None)#
Define a spatial selection.
Translate space selection types (node ids, elements ids, geometry selections, named selections…) into DPF known entities.
- select_named_selection(named_selection: str | List[str], location: str | locations | None = None, inclusive: bool = False)#
Select a mesh scoping corresponding to one or several named selections.
- Parameters:
named_selection (
Union
[str
,List
[str
]]) – Name of the named selection.location (
Optional
[Union`[:py:class:`str
,locations
]], default:None
) – Location of the mesh entities to extract results at. Available locations are listed in class:post.locations and are: post.locations.nodal or post.locations.elemental.inclusive (
bool
, default:False
) – If True and the named selection is nodal, include all elements that touch a node. If False, include only elements that share all the nodes in the scoping.
- Return type:
- select_external_layer(location: locations | str = 'Elemental', result_native_location: str | locations | None = None, elements: List[int] | Scoping | None = None, is_model_cyclic: str = 'not_cyclic')#
Select the external layer of the mesh.
Select the external layer of the mesh (possibly on parts of the mesh scoped to the
elements
input). The mesh corresponding to this external layer is then used to display results and the nodes or elements of this submesh are used to scope result data extraction.- Parameters:
location (
Union
[locations
,str
], default:'Elemental'
) – Location of the mesh entities to extract results at. Available locations are listed in class:post.locations and are: post.locations.nodal or post.locations.elemental.result_native_location (
Optional
[Union`[:py:class:`str
,locations
]], default:None
) – Native (as found in the file) location of the output result. Used to pick the location of the scoping.elements (
Optional
[List
[int
],Scoping
]], default:None
) – List of elements to use to compute the external layer, default is all the elements of the model.is_model_cyclic (
str
, default:'not_cyclic'
) – Cyclic type:not_cyclic
,single_stage
, ormulti_stage
. This value can be returned by the Operatoroperators.metadata.is_cyclic
. Used to get the skin on the expanded mesh.
- Return type:
- select_skin(location: locations | str = 'Elemental', result_native_location: str | locations | None = None, elements: List[int] | Scoping | None = None, is_model_cyclic: str = 'not_cyclic')#
Select the skin of the mesh.
Select the skin of the mesh (possibly on parts of the mesh scoped to the
elements
input). The mesh corresponding to this skin is then used to display results and the nodes or elements of this submesh are used to scope result data extraction.- Parameters:
location (
Union
[locations
,str
], default:'Elemental'
) – Location of the mesh entities to extract results at. Available locations are listed in class:post.locations and are: post.locations.nodal or post.locations.elemental.result_native_location (
Optional
[Union`[:py:class:`str
,locations
]], default:None
) – Native (as found in the file) location of the output result. Used to pick the location of the scoping.elements (
Optional
[List
[int
],Scoping
]], default:None
) – List of elements to use to compute the external layer, default is all the elements of the model. Getting the skin on a selection of elements for cyclic symmetry is not supported.is_model_cyclic (
str
, default:'not_cyclic'
) – Cyclic type:not_cyclic
,single_stage
, ormulti_stage
. This value can be returned by the Operatoroperators.metadata.is_cyclic
. Used to get the skin on the expanded mesh.
- Return type:
- select_with_scoping(scoping: Scoping)#
Directly sets the scoping as the spatial selection.
- Parameters:
scoping (
Scoping
) – Scoping to use for spatial selection.
- select_nodes_of_elements(elements: List[int] | Scoping, mesh: Mesh)#
Select all nodes of elements using the elements’ IDs or an elemental mesh scoping.
- select_elements_of_nodes(nodes: List[int] | Scoping, mesh: Mesh, inclusive: bool = True)#
Select all elements of nodes using the nodes’ IDs or a nodal mesh scoping.
- Parameters:
- Return type:
- select_nodes_of_faces(faces: List[int] | Scoping, mesh: Mesh)#
Select all nodes of faces using the faces’ IDs or a faces mesh scoping.
- select_faces_of_elements(elements: List[int] | Scoping, mesh: Mesh)#
Select all faces of elements using the elements’ IDs or an elemental mesh scoping.
- select_elements(elements: List[int] | Scoping)#
Select elements using their IDs or an elemental mesh scoping.
- intersect(spatial_selection: Selection | SpatialSelection | Scoping)#
Replaces the current selection by its intersection with the input.
- Parameters:
spatial_selection (
Union
[Selection
,SpatialSelection
,Scoping
]) – Spatial domain to intersect with.- Return type:
- apply_to(simulation: Simulation)#
Performs the currently defined selection on the given Simulation.
- Parameters:
simulation (
Simulation
) – PyDPF-Post Simulation to apply the selection on.- Return type:
IDs of the entities obtained after applying the selection.
- class ansys.dpf.post.selection.Selection(server: BaseServer | None = None)#
The
Selection
class helps define the domain on which results are evaluated.The result domain defines the time/frequency and the spatial selection.
- property time_freq_selection: TimeFreqSelection#
Returns the computed one-based time scoping.
- Returns:
Time/freq selection of the selection.
- Return type:
selection
- property spatial_selection: SpatialSelection#
Returns the computed one-based mesh scoping.
- Returns:
Spatial selection of the selection.
- Return type:
selection
- select_time_freq_indices(time_freq_indices: List[int])#
Select time frequency sets by their indices (zero-based indexing).
- select_time_freq_sets(time_freq_sets: List[int] | int)#
Select time frequency sets by their cumulative sets (one-based indexing).
- select_time_freq_values(time_freq_values: List[float] | ndarray | Field)#
Select time frequency sets by their values.
- select_named_selection(named_selection: str | List[str], location: str | locations | None = None, inclusive: bool = False)#
Select a mesh scoping corresponding to one or several named selections.
- Parameters:
named_selection (
Union
[str
,List
[str
]]) – Named selection to select.location (
Optional
[Union`[:py:class:`str
,locations
]], default:None
) – Location of the mesh entities to extract results at. Available locations are listed in class:post.locations and are: post.locations.nodal or post.locations.elemental.inclusive (
bool
, default:False
) – If True and the named selection is nodal, include all elements that touch a node. If False, include only elements that share all the nodes in the scoping.
- Return type:
- select_nodes(nodes: List[int] | Scoping)#
Select a mesh scoping with its node IDs.
Select a mesh scoping corresponding to a list of node IDs.
- select_faces(faces: List[int] | Scoping)#
Select a mesh scoping with its face IDs.
Select a mesh scoping corresponding to a list of face IDs.
- select_elements(elements: List[int] | Scoping)#
Select a mesh scoping with its element IDs.
Select a mesh scoping corresponding to a list of element IDs.
- select_nodes_of_elements(elements: List[int] | Scoping, mesh: Mesh)#
Select nodes belonging to elements defined by their IDs.
Select a nodal mesh scoping corresponding to elements.
- select_elements_of_nodes(nodes: List[int] | Scoping, mesh: Mesh, inclusive: bool = True)#
Select elements belonging to nodes defined by their IDs.
Select a elemental mesh scoping corresponding to nodes.
- select_nodes_of_faces(faces: List[int] | Scoping, mesh: Mesh)#
Select nodes belonging to faces defined by their IDs.
Select a nodal mesh scoping corresponding to faces.
- select_faces_of_elements(elements: List[int] | Scoping, mesh: Mesh)#
Select faces belonging to elements defined by their IDs.
Select a faces mesh scoping corresponding to elements.
- select_external_layer(location: locations | str = 'Elemental', result_native_location: str | locations | None = None, elements: List[int] | Scoping | None = None, is_model_cyclic: str = 'not_cyclic')#
Select the external layer of the mesh.
Select the external layer of the mesh (possibly on parts of the mesh scoped to the
elements
input). The mesh corresponding to this external layer are then used to display results and the nodes or elements of this submesh are used to scope result data extraction.- Parameters:
location (
Union
[locations
,str
], default:'Elemental'
) – Location of the mesh entities to extract results at. Available locations are listed in class:post.locations and are: post.locations.nodal or post.locations.elemental.result_native_location (
Optional
[Union`[:py:class:`str
,locations
]], default:None
) – Native (as found in the file) location of the output result. Used to pick the location of the scoping.elements (
Optional
[List
[int
],Scoping
]], default:None
) – List of elements to use to compute the external layer, default is all the elements of the model.is_model_cyclic (
str
, default:'not_cyclic'
) – Cyclic type:not_cyclic
,single_stage
, ormulti_stage
. This value can be returned by the Operatoroperators.metadata.is_cyclic
. Used to get the skin on the expanded mesh.
- Return type:
- select_skin(location: locations | str = 'Elemental', result_native_location: str | locations | None = None, elements: List[int] | Scoping | None = None, is_model_cyclic: str = 'not_cyclic')#
Select the skin of the mesh.
Select the skin of the mesh (possibly on parts of the mesh scoped to the
elements
input). The mesh corresponding to this skin are then used to display results and the nodes or elements of this submesh are used to scope result data extraction.- Parameters:
location (
Union
[locations
,str
], default:'Elemental'
) – Location of the mesh entities to extract results at. Available locations are listed in class:post.locations and are: post.locations.nodal or post.locations.elemental.result_native_location (
Optional
[Union`[:py:class:`str
,locations
]], default:None
) – Native (as found in the file) location of the output result. Used to pick the location of the scoping.elements (
Optional
[List
[int
],Scoping
]], default:None
) – List of elements to use to compute the external layer, default is all the elements of the model. Getting the skin on a selection of elements for cyclic symmetry is not supported.is_model_cyclic (
str
, default:'not_cyclic'
) – Cyclic type:not_cyclic
,single_stage
, ormulti_stage
. This value can be returned by the Operatoroperators.metadata.is_cyclic
. Used to get the skin on the expanded mesh.
- Return type: