capytaine 2.3.1__cp39-cp39-macosx_14_0_arm64.whl → 3.0.0a1__cp39-cp39-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.
- capytaine/__about__.py +7 -2
- capytaine/__init__.py +8 -12
- capytaine/bem/engines.py +234 -354
- capytaine/bem/problems_and_results.py +14 -13
- capytaine/bem/solver.py +204 -80
- capytaine/bodies/bodies.py +278 -869
- capytaine/bodies/dofs.py +136 -9
- capytaine/bodies/hydrostatics.py +540 -0
- capytaine/bodies/multibodies.py +216 -0
- capytaine/green_functions/{libs/Delhommeau_float32.cpython-39-darwin.so → Delhommeau_float32.cpython-39-darwin.so} +0 -0
- capytaine/green_functions/{libs/Delhommeau_float64.cpython-39-darwin.so → Delhommeau_float64.cpython-39-darwin.so} +0 -0
- capytaine/green_functions/abstract_green_function.py +2 -2
- capytaine/green_functions/delhommeau.py +31 -16
- capytaine/green_functions/hams.py +19 -13
- capytaine/io/legacy.py +3 -103
- capytaine/io/xarray.py +11 -6
- capytaine/meshes/__init__.py +2 -6
- capytaine/meshes/abstract_meshes.py +375 -0
- capytaine/meshes/clean.py +302 -0
- capytaine/meshes/clip.py +347 -0
- capytaine/meshes/export.py +89 -0
- capytaine/meshes/geometry.py +244 -394
- capytaine/meshes/io.py +433 -0
- capytaine/meshes/meshes.py +617 -681
- capytaine/meshes/predefined/cylinders.py +22 -56
- capytaine/meshes/predefined/rectangles.py +26 -85
- capytaine/meshes/predefined/spheres.py +4 -11
- capytaine/meshes/quality.py +118 -407
- capytaine/meshes/surface_integrals.py +48 -29
- capytaine/meshes/symmetric_meshes.py +641 -0
- capytaine/meshes/visualization.py +353 -0
- capytaine/post_pro/free_surfaces.py +1 -4
- capytaine/post_pro/kochin.py +10 -10
- capytaine/tools/block_circulant_matrices.py +275 -0
- capytaine/tools/lists_of_points.py +2 -2
- capytaine/tools/memory_monitor.py +45 -0
- capytaine/tools/symbolic_multiplication.py +13 -1
- capytaine/tools/timer.py +58 -34
- {capytaine-2.3.1.dist-info → capytaine-3.0.0a1.dist-info}/METADATA +7 -2
- capytaine-3.0.0a1.dist-info/RECORD +65 -0
- capytaine/bodies/predefined/__init__.py +0 -6
- capytaine/bodies/predefined/cylinders.py +0 -151
- capytaine/bodies/predefined/rectangles.py +0 -111
- capytaine/bodies/predefined/spheres.py +0 -70
- capytaine/green_functions/FinGreen3D/.gitignore +0 -1
- capytaine/green_functions/FinGreen3D/FinGreen3D.f90 +0 -3589
- capytaine/green_functions/FinGreen3D/LICENSE +0 -165
- capytaine/green_functions/FinGreen3D/Makefile +0 -16
- capytaine/green_functions/FinGreen3D/README.md +0 -24
- capytaine/green_functions/FinGreen3D/test_program.f90 +0 -39
- capytaine/green_functions/LiangWuNoblesse/.gitignore +0 -1
- capytaine/green_functions/LiangWuNoblesse/LICENSE +0 -504
- capytaine/green_functions/LiangWuNoblesse/LiangWuNoblesseWaveTerm.f90 +0 -751
- capytaine/green_functions/LiangWuNoblesse/Makefile +0 -16
- capytaine/green_functions/LiangWuNoblesse/README.md +0 -2
- capytaine/green_functions/LiangWuNoblesse/test_program.f90 +0 -28
- capytaine/green_functions/libs/__init__.py +0 -0
- capytaine/io/mesh_loaders.py +0 -1086
- capytaine/io/mesh_writers.py +0 -692
- capytaine/io/meshio.py +0 -38
- capytaine/matrices/__init__.py +0 -16
- capytaine/matrices/block.py +0 -592
- capytaine/matrices/block_toeplitz.py +0 -325
- capytaine/matrices/builders.py +0 -89
- capytaine/matrices/linear_solvers.py +0 -232
- capytaine/matrices/low_rank.py +0 -395
- capytaine/meshes/clipper.py +0 -465
- capytaine/meshes/collections.py +0 -342
- capytaine/meshes/mesh_like_protocol.py +0 -37
- capytaine/meshes/properties.py +0 -276
- capytaine/meshes/quadratures.py +0 -80
- capytaine/meshes/symmetric.py +0 -462
- capytaine/tools/lru_cache.py +0 -49
- capytaine/ui/vtk/__init__.py +0 -3
- capytaine/ui/vtk/animation.py +0 -329
- capytaine/ui/vtk/body_viewer.py +0 -28
- capytaine/ui/vtk/helpers.py +0 -82
- capytaine/ui/vtk/mesh_viewer.py +0 -461
- capytaine-2.3.1.dist-info/RECORD +0 -92
- {capytaine-2.3.1.dist-info → capytaine-3.0.0a1.dist-info}/LICENSE +0 -0
- {capytaine-2.3.1.dist-info → capytaine-3.0.0a1.dist-info}/WHEEL +0 -0
- {capytaine-2.3.1.dist-info → capytaine-3.0.0a1.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import time
|
|
3
|
+
from threading import Thread
|
|
4
|
+
|
|
5
|
+
from capytaine.tools.optional_imports import silently_import_optional_dependency
|
|
6
|
+
|
|
7
|
+
LOG = logging.getLogger(__name__)
|
|
8
|
+
|
|
9
|
+
class MemoryMonitor(Thread):
|
|
10
|
+
"""Monitor the memory usage in a separate thread.
|
|
11
|
+
from : https://joblib.readthedocs.io/en/stable/auto_examples/parallel_generator.html#sphx-glr-auto-examples-parallel-generator-py
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __init__(self):
|
|
15
|
+
super().__init__()
|
|
16
|
+
self.stop = False
|
|
17
|
+
self.memory_buffer = [0]
|
|
18
|
+
self.psutil = silently_import_optional_dependency("psutil")
|
|
19
|
+
self.start()
|
|
20
|
+
|
|
21
|
+
def get_memory(self):
|
|
22
|
+
"Get memory of a process and its children."
|
|
23
|
+
p = self.psutil.Process()
|
|
24
|
+
memory = p.memory_info().rss
|
|
25
|
+
for c in p.children():
|
|
26
|
+
try:
|
|
27
|
+
memory += c.memory_info().rss
|
|
28
|
+
except self.psutil.NoSuchProcess:
|
|
29
|
+
pass
|
|
30
|
+
return memory
|
|
31
|
+
|
|
32
|
+
def run(self):
|
|
33
|
+
if self.psutil is not None:
|
|
34
|
+
memory_start = self.get_memory()
|
|
35
|
+
while not self.stop:
|
|
36
|
+
self.memory_buffer.append(self.get_memory() - memory_start)
|
|
37
|
+
time.sleep(0.2)
|
|
38
|
+
|
|
39
|
+
def get_memory_peak(self):
|
|
40
|
+
self.stop = True
|
|
41
|
+
super().join()
|
|
42
|
+
if self.psutil is None:
|
|
43
|
+
return None
|
|
44
|
+
else:
|
|
45
|
+
return round(max(self.memory_buffer) / 1e9, 2)
|
|
@@ -24,11 +24,23 @@ class SymbolicMultiplication:
|
|
|
24
24
|
__array_priority__ = 1.0
|
|
25
25
|
|
|
26
26
|
def __array_function__(self, func, types, *args, **kwargs):
|
|
27
|
-
|
|
27
|
+
actual_args = args[0] # args = (actual_args, kwargs) for some reason
|
|
28
|
+
if func in {np.real, np.imag, np.sum} and len(actual_args) == 1 and len(kwargs) == 0:
|
|
28
29
|
return SymbolicMultiplication(self.symbol, func(self.value))
|
|
30
|
+
elif (
|
|
31
|
+
func in {np.einsum} and
|
|
32
|
+
len([a for a in actual_args if isinstance(a, SymbolicMultiplication)]) == 1 and
|
|
33
|
+
"out" not in kwargs
|
|
34
|
+
):
|
|
35
|
+
# Einsum with one of the array being wrapped in SymbolicMultiplication
|
|
36
|
+
unwrapped = [a.value if isinstance(a, SymbolicMultiplication) else a for a in actual_args]
|
|
37
|
+
return SymbolicMultiplication(self.symbol, func(*unwrapped, **kwargs))
|
|
29
38
|
else:
|
|
30
39
|
return NotImplemented
|
|
31
40
|
|
|
41
|
+
def astype(self, proper_type):
|
|
42
|
+
return SymbolicMultiplication(self.symbol, proper_type(self.value))
|
|
43
|
+
|
|
32
44
|
def __str__(self):
|
|
33
45
|
return f"{self.symbol}×{self.value}"
|
|
34
46
|
|
capytaine/tools/timer.py
CHANGED
|
@@ -2,21 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
from functools import wraps
|
|
4
4
|
import time
|
|
5
|
+
import contextlib
|
|
6
|
+
|
|
7
|
+
import pandas as pd
|
|
5
8
|
|
|
6
9
|
class Timer:
|
|
7
|
-
"""A
|
|
10
|
+
"""A timer class that can be used as context manager or as decorator using `wraps_function` method.
|
|
11
|
+
Several timing measurement can be nested.
|
|
12
|
+
|
|
13
|
+
Attributes
|
|
14
|
+
----------
|
|
15
|
+
timings: List[Dict]]
|
|
16
|
+
List of records of each timing measurement.
|
|
17
|
+
The record is a dict with a 'timing' key and any number of other metadata keys.
|
|
18
|
+
default_tags: Optional[Dict]
|
|
19
|
+
Tags added to all the timing measurements.
|
|
20
|
+
_start_times: List[float]
|
|
21
|
+
Start times of the ongoing timing measurements.
|
|
8
22
|
|
|
9
23
|
Example
|
|
10
24
|
-------
|
|
11
25
|
::
|
|
26
|
+
from time import sleep # For testing
|
|
12
27
|
|
|
13
28
|
timer = Timer()
|
|
14
|
-
|
|
29
|
+
|
|
30
|
+
with timer(tag="run 1"):
|
|
15
31
|
sleep(1.0)
|
|
16
32
|
|
|
17
33
|
print(timer.total) # 1.0...
|
|
18
34
|
|
|
19
|
-
@timer.wraps_function
|
|
35
|
+
@timer.wraps_function(tag="run function")
|
|
20
36
|
def my_function():
|
|
21
37
|
sleep(0.5)
|
|
22
38
|
|
|
@@ -25,42 +41,50 @@ class Timer:
|
|
|
25
41
|
my_function()
|
|
26
42
|
print(timer.total) # 2.0...
|
|
27
43
|
|
|
28
|
-
|
|
44
|
+
with timer(tag="outer"):
|
|
45
|
+
sleep(0.3)
|
|
46
|
+
with timer(tag="inner"):
|
|
47
|
+
sleep(0.3)
|
|
48
|
+
sleep(0.3)
|
|
29
49
|
"""
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
50
|
+
def __init__(self, *, default_tags=None):
|
|
51
|
+
self.timings = []
|
|
52
|
+
if default_tags is None:
|
|
53
|
+
default_tags = {}
|
|
54
|
+
self.default_tags = default_tags
|
|
55
|
+
self._start_times = [] # Starting time of ongoing sub-timers
|
|
36
56
|
|
|
37
57
|
def __repr__(self):
|
|
38
58
|
return f"Timer({self.timings})"
|
|
39
59
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
60
|
+
def add_data_from_other_timer(self, other, **supplementary_tags):
|
|
61
|
+
self.timings.extend([{**t, **supplementary_tags} for t in other.timings])
|
|
62
|
+
|
|
63
|
+
@contextlib.contextmanager
|
|
64
|
+
def __call__(self, **tags):
|
|
65
|
+
self._start_times.append(time.perf_counter())
|
|
66
|
+
try:
|
|
67
|
+
yield
|
|
68
|
+
finally:
|
|
69
|
+
timing = time.perf_counter() - self._start_times.pop()
|
|
70
|
+
self.timings.append({'timing': timing, **tags, **self.default_tags})
|
|
71
|
+
|
|
72
|
+
def wraps_function(self, **tags):
|
|
73
|
+
def wrapper(f):
|
|
74
|
+
@wraps(f)
|
|
75
|
+
def wrapped_f(*args, **kwargs):
|
|
76
|
+
with self(**tags):
|
|
77
|
+
out = f(*args, **kwargs)
|
|
78
|
+
return out
|
|
79
|
+
return wrapped_f
|
|
80
|
+
return wrapper
|
|
81
|
+
|
|
82
|
+
def as_dataframe(self):
|
|
83
|
+
if len(self.timings) == 0:
|
|
84
|
+
return pd.DataFrame([{'timing': 0.0}])
|
|
85
|
+
else:
|
|
86
|
+
return pd.DataFrame(self.timings)
|
|
43
87
|
|
|
44
88
|
@property
|
|
45
89
|
def total(self):
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
@property
|
|
49
|
-
def mean(self):
|
|
50
|
-
if self.nb_timings == 0:
|
|
51
|
-
return float('nan')
|
|
52
|
-
else:
|
|
53
|
-
return self.total/self.nb_timings
|
|
54
|
-
|
|
55
|
-
def __enter__(self):
|
|
56
|
-
self.start_time = time.perf_counter()
|
|
57
|
-
|
|
58
|
-
def __exit__(self, *exc):
|
|
59
|
-
self.timings.append(time.perf_counter() - self.start_time)
|
|
60
|
-
|
|
61
|
-
def wraps_function(self, f):
|
|
62
|
-
@wraps(f)
|
|
63
|
-
def wrapped_f(*args, **kwargs):
|
|
64
|
-
with self:
|
|
65
|
-
return f(*args, **kwargs)
|
|
66
|
-
return wrapped_f
|
|
90
|
+
return self.as_dataframe()['timing'].sum()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: capytaine
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0a1
|
|
4
4
|
Summary: Python BEM solver for linear potential flow, based on Nemoh
|
|
5
5
|
Author-Email: Matthieu Ancellin <matthieu.ancellin@mews-labs.com>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
@@ -694,10 +694,15 @@ Requires-Dist: xarray
|
|
|
694
694
|
Requires-Dist: rich
|
|
695
695
|
Provides-Extra: optional
|
|
696
696
|
Requires-Dist: matplotlib; extra == "optional"
|
|
697
|
+
Requires-Dist: vtk; extra == "optional"
|
|
698
|
+
Requires-Dist: pyvista; extra == "optional"
|
|
699
|
+
Requires-Dist: psutil; extra == "optional"
|
|
697
700
|
Requires-Dist: joblib>=1.3; extra == "optional"
|
|
701
|
+
Requires-Dist: threadpoolctl; extra == "optional"
|
|
698
702
|
Requires-Dist: meshio; extra == "optional"
|
|
703
|
+
Requires-Dist: trimesh; extra == "optional"
|
|
704
|
+
Requires-Dist: h5py; extra == "optional"
|
|
699
705
|
Requires-Dist: netcdf4; extra == "optional"
|
|
700
|
-
Requires-Dist: vtk; extra == "optional"
|
|
701
706
|
Description-Content-Type: text/markdown
|
|
702
707
|
|
|
703
708
|
# Capytaine: a linear potential flow BEM solver with Python.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
capytaine/__init__.py,sha256=fdEfZXF2pwTyT-VFiscWbiF_6fGpzyr5_o4P7tYasaY,1388
|
|
2
|
+
capytaine/__about__.py,sha256=bgxawhvlGsp8EpxmhlJ_ywUs9FSVl623qCo2GQAgj58,510
|
|
3
|
+
capytaine/ui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
capytaine/ui/rich.py,sha256=ZfMHUpCSVztNseIGpN2I69ts_Aw_HJ5RnZc0f73av5Q,233
|
|
5
|
+
capytaine/ui/cli.py,sha256=o3MH2OCHXFww1kb2zM9R3qs4jjfkCeeZFRAgnFnb2NE,797
|
|
6
|
+
capytaine/green_functions/Delhommeau_float64.cpython-39-darwin.so,sha256=8lkMXn3N8RZc5-QRy_Ho9QNpKYbZ0QrSzOa3igCoBms,399344
|
|
7
|
+
capytaine/green_functions/Delhommeau_float32.cpython-39-darwin.so,sha256=3tzBQy8zseRE6bT4IqKgMDB_7udLDrvqFU8SXCaXLg8,346288
|
|
8
|
+
capytaine/green_functions/__init__.py,sha256=527Pd0SIqwR64-d4sT-_jyE89XU-PLgFL0et96ChAIo,107
|
|
9
|
+
capytaine/green_functions/delhommeau.py,sha256=tAwJSFIlUh4Lxb3x2xRCJb496KTlTeOe00p3HY8q-kQ,24284
|
|
10
|
+
capytaine/green_functions/hams.py,sha256=HApi_OGay2cVt1nJxtZ849eEEsz4tK9ktxNNj2hrWo8,8267
|
|
11
|
+
capytaine/green_functions/abstract_green_function.py,sha256=gHwhzVB2KyDpjy5LTb80Hb2FOBmoKtpmPHCcMBlsEk4,2839
|
|
12
|
+
capytaine/bodies/dofs.py,sha256=WFT4snSkUFxxrdHsfxGAj5wc6aLWbqz8gLblhIlRWX8,5227
|
|
13
|
+
capytaine/bodies/bodies.py,sha256=aH3PDEN-ywFo2P8r4oh2zx7mOPRJcIUm8HihdQh1dV0,26102
|
|
14
|
+
capytaine/bodies/__init__.py,sha256=wIYFs14NAWqaHLQWvDGUEZTBWp_kdthKkbOlXHup6LA,157
|
|
15
|
+
capytaine/bodies/hydrostatics.py,sha256=9SUz-xqsizAMAciJhUn7ZT_tg78VZ-4PMNqXTKydgTk,26419
|
|
16
|
+
capytaine/bodies/multibodies.py,sha256=y6np-DpueJLu78ViOBApDWV5NTu86v8koTgI2OA9bb8,7880
|
|
17
|
+
capytaine/tools/cache_on_disk.py,sha256=Cj2J5pNKw9PbIvxUn53swSmuGJoMibZzIvB5Skt52ig,912
|
|
18
|
+
capytaine/tools/timer.py,sha256=2157o0Wm02GW5xHlTJR15gVgtGaGSIzOwR0FcMxmX5M,2602
|
|
19
|
+
capytaine/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
+
capytaine/tools/deprecation_handling.py,sha256=_QFNrkreLerm3-LzRZ3l6B_O249PM-fCCAXMsHA7kIU,809
|
|
21
|
+
capytaine/tools/block_circulant_matrices.py,sha256=2fRGtrWNTPtod02xt532p-VKZPJ5vsNa4R0cx0DQvc8,10977
|
|
22
|
+
capytaine/tools/optional_imports.py,sha256=HNjtvNZGxsw-eYmr4ejq001KhLevrvqq7ASAqTOw8W8,860
|
|
23
|
+
capytaine/tools/symbolic_multiplication.py,sha256=d0Ll0HOo8q_cPMt--ZBXQ5TZ4-Tw_VHmjoWz6Wy7r2E,5554
|
|
24
|
+
capytaine/tools/memory_monitor.py,sha256=UNG-yOCXqvCKK2fXbUj9rvVPHQnZk62R1b2EaHMC4YA,1427
|
|
25
|
+
capytaine/tools/lists_of_points.py,sha256=_yaQbBxWw5n61DoqndV21Q35kJhJK7sstc6Hcs_fXeA,1833
|
|
26
|
+
capytaine/tools/prony_decomposition.py,sha256=Eg8CcedPuLKVUA-wpjwXBJsnXjBGZruHVy4jMU2cCSM,5147
|
|
27
|
+
capytaine/bem/solver.py,sha256=z2P7asqt4UruV0LWe61a98f64btqXf1JyhY3xN9Efs4,35121
|
|
28
|
+
capytaine/bem/engines.py,sha256=G_CgTXe4fjrLiS0SiOdg6Ek0MkMUlMR6p1jy8mZW6RM,13125
|
|
29
|
+
capytaine/bem/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
|
+
capytaine/bem/problems_and_results.py,sha256=ryv4TDfGna1svW1QiYLnxSD281Ispto4IYIPtCJmIoY,27260
|
|
31
|
+
capytaine/bem/airy_waves.py,sha256=GAhX5xNEgjoOo2uEHXfKCxb2TnmbPBCqW6VWfvzJTM8,3498
|
|
32
|
+
capytaine/io/wamit.py,sha256=dvmthwIZnzOM8L1kq814pilCpQPLeTHvjjgg21hV2po,16028
|
|
33
|
+
capytaine/io/legacy.py,sha256=xWPznKSooZof9FOLLoogDu1ouvGgisx1TixdYazCEWY,10339
|
|
34
|
+
capytaine/io/bemio.py,sha256=WXT7QPJK0t2kgUdI0DOOQG8u5zh_zk9q_PmTXqW1dJE,7334
|
|
35
|
+
capytaine/io/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
|
+
capytaine/io/xarray.py,sha256=tbWUoqub56uddHfo0Nv1T6YcymipCo9m74PKgMsM3pY,27343
|
|
37
|
+
capytaine/.dylibs/libgfortran.5.dylib,sha256=6uNZS_KEqHsXxVzZp8qANpYBaOKVUp4PapKX4P8wvhE,1901520
|
|
38
|
+
capytaine/.dylibs/libquadmath.0.dylib,sha256=AtjHD7yn1DtR6T2PA-Ry7z9iJFiYF9eZ4dfkBVTFa6k,363936
|
|
39
|
+
capytaine/.dylibs/libgcc_s.1.1.dylib,sha256=a2klIEBZo0Ns9hxZzfO7_Aur4CtbIedHBYCDc5gRMbg,183040
|
|
40
|
+
capytaine/meshes/clean.py,sha256=xpbCiyEBxziCjEBaUN_izIkLinVGywGnwPT5rrggvF4,9824
|
|
41
|
+
capytaine/meshes/surface_integrals.py,sha256=JqQEIOz9fkMHEOHLva02zwvbS_Ed0q7qzDaVYUCG9wQ,3123
|
|
42
|
+
capytaine/meshes/io.py,sha256=xUU2WV00gcLduoP5db3eOGKgigh0OKdZY5-NGZfjxZg,17093
|
|
43
|
+
capytaine/meshes/abstract_meshes.py,sha256=kQE8phEGs92_HRPOEQiYcBkv8c2ECG06CVLPS_5gyd8,13050
|
|
44
|
+
capytaine/meshes/__init__.py,sha256=5K_nx-RnEGG2NO6o0HEO1YZ-eTFHQl0EL0sqF5UUSCM,102
|
|
45
|
+
capytaine/meshes/export.py,sha256=d3UFsMq0cvM2SIu537aii2kZkQn8GGxIRGO4pVvi2pg,2711
|
|
46
|
+
capytaine/meshes/visualization.py,sha256=HgTxmmar6owCp56eSMTC81pJmS8IwwN_sQE9S7haZbc,12384
|
|
47
|
+
capytaine/meshes/meshes.py,sha256=OPFa8d7QmQBmnn17nxjI7eoHfqhH2sgotv9aul-nleY,29805
|
|
48
|
+
capytaine/meshes/geometry.py,sha256=7rnVK87TFL8KrQ7fYfwaYQb6t2ME1beFG-Mb-HQjJjs,8833
|
|
49
|
+
capytaine/meshes/clip.py,sha256=QM3qWCBDAMacOywx5WugHM9aRYRXr7kNdtVxaw_FDw8,10729
|
|
50
|
+
capytaine/meshes/quality.py,sha256=D5EtbtBFiLccEeO89tfjBl17uipOeffOPoubQ4ZH5_4,4870
|
|
51
|
+
capytaine/meshes/symmetric_meshes.py,sha256=APRMDAZOHg-mNGLVSxpy7kyaeZJt1h2zfqwTOys2E_Y,24732
|
|
52
|
+
capytaine/meshes/predefined/rectangles.py,sha256=cjq_lOP43udVxxtvYGmMNuyHZChQlh_gZi9_Y6RMWh0,9471
|
|
53
|
+
capytaine/meshes/predefined/spheres.py,sha256=HgZpWV__gA5P5yCjCPpF7OdtW_FE7v5hjRwQHdhD_-g,1939
|
|
54
|
+
capytaine/meshes/predefined/__init__.py,sha256=uc2b-3UJi_4NnTkk6wRlbq5UTKOyRU7JTpMDdlUrjiY,365
|
|
55
|
+
capytaine/meshes/predefined/cylinders.py,sha256=ETG3P_44YFQucrsKGmLoSScvi3FQ3OXBF16QUYg39Og,13412
|
|
56
|
+
capytaine/post_pro/rao.py,sha256=kLePr2sbh38f-ydjQTIyeRuoDDqEootqwLSt575aGik,2293
|
|
57
|
+
capytaine/post_pro/free_surfaces.py,sha256=pNf3uBMJ7snD9I0dWRqZmLSVoPcH0vEc3jbwwL2kCOA,3016
|
|
58
|
+
capytaine/post_pro/__init__.py,sha256=fi9BE68OzphGjf08HYGcCPmZLJYnD-wHjz86QEXkBn8,274
|
|
59
|
+
capytaine/post_pro/kochin.py,sha256=8Dmc7Xt0qTPRzXjzZYfMywVdPa_eSRQxfrKEmDZhSpI,2067
|
|
60
|
+
capytaine/post_pro/impedance.py,sha256=gNMKkSyD4qN55_PrTZhrtsh2XsAbC3ciFCWtvpJLKLM,3492
|
|
61
|
+
capytaine-3.0.0a1.dist-info/RECORD,,
|
|
62
|
+
capytaine-3.0.0a1.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
|
|
63
|
+
capytaine-3.0.0a1.dist-info/WHEEL,sha256=QNpUOVkwcjwY22mJ1yDEo3_scKAYwaSfG2-jzE22pPE,120
|
|
64
|
+
capytaine-3.0.0a1.dist-info/entry_points.txt,sha256=R72-je8lc6ELm8ftt7lJ7f1aalnQs5BWYrGDBMexHII,53
|
|
65
|
+
capytaine-3.0.0a1.dist-info/METADATA,sha256=4YdZOR22xCmwIHWLYxDSR21K5JLNhiUGdOCEsDYI-NI,45296
|
|
@@ -1,6 +0,0 @@
|
|
|
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
|
|
@@ -1,151 +0,0 @@
|
|
|
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)
|
|
@@ -1,111 +0,0 @@
|
|
|
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
|
|
@@ -1,70 +0,0 @@
|
|
|
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)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
build/
|