Muscat.Containers.Filters.FilterOperators module

CheckIntegrity(GUI: bool = False)[source]
class ComplementaryFilter(filters: FilterBase | FilterOperatorBase | List[FilterBase | FilterOperatorBase] | None = None)[source]

Bases: FilterOperatorBase

Class to generate the complementary part of a filter

GetIdsToTreat(mesh: Mesh, elementType: ED.ElementType | str) np.ndarray | Collection[source]

return the ids of the element selected by the filter for the ElementsContainer

Parameters:

elementType (str) – the element Type to work on

Returns:

the ids selected by the filter

Return type:

np.ndarray

Raises:

Exception – if the list contains more than one filter

GetNodesIndices(mesh: Mesh) np.ndarray[source]

return the indices of the node selected by the filter

Parameters:

mesh (Mesh) – elementType : str

Returns:

the indices of the selected nodes by the filter

Return type:

np.ndarray

Raises:

NotImplementedError – _description_

class DifferenceFilter(filters: FilterBase | FilterOperatorBase | List[FilterBase | FilterOperatorBase] | None = None)[source]

Bases: FilterOperatorBase

Specialized class to compute the difference between two filters

GetIdsToTreat(mesh: Mesh, elementType: ED.ElementType | str) np.ndarray | Collection[source]

return the ids of the element selected by the filter for the ElementsContainer

Parameters:

elementType (str) – the element Type to work on

Returns:

the ids selected by the filter

Return type:

np.ndarray

GetNodesIndices(mesh: Mesh) np.ndarray[source]

return the indices of the node selected by the filter

Parameters:

mesh (Mesh) – elementType : str

Returns:

the indices of the selected nodes by the filter

Return type:

np.ndarray

Raises:

NotImplementedError – _description_

class FilterOperatorBase(filters: FilterBase | FilterOperatorBase | List[FilterBase | FilterOperatorBase] | None = None, minNumberOfInternalFilters: int = 1, maxNumberOfInternalFilters: int = 100)[source]

Bases: object

Base class to construct derived Filters (Union filter for example)

Parameters:

filters (List[Union[Filter,FilterOperatorBase]], optional) – the list of filters to use, by default None

AddToFiltersList(filters: FilterBase | FilterOperatorBase | Sequence[FilterBase | FilterOperatorBase]) None[source]

Add filter(s) to the internal list of filter to be used by the operators

Parameters:

filters (Union[FilterLike, Sequence[FilterLike]]) – a filter or a list of filters

Raises:
  • TypeError – if filters is not of the correct type

  • RuntimeError – if the operator cant accept more internal filters

Check() None[source]
ClearFilterList() None[source]

Clear the internal list of filter to be used to compute the operator

GetIdsToTreat(mesh: Mesh, elementType: ED.ElementType | str) np.ndarray | Collection[source]

return the indices of the element selected by the filter for the ElementsContainer

Parameters:
  • mesh (Mesh) – the mesh to filter

  • elementType (str) – the element Type to work on

Returns:

the indices of the selected elements by the filter

Return type:

np.ndarray

GetNodesIndices(mesh: Mesh) np.ndarray[source]

return the indices of the node selected by the filter

Parameters:

mesh (Mesh) – elementType : str

Returns:

the indices of the selected nodes by the filter

Return type:

np.ndarray

Raises:

NotImplementedError – _description_

IsEquivalent(other: Any) bool[source]

To check if 2 element filter are equivalent ()

Parameters:

other (Any) – other object to check the equivalency

Returns:

True if the two filters are equal

Return type:

bool

class FilterWithMesh(filters: FilterBase | FilterOperatorBase | List[FilterBase | FilterOperatorBase], mesh: Mesh | None, ignoreIncomingMesh=False)[source]

Bases: FilterOperatorBase

Filter operator to ignore the incoming mesh and use a internally stored mesh

GetIdsToTreat(mesh: Mesh, elementType: ED.ElementType | str) np.ndarray | Collection[source]

return the ids of the element selected by the filter for the ElementsContainer

Parameters:
  • mesh (Mesh) – Not Used! this argument is ignored, the mesh used is stored in self.mesh

  • elementType (str) – the element Type to work on

Returns:

the ids selected by the filter

Return type:

np.ndarray

GetNodesIndices(mesh: Mesh | None = None) np.ndarray[source]

return the indices of the node selected by the filter

Parameters:

mesh (Mesh) – elementType : str

Returns:

the indices of the selected nodes by the filter

Return type:

np.ndarray

Raises:

NotImplementedError – _description_

class FrozenFilter(filters: FilterBase | FilterOperatorBase, mesh, onElements: bool = True, onNodes: bool = False, withError: bool = False)[source]

Bases: FilterOperatorBase

GetElementSelectionSize() int[source]

Return the size of the element selection

Returns:

number of elements in the selection

Return type:

int

GetIdsToTreat(mesh: Mesh, elementType: ED.ElementType | str) np.ndarray | Collection[source]

return the ids of the element selected by the filter for the elementType

Parameters:
  • mesh (Mesh) – this is a frozen filter so mesh is ignored

  • elementType (str) – the element Type to work on

Returns:

the ids to selected by this filter

Return type:

np.ndarray

GetNodeSelectionSize() int[source]

Return the size of the element selection

Returns:

number of elements in the selection

Return type:

int

GetNodesIndices(mesh: Mesh | None = None) np.ndarray[source]

return the indices of the node selected by the filter

Parameters:

mesh (Mesh) – elementType : str

Returns:

the indices of the selected nodes by the filter

Return type:

np.ndarray

Raises:

NotImplementedError – _description_

IsEquivalent(other: FrozenFilter | Any) bool[source]

To check if 2 element filter are equivalent ()

Parameters:

other (Any) – other object to check the equivalency

Returns:

True if the two filters are equal

Return type:

bool

SetIdsToTreatFor(selection: ElementsSelection)[source]

Set the ids for a specific element type. this filter keeps a reference to elements internally

Parameters:

selection (ElementsSelection) – ElementsSelection to extract the element type

class IntersectionFilter(filters: FilterBase | FilterOperatorBase | List[FilterBase | FilterOperatorBase] | None = None)[source]

Bases: FilterOperatorBase

Specialized class to compute the intersection of filters

GetIdsToTreat(mesh: Mesh, elementType: ED.ElementType | str) np.ndarray | Collection[source]

return the ids of the element selected by the filter for the ElementsContainer

Parameters:

elementType (str) – the element Type to work on

Returns:

the ids selected by the filter

Return type:

np.ndarray

GetNodesIndices(mesh: Mesh) np.ndarray[source]

return the indices of the node selected by the filter

Parameters:

mesh (Mesh) – elementType : str

Returns:

the indices of the selected nodes by the filter

Return type:

np.ndarray

Raises:

NotImplementedError – _description_

class PartialFilter(elementFilter: FilterBase | FilterOperatorBase | List[FilterBase | FilterOperatorBase], partitions: int | int64, partitionNumber: int | int64)[source]

Bases: FilterOperatorBase

Utility class to create a partition of a ElementFilter

GetIdsToTreat(mesh: Mesh, elementType: ED.ElementType | str) np.ndarray | Collection[source]

return the ids of the element selected by the filter for the elementType

Parameters:

elementType (str) – the element Type to work on

Returns:

the ids selected by the filter

Return type:

np.ndarray

Raises:

Exception – if the list contains more than one filter

GetNodesIndices(mesh: Mesh) np.ndarray[source]

return the indices of the node selected by the filter

Parameters:

mesh (Mesh) – elementType : str

Returns:

the indices of the selected nodes by the filter

Return type:

np.ndarray

Raises:

NotImplementedError – _description_

class UnionFilter(filters: FilterBase | FilterOperatorBase | List[FilterBase | FilterOperatorBase] | None = None)[source]

Bases: FilterOperatorBase

Specialized class to compute the union of filter (add)

GetIdsToTreat(mesh: Mesh, elementType: ED.ElementType | str) np.ndarray | Collection[source]

return the ids of the element selected by the filter for the ElementsContainer

Parameters:

elementType (str) – the element Type to work on

Returns:

the ids selected by the filter

Return type:

np.ndarray

GetNodesIndices(mesh: Mesh) np.ndarray[source]

return the indices of the node selected by the filter

Parameters:

mesh (Mesh) – elementType : str

Returns:

the indices of the selected nodes by the filter

Return type:

np.ndarray

Raises:

NotImplementedError – _description_