capytaine 2.3.1__cp314-cp314t-macosx_14_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. capytaine/.dylibs/libgcc_s.1.1.dylib +0 -0
  2. capytaine/.dylibs/libgfortran.5.dylib +0 -0
  3. capytaine/.dylibs/libquadmath.0.dylib +0 -0
  4. capytaine/__about__.py +16 -0
  5. capytaine/__init__.py +36 -0
  6. capytaine/bem/__init__.py +0 -0
  7. capytaine/bem/airy_waves.py +111 -0
  8. capytaine/bem/engines.py +441 -0
  9. capytaine/bem/problems_and_results.py +600 -0
  10. capytaine/bem/solver.py +594 -0
  11. capytaine/bodies/__init__.py +4 -0
  12. capytaine/bodies/bodies.py +1221 -0
  13. capytaine/bodies/dofs.py +19 -0
  14. capytaine/bodies/predefined/__init__.py +6 -0
  15. capytaine/bodies/predefined/cylinders.py +151 -0
  16. capytaine/bodies/predefined/rectangles.py +111 -0
  17. capytaine/bodies/predefined/spheres.py +70 -0
  18. capytaine/green_functions/FinGreen3D/.gitignore +1 -0
  19. capytaine/green_functions/FinGreen3D/FinGreen3D.f90 +3589 -0
  20. capytaine/green_functions/FinGreen3D/LICENSE +165 -0
  21. capytaine/green_functions/FinGreen3D/Makefile +16 -0
  22. capytaine/green_functions/FinGreen3D/README.md +24 -0
  23. capytaine/green_functions/FinGreen3D/test_program.f90 +39 -0
  24. capytaine/green_functions/LiangWuNoblesse/.gitignore +1 -0
  25. capytaine/green_functions/LiangWuNoblesse/LICENSE +504 -0
  26. capytaine/green_functions/LiangWuNoblesse/LiangWuNoblesseWaveTerm.f90 +751 -0
  27. capytaine/green_functions/LiangWuNoblesse/Makefile +16 -0
  28. capytaine/green_functions/LiangWuNoblesse/README.md +2 -0
  29. capytaine/green_functions/LiangWuNoblesse/test_program.f90 +28 -0
  30. capytaine/green_functions/__init__.py +2 -0
  31. capytaine/green_functions/abstract_green_function.py +64 -0
  32. capytaine/green_functions/delhommeau.py +507 -0
  33. capytaine/green_functions/hams.py +204 -0
  34. capytaine/green_functions/libs/Delhommeau_float32.cpython-314t-darwin.so +0 -0
  35. capytaine/green_functions/libs/Delhommeau_float64.cpython-314t-darwin.so +0 -0
  36. capytaine/green_functions/libs/__init__.py +0 -0
  37. capytaine/io/__init__.py +0 -0
  38. capytaine/io/bemio.py +153 -0
  39. capytaine/io/legacy.py +328 -0
  40. capytaine/io/mesh_loaders.py +1086 -0
  41. capytaine/io/mesh_writers.py +692 -0
  42. capytaine/io/meshio.py +38 -0
  43. capytaine/io/wamit.py +479 -0
  44. capytaine/io/xarray.py +668 -0
  45. capytaine/matrices/__init__.py +16 -0
  46. capytaine/matrices/block.py +592 -0
  47. capytaine/matrices/block_toeplitz.py +325 -0
  48. capytaine/matrices/builders.py +89 -0
  49. capytaine/matrices/linear_solvers.py +232 -0
  50. capytaine/matrices/low_rank.py +395 -0
  51. capytaine/meshes/__init__.py +6 -0
  52. capytaine/meshes/clipper.py +465 -0
  53. capytaine/meshes/collections.py +342 -0
  54. capytaine/meshes/geometry.py +409 -0
  55. capytaine/meshes/mesh_like_protocol.py +37 -0
  56. capytaine/meshes/meshes.py +890 -0
  57. capytaine/meshes/predefined/__init__.py +6 -0
  58. capytaine/meshes/predefined/cylinders.py +314 -0
  59. capytaine/meshes/predefined/rectangles.py +261 -0
  60. capytaine/meshes/predefined/spheres.py +62 -0
  61. capytaine/meshes/properties.py +276 -0
  62. capytaine/meshes/quadratures.py +80 -0
  63. capytaine/meshes/quality.py +448 -0
  64. capytaine/meshes/surface_integrals.py +63 -0
  65. capytaine/meshes/symmetric.py +462 -0
  66. capytaine/post_pro/__init__.py +6 -0
  67. capytaine/post_pro/free_surfaces.py +88 -0
  68. capytaine/post_pro/impedance.py +92 -0
  69. capytaine/post_pro/kochin.py +54 -0
  70. capytaine/post_pro/rao.py +60 -0
  71. capytaine/tools/__init__.py +0 -0
  72. capytaine/tools/cache_on_disk.py +26 -0
  73. capytaine/tools/deprecation_handling.py +18 -0
  74. capytaine/tools/lists_of_points.py +52 -0
  75. capytaine/tools/lru_cache.py +49 -0
  76. capytaine/tools/optional_imports.py +27 -0
  77. capytaine/tools/prony_decomposition.py +150 -0
  78. capytaine/tools/symbolic_multiplication.py +149 -0
  79. capytaine/tools/timer.py +66 -0
  80. capytaine/ui/__init__.py +0 -0
  81. capytaine/ui/cli.py +28 -0
  82. capytaine/ui/rich.py +5 -0
  83. capytaine/ui/vtk/__init__.py +3 -0
  84. capytaine/ui/vtk/animation.py +329 -0
  85. capytaine/ui/vtk/body_viewer.py +28 -0
  86. capytaine/ui/vtk/helpers.py +82 -0
  87. capytaine/ui/vtk/mesh_viewer.py +461 -0
  88. capytaine-2.3.1.dist-info/LICENSE +674 -0
  89. capytaine-2.3.1.dist-info/METADATA +750 -0
  90. capytaine-2.3.1.dist-info/RECORD +92 -0
  91. capytaine-2.3.1.dist-info/WHEEL +6 -0
  92. capytaine-2.3.1.dist-info/entry_points.txt +3 -0
@@ -0,0 +1,19 @@
1
+ # Copyright (C) 2017-2022 Matthieu Ancellin
2
+ # See LICENSE file at <https://github.com/capytaine/capytaine>
3
+
4
+
5
+ class RigidBodyDofsPlaceholder:
6
+ """Pass an instance of this class to the FloatingBody initializer to initialize the 6 ridig body dofs."""
7
+
8
+ def __init__(self, rotation_center=None):
9
+ self.rotation_center = rotation_center
10
+
11
+ def __str__(self):
12
+ return "RigidBodyDofsPlaceholder()"
13
+
14
+ def _repr_pretty_(self, p, cycle):
15
+ p.text(self.__str__())
16
+
17
+
18
+ def rigid_body_dofs(rotation_center=None):
19
+ return RigidBodyDofsPlaceholder(rotation_center=rotation_center)
@@ -0,0 +1,6 @@
1
+ # Copyright (C) 2017-2019 Matthieu Ancellin
2
+ # See LICENSE file at <https://github.com/mancellin/capytaine>
3
+
4
+ from capytaine.bodies.predefined.spheres import Sphere
5
+ from capytaine.bodies.predefined.cylinders import HorizontalCylinder, VerticalCylinder
6
+ from capytaine.bodies.predefined.rectangles import Rectangle, RectangularParallelepiped
@@ -0,0 +1,151 @@
1
+ """Legacy interfaces to predefined meshes"""
2
+ # Copyright (C) 2017-2022 Matthieu Ancellin
3
+ # See LICENSE file at <https://github.com/capytaine/capytaine>
4
+
5
+ import logging
6
+ import numpy as np
7
+
8
+ from capytaine.meshes.predefined import mesh_disk, mesh_vertical_cylinder, mesh_horizontal_cylinder
9
+ from capytaine.meshes.meshes import Mesh
10
+ from capytaine.bodies.bodies import FloatingBody
11
+
12
+ LOG = logging.getLogger(__name__)
13
+
14
+
15
+ ##########
16
+ # Disk #
17
+ ##########
18
+
19
+ class Disk(FloatingBody):
20
+ """(One-sided) disk.
21
+ Deprecated: please prefer capytaine.meshes.predefined.mesh_disk()
22
+
23
+ Parameters
24
+ ----------
25
+ radius : float, optional
26
+ radius of the disk
27
+ resolution : 2-ple of int, optional
28
+ number of panels along a radius and around the disk
29
+ center : 3-ple or array of shape (3,), optional
30
+ position of the geometric center of the disk
31
+ normal: 3-ple of floats, optional
32
+ normal vector, default: along x axis
33
+ axial_symmetry : bool, optional
34
+ if True, use the axial symmetry to speed up the computations
35
+ reflection_symmetry : bool, optional
36
+ if True, use the reflection symmetry to speed up the computations
37
+ name : str, optional
38
+ a string naming the floating body
39
+ """
40
+
41
+ def __init__(self, radius=1.0, resolution=(3, 5),
42
+ center=(0, 0, 0), normal=(1, 0, 0),
43
+ reflection_symmetry=False, axial_symmetry=False,
44
+ name=None):
45
+ LOG.warning("Deprecation warning: The class Disk() is deprecated. "
46
+ "Please prefer the function capytaine.meshes.predefined.mesh_disk()")
47
+
48
+ if name is None:
49
+ name = f"disk_{next(Mesh._ids)}"
50
+
51
+ self.radius = float(radius)
52
+ self.geometric_center = np.asarray(center, dtype=float)
53
+ mesh = mesh_disk(radius=radius, center=center, normal=normal, resolution=resolution,
54
+ reflection_symmetry=reflection_symmetry, axial_symmetry=axial_symmetry, name=f"{name}_mesh")
55
+ FloatingBody.__init__(self, mesh=mesh, name=name)
56
+
57
+
58
+ ##############
59
+ # Cylinder #
60
+ ##############
61
+
62
+ class HorizontalCylinder(FloatingBody):
63
+ """Horizontal cylinder
64
+ Deprecated: please prefer capytaine.meshes.predefined.mesh_horizontal_cylinder()
65
+
66
+ Parameters
67
+ ----------
68
+ length : float, optional
69
+ length of the cylinder
70
+ radius : float, optional
71
+ radius of the cylinder
72
+ center : 3-ple or array of shape (3,), optional
73
+ position of the geometric center of the cylinder
74
+ nx : int, optional
75
+ number of circular slices
76
+ ntheta : int, optional
77
+ number of panels along a circular slice of the cylinder
78
+ nr : int, optional
79
+ number of panels along a radius on the extremities of the cylinder
80
+ reflection_symmetry : bool, optional
81
+ if True, returns a ReflectionSymmetricMesh
82
+ translation_symmetry : bool, optional
83
+ if True, uses a TranslationalSymmetricMesh internally for the main part of the cylinder
84
+ name : str, optional
85
+ a string naming the floating body
86
+ """
87
+
88
+ def __init__(self, length=10.0, radius=1.0, center=(0, 0, 0),
89
+ nx=10, ntheta=10, nr=2,
90
+ reflection_symmetry=True, translation_symmetry=False,
91
+ clever=None,
92
+ name=None):
93
+
94
+ LOG.warning("Deprecation warning: The class HorizontalCylinder() is deprecated. "
95
+ "Please prefer the function capytaine.meshes.predefined.mesh_horizontal_cylinder()")
96
+
97
+ self.length = length
98
+ self.radius = radius
99
+ self.geometric_center = np.asarray(center, dtype=float)
100
+
101
+ if name is None:
102
+ name = f"cylinder_{next(Mesh._ids)}"
103
+
104
+ mesh = mesh_horizontal_cylinder(length=length, radius=radius, center=center,
105
+ resolution=(nr, ntheta, nx), reflection_symmetry=reflection_symmetry,
106
+ translation_symmetry=translation_symmetry, name=f"{name}_mesh")
107
+ FloatingBody.__init__(self, mesh=mesh, name=name)
108
+
109
+
110
+ class VerticalCylinder(FloatingBody):
111
+ """Vertical cylinder.
112
+ Deprecated: please prefer capytaine.meshes.predefined.mesh_vertical_cylinder()
113
+
114
+ Parameters
115
+ ----------
116
+ length : float, optional
117
+ length of the cylinder
118
+ radius : float, optional
119
+ radius of the cylinder
120
+ center : 3-ple or array of shape (3,), optional
121
+ position of the geometric center of the cylinder
122
+ nx : int, optional
123
+ number of circular slices
124
+ ntheta : int, optional
125
+ number of panels along a circular slice of the cylinder
126
+ nr : int, optional
127
+ number of panels along a radius on the extremities of the cylinder
128
+ clever : bool, optional
129
+ if True, uses the mesh symmetries
130
+ name : str, optional
131
+ a string naming the floating body
132
+ """
133
+
134
+ def __init__(self, length=10.0, radius=1.0, center=(0, 0, 0),
135
+ nx=10, ntheta=10, nr=2,
136
+ clever=True, name=None):
137
+ LOG.warning("Deprecation warning: The class VerticalCylinder() is deprecated. "
138
+ "Please prefer the function capytaine.meshes.predefined.mesh_vertical_cylinder()")
139
+
140
+ self.length = length
141
+ self.radius = radius
142
+ self.geometric_center = np.asarray(center, dtype=float)
143
+
144
+ if name is None:
145
+ name = f"cylinder_{next(Mesh._ids)}"
146
+
147
+ mesh = mesh_vertical_cylinder(length=length, radius=radius, center=center,
148
+ resolution=(nr, ntheta, nx), reflection_symmetry=False,
149
+ axial_symmetry=clever, name=f"{name}_mesh")
150
+
151
+ FloatingBody.__init__(self, mesh=mesh, name=name)
@@ -0,0 +1,111 @@
1
+ """Legacy interfaces to predefined meshes"""
2
+ # Copyright (C) 2017-2022 Matthieu Ancellin
3
+ # See LICENSE file at <https://github.com/capytaine/capytaine>
4
+
5
+ import logging
6
+ import numpy as np
7
+
8
+ from capytaine.meshes.predefined import mesh_rectangle, mesh_parallelepiped
9
+ from capytaine.meshes.meshes import Mesh
10
+ from capytaine.bodies.bodies import FloatingBody
11
+
12
+ LOG = logging.getLogger(__name__)
13
+
14
+
15
+ class Rectangle(FloatingBody):
16
+ """One-sided vertical rectangle (along y and z).
17
+
18
+ By default, the normals are oriented in the positive y direction.
19
+
20
+ Parameters
21
+ ----------
22
+ size : couple of floats, optional
23
+ dimensions of the rectangle (width and height)
24
+ resolution : couple of ints, optional
25
+ number of faces along each of the two directions
26
+ center : 3-ple of floats, optional
27
+ position of the geometric center of the rectangle, default: (0, 0, 0)
28
+ normal: 3-ple of floats, optional
29
+ normal vector, default: along x axis
30
+ translational_symmetry : bool, optional
31
+ if True, use the translation symmetry to speed up the computations
32
+ reflection_symmetry : bool, optional
33
+ if True, use the reflection symmetry to speed up the computations
34
+ name : string, optional
35
+ a name for the body
36
+ """
37
+
38
+ def __init__(self, size=(5.0, 5.0), resolution=(5, 5),
39
+ center=(0, 0, 0), normal=(1, 0, 0),
40
+ translational_symmetry=False, reflection_symmetry=False, name=None):
41
+
42
+ LOG.warning("Deprecation warning: The class Rectangle() is deprecated. "
43
+ "Please prefer the function capytaine.meshes.predefined.mesh_rectangle()")
44
+
45
+ self.size = np.asarray(size, dtype=float)
46
+ self.geometric_center = np.asarray(center, dtype=float)
47
+
48
+ if name is None:
49
+ name = f"rectangle_{next(Mesh._ids)}"
50
+
51
+ mesh = mesh_rectangle(size=size, resolution=resolution, center=center, normal=normal,
52
+ translation_symmetry=translational_symmetry, reflection_symmetry=reflection_symmetry,
53
+ name=f"{name}_mesh")
54
+ FloatingBody.__init__(self, mesh=mesh, name=name)
55
+
56
+
57
+ class RectangularParallelepiped(FloatingBody):
58
+ """Six rectangles forming a parallelepiped.
59
+
60
+ Parameters
61
+ ----------
62
+ size : 3-ple of floats, optional
63
+ dimensions of the parallelepiped (width, thickness, height) for coordinates (x, y, z).
64
+ resolution : 3-ple of ints, optional
65
+ number of faces along the three directions
66
+ center : 3-ple of floats, optional
67
+ coordinates of the geometric center of the parallelepiped
68
+ top: bool, optional
69
+ whether or not to close the parallelepiped on the top
70
+ bottom: bool, optional
71
+ whether or not to close the parallelepiped on the bottom
72
+ reflection_symmetry : bool, optional
73
+ use xOz and yOz symmetry plane to generate the mesh
74
+ translational_symmetry : bool, optional
75
+ if True, use the translation symmetry in the x direction to speed up the computations.
76
+ To use the translation symmetry in the y direction, create a x-symmetric body and then rotate it by pi/2.
77
+ name : string, optional
78
+ a name for the body
79
+ """
80
+
81
+ def __init__(self,
82
+ size=(1.0, 1.0, 1.0), resolution=(4, 4, 4),
83
+ center=(0, 0, 0),
84
+ top=True, bottom=True,
85
+ reflection_symmetry=False,
86
+ translational_symmetry=False,
87
+ name=None):
88
+
89
+ LOG.warning("Deprecation warning: The class RectangularParallelepiped() is deprecated. "
90
+ "Please prefer the function capytaine.meshes.predefined.mesh_parallelepiped()")
91
+
92
+ if name is None:
93
+ name = f"rectangular_parallelepiped_{next(Mesh._ids)}"
94
+
95
+ missing_sides = set()
96
+ if not top: missing_sides.add("top")
97
+ if not bottom: missing_sides.add("bottom")
98
+
99
+ mesh = mesh_parallelepiped(size=size, resolution=resolution, center=center,
100
+ missing_sides=missing_sides,
101
+ translation_symmetry=translational_symmetry, reflection_symmetry=reflection_symmetry,
102
+ name=f"{name}_mesh")
103
+
104
+ self.geometric_center = np.asarray(center, dtype=float)
105
+
106
+ FloatingBody.__init__(self, mesh=mesh, name=name)
107
+
108
+ class OpenRectangularParallelepiped(RectangularParallelepiped):
109
+ def __init__(self, *args, **kwargs):
110
+ RectangularParallelepiped.__init__(self, top=False, bottom=False, *args, **kwargs)
111
+ # Kept mostly for legacy
@@ -0,0 +1,70 @@
1
+ """Generate spherical bodies."""
2
+ # Copyright (C) 2017-2022 Matthieu Ancellin
3
+ # See LICENSE file at <https://github.com/capytaine/capytaine>
4
+
5
+ import logging
6
+
7
+ import numpy as np
8
+
9
+ from capytaine.meshes import Mesh
10
+ from capytaine.meshes.predefined import mesh_sphere
11
+ from capytaine.bodies.bodies import FloatingBody
12
+
13
+ LOG = logging.getLogger(__name__)
14
+
15
+
16
+ class Sphere(FloatingBody):
17
+ """Sphere
18
+ Deprecated: please prefer capytaine.meshes.predefined.mesh_sphere()
19
+
20
+ Parameters
21
+ ----------
22
+ radius : float
23
+ radius of the sphere
24
+ center : 3-ple or array of shape (3,)
25
+ position of the geometric center of the sphere
26
+ ntheta : int
27
+ number of panels along a meridian (or number of parallels-1)
28
+ nphi : int
29
+ number of panels along a parallel (or number of meridians-1)
30
+ axial_symmetry : bool
31
+ if True, use the axial symmetry to build the mesh (default: True)
32
+ clip_free_surface : bool
33
+ if True, only mesh the part of the sphere where z < 0 (default: False),
34
+ can be used with center to obtain any clipped sphere,
35
+ if True, then ntheta is the number of parallel below the free surface.
36
+ name : string
37
+ a name identifying the sphere (default: "sphere_id" where id is an unique integer).
38
+ """
39
+
40
+ def __init__(self, *, radius=1.0, center=(0, 0, 0),
41
+ ntheta=10, nphi=10, clip_free_surface=False,
42
+ axial_symmetry=True, clever=None,
43
+ name=None):
44
+
45
+ LOG.warning("Deprecation warning: The class Sphere() is deprecated. "
46
+ "Please prefer the function capytaine.meshes.predefined.mesh_sphere()")
47
+
48
+ if clever is not None:
49
+ LOG.warning("Deprecation warning: `clever` argument for Sphere is deprecated. "
50
+ "Use `axial_symmetry` instead.")
51
+
52
+ if name is None:
53
+ name = f"sphere_{next(Mesh._ids)}"
54
+
55
+ if clip_free_surface:
56
+ if center[2] < -radius: # fully immersed
57
+ pass
58
+ elif center[2] < radius:
59
+ ntheta = int(ntheta*np.pi/np.arccos(center[2]/radius))
60
+ else:
61
+ raise ValueError("Impossible to mesh the immersed hull of a sphere completely out of the water")
62
+
63
+ mesh = mesh_sphere(radius=radius, center=center, resolution=(ntheta, nphi), axial_symmetry=axial_symmetry, name=f"{name}_mesh")
64
+
65
+ if clip_free_surface:
66
+ mesh.keep_immersed_part()
67
+
68
+ self.radius = radius
69
+ self.geometric_center = np.array(center, dtype=float)
70
+ FloatingBody.__init__(self, mesh=mesh, name=name)
@@ -0,0 +1 @@
1
+ build/