cashocs.geometry.DeformationHandler#
- class cashocs.geometry.DeformationHandler(mesh: fenics.Mesh, a_priori_tester: mesh_testing.APrioriMeshTester, intersection_tester: mesh_testing.IntersectionTester)[source]#
Bases:
object
A class, which implements mesh deformations.
The deformations can be due to a deformation vector field or a (piecewise) update of the mesh coordinates.
Initializes self.
- Parameters:
mesh (fenics.Mesh) – The fenics mesh which is to be deformed.
a_priori_tester (mesh_testing.APrioriMeshTester) – The tester before mesh modification.
intersection_tester (mesh_testing.IntersectionTester) – The tester after mesh modification (for (self) intersections).
Methods Summary
assign_coordinates
(coordinates)Assigns coordinates to self.mesh.
coordinate_to_dof
(coordinate_deformation)Converts a coordinate deformation to a deformation vector field (dof based).
dof_to_coordinate
(dof_deformation)Converts a deformation vector field to a coordinate based deformation.
move_mesh
(transformation[, ...])Transforms the mesh by perturbation of identity.
Reverts the previous mesh transformation.
Methods Documentation
- assign_coordinates(coordinates: ndarray) bool [source]#
Assigns coordinates to self.mesh.
- Parameters:
coordinates (ndarray) – Array of mesh coordinates, which you want to assign.
- Returns:
True
if the assignment was possible,False
if not.- Return type:
bool
- coordinate_to_dof(coordinate_deformation: ndarray) fenics.Function [source]#
Converts a coordinate deformation to a deformation vector field (dof based).
- Parameters:
coordinate_deformation (ndarray) – The deformation for the mesh coordinates.
- Returns:
The deformation vector field.
- Return type:
fenics.Function
- dof_to_coordinate(dof_deformation: fenics.Function) ndarray [source]#
Converts a deformation vector field to a coordinate based deformation.
- Parameters:
dof_deformation (fenics.Function) – The deformation vector field.
- Returns:
The array which can be used to deform the mesh coordinates.
- Return type:
ndarray
- move_mesh(transformation: fenics.Function | np.ndarray, validated_a_priori: bool = False, test_for_intersections: bool = True) bool [source]#
Transforms the mesh by perturbation of identity.
Moves the mesh according to the deformation given by
\[\text{id} + \mathcal{V}(x),\]where \(\mathcal{V}\) is the transformation. This represents the perturbation of identity.
- Parameters:
transformation (fenics.Function | np.ndarray) – The transformation for the mesh, a vector CG1 Function.
validated_a_priori (bool) – A boolean flag, which indicates whether an a-priori check has already been performed before moving the mesh. Default is
False
test_for_intersections (bool) – A boolean flag which indicates whether an a-posteriori check for (self)-intersections of the mesh should be performed.
- Returns:
True
if the mesh movement was successful,False
otherwise.- Return type:
bool