Muscat.Containers.MeshTools module

CheckIntegrity()[source]
CheckIntegrity_GetCellCenters()[source]
CheckIntegrity_TagsToRefs()[source]
GetElementsCenters(mesh: Mesh | None = None, nodes: _SupportsArray[dtype] | _NestedSequence[_SupportsArray[dtype]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, elements: ElementsContainer | StructuredElementsContainer | None = None, dim: int | None = None) ndarray[source]

Internal function to compute the element centers. Waring!!!! This function is used in the filters implementation no Filter can appear in this implementation

Parameters:
  • mesh (Mesh, optional) – if mesh is not none the element center for all the element is calculated, by default None

  • nodes (ArrayLike, optional) – if mesh is non, nodes and elements must be supplied to compute the element center only for the ElementContainer, by default None

  • elements (ElementContainerLike, optional) – if mesh is non, nodes and elements must be supplied to compute the element center only for the ElementContainer, by default None

  • dim (int, optional) – the dimensionality (int) to filter element to be treated, by default None

Returns:

the center for each element

Return type:

np.ndarray

IsClose(mesh1, mesh2) bool[source]

Verified if two meshes are close (in the sense of numpy.isclose) meshes must have the same : - nodes - nodes tags - elements - element tags

Parameters:
  • mesh1 (_type_) – first mesh to be compare

  • mesh2 (_type_) – second mesh to be compare

Returns:

True if mesh1 and mesh2 are close enough

Return type:

bool

RefsToTags(mesh: Mesh, dictNodesRefsToTags: dict, dictElemRefsToTags: dict, prefix='new')[source]

Function to retrieve the tags (strings) of the mesh (for nodes and elements) from the elementFields and nodeFields “ref” which are deleted after conversion to Tags. Needed for some mesh format as .mesh

Parameters:
  • mesh (a mesh with an element field and a node field named "ref") –

  • dictNodesRefsToTags (a dictionnary giving for each reference number the corresponding node tags) –

  • dictElemRefsToTags (a dictionnary giving for each reference number the corresponding element tags) –

  • prefix (the prefix to add if new reference numbers have been created) –

Returns:

mesh

Return type:

the mesh with the tags

TagsToRefs(mesh: Mesh, offset: int = 1)[source]

Function to convert the tags (strings) of the mesh (for nodes and elements) in one reference number (int). Needed for some mesh format as .mesh

Parameters:
  • mesh (a mesh with tags) –

  • offset (int greater than one) –

Returns:

  • refByNode (a np.array giving at position i the reference number (int) for the node i in the mesh)

  • dictNodesRefsToTags (a dictionnary giving for each reference number the corresponding node tags)

  • refByElement (a np.array giving at position i the reference number (int) for the element i in the mesh)

  • dictElemRefsToTags (a dictionnary giving for each reference number the corresponding element tags)