capytaine.bodies.abstract_bodies module¶
Abstract base class for floating bodies.
- class capytaine.bodies.abstract_bodies.AbstractBody[source]¶
Bases:
ABCAbstract base class for FloatingBody and Multibody.
Defines the shared interface that both single bodies and collections of bodies must implement.
Subclasses must provide the following attributes (either as instance attributes set in __init__, or as properties/cached_properties): * name: str * mesh * lid_mesh * mesh_including_lid * hull_mask * dofs: dict * mass * center_of_mass
- add_dofs_labels_to_matrix(matrix)[source]¶
Helper function turning a bare matrix into a matrix labelled by the name of the dofs of the body, to be used for instance for the computation of RAO.
- add_dofs_labels_to_vector(vector)[source]¶
Helper function turning a bare vector into a vector labelled by the name of the dofs of the body, to be used for instance for the computation of RAO.
- abstractmethod clipped(*, origin, normal, name=None) AbstractBody[source]¶
- abstractmethod copy(name=None) AbstractBody[source]¶
- abstractmethod immersed_part(free_surface=0.0, *, sea_botton=None, water_depth=None, name=None) AbstractBody[source]¶
- abstractmethod mirrored(plane: Literal['xOz', 'yOz']) AbstractBody[source]¶
- name: str¶
- abstractmethod rotated_with_matrix(R, *, name=None) AbstractBody[source]¶
- rotated_x(angle: float, *, name=None) AbstractBody[source]¶
- rotated_y(angle: float, *, name=None) AbstractBody[source]¶
- rotated_z(angle: float, *, name=None) AbstractBody[source]¶
- show(*, backend=None, **kwargs)[source]¶
Visualize the mesh using the specified backend.
- Parameters:
backend (str, optional) – Visualization backend to use. Options are ‘pyvista’ or ‘matplotlib’. By default, try several until an installed one is found.
**kwargs – Additional keyword arguments passed to the visualization backend. See
visualization
- Returns:
Visualization object returned by the backend (e.g., matplotlib figure).
- Return type:
object
- Raises:
NotImplementedError – If the specified backend is not supported.
- show_matplotlib(**kwargs)[source]¶
Equivalent to show(backend=”matplotlib”). See also
show_matplotlib()
- show_pyvista(**kwargs)[source]¶
Equivalent to show(backend=”pyvista”). See also
show_pyvista()
- abstractmethod translated(shift, *, name=None) AbstractBody[source]¶
- translated_x(dx: float, *, name=None) AbstractBody[source]¶
- translated_y(dy: float, *, name=None) AbstractBody[source]¶
- translated_z(dz: float, *, name=None) AbstractBody[source]¶