BasicTools.Containers.UnstructuredMeshFieldOperations module
- BasicTools.Containers.UnstructuredMeshFieldOperations.ApplyRotationMatrixTensorField(fields: Dict, fieldsToTreat: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], baseNames: List = ['v1', 'v2'], inPlace: bool = False, prefix: str = 'new_', inverse: bool = False) Dict[source]
Apply a rotation operation on the fields
- Parameters:
fields (dict[ArrayLike]) – dictionary of field. Keys are names, values are data
fieldsToTreat (ArrayLike) – is a 3x3 list of list with the names of the fields to create the local tensor. For example [[“S00”,”S01”,”S02”][“S01”,”S11”,”S12”][“S02”,”S12”,”S22”]]
baseNames (List, optional) – the names of the fields to extract the direction (each field must be on size (nb entries, 3) ), by default [“v1”,”v2”]
inPlace (bool, optional) – True to put the output back to the field dictionary, by default False
prefix (str, optional) – prefix to prepend to the new field, by default “new_”
inverse (bool, optional) – True to apply the inverse transform, by default False
- Returns:
a dictionary containing the field after the rotation operation
- Return type:
dict
- BasicTools.Containers.UnstructuredMeshFieldOperations.CheckIntegrity1DSecondOrderTo2D(GUI=False)[source]
- BasicTools.Containers.UnstructuredMeshFieldOperations.CheckIntegrityApplyRotationMatrixTensorField(GUI=False)[source]
- BasicTools.Containers.UnstructuredMeshFieldOperations.CheckIntegrity_GetValueAtPosLinearSymplecticMesh(GUI=False)[source]
- BasicTools.Containers.UnstructuredMeshFieldOperations.CheckIntegrity_PointToCellData(GUI=False)[source]
- BasicTools.Containers.UnstructuredMeshFieldOperations.ComputeBarycentricCoordinateOnElement(coordAtDofs: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], localspace, targetPoint: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], elementType: str)[source]
Newton to compute the best baricentric coordinates on an element for the target point Warning!! This function is not intended for the final user. function used by (GetFieldTransferOp)
- Parameters:
coordAtDofs (ArrayLike) – Coordinates of the node of the element
localspace (_type_) – _description_
targetPoint (ArrayLike) – Target Point
elementType (str) – Element type
- Returns:
_description_
- Return type:
_type_
- BasicTools.Containers.UnstructuredMeshFieldOperations.ComputeInterpolationCoefficients(mask: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], TP: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], elementsdata, coordAtDofs: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], posspace, localspace)[source]
Compute the interpolation coefficients for the element. Warning!! This function is not intended for the final user. function used by (GetFieldTransferOp)
- BasicTools.Containers.UnstructuredMeshFieldOperations.ComputeInterpolationExtrapolationsBarycentricCoordinates(TP: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], elementType: str, coordAtDofs: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], posspace)[source]
Function to compute the interpolation extrapolation shape function for an element for the target point This function is not intended to be used by the final users
- Parameters:
TP (ArrayLike) – the target point
elementType (str) – the element type
coordAtDofs (_type_) – The coordinate in the real space for all the nodes of the element
posspace (_type_) – The space used to interpolate the position
- Returns:
True : if the target point is inside the element (None if error in the computation) numpy.ndarray : the distance vector between the best point using the barycentric coordinates and the target point numpy.ndarray : the closes barycentric coordinates of the target point using the shape function of the elements numpy.ndarray : the clamped barycentric coordinates of the target point using the shape function of the elements ()
- Return type:
tuple of len 4
- BasicTools.Containers.UnstructuredMeshFieldOperations.ComputeShapeFunctionsOnElement(coordAtDofs: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], localspace, localnumbering, point: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], faceElementType)[source]
- BasicTools.Containers.UnstructuredMeshFieldOperations.CopyFieldsFromOriginalMeshToTargetMesh(inMesh: UnstructuredMesh, outMesh: UnstructuredMesh)[source]
- Function to copy fields (nodeFields and elemFields) for the original mesh to the
derivated mesh ( f(inMesh) -> outMesh )
- Parameters:
inMesh (UnstructuredMesh) – the source mesh, we extract the fields from inMesh.nodeFields and inMesh.elemFields.
outMesh (UnstructuredMesh) – The target mesh, we push the new fields into outMesh.nodeFields and outMesh.elemFields.
- BasicTools.Containers.UnstructuredMeshFieldOperations.GetFieldTransferOp(inputField: FEField, targetPoints: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], method: str | None = None, verbose: bool = False, elementFilter: ElementFilter | None = None) Tuple[ndarray, ndarray][source]
- BasicTools.Containers.UnstructuredMeshFieldOperations.GetFieldTransferOpCpp(inputField: FEField, targetPoints: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], method: str | None = None, verbose: bool = False, elementFilter: ElementFilter | None = None) Tuple[ndarray, ndarray][source]
- BasicTools.Containers.UnstructuredMeshFieldOperations.GetFieldTransferOpPython(inputField: FEField, targetPoints: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], method: str | None = None, verbose: bool = False, elementFilter: ElementFilter | None = None) Tuple[ndarray, ndarray][source]
Compute the transfer operator from the inputField to the target points so: valueAtTargetPoints = op.dot(FEField.data)
possible methods are = [“Interp/Nearest”,”Nearest/Nearest”,”Interp/Clamp”,”Interp/Extrap”,”Interp/ZeroFill”] possible output status = {“Nearest”:0, “Interp”:1, “Extrap”:2, “Clamp”:3, “ZeroFill”:4 }
- Parameters:
inputField (FEField) – the FEField to be transferred
targetPoints (ArrayLike) – Numpy array of the target points. Position to extract the values
method (Union[str,None], optional) –
- A couple for the algorithm used when the point is inside the mesh :
”Interp” -> to use the interpolation of the FEField to extract the values “Nearest” -> to use the closest point to extract the values
- Possible options are:
”Interp/Nearest”, “Nearest/Nearest”, “Interp/Clamp”, “Interp/Extrap”, “Interp/ZeroFill”
If None is provided then “Interp/Clamp” is used
verbose (bool, optional) – Print a progress bar, by default False
elementFilter (Optional[ElementFilter], optional) – ElementFilter to extract the information from only a subdomain, by default None
- Returns:
- a tuple with 2 object containing:
op, sparse matrix with the operator to make the transfer status: vector of ints with the status transfer for each target point :
0: “Nearest” 1: “Interp” 2: “Extrap” 3: “Clamp” 4: “ZeroFill”
return op, status
- Return type:
Tuple [np.ndarray,np.ndarray]
- BasicTools.Containers.UnstructuredMeshFieldOperations.GetValueAtPosLinearSymplecticMesh(fields: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], mesh: UnstructuredMesh, constantRectilinearMesh: ConstantRectilinearMesh, verbose: bool = False) Tuple[source]
Transport point fields from a symplectic mesh into a ConstantRectilinearMesh
- Parameters:
fields (ArrayLike) – the nodes fields to be transported to the constantRectilinearMesh
mesh (UnstructuredMesh) – the support mesh for the fields
constantRectilinearMesh (ConstantRectilinearMesh) – the target mesh
verbose (bool, optional) – true to print extra output by default False
- Returns:
numpy array (output fields) with 3 or 4 dimension first dimension is the field number and the last 2/3 are the indexing in the constantRectilinearMesh (for 2D or 3D) numpy array (mask) mask with 1. if the point are inside the input mesh
- Return type:
tuple
- BasicTools.Containers.UnstructuredMeshFieldOperations.PointToCellData(mesh: UnstructuredMesh, pointfield: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], dim: int | None = None) ndarray[source]
Convert a point field to cell field. the cell values are compute the average of the values on the nodes for each element
- Parameters:
mesh (UnstructuredMesh) – mesh support of the field
pointfield (ArrayLike) – a field defined on the points
dim (int, optional) – dimensionality filter. if dim != the result array contain only values for the selected element ( len(result) is smaller than mesh.GetNumberOfElements() ) , by default None
- Returns:
a numpy array with the field on the elements
- Return type:
np.ndarray
- BasicTools.Containers.UnstructuredMeshFieldOperations.QuadFieldToLinField(quadMesh: UnstructuredMesh, quadField: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], linMesh: UnstructuredMesh | None = None) ndarray[source]
Extract the linear part of the field quadField.
- Parameters:
quadMesh (UnstructuredMesh) – the quadratic mesh supporting the quad field
quadField (ArrayLike) – the field to be converted to linear
linMesh (UnstructuredMesh, optional) – the support of the linear field, if None a linear convertion of the quadMesh is done (with QuandTolin), by default None
- Returns:
_description_
- Return type:
np.ndarray
- BasicTools.Containers.UnstructuredMeshFieldOperations.RunTransfer(inputFEField, data, outmesh)[source]
- BasicTools.Containers.UnstructuredMeshFieldOperations.TransportPos(imesh: UnstructuredMesh, tmesh: UnstructuredMesh, tspace, tnumbering, method: str = 'Interp/Clamp', verbose: bool | None = None) ndarray[source]
Function to transport the position from the input mesh (imesh) to a target FEField target mesh, target space, tnumbering
- Parameters:
imesh (UnstructuredMesh) – input mesh
tmesh (UnstructuredMesh) – target mesh
tspace (_type_) – target space
tnumbering (_type_) – target numbering
method (str, optional) – method for the interpolation/extrapolation, by default “Interp/Clamp”
verbose (bool, optional) – True to print more output during the computation of the transfer operator, by default None
- Returns:
a numpy.array with 3 FEField for each component of the position
- Return type:
np.ndarray
- BasicTools.Containers.UnstructuredMeshFieldOperations.TransportPosToPoints(imesh: UnstructuredMesh, points: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], method: str = 'Interp/Clamp', verbose: bool | None = None)[source]
For each point in points compute the position of the source data by tranporting the position field
- Parameters:
imesh (UnstructuredMesh) – the input mesh from where we
points (ArrayLike) – the target points
method (str, optional) – Transfer method, by default “Interp/Clamp”
verbose (bool, optional) – True to print more output during the computation of the transfer operator, by default None
- Returns:
for each point in points the position of the source data
- Return type:
np.array
- BasicTools.Containers.UnstructuredMeshFieldOperations.ddf(f, xiEtaPhi, dN, GetShapeFuncDerDer, coordAtDofs, linear)[source]
Warning!! This function is not intended for the final user. function used by (GetFieldTransferOp)
- BasicTools.Containers.UnstructuredMeshFieldOperations.df(f, dN, coordAtDofs)[source]
Warning!! This function is not intended for the final user. function used by (GetFieldTransferOp)
- BasicTools.Containers.UnstructuredMeshFieldOperations.hdinv(A: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) ndarray[source]
Compute the inverse of a 3x3 matrix Warning!! This function is not intended for the final user. function used by (GetFieldTransferOp)
- Parameters:
A (ArrayLike) – a 3x3 matrix
- Returns:
the inverse of A
- Return type:
np.ndarray
- BasicTools.Containers.UnstructuredMeshFieldOperations.inv22(A: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) ndarray[source]
Compute the inverse of a 2x2 matrix Warning!! This function is not intended for the final user. function used by (GetFieldTransferOp)
- Parameters:
A (ArrayLike) – a 2x2 matrix
- Returns:
the inverse of A
- Return type:
np.ndarray
- BasicTools.Containers.UnstructuredMeshFieldOperations.normsquared(v: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) number[source]
sqared norm of a vector
- Parameters:
v (ArrayLike) – a vector
- Returns:
the squared norm
- Return type:
np.number
- BasicTools.Containers.UnstructuredMeshFieldOperations.vdet(A: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) float64[source]
Compute the determinant of a 3x3 matrix Warning!! This function is not intended for the final user. function used by (GetFieldTransferOp)
- Parameters:
A (ArrayLike) – a 3x3 matrix
- Returns:
the determinant
- Return type:
PBasicFloatType