loadpath 0.1.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 (220) hide show
  1. loadpath/README.md +294 -0
  2. loadpath/SKILL.md +584 -0
  3. loadpath/__init__.py +17 -0
  4. loadpath/__main__.py +1202 -0
  5. loadpath/am.py +316 -0
  6. loadpath/amgfast.py +326 -0
  7. loadpath/assembly.py +985 -0
  8. loadpath/benchmarks/__init__.py +0 -0
  9. loadpath/benchmarks/beams.py +266 -0
  10. loadpath/benchmarks/cases/ge-bracket.json +380 -0
  11. loadpath/benchmarks/evaluate.py +172 -0
  12. loadpath/benchmarks/mechanisms.py +416 -0
  13. loadpath/benchmarks/problems.py +140 -0
  14. loadpath/benchmarks/reference/bridge-3d.top3d.npz +0 -0
  15. loadpath/benchmarks/reference/cantilever-3d.top3d.npz +0 -0
  16. loadpath/benchmarks/reference/lbracket-2d.top88-ft2.npz +0 -0
  17. loadpath/benchmarks/reference/mbb-2d.top88-ft1.npz +0 -0
  18. loadpath/benchmarks/reference/mbb-2d.top88-ft2.npz +0 -0
  19. loadpath/benchmarks/reference.py +138 -0
  20. loadpath/benchmarks/run.py +301 -0
  21. loadpath/brep.py +1470 -0
  22. loadpath/bucklingopt.py +300 -0
  23. loadpath/buildsim.py +1490 -0
  24. loadpath/cadimport.py +904 -0
  25. loadpath/calibration.py +885 -0
  26. loadpath/cavities.py +211 -0
  27. loadpath/checks/__init__.py +0 -0
  28. loadpath/checks/dfm.py +354 -0
  29. loadpath/checks/exchanger.py +7 -0
  30. loadpath/checks/fea.py +212 -0
  31. loadpath/checks/fit.py +475 -0
  32. loadpath/checks/networks.py +260 -0
  33. loadpath/checks/opening.py +67 -0
  34. loadpath/checks/sdf_kit.py +7 -0
  35. loadpath/conjugate.py +267 -0
  36. loadpath/constrained.py +329 -0
  37. loadpath/contact.py +691 -0
  38. loadpath/coopt.py +342 -0
  39. loadpath/cores.py +163 -0
  40. loadpath/crease.py +1138 -0
  41. loadpath/critic.py +212 -0
  42. loadpath/crosscheck.py +1107 -0
  43. loadpath/cutcell.py +510 -0
  44. loadpath/data/lattice_buckling.json +439 -0
  45. loadpath/data/lattice_tensors.json +27449 -0
  46. loadpath/data/published_experiments.json +71 -0
  47. loadpath/decimate.py +177 -0
  48. loadpath/delivery.py +190 -0
  49. loadpath/directions.py +262 -0
  50. loadpath/domain.py +630 -0
  51. loadpath/drains.py +615 -0
  52. loadpath/durability.py +413 -0
  53. loadpath/editor.html +3135 -0
  54. loadpath/editor.py +610 -0
  55. loadpath/escape.py +354 -0
  56. loadpath/evals/__init__.py +0 -0
  57. loadpath/evals/baselines/coarse.json +1543 -0
  58. loadpath/evals/baselines/full.json +1497 -0
  59. loadpath/evals/brief_kinds/__init__.py +1 -0
  60. loadpath/evals/brief_kinds/heatx.py +387 -0
  61. loadpath/evals/brief_kinds/lattice.py +571 -0
  62. loadpath/evals/brief_kinds/multimat.py +593 -0
  63. loadpath/evals/briefs/assets/bracket.step +1201 -0
  64. loadpath/evals/briefs/assets/desk_arm.urdf +22 -0
  65. loadpath/evals/briefs/assets/elbow-gearbox.stl +0 -0
  66. loadpath/evals/briefs/assets/motor-body.stl +0 -0
  67. loadpath/evals/briefs/assets/sketch.png +0 -0
  68. loadpath/evals/briefs/base-adapter-fdm.json +492 -0
  69. loadpath/evals/briefs/bell-crank-lpbf.json +180 -0
  70. loadpath/evals/briefs/belt-tensioner-fdm.json +151 -0
  71. loadpath/evals/briefs/camera-boom-mjf.json +339 -0
  72. loadpath/evals/briefs/camera-mount-pla.json +203 -0
  73. loadpath/evals/briefs/coolant-isolator-petg.json +100 -0
  74. loadpath/evals/briefs/elbow-bearing-bracket-sls.json +300 -0
  75. loadpath/evals/briefs/elbow-gearbox-forearm-mjf.json +558 -0
  76. loadpath/evals/briefs/elbow-link-fatigue-fdm.json +251 -0
  77. loadpath/evals/briefs/elbow-stop-pad-tpu.json +39 -0
  78. loadpath/evals/briefs/forearm-fdm.json +146 -0
  79. loadpath/evals/briefs/forearm-servo-link-fdm.json +327 -0
  80. loadpath/evals/briefs/grip-pad-finger-mm.json +354 -0
  81. loadpath/evals/briefs/gripper-bracket-creep-fdm.json +340 -0
  82. loadpath/evals/briefs/gripper-finger-fdm.json +155 -0
  83. loadpath/evals/briefs/gripper-jaw-fatigue-mjf.json +328 -0
  84. loadpath/evals/briefs/gripper-palm-fdm.json +715 -0
  85. loadpath/evals/briefs/hot-stepper-mount-asa-fdm.json +471 -0
  86. loadpath/evals/briefs/hpu-oil-cooler-lpbf.json +121 -0
  87. loadpath/evals/briefs/isolated-camera-mount-mm.json +675 -0
  88. loadpath/evals/briefs/kart-charge-cooler-lpbf.json +93 -0
  89. loadpath/evals/briefs/lighten-step-bracket.json +220 -0
  90. loadpath/evals/briefs/nema17-mount-stl.json +429 -0
  91. loadpath/evals/briefs/pillow-block-sls.json +220 -0
  92. loadpath/evals/briefs/polyjet-fingertip-mm.json +305 -0
  93. loadpath/evals/briefs/rod-hook-pla.json +154 -0
  94. loadpath/evals/briefs/sensor-arm-resin.json +150 -0
  95. loadpath/evals/briefs/shelf-bracket-pla.json +158 -0
  96. loadpath/evals/briefs/shoulder-riser-mjf.json +487 -0
  97. loadpath/evals/briefs/sketch-clevis.json +229 -0
  98. loadpath/evals/briefs/spring-bracket-pacf.json +294 -0
  99. loadpath/evals/briefs/tool-flange-ti64.json +280 -0
  100. loadpath/evals/briefs/tray-arm-lattice-fdm.json +260 -0
  101. loadpath/evals/briefs/turret-fdm.json +281 -0
  102. loadpath/evals/briefs/upper-arm-sls.json +179 -0
  103. loadpath/evals/briefs/urdf-forearm.json +233 -0
  104. loadpath/evals/briefs/wrist-link-mjf.json +278 -0
  105. loadpath/evals/briefs/wrist-yoke-mjf.json +245 -0
  106. loadpath/evals/briefs.py +393 -0
  107. loadpath/evals/cases/arm-link-cast.json +157 -0
  108. loadpath/evals/cases/arm-link-driven.json +171 -0
  109. loadpath/evals/cases/arm-link-sandwich.json +315 -0
  110. loadpath/evals/cases/arm-link.json +111 -0
  111. loadpath/evals/cases/bell-crank.json +116 -0
  112. loadpath/evals/cases/grip-turret.json +479 -0
  113. loadpath/evals/cases/grip-upper-arm.json +253 -0
  114. loadpath/evals/cases/grip-wrist-link-mjf.json +929 -0
  115. loadpath/evals/cases/grip-wrist-yoke.json +831 -0
  116. loadpath/evals/cases/lpbf-intercooler-core.json +59 -0
  117. loadpath/evals/cases/mbb-beam.json +61 -0
  118. loadpath/evals/cases/motor-body.stl +0 -0
  119. loadpath/evals/cases/motor-mount.json +265 -0
  120. loadpath/evals/cases/printed-hook.json +77 -0
  121. loadpath/evals/cases/wall-bracket-fasteners.json +125 -0
  122. loadpath/evals/cases/wall-bracket.json +126 -0
  123. loadpath/evals/corpus.py +179 -0
  124. loadpath/evals/pareto.py +90 -0
  125. loadpath/evals/run.py +860 -0
  126. loadpath/examples/arm-link.json +25 -0
  127. loadpath/examples/bumpered-bracket-compression.json +225 -0
  128. loadpath/examples/bumpered-bracket-lattice.json +204 -0
  129. loadpath/examples/bumpered-bracket.json +34 -0
  130. loadpath/examples/gripper-finger-mm.json +185 -0
  131. loadpath/examples/heat-exchanger-counterflow.json +21 -0
  132. loadpath/examples/heat-exchanger-crossflow-tuned.json +48 -0
  133. loadpath/examples/heat-exchanger-crossflow.json +20 -0
  134. loadpath/examples/pedal-lattice.json +23 -0
  135. loadpath/examples/pressure-plenum.json +12 -0
  136. loadpath/examples/shelf-bracket.json +27 -0
  137. loadpath/exchanger.py +831 -0
  138. loadpath/fasteners.py +199 -0
  139. loadpath/fem.py +668 -0
  140. loadpath/femops.py +70 -0
  141. loadpath/fieldjit.py +981 -0
  142. loadpath/fieldops.py +119 -0
  143. loadpath/fields.py +3697 -0
  144. loadpath/fieldtorch.py +464 -0
  145. loadpath/flow.py +984 -0
  146. loadpath/flowtopo.py +300 -0
  147. loadpath/gpu.py +521 -0
  148. loadpath/heatx.py +1067 -0
  149. loadpath/heatx_thermal.py +432 -0
  150. loadpath/homogenized.py +886 -0
  151. loadpath/ibrep.py +552 -0
  152. loadpath/impact.py +693 -0
  153. loadpath/infill.py +376 -0
  154. loadpath/interface_library.py +340 -0
  155. loadpath/interlock.py +186 -0
  156. loadpath/isolator.py +149 -0
  157. loadpath/knn.py +204 -0
  158. loadpath/lattice.py +1065 -0
  159. loadpath/lattice3mf.py +760 -0
  160. loadpath/lattice_buckling.py +245 -0
  161. loadpath/lattice_grade.py +325 -0
  162. loadpath/lattice_orient.py +595 -0
  163. loadpath/lattice_print.py +159 -0
  164. loadpath/lattice_tensors.py +558 -0
  165. loadpath/latticestep.py +1210 -0
  166. loadpath/manufacture.py +446 -0
  167. loadpath/material_library.py +489 -0
  168. loadpath/materials.py +144 -0
  169. loadpath/mcp_server.py +786 -0
  170. loadpath/mechanism.py +218 -0
  171. loadpath/mechanism_nl.py +811 -0
  172. loadpath/meshops.py +452 -0
  173. loadpath/mg.py +853 -0
  174. loadpath/mma.py +214 -0
  175. loadpath/modal.py +210 -0
  176. loadpath/multimat.py +1788 -0
  177. loadpath/narrowband.py +418 -0
  178. loadpath/nlkernel.py +241 -0
  179. loadpath/nonlinear.py +1095 -0
  180. loadpath/orient.py +334 -0
  181. loadpath/porous.py +994 -0
  182. loadpath/pressure.py +171 -0
  183. loadpath/preview.py +335 -0
  184. loadpath/printcheck.py +263 -0
  185. loadpath/printsetup.py +207 -0
  186. loadpath/processcheck.py +376 -0
  187. loadpath/quick.py +113 -0
  188. loadpath/recall.py +406 -0
  189. loadpath/reconstruct.py +797 -0
  190. loadpath/render.py +436 -0
  191. loadpath/resolved.py +189 -0
  192. loadpath/schema.py +1701 -0
  193. loadpath/sdf_kit.py +843 -0
  194. loadpath/selfx.py +292 -0
  195. loadpath/shapes.py +584 -0
  196. loadpath/sharp.py +717 -0
  197. loadpath/simp.py +1170 -0
  198. loadpath/sizing.py +312 -0
  199. loadpath/slicer.py +321 -0
  200. loadpath/spec.py +1072 -0
  201. loadpath/step.py +806 -0
  202. loadpath/struts.py +639 -0
  203. loadpath/study.py +1937 -0
  204. loadpath/tasks.py +822 -0
  205. loadpath/thermal.py +1691 -0
  206. loadpath/threemf.py +487 -0
  207. loadpath/tune.py +437 -0
  208. loadpath/validation.py +145 -0
  209. loadpath/verify.py +1215 -0
  210. loadpath/viewer.html +694 -0
  211. loadpath/viewer.py +446 -0
  212. loadpath/viscoelastic.py +106 -0
  213. loadpath/voxelprint.py +582 -0
  214. loadpath/voxels.py +402 -0
  215. loadpath-0.1.1.dist-info/METADATA +319 -0
  216. loadpath-0.1.1.dist-info/RECORD +220 -0
  217. loadpath-0.1.1.dist-info/WHEEL +5 -0
  218. loadpath-0.1.1.dist-info/entry_points.txt +2 -0
  219. loadpath-0.1.1.dist-info/licenses/LICENSE +21 -0
  220. loadpath-0.1.1.dist-info/top_level.txt +1 -0
loadpath/fieldops.py ADDED
@@ -0,0 +1,119 @@
1
+ """Compiled kernels for the hot field-graph ops (numba, nogil, so peval's
2
+ threads run them in parallel), each giving the numpy op's values:
3
+
4
+ - `tpms`: gyroid / diamond / Schwarz-P distance in double precision, one
5
+ pass per point (sines and cosines once, no temporaries): ~4x numpy's
6
+ float64, bit for bit. Single precision stays on numpy, whose float32
7
+ sin/cos are SIMD and faster still.
8
+ - `warp`: a graded lattice's coordinates (_CellWarp), the three trilinear
9
+ lookups fused, as map_coordinates(order=1, mode="nearest") of the
10
+ clipped point plus the carry-on past the grid: ~5x.
11
+
12
+ `available()` is False without numba or with LOADPATH_FIELDOPS=numpy,
13
+ and callers keep their numpy code.
14
+ """
15
+ from __future__ import annotations
16
+
17
+ import os
18
+
19
+ import numpy as np
20
+
21
+ try:
22
+ import numba as nb
23
+
24
+ from . import meshops as _meshops # noqa: F401 - caps numba's threads (LOADPATH_THREADS)
25
+ except ImportError: # pragma: no cover - numba is a dependency; numpy without it
26
+ nb = None
27
+
28
+ __all__ = ["available", "tpms", "warp"]
29
+
30
+ _KINDS = {"gyroid": 0, "diamond": 1, "schwarz-p": 2}
31
+
32
+
33
+ def available():
34
+ return nb is not None and os.environ.get("LOADPATH_FIELDOPS", "").lower() != "numpy"
35
+
36
+
37
+ if nb is not None:
38
+
39
+ @nb.njit(cache=True, nogil=True)
40
+ def _tpms(kind, P, k, out):
41
+ for i in range(P.shape[0]):
42
+ x = k * P[i, 0]
43
+ y = k * P[i, 1]
44
+ z = k * P[i, 2]
45
+ if kind == 2:
46
+ # lattice.TPMS["schwarz-p"]: cos x + cos y + cos z, gradient -sin
47
+ f = np.cos(x) + np.cos(y) + np.cos(z)
48
+ g0 = -np.sin(x) * k
49
+ g1 = -np.sin(y) * k
50
+ g2 = -np.sin(z) * k
51
+ gn = np.sqrt(g0 * g0 + g1 * g1 + g2 * g2)
52
+ out[i] = f / max(gn, 0.3 * k)
53
+ continue
54
+ sx, cx, sy, cy, sz, cz = np.sin(x), np.cos(x), np.sin(y), np.cos(y), np.sin(z), np.cos(z)
55
+ if kind == 0:
56
+ f = sx * cy + sy * cz + sz * cx
57
+ g0 = cx * cy - sz * sx
58
+ g1 = cy * cz - sx * sy
59
+ g2 = cz * cx - sy * sz
60
+ else:
61
+ f = sx * sy * sz + sx * cy * cz + cx * sy * cz + cx * cy * sz
62
+ g0 = cx * sy * sz + cx * cy * cz - sx * sy * cz - sx * cy * sz
63
+ g1 = sx * cy * sz - sx * sy * cz + cx * cy * cz - cx * sy * sz
64
+ g2 = sx * sy * cz - sx * cy * sz - cx * sy * sz + cx * cy * cz
65
+ gn = np.sqrt(g0 * g0 + g1 * g1 + g2 * g2) * k
66
+ out[i] = f / max(gn, 0.3 * k)
67
+
68
+ @nb.njit(cache=True, nogil=True, inline="always")
69
+ def _lerp_index(x, n):
70
+ # map_coordinates order 1, mode nearest, x already in [0, n - 1]
71
+ i0 = int(np.floor(x))
72
+ if i0 > n - 2:
73
+ i0 = n - 2 if n > 1 else 0
74
+ w = x - i0
75
+ i1 = i0 + 1 if n > 1 else 0
76
+ return i0, i1, w
77
+
78
+ @nb.njit(cache=True, nogil=True)
79
+ def _warp(P, lo, h, u0, u1, u2, cell, out):
80
+ n0, n1, n2 = u0.shape
81
+ for i in range(P.shape[0]):
82
+ ix = (P[i, 0] - lo[0]) / h
83
+ iy = (P[i, 1] - lo[1]) / h
84
+ iz = (P[i, 2] - lo[2]) / h
85
+ cx = min(max(ix, 0.0), n0 - 1.0)
86
+ cy = min(max(iy, 0.0), n1 - 1.0)
87
+ cz = min(max(iz, 0.0), n2 - 1.0)
88
+ a0, a1, wa = _lerp_index(cx, n0)
89
+ b0, b1, wb = _lerp_index(cy, n1)
90
+ c0, c1, wc = _lerp_index(cz, n2)
91
+ c = cell[i] if cell.shape[0] > 1 else cell[0]
92
+ for comp in range(3):
93
+ u = u0 if comp == 0 else (u1 if comp == 1 else u2)
94
+ v00 = u[a0, b0, c0] * (1 - wc) + u[a0, b0, c1] * wc
95
+ v01 = u[a0, b1, c0] * (1 - wc) + u[a0, b1, c1] * wc
96
+ v10 = u[a1, b0, c0] * (1 - wc) + u[a1, b0, c1] * wc
97
+ v11 = u[a1, b1, c0] * (1 - wc) + u[a1, b1, c1] * wc
98
+ v0 = v00 * (1 - wb) + v01 * wb
99
+ v1 = v10 * (1 - wb) + v11 * wb
100
+ v = v0 * (1 - wa) + v1 * wa
101
+ d = ix - cx if comp == 0 else (iy - cy if comp == 1 else iz - cz)
102
+ out[i, comp] = v + d * h / c
103
+
104
+
105
+ def tpms(kind, pts, cell):
106
+ """lattice.tpms(kind, pts, cell) in double precision (scalar cell)."""
107
+ pts = np.ascontiguousarray(pts, np.float64)
108
+ out = np.empty(len(pts))
109
+ _tpms(_KINDS[kind], pts, 2.0 * np.pi / float(cell), out)
110
+ return out
111
+
112
+
113
+ def warp(P, lo, h, us, cell):
114
+ """_CellWarp.__call__: the three lattice coordinates at P."""
115
+ P = np.ascontiguousarray(P, np.float64)
116
+ cell = np.ascontiguousarray(np.atleast_1d(np.asarray(cell, np.float64)).ravel())
117
+ out = np.empty((len(P), 3))
118
+ _warp(P, np.ascontiguousarray(lo, np.float64), float(h), us[0], us[1], us[2], cell, out)
119
+ return out