BasicTools.Containers.MeshBase module

BasicTools.Containers.MeshBase.CheckIntegrity()[source]
class BasicTools.Containers.MeshBase.MeshBase[source]

Bases: BaseOutputObject

This is the base mesh of all the meshe classes in BasicTools

ComputeBoundingBox()[source]
CopyProperties(other)[source]
GenerateManufacturedOriginalIDs(offset: int = 0)[source]

function to generate a valid originalids for the nodes and the data

Parameters:

offset (int, optional) – offset to use to start counting nodes and elements. This is useful for code needing numbering stating from 1, by default 0

GetElementsDimensionality() int[source]

Return the maximal dimension of the elements

Returns:

the max of all elements dimensionality

Return type:

int

GetElementsOfType(typename: str)[source]

return the element container for the element name (typename)

Parameters:

typename (str) – the name of the elements to extract

Returns:

The Element Container for element

Return type:

ElementContainer

GetNamesOfElemTags() List[str][source]

return a list containing all the element tags present in the mesh

Returns:

the list of all the name of the element tags present in the mesh

Return type:

List[str]

GetNodalTag(tagName: str)[source]

return the Tag (instance of the class) with name tagName. If the tag does not exist a new is created

GetNumberOfNodes() int[source]

Return the number of nodes

Returns:

the number of nodes

Return type:

int

Raises:

NotImplemented – if not implemented in derived class

IsConstantRectilinear()[source]
IsRectilinear()[source]
IsStructured()[source]
IsUnstructured()[source]
PrepareForOutput()[source]
WithModification() ClosingMeshAutomatically[source]

Context manager to release all the extra memory of the mesh after modification. this context manager call mesh.PrepareForOutput() automatically at the end of the block

Example

with mesh.WithModification():

# mesh.PrepareForOutput() is called at the end of this block, # even if code in the block raises an exception

elemFields

This is a dictionary containing fields defined over the elements (all the elements). The keys are the names of the fields the values are the actual data of size (nb elements, nb of components)

nodeFields: Dict[str, ndarray]

This is a dictionary containing fields defined over the nodes (all the nodes). The keys are the names of the fields the values are the actual data of size (nb nodes, nb of components)

nodesTags

Tags for the nodes

props

Metadata this is just a dictionary that can be used to transport information with the mesh, please use the class name as key of the object using/setting the information