Muscat.Containers.Filters.FilterObjects module¶
- class ElementFilter(dimensionality: Sequence[int64] | int64 | None = None, elementType: List[ElementType] | ElementType | None = None, zonesTreatment: str = 'CENTER', nTagsTreatment: str = 'ALL_NODES', nMaskTreatment: str = 'ALL_NODES', nFilterTreatment: str = 'ALL_NODES', zone: Callable[[_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]], ndarray] | List[Callable[[_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]], ndarray]] | None = None, eMask: ArrayLike | None = None, nMask: ArrayLike | None = None, eTag: str | List[str] | None = None, nTag: str | List[str] | None = None, eFilter: ElementFilter | None = None, nFilter: FilterBase | None = None)[source]¶
Bases:
FilterBase
Class for element filtering by dimensionality, zone, mask, elementType, tag, external element filter and/or nodal filter
- Parameters:
dimensionality (list[int], optional) – the dimensionality of the element to be included in this filter, by default None possible option are: 0 1 2 3
elementType (Optional[Union[List[ED.ElementType], ED.ElementType]], optional) – the name of a element type or a list of element types to be included in this filter, by default None
CENTER = if the the center of the element is inside the zone ALL_NODES = if all nodes of the element are inside the selection (zone, tag, mask…) AT_LEAST_ONE = if at least one node of the element is inside the selection (zone, tag, mask…)
- zonesTreatmentstr, optional
[“CENTER” | “ALL_NODES” | “AT_LEAST_ONE” ], by default “CENTER” [ ZT_CENTER | ZT_ALL_NODES | ZT_AT_LEAST_ONE ], by default ZT_CENTER
- nTagsTreatmentstr, optional
[“ALL_NODES” | “AT_LEAST_ONE” ], by default “ALL_NODES” [NT_ALL_NODES | NT_AT_LEAST_ONE ], by default NT_ALL_NODES
- nMaskTreatmentstr, optional
[“ALL_NODES” | “AT_LEAST_ONE” ], by default “ALL_NODES” [NM_ALL_NODES | NM_AT_LEAST_ONE ], by default NM_ALL_NODES
- nFilterTreatmentstr, optional
[“ALL_NODES” | “AT_LEAST_ONE” ], by default “ALL_NODES” [NF_ALL_NODES | NF_AT_LEAST_ONE ], by default NF_ALL_NODES
- AddElementType(elementType: ElementType | str) None [source]¶
Add an element type to be included in this filter
- Parameters:
elementType (str) – the name of an element type
- GetIdsToTreat(mesh: Mesh, elementType: ED.ElementType) np.ndarray [source]¶
Get the entities selected by this filter
- Parameters:
elementType (str) – Elements type to treat
- Returns:
The filtered entities
- Return type:
Union np.ndarray
- GetNodesIndices(mesh: Mesh) np.ndarray [source]¶
Return the nodes selected by this filter
- Parameters:
mesh (Mesh) – the mesh
- Returns:
the nodes indices selected by the filter
- Return type:
np.ndarray
- IsEquivalent(other: Any) bool [source]¶
To check if 2 element filters are equivalent
- Parameters:
other (Any) – other object to check the equivalency
- Returns:
True if the two filters are equal
- Return type:
bool
- IsFrozen()¶
- SetDimensionality(dimensionality: Sequence[int64] | int64) None [source]¶
Set the dimensionality of the elements to be treated
- Parameters:
dimensionality (Union[int, List[int]]) – a int to be added to the list or a list of all the dimensionalities to take into account
- Raises:
TypeError – if the input is not a list or an int
- SetElementType(elementTypes: List[ElementType] | ElementType) None [source]¶
Set the names of the element types to be included in this filter
- Parameters:
elementTypes (Union[List[ED.ElementType], ED.ElementType]) – an element Type or the list of element types
- SetNFilterTreatment(nFilterTreatment: str) None [source]¶
Set the way the elements are selected based on the nodal mask nMask
ALL_NODES = if all nodes of the element are inside the selection (zone, tag, mask…) AT_LEAST_ONE = if at least one node of the element is inside the selection (zone, tag, mask…)
- Parameters:
nFilterTreatment (str) – [“ALL_NODES” | “AT_LEAST_ONE”]
- Raises:
Exception – if the nFilterTreatment string is not in [“ALL_NODES”, “AT_LEAST_ONE”]
- SetNMaskTreatment(nMaskTreatment: str) None [source]¶
Set the way the elements are selected based on the nodal mask nMask
ALL_NODES = if all nodes of the element are inside the selection (zone, tag, mask…) AT_LEAST_ONE = if at least one node of the element is inside the selection (zone, tag, mask…)
- Parameters:
nMaskTreatment (str) – [“ALL_NODES” | “AT_LEAST_ONE”]
- Raises:
Exception – if the nMaskTreatment string is not in [“ALL_NODES”, “AT_LEAST_ONE”]
- SetNTagsTreatment(nTagsTreatment: str) None [source]¶
Set the way the elements are selected based on the nTags
ALL_NODES = if all nodes of the element are inside the selection (zone, tag, mask…) AT_LEAST_ONE = if at least one node of the element is inside the selection (zone, tag, mask…)
- Parameters:
nTagsTreatment (str) – [“ALL_NODES” | “AT_LEAST_ONE” ], by default “ALL_NODES” [NT_ALL_NODES | NT_AT_LEAST_ONE ], by default NT_ALL_NODES
- Raises:
Exception – if the nTagsTreatment string is not in [“ALL_NODES” | “AT_LEAST_ONE” ]
- SetZonesTreatment(zonesTreatment: str) None [source]¶
Set the way the elements are selected based on the position
CENTER = if the the center of the element is inside the zone ALL_NODES = if all nodes of the element are inside the selection (zone, tag, mask…) AT_LEAST_ONE = if at least one node of the element is inside the selection (zone, tag, mask…)
- Parameters:
zonesTreatment (str) – [“CENTER” | “ALL_NODES” | “AT_LEAST_ONE” ], by default “CENTER” [ ZT_CENTER | ZT_ALL_NODES | ZT_AT_LEAST_ONE ], by default ZT_CENTER
- Raises:
Exception – if the string is not permitted
- UnFrozen()¶
- class NodeFilter(zone: Callable[[_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]], ndarray] | List[Callable[[_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]], ndarray]] | None = None, eMask: ArrayLike | None = None, nMask: ArrayLike | None = None, eTag: str | List[str] | None = None, nTag: str | List[str] | None = None, eFilter: FilterBase | None = None, nFilter: FilterBase | None = None)[source]¶
Bases:
FilterBase
class for filtering nodes, bye , zone, mask, tag, external element filter and/or nodal filter
the rest of the parameter are passed to the constructor of the base class Filter
- GetNodesIndices(mesh: Mesh) np.ndarray [source]¶
Get the nodes indices selected by this filter
- Parameters:
mesh (Mesh) – mesh to apply the filter
- Returns:
The filtered nodes indices
- Return type:
Union np.ndarray
- IsFrozen()¶
- UnFrozen()¶