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).

Parameters:

time_freq_indices (List[int]) – Indices of the time-steps/frequencies to select.

Return type:

None

select_time_freq_sets(time_freq_sets: List[int])#

Select time frequency sets by their cumulative sets (one-based indexing).

Parameters:

time_freq_sets (List[int]) – Cumulative set indices of the time-steps/frequencies to select.

Return type:

None

select_load_steps(load_steps: List[int])#

Select a list of load steps (one-based indexing).

Parameters:

load_steps (List[int]) – IDs of the load steps to select.

Return type:

None

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).

Parameters:

time_freq_values (Union[List[float], ndarray, Field]) – Time/frequency values to select.

Return type:

None

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)#

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.

Return type:

None

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, or multi_stage. This value can be returned by the Operator operators.metadata.is_cyclic. Used to get the skin on the expanded mesh.

Return type:

None

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, or multi_stage. This value can be returned by the Operator operators.metadata.is_cyclic. Used to get the skin on the expanded mesh.

Return type:

None

select_with_scoping(scoping: Scoping)#

Directly sets the scoping as the spatial selection.

Parameters:

scoping (Scoping) – Scoping to use for spatial selection.

select_nodes(nodes: List[int] | Scoping)#

Select nodes using their IDs or a nodal mesh scoping.

Parameters:

nodes (Union[List[int], Scoping]) – node IDs or nodal mesh scoping.

Return type:

None

select_nodes_of_elements(elements: List[int] | Scoping, mesh: Mesh)#

Select all nodes of elements using the elements’ IDs or an elemental mesh scoping.

Parameters:
  • elements (Union[List[int], Scoping]) – element IDs or elemental mesh scoping.

  • mesh (Mesh) – Mesh containing the necessary connectivity.

Return type:

None

select_nodes_of_faces(faces: List[int] | Scoping, mesh: Mesh)#

Select all nodes of faces using the faces’ IDs or a faces mesh scoping.

Parameters:
  • faces (Union[List[int], Scoping]) – face IDs or faces mesh scoping.

  • mesh (Mesh) – Mesh containing the necessary connectivity.

Return type:

None

select_faces_of_elements(elements: List[int] | Scoping, mesh: Mesh)#

Select all faces of elements using the elements’ IDs or an elemental mesh scoping.

Parameters:
  • elements (Union[List[int], Scoping]) – element IDs or elemental mesh scoping.

  • mesh (Mesh) – Mesh containing the necessary connectivity.

Return type:

None

select_faces(faces: List[int] | Scoping)#

Select faces using their IDs or a faces mesh scoping.

Parameters:

faces (Union[List[int], Scoping]) – face IDs or faces mesh scoping.

Return type:

None

select_elements(elements: List[int] | Scoping)#

Select elements using their IDs or an elemental mesh scoping.

Parameters:

elements (Union[List[int], Scoping]) – element IDs or elemental mesh scoping.

Return type:

None

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:

None

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.

property requires_mesh: bool#

Whether the selection workflow requires a mesh as an input or not.

property outputs_mesh: bool#

Whether the selection workflow as an output named mesh.

requires_manual_averaging(location: str | locations, result_native_location: str | locations, is_model_cyclic: str = 'not_cyclic')#

Whether the selection workflow requires to manually build the averaging workflow.

Return type:

bool

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).

Parameters:

time_freq_indices (List[int]) – Time/freq indexes to select.

Return type:

None

select_time_freq_sets(time_freq_sets: List[int] | int)#

Select time frequency sets by their cumulative sets (one-based indexing).

Parameters:

time_freq_sets (Union[List[int], int]) – Time/freq sets to select.

Return type:

None

select_time_freq_values(time_freq_values: List[float] | ndarray | Field)#

Select time frequency sets by their values.

Parameters:

time_freq_values (Union[List[float], ndarray, Field]) – Time/freq values to select.

Return type:

None

select_named_selection(named_selection: str | List[str], location: str | locations | None = None)#

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.

Return type:

None

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.

Parameters:

nodes (Union[List[int], Scoping]) – node IDs.

Return type:

None

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.

Parameters:

faces (Union[List[int], Scoping]) – face IDs.

Return type:

None

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.

Parameters:

elements (Union[List[int], Scoping]) – element IDs.

Return type:

None

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.

Parameters:
  • elements (Union[List[int], Scoping]) – element IDs.

  • mesh (Mesh) – Mesh containing the connectivity.

Return type:

None

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.

Parameters:
  • faces (Union[List[int], Scoping]) – face IDs.

  • mesh (Mesh) – Mesh containing the connectivity.

Return type:

None

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.

Parameters:
  • elements (Union[List[int], Scoping]) – element IDs.

  • mesh (Mesh) – Mesh containing the connectivity.

Return type:

None

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, or multi_stage. This value can be returned by the Operator operators.metadata.is_cyclic. Used to get the skin on the expanded mesh.

Return type:

None

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, or multi_stage. This value can be returned by the Operator operators.metadata.is_cyclic. Used to get the skin on the expanded mesh.

Return type:

None

property requires_mesh: bool#

Whether the selection workflow requires a initial_mesh as an input or not.

property outputs_mesh: bool#

Whether the selection workflow as an output named mesh.

requires_manual_averaging(location: str | locations, result_native_location: str | locations, is_model_cyclic: str = 'not_cyclic')#

Whether the selection workflow requires to manually build the averaging workflow.

Return type:

bool