BasicTools.Containers.UnstructuredMeshCreationTools module

BasicTools.Containers.UnstructuredMeshCreationTools.CheckIntegrity(GUI=False)[source]
BasicTools.Containers.UnstructuredMeshCreationTools.CheckIntegrity_Create0DElementContainerForEveryPoint(GUI=False)[source]
BasicTools.Containers.UnstructuredMeshCreationTools.CheckIntegrity_CreateCube(GUI=False)[source]
BasicTools.Containers.UnstructuredMeshCreationTools.CheckIntegrity_CreateDisk(GUI=False)[source]
BasicTools.Containers.UnstructuredMeshCreationTools.CheckIntegrity_CreateMeshFromConstantRectilinearMesh(GUI=False)[source]
BasicTools.Containers.UnstructuredMeshCreationTools.CheckIntegrity_CreateMeshOfTriangles(GUI=False)[source]
BasicTools.Containers.UnstructuredMeshCreationTools.CheckIntegrity_CreateSquare(GUI=False)[source]
BasicTools.Containers.UnstructuredMeshCreationTools.CheckIntegrity_CreateUniformMeshOfBars(GUI=False)[source]
BasicTools.Containers.UnstructuredMeshCreationTools.CheckIntegrity_MirrorMesh(GUI=False)[source]
BasicTools.Containers.UnstructuredMeshCreationTools.CheckIntegrity_QuadToLin(GUI=False)[source]
BasicTools.Containers.UnstructuredMeshCreationTools.CheckIntegrity_SubDivideMesh(GUI=False)[source]
BasicTools.Containers.UnstructuredMeshCreationTools.CheckIntegrity_ToQuadraticMesh(GUI=False)[source]
BasicTools.Containers.UnstructuredMeshCreationTools.Create0DElementContainerForEveryPoint(mesh: UnstructuredMesh) ElementsContainer[source]

Create a ElementContainer with 0D elements based on the point of the mesh The user is responsible to put this ElementContainer back to a mesh (using merge for example) the Nodal tags are transferred to the new 0D elements the originalIds is constructed based on the nodes (range(nb Nodes))

Parameters:

mesh (UnstructuredMesh) – the input mesh

Returns:

An ElementsContainer with the new 0D elements

Return type:

ElementsContainer

BasicTools.Containers.UnstructuredMeshCreationTools.CreateCube(dimensions: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]] = [2, 2, 2], origin: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]] = [-1.0, -1.0, -1.0], spacing: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]] = [1.0, 1.0, 1.0], ofTetras: bool = False) UnstructuredMesh[source]

Create a UnstructuredMesh of a cube

Parameters:
  • dimensions (ArrayLike, optional) – Number of point in every direction, by default [2,2,2]

  • origin (ArrayLike, optional) – origin of the lowest point, by default [-1.0,-1.0,-1.0]

  • spacing (ArrayLike, optional) – size in the 3 direction of every element, by default [1.,1.,1.]

  • ofTetras (bool, optional) – if False: mesh of hexahedrons if True: mesh of tetrahedrons by default False

Returns:

A mesh of the cube

Return type:

UnstructuredMesh

BasicTools.Containers.UnstructuredMeshCreationTools.CreateDisk(nr: int64 = 10, nTheta: int64 = 10, r0: float64 = 0.5, r1: float64 = 1.0, theta0: float64 = 0, theta1: float64 = 1.5707963267948966) UnstructuredMesh[source]

Function to create a disk section

Parameters:
  • nr (PBasicIndexType, optional) – number of points in the radial direction, by default 10

  • nTheta (PBasicIndexType, optional) – number of point in the angular direction, by default 10

  • r0 (PBasicFloatType, optional) – internal radius, by default 0.5

  • r1 (PBasicFloatType, optional) – external radius, by default 1.

  • theta0 (PBasicFloatType, optional) – start angle, by default 0

  • theta1 (PBasicFloatType, optional) – end angle, by default np.pi/2

Returns:

An UnstructuredMesh of a disk sector

Return type:

UnstructuredMesh

BasicTools.Containers.UnstructuredMeshCreationTools.CreateMeshFromConstantRectilinearMesh(CRM: ConstantRectilinearMesh, ofSimplex: bool = False) UnstructuredMesh[source]

Function to convert a ConstantRectilinear mesh to a UnstructuredMesh

Parameters:
  • CRM (ConstantRectilinearMesh) – The input mesh

  • ofSimplex (bool, optional) – True to make simplex (tetras and triangles), by default False

Returns:

An UnstructuredMesh instance of the input mesh

Return type:

UnstructuredMesh

BasicTools.Containers.UnstructuredMeshCreationTools.CreateMeshOf(points: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]], connectivity: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]], elemName: str) UnstructuredMesh[source]

Helper function to create a mesh of homogeneous elements.

Parameters:
  • points (ArrayLike) – The positions of the point (nb Points,3)

  • connectivity (ArrayLike) – The connectivity of the elements (nb of elements, number of point per element)

  • elemName (str, optional) – the name of the elements to create. , by default None

Returns:

A instance of UnstructuredMesh with the given point and elements

Return type:

UnstructuredMesh

BasicTools.Containers.UnstructuredMeshCreationTools.CreateMeshOfTriangles(points: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]], triangles: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) UnstructuredMesh[source]

Helper function to create a Unstructured mesh using only points and the connectivity matrix for the triangles.

Parameters:
  • points (ArrayLike) – The positions of the point (nb Points,3)

  • triangles (ArrayLike) – The connectivity of the triangles (nb Triangles, 3)

Returns:

A instance of UnstructuredMesh with the triangles

Return type:

UnstructuredMesh

BasicTools.Containers.UnstructuredMeshCreationTools.CreateSquare(dimensions: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]] = [2, 2], origin: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]] = [-1.0, -1.0], spacing: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]] = [1.0, 1.0], ofTriangles: bool = False) UnstructuredMesh[source]

Create a mesh of a square

Parameters:
  • dimensions (ArrayLike, optional) – Number of points in every direction, by default [2,2]

  • origin (ArrayLike, optional) – origin of the mesh , by default [-1.0,-1.0]

  • spacing (ArrayLike, optional) – x and y size of every element, by default [1.,1.]

  • ofTriangles (bool, optional) – , by default False

Returns:

_description_

Return type:

UnstructuredMesh

BasicTools.Containers.UnstructuredMeshCreationTools.CreateUniformMeshOfBars(startPoint: Union[float64, _SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]], stopPoint: Union[float64, _SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]], nbPoints: int64 = 50, secondOrder: bool = False) UnstructuredMesh[source]

Create a uniform mesh of bars. In the case the starPoint and stopPoint are scalar the nodes of the mesh are 3D (with zeros for the other columns) The user can give a list with only one component to generate nodes with only 1 coordinate 0D elements are created at the start and stop points with tags “L”, “H” nodal tags are created at the start and stop points with tags “L”, “H”

Parameters:
  • startPoint (Union[PBasicFloatType,ArrayLike]) – Start point of the linear mesh

  • stopPoint (Union[PBasicFloatType,ArrayLike]) – Stop point of the linear mesh

  • nbPoints (PBasicIndexType, optional) – Number of point in the mesh, by default 50

  • secondOrder (bool, optional) – if true second order bars are generated. In this case the number of points (nbPoints) must be odd

Returns:

the mesh in UnstructuredMesh format

Return type:

UnstructuredMesh

Raises:

Exception – if the startPoint and stopPoint are not compatible

BasicTools.Containers.UnstructuredMeshCreationTools.MeshToSimplex(mesh: UnstructuredMesh) UnstructuredMesh[source]

(EXPERIMENTAL) Convert mesh to only tetrahedron/triangle/bars/points

Warning!!! This function is dangerous, we don’t check the compatibility at each interface between the elements.

Parameters:

mesh (UnstructuredMesh) – A mesh

Returns:

A mesh composed only by simplex

Return type:

UnstructuredMesh

BasicTools.Containers.UnstructuredMeshCreationTools.MirrorMesh(inmesh: UnstructuredMesh, x: Optional[float64] = None, y: Optional[float64] = None, z: Optional[float64] = None) UnstructuredMesh[source]

Compute a new symmetric mesh from the inmesh All inMesh element with be copied to the output The user is responsible to call RemoveDoubles to eliminate the possible double nodes on the symmetry plane

Parameters:
  • inmesh (UnstructuredMesh) – input mesh

  • x (Optional[PBasicFloatType], optional) – the position of the yz plane to build the symmetric part, if Non, no symmetry to the plane yz , by default None

  • y (Optional[PBasicFloatType], optional) – the position of the xz plane to build the symmetric part, if Non, no symmetry to the plane xz , by default None

  • z (Optional[PBasicFloatType], optional) – the position of the xy plane to build the symmetric part, if Non, no symmetry to the plane xy _description_, by default None

Returns:

the output mesh

Return type:

UnstructuredMesh

BasicTools.Containers.UnstructuredMeshCreationTools.QuadToLin(inputMesh: UnstructuredMesh, divideQuadElements: bool = True, linearizedMiddlePoints: bool = False) UnstructuredMesh[source]

Convert a quadratic mesh to a linear mesh

Parameters:
  • inputMesh (UnstructuredMesh) – the input mesh

  • divideQuadElements (bool, optional) – if the quadratic element must be divided, by default True

  • linearizedMiddlePoints (bool, optional) – if the middle point of the quadratic element must line in the segment forme by the extreme values , by default False

Returns:

a linear mesh

Return type:

UnstructuredMesh

BasicTools.Containers.UnstructuredMeshCreationTools.SubDivideMesh(mesh: UnstructuredMesh, level: int64 = 1) UnstructuredMesh[source]

Subdivide a mesh

Parameters:
  • mesh (UnstructuredMesh) – The input mesh

  • level (PBasicIndexType, optional) – Number of times the mesh must be divided, by default 1

Returns:

A new mesh divided level times

Return type:

UnstructuredMesh

BasicTools.Containers.UnstructuredMeshCreationTools.ToQuadraticMesh(inputMesh: UnstructuredMesh) UnstructuredMesh[source]

Function to convert any mesh to a quadratic mesh. Nodes fields and element fields are lost.

Parameters:

inputMesh (UnstructuredMesh) – the in put mesh

Returns:

A mesh composed only by quadratic elements

Return type:

UnstructuredMesh