capytaine.meshes.symmetric module¶
Special meshes with symmetries, useful to speed up the computations.
- class capytaine.meshes.symmetric.AxialSymmetricMesh(mesh_slice: ~capytaine.meshes.meshes.Mesh | ~capytaine.meshes.collections.CollectionOfMeshes, axis: ~capytaine.meshes.geometry.Axis = Axis(vector=[0. 0. 1.], point=[0. 0. 0.]), nb_repetitions: int = 1, name=None)[source]¶
Bases:
SymmetricMesh
A mesh with a repeating pattern by rotation.
- Parameters:
mesh_slice (Mesh or CollectionOfMeshes) – the pattern that will be repeated to form the whole body
axis (Axis, optional) – symmetry axis
nb_repetitions (int, optional) – the number of repetitions of the pattern (excluding the original one, default: 1)
name (str, optional) – a name for the mesh
- property first_slice¶
- static from_profile(profile: ~typing.Callable | ~typing.Iterable[float], z_range: ~typing.Iterable[float] = array([-5. , -4.73684211, -4.47368421, -4.21052632, -3.94736842, -3.68421053, -3.42105263, -3.15789474, -2.89473684, -2.63157895, -2.36842105, -2.10526316, -1.84210526, -1.57894737, -1.31578947, -1.05263158, -0.78947368, -0.52631579, -0.26315789, 0. ]), axis: ~capytaine.meshes.geometry.Axis = Axis(vector=[0. 0. 1.], point=[0. 0. 0.]), nphi: int = 20, name=None)[source]¶
Return a floating body using the axial symmetry. The shape of the body can be defined either with a function defining the profile as [f(z), 0, z] for z in z_range. Alternatively, the profile can be defined as a list of points. The number of vertices along the vertical direction is len(z_range) in the first case and profile.shape[0] in the second case.
- Parameters:
profile (function(float → float) or array(N, 3)) – define the shape of the body either as a function or a list of points.
z_range (array(N), optional) – used only if the profile is defined as a function.
axis (Axis) – symmetry axis
nphi (int, optional) – number of vertical slices forming the body
name (str, optional) – name of the generated body (optional)
- Returns:
the generated mesh
- Return type:
- mirror(*args, inplace=True, name=None, **kwargs)¶
- rotate(*args, inplace=True, name=None, **kwargs)¶
- translate(*args, inplace=True, name=None, **kwargs)¶
- class capytaine.meshes.symmetric.ReflectionSymmetricMesh(half: Mesh | CollectionOfMeshes, plane: Plane, name=None)[source]¶
Bases:
SymmetricMesh
A mesh with one vertical symmetry plane.
- Parameters:
half (Mesh or CollectionOfMeshes) – a mesh describing half of the body
plane (Plane) – the symmetry plane across which the half body is mirrored
name (str, optional) – a name for the mesh
- property half¶
- mirror(*args, inplace=True, name=None, **kwargs)¶
- rotate(*args, inplace=True, name=None, **kwargs)¶
- translate(*args, inplace=True, name=None, **kwargs)¶
- class capytaine.meshes.symmetric.SymmetricMesh(meshes: Iterable[Mesh | CollectionOfMeshes], name=None)[source]¶
Bases:
CollectionOfMeshes
- class capytaine.meshes.symmetric.TranslationalSymmetricMesh(mesh_slice: Mesh | CollectionOfMeshes, translation, nb_repetitions=1, name=None)[source]¶
Bases:
SymmetricMesh
A mesh with a repeating pattern by translation.
- Parameters:
mesh_slice (Mesh or CollectionOfMeshes) – the pattern that will be repeated to form the whole body
translation (array(3)) – the vector of the translation
nb_repetitions (int, optional) – the number of repetitions of the pattern (excluding the original one, default: 1)
name (str, optional) – a name for the mesh
- property first_slice¶
- mirror(*args, inplace=True, name=None, **kwargs)¶
- rotate(*args, inplace=True, name=None, **kwargs)¶
- translate(*args, inplace=True, name=None, **kwargs)¶
- capytaine.meshes.symmetric.build_regular_array_of_meshes(base_mesh, distance, nb_bodies)[source]¶
Create an array of objects using TranslationalSymmetries.
- Parameters:
base_mesh (Mesh or CollectionOfMeshes or SymmetricMesh) – The mesh to duplicate to create the array
distance (float) – Center-to-center distance between objects in the array
nb_bodies (couple of ints) – Number of objects in the x and y directions.
- Return type: