loop-common 0.0.1__py3-none-any.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 (50) hide show
  1. loop_common/__init__.py +6 -0
  2. loop_common/base.py +98 -0
  3. loop_common/geometry/__init__.py +19 -0
  4. loop_common/geometry/_aabb.py +37 -0
  5. loop_common/geometry/_bounding_box.py +792 -0
  6. loop_common/geometry/_face_table.py +42 -0
  7. loop_common/geometry/_point.py +238 -0
  8. loop_common/geometry/_structured_grid.py +114 -0
  9. loop_common/geometry/_structured_grid_2d.py +146 -0
  10. loop_common/geometry/_structured_grid_3d.py +243 -0
  11. loop_common/geometry/_surface.py +288 -0
  12. loop_common/geometry/_unstructured_mesh.py +208 -0
  13. loop_common/interfaces/__init__.py +0 -0
  14. loop_common/interfaces/representation.py +45 -0
  15. loop_common/io/__init__.py +0 -0
  16. loop_common/logging/__init__.py +14 -0
  17. loop_common/logging/logger.py +123 -0
  18. loop_common/logging/sinks.py +221 -0
  19. loop_common/logging/timing.py +113 -0
  20. loop_common/math/__init__.py +5 -0
  21. loop_common/math/_maths.py +441 -0
  22. loop_common/math/_transformation.py +178 -0
  23. loop_common/math/finite_difference_stencil.py +38 -0
  24. loop_common/observations/__init__.py +3 -0
  25. loop_common/observations/lineset.py +41 -0
  26. loop_common/observations/orientation.py +122 -0
  27. loop_common/observations/pointset.py +8 -0
  28. loop_common/observer.py +284 -0
  29. loop_common/supports/_2d_base_unstructured.py +361 -0
  30. loop_common/supports/_2d_p1_unstructured.py +131 -0
  31. loop_common/supports/_2d_p2_unstructured.py +349 -0
  32. loop_common/supports/_2d_structured_grid.py +545 -0
  33. loop_common/supports/_3d_base_structured.py +546 -0
  34. loop_common/supports/_3d_p2_tetra.py +374 -0
  35. loop_common/supports/_3d_rectilinear_grid.py +315 -0
  36. loop_common/supports/_3d_structured_grid.py +510 -0
  37. loop_common/supports/_3d_structured_tetra.py +764 -0
  38. loop_common/supports/_3d_unstructured_tetra.py +656 -0
  39. loop_common/supports/__init__.py +69 -0
  40. loop_common/supports/_aabb.py +77 -0
  41. loop_common/supports/_base_support.py +118 -0
  42. loop_common/supports/_face_table.py +70 -0
  43. loop_common/supports/_p2_structured_tetra.py +627 -0
  44. loop_common/supports/_support_factory.py +78 -0
  45. loop_common/utils.py +74 -0
  46. loop_common-0.0.1.dist-info/METADATA +35 -0
  47. loop_common-0.0.1.dist-info/RECORD +50 -0
  48. loop_common-0.0.1.dist-info/WHEEL +5 -0
  49. loop_common-0.0.1.dist-info/licenses/LICENSE +21 -0
  50. loop_common-0.0.1.dist-info/top_level.txt +1 -0
loop_common/utils.py ADDED
@@ -0,0 +1,74 @@
1
+ import logging
2
+ import os
3
+
4
+ import numpy as np
5
+
6
+ from .logging import get_logger
7
+
8
+
9
+ class LoopException(Exception):
10
+ """Base class for LoopStructural exceptions."""
11
+
12
+
13
+ class LoopImportError(LoopException):
14
+ def __init__(self, message, additional_information=None):
15
+ super().__init__(message)
16
+ self.additional_information = additional_information
17
+
18
+
19
+ class InterpolatorError(LoopException):
20
+ pass
21
+
22
+
23
+ class LoopTypeError(LoopException):
24
+ pass
25
+
26
+
27
+ class LoopValueError(LoopException):
28
+ pass
29
+
30
+
31
+ def get_levels():
32
+ return {"info": logging.INFO, "warning": logging.WARNING, "error": logging.ERROR, "debug": logging.DEBUG}
33
+
34
+
35
+ def getLogger(name: str):
36
+ return get_logger(name)
37
+
38
+
39
+ def log_to_file(filename, overwrite=True, level="info"):
40
+ logger = getLogger(__name__)
41
+ if overwrite and os.path.isfile(filename):
42
+ os.remove(filename)
43
+ levels = get_levels()
44
+ level_value = levels.get(level, logging.WARNING)
45
+ handler = logging.FileHandler(filename)
46
+ handler.setLevel(level_value)
47
+ logger.addHandler(handler)
48
+ logger.setLevel(level_value)
49
+ return logger
50
+
51
+
52
+ def log_to_console(level="warning"):
53
+ levels = get_levels()
54
+ level_value = levels.get(level, logging.WARNING)
55
+ logger = getLogger(__name__)
56
+ logger.setLevel(level_value)
57
+ return logger
58
+
59
+
60
+ rng = np.random.default_rng()
61
+
62
+
63
+ __all__ = [
64
+ "InterpolatorError",
65
+ "LoopException",
66
+ "LoopImportError",
67
+ "LoopTypeError",
68
+ "LoopValueError",
69
+ "getLogger",
70
+ "get_levels",
71
+ "log_to_console",
72
+ "log_to_file",
73
+ "rng",
74
+ ]
@@ -0,0 +1,35 @@
1
+ Metadata-Version: 2.4
2
+ Name: loop-common
3
+ Version: 0.0.1
4
+ Summary: Common utilities for LoopStructural
5
+ Author-email: Lachlan Grose <lachlan.grose@monash.edu>
6
+ License: MIT
7
+ Classifier: Development Status :: 5 - Production/Stable
8
+ Classifier: Intended Audience :: Science/Research
9
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: Microsoft :: Windows
12
+ Classifier: Operating System :: POSIX
13
+ Classifier: Operating System :: MacOS
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: numpy
22
+ Requires-Dist: pandas
23
+ Requires-Dist: pydantic
24
+ Requires-Dist: scipy
25
+ Requires-Dist: pyvista
26
+ Requires-Dist: pyyaml
27
+ Provides-Extra: tests
28
+ Requires-Dist: pytest; extra == "tests"
29
+ Dynamic: license-file
30
+
31
+ # loop-common
32
+
33
+ Common utilities for LoopStructural, including bounding box geometry helpers,
34
+ mesh/grid support types, and shared math/logging utilities used across the
35
+ LoopStructural workspace packages.
@@ -0,0 +1,50 @@
1
+ loop_common/__init__.py,sha256=jk8asRyWS1EqlN4481Fc6cbIG4Z9guZVP9ZywRJijmk,173
2
+ loop_common/base.py,sha256=D4R9Et8uVh1I8kbeeObRUtnjht4BCpMrE2hO3iOmN-o,3216
3
+ loop_common/observer.py,sha256=gfW7P4BYfMBqXMn7rlHwGhyBzo8FV_GJ5wkvUHu0W6Y,10224
4
+ loop_common/utils.py,sha256=B7nyPYTTzBJ2qtLA3dxGhZ-i_pvuUFALPQP6F4meszg,1548
5
+ loop_common/geometry/__init__.py,sha256=8Gup54dZy2BJjwsQL0Sa9CWCBE8AyMfh4wEx2JWmJpc,601
6
+ loop_common/geometry/_aabb.py,sha256=MLPcJXVSIqeTf16X1aASaiCBBxZZiPqZvNa8M7vfV_Q,2085
7
+ loop_common/geometry/_bounding_box.py,sha256=eaLOHzLJ4WQ4GwB8htReK6ovXbuV-xq-ozys8jF3M1k,26508
8
+ loop_common/geometry/_face_table.py,sha256=z1pMUMCfqDhublTUkioknUMm_gWaKYygQIXjIGrk1NE,2060
9
+ loop_common/geometry/_point.py,sha256=chfZfb1fKiGpR-ORWhdXyWtoE5NNV-kkuG5LVFY-4oU,7936
10
+ loop_common/geometry/_structured_grid.py,sha256=B4VxKktLtfv0oGIiOX3wiYD4gT1gYuChhZ4qusZGp4s,4380
11
+ loop_common/geometry/_structured_grid_2d.py,sha256=acLvv5nbEhcYr8bcBG3V8oeXTj2M23G1gTaCdPqxm-k,5950
12
+ loop_common/geometry/_structured_grid_3d.py,sha256=7up4x2oSShHGJXwq1Vx23KyM4er98zmsU58X-d7DNOM,9810
13
+ loop_common/geometry/_surface.py,sha256=f2Sd5roqsvYF1Be4EbinFHtYAGvHD7LRpojazZHUTCY,11025
14
+ loop_common/geometry/_unstructured_mesh.py,sha256=4qcrMzaxLS7Y5LN6f-d5bleoJ700EfJIo8ry5jxfKhI,7560
15
+ loop_common/interfaces/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ loop_common/interfaces/representation.py,sha256=JCrtSYwewPpCBbUWh_ECyA_ZnuXysSPapKzL51YIfuw,1259
17
+ loop_common/io/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ loop_common/logging/__init__.py,sha256=_7YWtO-hnkun3C9yhrwbPnalKnFgjzpt4pAv2F6Wxmw,307
19
+ loop_common/logging/logger.py,sha256=W54qw_5HViTXjz7sWtASG323cbnNnjOb64G8ku_LA5Q,3912
20
+ loop_common/logging/sinks.py,sha256=ynCkCDY57GQfwF_iAhRWXQ2v7dnVHYuvZ7ZWmBWjs8c,7265
21
+ loop_common/logging/timing.py,sha256=IUPgStKXqmIaBmr-MnAO3uNh6HvLIKZg48vPb04hnVU,3391
22
+ loop_common/math/__init__.py,sha256=nhvrF-dNYJLtWp4SkbcPTMn4ceEGpf1KpDea-_j4LyI,73
23
+ loop_common/math/_maths.py,sha256=4bw9UI1UxYASKl6WSUuqoJyht7BZk2yH_KVobAnPeTc,12716
24
+ loop_common/math/_transformation.py,sha256=oqiKj8YY16Cwmf5NDu6E-_ZFxo2TVJyuq4u_0Od70v8,5456
25
+ loop_common/math/finite_difference_stencil.py,sha256=QfJbUtwDtCYLxQIQVkWsgzXi0p3syvnTCEwMRSM0pzA,1110
26
+ loop_common/observations/__init__.py,sha256=1wDzG0toooIMRYQ-wHRT4zI5LK4k97ffgWJHZgr1e78,114
27
+ loop_common/observations/lineset.py,sha256=SIezX7JR5ahREoC4beuygQjN5GQJjM93NMWA5YaD538,1608
28
+ loop_common/observations/orientation.py,sha256=iJTfWqcdEfAKZXFFRqCOK4i24Dg0ecAmryC9-ehz0TQ,4125
29
+ loop_common/observations/pointset.py,sha256=ix91x1n_TUvyVHCXY6w4ksYWEuK3bV4jlk4rgvx9Sos,200
30
+ loop_common/supports/_2d_base_unstructured.py,sha256=pmNSKRytd2123O9MCcHAE_3jLk-AVysXSwwct7UadiU,12018
31
+ loop_common/supports/_2d_p1_unstructured.py,sha256=32qCJbPv86pXBizupjBbssDecW2xo14m8Jds4SA3x9M,5236
32
+ loop_common/supports/_2d_p2_unstructured.py,sha256=eRwr8JN0YBY2pqhF_ubEUW4z8Isq8vkBTc1BFuXpITE,13714
33
+ loop_common/supports/_2d_structured_grid.py,sha256=3wbfaPU6L5KKNZ0IATvRqPutmISVGb43Y7IAJSVdkHc,17991
34
+ loop_common/supports/_3d_base_structured.py,sha256=NORpkOlWuWtSLrbaHzF4XDQ6Ub1QnFQesBCcRYw03AQ,18243
35
+ loop_common/supports/_3d_p2_tetra.py,sha256=0NdORDxb02YQCsvUGcfHsC3zM-55aXMTglCcvH9BlEM,13817
36
+ loop_common/supports/_3d_rectilinear_grid.py,sha256=3LcmliLc8HlwIamVzl_MOdxM9MI_c_VI2_13dkuhSow,12429
37
+ loop_common/supports/_3d_structured_grid.py,sha256=ZAbuVG5f5L0OPPPDCtZCy6gL_voQCcBA-rZiHvHp59k,17798
38
+ loop_common/supports/_3d_structured_tetra.py,sha256=jUtTvpEyDQW07fE0SBsUkAGzPthroJMd861J3viPqxg,26979
39
+ loop_common/supports/_3d_unstructured_tetra.py,sha256=F_PTi5KdvAbMjq4pVR5hR1J6IgY8_sOhbBqvYDP5mqU,24365
40
+ loop_common/supports/__init__.py,sha256=UAnP1xAb7qF99API9jzwb4EBWPlv0eJE83xZc9tJgJ8,1872
41
+ loop_common/supports/_aabb.py,sha256=Z-kH_u6c6izak0aHG3Uo14PEKQeZmYlevLDC32Q06xk,3208
42
+ loop_common/supports/_base_support.py,sha256=MNlrgFEtjY3zAmDTK1Hc-n6RAF7c8-GV_XUIbiHITWk,2427
43
+ loop_common/supports/_face_table.py,sha256=Hyj4Io63NkPRN8ab9uDHyec-2Kb8BLY_xBF6STNlvBw,3095
44
+ loop_common/supports/_p2_structured_tetra.py,sha256=kZ2JM9xebTNJf1sc5qBehYywPYHL-DZZWbHaPbvrgbY,23297
45
+ loop_common/supports/_support_factory.py,sha256=qvtL5WI5Vkr-4uI6kXVvHKqMYhTdPY8WOUGt7AMdB4E,2977
46
+ loop_common-0.0.1.dist-info/licenses/LICENSE,sha256=ZqGeNFOgmYevj7Ld7Q-kR4lAxWXuBRUdUmPC6XM_py8,1071
47
+ loop_common-0.0.1.dist-info/METADATA,sha256=37TE49_vzsxRqcSFTwCxX012-KzhVnzZHXYecWLsuwM,1231
48
+ loop_common-0.0.1.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
49
+ loop_common-0.0.1.dist-info/top_level.txt,sha256=VVxKP9o0YxZI9xCkuS-xuqx_Y4-SlGe2njWEn3w1UB4,12
50
+ loop_common-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Lachlan Grose
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ loop_common