BasicTools.Containers.FiltersTools module

BasicTools.Containers.FiltersTools.CheckIntegrity(GUI=False)[source]
BasicTools.Containers.FiltersTools.CheckIntegrityReadElementFilter(GUI=False)[source]
BasicTools.Containers.FiltersTools.CheckIntegrity_FilterToETag(GUI=False)[source]
BasicTools.Containers.FiltersTools.CheckIntegrity_GetNodesMaskForElementFilter(GUI=False)[source]
BasicTools.Containers.FiltersTools.CheckIntegrity_ListOfElementFiltersFromETagList(GUI=False)[source]
BasicTools.Containers.FiltersTools.CheckIntegrity_ListOfElementFiltersFromMask(GUI=False)[source]
BasicTools.Containers.FiltersTools.CheckIntegrity_VerifyExclusiveFilters(GUI=False)[source]
BasicTools.Containers.FiltersTools.FilterToETag(mesh: UnstructuredMesh, elementFilter: ElementFilter | FilterOP, tagname: str) None[source]

Create a Element tag with the name tagname using the elementFilter The tag is added the mesh.

Parameters:
  • mesh (UnstructuredMesh) – Mesh to work on

  • elementFilter (Union[ElementFilter,FilterOP]) – The element filter to use to select the elements

  • tagname (str) – the name of tag to create

  • exists (if the tag already) –

  • raised. (an exception is) –

BasicTools.Containers.FiltersTools.GetListOfPartialElementFilter(elementFilter, nbPartitions: int, frozen=True) List[PartialElementFilter][source]

Generate a list of PartialElementFilter for a number of partitions

Parameters:
  • elementFilter (ElementFilter) – _description_

  • nbPartitions (int) – Number of partitions

  • frozen (bool, optional) – if True the filters are frozen (evaluated at the moment of creation), no more modification is allowed, by default True

Returns:

a list of partialElementFilter or frozen filter. the union of all the element of the list matches the original elementFilter

Return type:

List[PartialElementFilter]

BasicTools.Containers.FiltersTools.GetNodesMaskForElementFilter(elementFilter: ElementFilter, mesh: UnstructuredMesh) ndarray[source]

Generate a node mask of all the nodes used by the element filter

Parameters:
Returns:

a array of size mesh.GetNumberOfNodes and True if the nodes is used by an element selected by the filter

Return type:

np.ndarray

BasicTools.Containers.FiltersTools.ListOfElementFiltersFromETagList(tagList: List[str | List[str]], mesh: UnstructuredMesh | None = None) List[ElementFilter][source]

Function to construct a list of filters from a list of tags (or a list of tags)

Parameters:
  • tagList (List[Union[str,List[str]]]) – A list containing a string or a list of strings. Example (“tag1”,(“tag2”,”tag3”)) -> list with 2 ElementFilters

  • mesh (Optional[UnstructuredMesh], optional) – Mesh to pass to the filters

Returns:

List of ElementFilter with the associated tags as filters

Return type:

List[ElementFilter]

BasicTools.Containers.FiltersTools.ListOfElementFiltersFromMask(maskVector: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], mesh: UnstructuredMesh | None = None) List[ElementFilter][source]

Function to construct a list of filter from a mask vector

Parameters:
  • maskVector (ArrayLike) – A element size vector of ints to determine to which filter each elements belongs to. The number of filters is calculated using np.unique

  • mesh (Optional[UnstructuredMesh], optional) – Mesh to pass to the filters

Returns:

List of ElementFilter with the associated tags as filters

Return type:

List[ElementFilter]

BasicTools.Containers.FiltersTools.ReadElementFilter(string: str) ElementFilter[source]

Function to read from a string all the parameter of a ElementFiler

Parameters:

string (str) –

a string in the form of “key(names) & key(options) && …” possible keywords are :

Tags -> Tags(bulk1,bulk2) nTags -> nTags(points1,points2) Dim -> Dim(3) (only one int) Exprs -> Exprs(x-1,y+3, x**2 +y**2 - 5) nTagsOn : to select the nTags Treatment ExprsOn : to select the Exprs Treatment

Examples

>>> ReadElementFilter("Tags(Inside) & Dim(2) & nTags(Toto,Tata) & Exprs(x-1, y+3, x**2 + y**2 - 5)")

Please read the documentation of ElementFilter

Returns:

An initialized instance of an ElementFilter.

Return type:

ElementFilter

BasicTools.Containers.FiltersTools.VerifyExclusiveFilters(listOfFilters: List[ElementFilter | FilterOP], mesh: UnstructuredMesh) bool[source]
Function to check if a list of ElementFilter is exclusive.

(each element is present at the most in one filter)

Parameters:
Returns:

True if the filters are exclusive

Return type:

bool