cadjoint 0.1.0__tar.gz

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 (267) hide show
  1. cadjoint-0.1.0/LICENSE +202 -0
  2. cadjoint-0.1.0/PKG-INFO +300 -0
  3. cadjoint-0.1.0/README.md +237 -0
  4. cadjoint-0.1.0/cadjoint/__init__.py +36 -0
  5. cadjoint-0.1.0/cadjoint/backends/__init__.py +15 -0
  6. cadjoint-0.1.0/cadjoint/backends/wgsl/__init__.py +29 -0
  7. cadjoint-0.1.0/cadjoint/backends/wgsl/_culling.py +326 -0
  8. cadjoint-0.1.0/cadjoint/backends/wgsl/_wgsl_emitter.py +964 -0
  9. cadjoint-0.1.0/cadjoint/backends/wgsl/codegen.py +626 -0
  10. cadjoint-0.1.0/cadjoint/backends/wgsl/direct.py +877 -0
  11. cadjoint-0.1.0/cadjoint/cache.py +229 -0
  12. cadjoint-0.1.0/cadjoint/constraints/__init__.py +104 -0
  13. cadjoint-0.1.0/cadjoint/constraints/null_space.py +143 -0
  14. cadjoint-0.1.0/cadjoint/constraints/residual.py +103 -0
  15. cadjoint-0.1.0/cadjoint/constraints/solve.py +437 -0
  16. cadjoint-0.1.0/cadjoint/constraints/types/__init__.py +0 -0
  17. cadjoint-0.1.0/cadjoint/constraints/types/_sketch.py +57 -0
  18. cadjoint-0.1.0/cadjoint/constraints/types/angle.py +84 -0
  19. cadjoint-0.1.0/cadjoint/constraints/types/base.py +80 -0
  20. cadjoint-0.1.0/cadjoint/constraints/types/coincident.py +63 -0
  21. cadjoint-0.1.0/cadjoint/constraints/types/distance.py +83 -0
  22. cadjoint-0.1.0/cadjoint/constraints/types/equal_length.py +74 -0
  23. cadjoint-0.1.0/cadjoint/constraints/types/fixed.py +62 -0
  24. cadjoint-0.1.0/cadjoint/constraints/types/horizontal.py +62 -0
  25. cadjoint-0.1.0/cadjoint/constraints/types/parallel.py +69 -0
  26. cadjoint-0.1.0/cadjoint/constraints/types/parallel_edges.py +77 -0
  27. cadjoint-0.1.0/cadjoint/constraints/types/perpendicular.py +69 -0
  28. cadjoint-0.1.0/cadjoint/constraints/types/perpendicular_edges.py +78 -0
  29. cadjoint-0.1.0/cadjoint/constraints/types/point_on_line.py +69 -0
  30. cadjoint-0.1.0/cadjoint/constraints/types/vertical.py +62 -0
  31. cadjoint-0.1.0/cadjoint/construction/__init__.py +47 -0
  32. cadjoint-0.1.0/cadjoint/construction/extrude.py +87 -0
  33. cadjoint-0.1.0/cadjoint/construction/faces.py +812 -0
  34. cadjoint-0.1.0/cadjoint/construction/loft.py +66 -0
  35. cadjoint-0.1.0/cadjoint/construction/revolve.py +53 -0
  36. cadjoint-0.1.0/cadjoint/construction/sketch.py +761 -0
  37. cadjoint-0.1.0/cadjoint/construction/solid.py +306 -0
  38. cadjoint-0.1.0/cadjoint/enums.py +556 -0
  39. cadjoint-0.1.0/cadjoint/extraction.py +103 -0
  40. cadjoint-0.1.0/cadjoint/fem/__init__.py +107 -0
  41. cadjoint-0.1.0/cadjoint/fem/backends.py +519 -0
  42. cadjoint-0.1.0/cadjoint/fem/boundary.py +220 -0
  43. cadjoint-0.1.0/cadjoint/fem/calculix.py +1354 -0
  44. cadjoint-0.1.0/cadjoint/fem/cutfem.py +1141 -0
  45. cadjoint-0.1.0/cadjoint/fem/discretization.py +189 -0
  46. cadjoint-0.1.0/cadjoint/fem/elements.py +121 -0
  47. cadjoint-0.1.0/cadjoint/fem/gmsh.py +1156 -0
  48. cadjoint-0.1.0/cadjoint/fem/hexmesh.py +532 -0
  49. cadjoint-0.1.0/cadjoint/fem/jaxfem.py +918 -0
  50. cadjoint-0.1.0/cadjoint/fem/motion.py +201 -0
  51. cadjoint-0.1.0/cadjoint/fem/postprocess.py +204 -0
  52. cadjoint-0.1.0/cadjoint/fem/properties.py +364 -0
  53. cadjoint-0.1.0/cadjoint/fem/quality.py +131 -0
  54. cadjoint-0.1.0/cadjoint/fem/render_payload.py +156 -0
  55. cadjoint-0.1.0/cadjoint/fem/result.py +260 -0
  56. cadjoint-0.1.0/cadjoint/fem/rungs.py +365 -0
  57. cadjoint-0.1.0/cadjoint/fem/simmesh.py +483 -0
  58. cadjoint-0.1.0/cadjoint/fem/simulate.py +255 -0
  59. cadjoint-0.1.0/cadjoint/fem/study.py +782 -0
  60. cadjoint-0.1.0/cadjoint/fem/tesseracts/__init__.py +1 -0
  61. cadjoint-0.1.0/cadjoint/fem/tesseracts/chain.py +851 -0
  62. cadjoint-0.1.0/cadjoint/fem/tesseracts/elastic_calculix/__init__.py +1 -0
  63. cadjoint-0.1.0/cadjoint/fem/tesseracts/elastic_calculix/tesseract_api.py +172 -0
  64. cadjoint-0.1.0/cadjoint/fem/tesseracts/elastic_calculix/tesseract_config.yaml +33 -0
  65. cadjoint-0.1.0/cadjoint/fem/tesseracts/elastic_calculix/tesseract_environment.yaml +27 -0
  66. cadjoint-0.1.0/cadjoint/fem/tesseracts/elastic_jaxfem/__init__.py +1 -0
  67. cadjoint-0.1.0/cadjoint/fem/tesseracts/elastic_jaxfem/tesseract_api.py +275 -0
  68. cadjoint-0.1.0/cadjoint/fem/tesseracts/elastic_jaxfem/tesseract_config.yaml +25 -0
  69. cadjoint-0.1.0/cadjoint/fem/tesseracts/elastic_jaxfem/tesseract_environment.yaml +40 -0
  70. cadjoint-0.1.0/cadjoint/fem/tesseracts/flow_brinkman/__init__.py +1 -0
  71. cadjoint-0.1.0/cadjoint/fem/tesseracts/flow_brinkman/tesseract_api.py +249 -0
  72. cadjoint-0.1.0/cadjoint/fem/tesseracts/flow_brinkman/tesseract_config.yaml +19 -0
  73. cadjoint-0.1.0/cadjoint/fem/tesseracts/flow_brinkman/tesseract_requirements.txt +12 -0
  74. cadjoint-0.1.0/cadjoint/fem/tesseracts/mesher/__init__.py +1 -0
  75. cadjoint-0.1.0/cadjoint/fem/tesseracts/mesher/tesseract_api.py +298 -0
  76. cadjoint-0.1.0/cadjoint/fem/tesseracts/mesher/tesseract_config.yaml +18 -0
  77. cadjoint-0.1.0/cadjoint/fem/tesseracts/mesher/tesseract_requirements.txt +14 -0
  78. cadjoint-0.1.0/cadjoint/fem/tesseracts/tet_gmsh/__init__.py +1 -0
  79. cadjoint-0.1.0/cadjoint/fem/tesseracts/tet_gmsh/tesseract_api.py +286 -0
  80. cadjoint-0.1.0/cadjoint/fem/tesseracts/tet_gmsh/tesseract_config.yaml +22 -0
  81. cadjoint-0.1.0/cadjoint/fem/tesseracts/tet_gmsh/tesseract_requirements.txt +19 -0
  82. cadjoint-0.1.0/cadjoint/fem/tesseracts/tetfill/__init__.py +1 -0
  83. cadjoint-0.1.0/cadjoint/fem/tesseracts/tetfill/tesseract_api.py +287 -0
  84. cadjoint-0.1.0/cadjoint/fem/tesseracts/tetfill/tesseract_config.yaml +20 -0
  85. cadjoint-0.1.0/cadjoint/fem/tesseracts/tetfill/tesseract_requirements.txt +14 -0
  86. cadjoint-0.1.0/cadjoint/fem/tesseracts/thermal_jaxfem/__init__.py +1 -0
  87. cadjoint-0.1.0/cadjoint/fem/tesseracts/thermal_jaxfem/tesseract_api.py +234 -0
  88. cadjoint-0.1.0/cadjoint/fem/tesseracts/thermal_jaxfem/tesseract_config.yaml +27 -0
  89. cadjoint-0.1.0/cadjoint/fem/tesseracts/thermal_jaxfem/tesseract_environment.yaml +40 -0
  90. cadjoint-0.1.0/cadjoint/fem/tetmesh.py +752 -0
  91. cadjoint-0.1.0/cadjoint/flow/__init__.py +168 -0
  92. cadjoint-0.1.0/cadjoint/flow/domain.py +217 -0
  93. cadjoint-0.1.0/cadjoint/flow/energy.py +697 -0
  94. cadjoint-0.1.0/cadjoint/flow/lattice.py +114 -0
  95. cadjoint-0.1.0/cadjoint/flow/lbm.py +306 -0
  96. cadjoint-0.1.0/cadjoint/flow/objectives.py +93 -0
  97. cadjoint-0.1.0/cadjoint/flow/precision.py +80 -0
  98. cadjoint-0.1.0/cadjoint/flow/regions.py +90 -0
  99. cadjoint-0.1.0/cadjoint/flow/solver.py +275 -0
  100. cadjoint-0.1.0/cadjoint/flow/steady.py +297 -0
  101. cadjoint-0.1.0/cadjoint/flow/study.py +1024 -0
  102. cadjoint-0.1.0/cadjoint/fluent.py +72 -0
  103. cadjoint-0.1.0/cadjoint/functionalize.py +496 -0
  104. cadjoint-0.1.0/cadjoint/geometry/__init__.py +32 -0
  105. cadjoint-0.1.0/cadjoint/geometry/parameters.py +287 -0
  106. cadjoint-0.1.0/cadjoint/geometry/vectors.py +37 -0
  107. cadjoint-0.1.0/cadjoint/materials.py +309 -0
  108. cadjoint-0.1.0/cadjoint/meshing/__init__.py +136 -0
  109. cadjoint-0.1.0/cadjoint/meshing/_lattice.py +30 -0
  110. cadjoint-0.1.0/cadjoint/meshing/adaptive.py +234 -0
  111. cadjoint-0.1.0/cadjoint/meshing/bounds.py +136 -0
  112. cadjoint-0.1.0/cadjoint/meshing/diagnostics.py +345 -0
  113. cadjoint-0.1.0/cadjoint/meshing/dual_contouring.py +423 -0
  114. cadjoint-0.1.0/cadjoint/meshing/edge_detection.py +395 -0
  115. cadjoint-0.1.0/cadjoint/meshing/export.py +584 -0
  116. cadjoint-0.1.0/cadjoint/meshing/features.py +506 -0
  117. cadjoint-0.1.0/cadjoint/meshing/patch_fields.py +194 -0
  118. cadjoint-0.1.0/cadjoint/meshing/simplify.py +394 -0
  119. cadjoint-0.1.0/cadjoint/optimize.py +1114 -0
  120. cadjoint-0.1.0/cadjoint/parametrization.py +231 -0
  121. cadjoint-0.1.0/cadjoint/plugins/__init__.py +155 -0
  122. cadjoint-0.1.0/cadjoint/plugins/contracts.py +571 -0
  123. cadjoint-0.1.0/cadjoint/plugins/plugin.py +637 -0
  124. cadjoint-0.1.0/cadjoint/plugins/registry.py +509 -0
  125. cadjoint-0.1.0/cadjoint/plugins/spec.py +361 -0
  126. cadjoint-0.1.0/cadjoint/render/__init__.py +33 -0
  127. cadjoint-0.1.0/cadjoint/render/_plotting.py +20 -0
  128. cadjoint-0.1.0/cadjoint/render/material.py +373 -0
  129. cadjoint-0.1.0/cadjoint/render/overlay.py +149 -0
  130. cadjoint-0.1.0/cadjoint/render/raymarch/__init__.py +51 -0
  131. cadjoint-0.1.0/cadjoint/render/raymarch/_constants.py +13 -0
  132. cadjoint-0.1.0/cadjoint/render/raymarch/camera.py +52 -0
  133. cadjoint-0.1.0/cadjoint/render/raymarch/env.py +89 -0
  134. cadjoint-0.1.0/cadjoint/render/raymarch/render.py +518 -0
  135. cadjoint-0.1.0/cadjoint/render/raymarch/shade.py +208 -0
  136. cadjoint-0.1.0/cadjoint/render/raymarch/surface.py +14 -0
  137. cadjoint-0.1.0/cadjoint/render/raymarch/trace.py +156 -0
  138. cadjoint-0.1.0/cadjoint/render/scene.py +31 -0
  139. cadjoint-0.1.0/cadjoint/render/settings.py +99 -0
  140. cadjoint-0.1.0/cadjoint/sdf/__init__.py +99 -0
  141. cadjoint-0.1.0/cadjoint/sdf/_lowering.py +466 -0
  142. cadjoint-0.1.0/cadjoint/sdf/base.py +277 -0
  143. cadjoint-0.1.0/cadjoint/sdf/boolean/__init__.py +24 -0
  144. cadjoint-0.1.0/cadjoint/sdf/boolean/base.py +163 -0
  145. cadjoint-0.1.0/cadjoint/sdf/boolean/difference.py +104 -0
  146. cadjoint-0.1.0/cadjoint/sdf/boolean/intersection.py +96 -0
  147. cadjoint-0.1.0/cadjoint/sdf/boolean/smooth.py +76 -0
  148. cadjoint-0.1.0/cadjoint/sdf/boolean/union.py +92 -0
  149. cadjoint-0.1.0/cadjoint/sdf/boolean/xor.py +57 -0
  150. cadjoint-0.1.0/cadjoint/sdf/measure/__init__.py +6 -0
  151. cadjoint-0.1.0/cadjoint/sdf/measure/mass.py +97 -0
  152. cadjoint-0.1.0/cadjoint/sdf/measure/volume.py +46 -0
  153. cadjoint-0.1.0/cadjoint/sdf/primitives/__init__.py +27 -0
  154. cadjoint-0.1.0/cadjoint/sdf/primitives/base.py +23 -0
  155. cadjoint-0.1.0/cadjoint/sdf/primitives/box.py +81 -0
  156. cadjoint-0.1.0/cadjoint/sdf/primitives/capsule.py +59 -0
  157. cadjoint-0.1.0/cadjoint/sdf/primitives/cylinder.py +77 -0
  158. cadjoint-0.1.0/cadjoint/sdf/primitives/loft.py +358 -0
  159. cadjoint-0.1.0/cadjoint/sdf/primitives/plane.py +56 -0
  160. cadjoint-0.1.0/cadjoint/sdf/primitives/polygon.py +536 -0
  161. cadjoint-0.1.0/cadjoint/sdf/primitives/round_box.py +60 -0
  162. cadjoint-0.1.0/cadjoint/sdf/primitives/sphere.py +84 -0
  163. cadjoint-0.1.0/cadjoint/sdf/primitives/torus.py +57 -0
  164. cadjoint-0.1.0/cadjoint/sdf/transforms/__init__.py +6 -0
  165. cadjoint-0.1.0/cadjoint/sdf/transforms/_operation.py +72 -0
  166. cadjoint-0.1.0/cadjoint/sdf/transforms/affine/__init__.py +7 -0
  167. cadjoint-0.1.0/cadjoint/sdf/transforms/affine/rotate.py +97 -0
  168. cadjoint-0.1.0/cadjoint/sdf/transforms/affine/scale.py +88 -0
  169. cadjoint-0.1.0/cadjoint/sdf/transforms/affine/translate.py +68 -0
  170. cadjoint-0.1.0/cadjoint/sdf/transforms/base.py +25 -0
  171. cadjoint-0.1.0/cadjoint/sdf/transforms/deformations/__init__.py +5 -0
  172. cadjoint-0.1.0/cadjoint/sdf/transforms/deformations/twist.py +87 -0
  173. cadjoint-0.1.0/cadjoint/sdf/transforms/fields.py +239 -0
  174. cadjoint-0.1.0/cadjoint/sdf/transforms/patterns.py +473 -0
  175. cadjoint-0.1.0/cadjoint/studies/__init__.py +49 -0
  176. cadjoint-0.1.0/cadjoint/studies/_validate.py +35 -0
  177. cadjoint-0.1.0/cadjoint/studies/capture.py +71 -0
  178. cadjoint-0.1.0/cadjoint/studies/selection.py +517 -0
  179. cadjoint-0.1.0/cadjoint/tier.py +311 -0
  180. cadjoint-0.1.0/cadjoint/viewer/__init__.py +16 -0
  181. cadjoint-0.1.0/cadjoint/viewer/_camera_wgsl.py +86 -0
  182. cadjoint-0.1.0/cadjoint/viewer/_edge_overlay.py +870 -0
  183. cadjoint-0.1.0/cadjoint/viewer/_example_scene.py +337 -0
  184. cadjoint-0.1.0/cadjoint/viewer/_http.py +242 -0
  185. cadjoint-0.1.0/cadjoint/viewer/_intelligence.py +722 -0
  186. cadjoint-0.1.0/cadjoint/viewer/_jobs.py +705 -0
  187. cadjoint-0.1.0/cadjoint/viewer/_limits.py +27 -0
  188. cadjoint-0.1.0/cadjoint/viewer/_overlay_refresh.py +193 -0
  189. cadjoint-0.1.0/cadjoint/viewer/_patch_requests.py +914 -0
  190. cadjoint-0.1.0/cadjoint/viewer/_pathtracer.py +656 -0
  191. cadjoint-0.1.0/cadjoint/viewer/_scenes.py +346 -0
  192. cadjoint-0.1.0/cadjoint/viewer/_webgpu.py +939 -0
  193. cadjoint-0.1.0/cadjoint/viewer/_worker_client.py +607 -0
  194. cadjoint-0.1.0/cadjoint/viewer/patch/__init__.py +173 -0
  195. cadjoint-0.1.0/cadjoint/viewer/patch/constraints.py +295 -0
  196. cadjoint-0.1.0/cadjoint/viewer/patch/edits.py +228 -0
  197. cadjoint-0.1.0/cadjoint/viewer/patch/errors.py +16 -0
  198. cadjoint-0.1.0/cadjoint/viewer/patch/format.py +140 -0
  199. cadjoint-0.1.0/cadjoint/viewer/patch/geometry.py +518 -0
  200. cadjoint-0.1.0/cadjoint/viewer/patch/materials.py +561 -0
  201. cadjoint-0.1.0/cadjoint/viewer/patch/meshes.py +186 -0
  202. cadjoint-0.1.0/cadjoint/viewer/patch/optimizations.py +92 -0
  203. cadjoint-0.1.0/cadjoint/viewer/patch/parameters.py +62 -0
  204. cadjoint-0.1.0/cadjoint/viewer/patch/resolvers.py +278 -0
  205. cadjoint-0.1.0/cadjoint/viewer/patch/scene.py +127 -0
  206. cadjoint-0.1.0/cadjoint/viewer/patch/sketch.py +553 -0
  207. cadjoint-0.1.0/cadjoint/viewer/patch/studies.py +558 -0
  208. cadjoint-0.1.0/cadjoint/viewer/playground.py +586 -0
  209. cadjoint-0.1.0/cadjoint/viewer/schema/__init__.py +90 -0
  210. cadjoint-0.1.0/cadjoint/viewer/schema/emit.py +256 -0
  211. cadjoint-0.1.0/cadjoint/viewer/schema/payloads.d.ts +873 -0
  212. cadjoint-0.1.0/cadjoint/viewer/schema/payloads.py +589 -0
  213. cadjoint-0.1.0/cadjoint/viewer/schema/requests.py +482 -0
  214. cadjoint-0.1.0/cadjoint/viewer/source_map/__init__.py +138 -0
  215. cadjoint-0.1.0/cadjoint/viewer/source_map/calls.py +178 -0
  216. cadjoint-0.1.0/cadjoint/viewer/source_map/capture.py +64 -0
  217. cadjoint-0.1.0/cadjoint/viewer/source_map/constraints.py +179 -0
  218. cadjoint-0.1.0/cadjoint/viewer/source_map/declarations.py +349 -0
  219. cadjoint-0.1.0/cadjoint/viewer/source_map/elements.py +489 -0
  220. cadjoint-0.1.0/cadjoint/viewer/source_map/features.py +216 -0
  221. cadjoint-0.1.0/cadjoint/viewer/source_map/identity.py +541 -0
  222. cadjoint-0.1.0/cadjoint/viewer/source_map/materials.py +158 -0
  223. cadjoint-0.1.0/cadjoint/viewer/source_map/nodes.py +273 -0
  224. cadjoint-0.1.0/cadjoint/viewer/source_map/parameters.py +109 -0
  225. cadjoint-0.1.0/cadjoint/viewer/source_map/payload.py +575 -0
  226. cadjoint-0.1.0/cadjoint/viewer/static/assets/index-Wg5bw0AO.js +787 -0
  227. cadjoint-0.1.0/cadjoint/viewer/static/assets/index-mniljhS-.css +1 -0
  228. cadjoint-0.1.0/cadjoint/viewer/static/index.html +14 -0
  229. cadjoint-0.1.0/cadjoint/viewer/widget.py +384 -0
  230. cadjoint-0.1.0/cadjoint/viewer/worker/__init__.py +23 -0
  231. cadjoint-0.1.0/cadjoint/viewer/worker/__main__.py +7 -0
  232. cadjoint-0.1.0/cadjoint/viewer/worker/declarations.py +208 -0
  233. cadjoint-0.1.0/cadjoint/viewer/worker/export.py +364 -0
  234. cadjoint-0.1.0/cadjoint/viewer/worker/fem.py +172 -0
  235. cadjoint-0.1.0/cadjoint/viewer/worker/main.py +417 -0
  236. cadjoint-0.1.0/cadjoint/viewer/worker/optimize.py +157 -0
  237. cadjoint-0.1.0/cadjoint/viewer/worker/payloads.py +127 -0
  238. cadjoint-0.1.0/cadjoint/viewer/worker/protocol.py +20 -0
  239. cadjoint-0.1.0/cadjoint/viewer/worker/scene.py +91 -0
  240. cadjoint-0.1.0/cadjoint/zeroset/__init__.py +14 -0
  241. cadjoint-0.1.0/cadjoint/zeroset/bounds.py +373 -0
  242. cadjoint-0.1.0/cadjoint/zeroset/evaluate.py +343 -0
  243. cadjoint-0.1.0/cadjoint/zeroset/gpu.py +389 -0
  244. cadjoint-0.1.0/cadjoint/zeroset/project.py +468 -0
  245. cadjoint-0.1.0/cadjoint/zeroset/refresh.py +141 -0
  246. cadjoint-0.1.0/cadjoint/zeroset/table.py +553 -0
  247. cadjoint-0.1.0/cadjoint/zeroset/wgsl.py +378 -0
  248. cadjoint-0.1.0/cadjoint.egg-info/PKG-INFO +300 -0
  249. cadjoint-0.1.0/cadjoint.egg-info/SOURCES.txt +265 -0
  250. cadjoint-0.1.0/cadjoint.egg-info/dependency_links.txt +1 -0
  251. cadjoint-0.1.0/cadjoint.egg-info/entry_points.txt +2 -0
  252. cadjoint-0.1.0/cadjoint.egg-info/requires.txt +48 -0
  253. cadjoint-0.1.0/cadjoint.egg-info/top_level.txt +1 -0
  254. cadjoint-0.1.0/pyproject.toml +205 -0
  255. cadjoint-0.1.0/setup.cfg +4 -0
  256. cadjoint-0.1.0/tests/test_backends.py +345 -0
  257. cadjoint-0.1.0/tests/test_cache.py +155 -0
  258. cadjoint-0.1.0/tests/test_compiled_fields.py +164 -0
  259. cadjoint-0.1.0/tests/test_enums.py +479 -0
  260. cadjoint-0.1.0/tests/test_extraction.py +71 -0
  261. cadjoint-0.1.0/tests/test_functionalize.py +254 -0
  262. cadjoint-0.1.0/tests/test_integration_e2e.py +90 -0
  263. cadjoint-0.1.0/tests/test_materials.py +222 -0
  264. cadjoint-0.1.0/tests/test_optimize.py +763 -0
  265. cadjoint-0.1.0/tests/test_packaging.py +43 -0
  266. cadjoint-0.1.0/tests/test_playground.py +1479 -0
  267. cadjoint-0.1.0/tests/test_wgsl_scene_codegen.py +134 -0
cadjoint-0.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,300 @@
1
+ Metadata-Version: 2.4
2
+ Name: cadjoint
3
+ Version: 0.1.0
4
+ Summary: Fully differentiable CAD software built with JAX
5
+ Author: Andrin Rehmann
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/andrinr/cadjoint
8
+ Project-URL: Documentation, https://andrinr.github.io/cadjoint/
9
+ Project-URL: Source, https://github.com/andrinr/cadjoint
10
+ Project-URL: Issues, https://github.com/andrinr/cadjoint/issues
11
+ Keywords: cad,jax,sdf,differentiable,optimization,fem
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Scientific/Engineering
21
+ Classifier: Topic :: Scientific/Engineering :: Physics
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: imageio>=2.37.2
26
+ Requires-Dist: jax>=0.4.20
27
+ Requires-Dist: numpy>=1.24.0
28
+ Requires-Dist: optax>=0.2.4
29
+ Requires-Dist: optimistix>=0.0.10
30
+ Provides-Extra: cuda
31
+ Requires-Dist: jax[cuda12]>=0.4.20; extra == "cuda"
32
+ Provides-Extra: fem
33
+ Requires-Dist: jax-fem; extra == "fem"
34
+ Requires-Dist: fenics-basix; extra == "fem"
35
+ Requires-Dist: meshio; extra == "fem"
36
+ Requires-Dist: gmsh; extra == "fem"
37
+ Requires-Dist: petsc4py; extra == "fem"
38
+ Requires-Dist: pyfiglet; extra == "fem"
39
+ Requires-Dist: scipy; extra == "fem"
40
+ Provides-Extra: tesseract
41
+ Requires-Dist: tesseract-core[runtime]; extra == "tesseract"
42
+ Requires-Dist: tesseract-jax; extra == "tesseract"
43
+ Provides-Extra: gmsh
44
+ Requires-Dist: gmsh; extra == "gmsh"
45
+ Provides-Extra: stepcheck
46
+ Requires-Dist: cadquery-ocp; python_version < "3.15" and extra == "stepcheck"
47
+ Provides-Extra: viewer
48
+ Requires-Dist: anywidget>=0.9.21; extra == "viewer"
49
+ Requires-Dist: psutil>=5.9; extra == "viewer"
50
+ Requires-Dist: pydantic>=2; extra == "viewer"
51
+ Provides-Extra: editor
52
+ Requires-Dist: jedi>=0.19.0; extra == "editor"
53
+ Requires-Dist: ruff>=0.8.0; extra == "editor"
54
+ Provides-Extra: dev
55
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
56
+ Requires-Dist: pytest-xdist>=3.5; extra == "dev"
57
+ Requires-Dist: pre-commit>=3.0.0; extra == "dev"
58
+ Requires-Dist: matplotlib>=3.7.0; extra == "dev"
59
+ Provides-Extra: docs
60
+ Requires-Dist: quartodoc>=0.7; extra == "docs"
61
+ Requires-Dist: griffe<1.0; extra == "docs"
62
+ Dynamic: license-file
63
+
64
+ # cadjoint
65
+
66
+ Differentiable code-first CAD: sketches, constraints, SDF geometry, meshing and
67
+ FEM simulation composed into one function JAX can differentiate end to end.
68
+
69
+ > [!WARNING]
70
+ > The API is not stable. Expect breaking changes.
71
+
72
+ [![The bracket scene in the cadjoint playground: with the pointer in vertex selection, the tip of the bracket's triangular gusset rib is dragged up the vertical web. The rib re-attaches where the pointer puts it and the smooth union re-blends the joint at frame rate while the plate and web stay put; the editor on the left holds the highlighted line rib_tip = Vector2(value=[-0.9, -0.62], free=True, ...). Then the camera makes one full turn around the bracket.](https://raw.githubusercontent.com/andrinr/cadjoint/main/docs/assets/motion/bracket-orbit-drag.webp)](https://andrinr.github.io/cadjoint/docs/viewer.html)
73
+
74
+ *The handle under the pointer is a named `Vector2` in `scene.py`, and the
75
+ joint it moves is a smooth union of three extrusions. Dragging it writes the
76
+ parameter buffer the shader already reads, so the blend follows at frame
77
+ rate; releasing it patches the literal in the source. The source is the
78
+ model.*
79
+
80
+ ## The chain
81
+
82
+ One Python program declares the whole thing, and every arrow is a derivative
83
+ JAX can take:
84
+
85
+ ```
86
+ sketch vertices ─► constraints ─► SDF ─► mesh ─► FEM solve ─► objective
87
+ └─────────────────────────── ∂J/∂θ ◄───────────────────────────┘
88
+ ```
89
+
90
+ A sketch profile is a list of named `Vector2` parameters. Constraints are
91
+ residuals on those parameters, solved by Newton projection onto the constraint
92
+ manifold. Extruding or revolving the profile produces an SDF that *shares* those
93
+ parameter objects. Dual contouring turns the field into a surface, TetGen or
94
+ Gmsh fills it, and jax-fem or CalculiX solves on it. A study is declared in the
95
+ scene beside the geometry it loads — here the end cap's `ThermalStudy`, a heat
96
+ flux on the bearing boss and a fixed temperature on the flange — and solving it
97
+ is one click, meshing included:
98
+
99
+ [![The end cap's cap-conduction thermal study is run from the Simulate panel. Its mesh is declared as cut cells, so no volume mesh is built: the job chip counts up while the lattice's cut cells are assembled and solved, then the temperature field lands on the solid with its legend, and the part is turned with the field on it.](https://raw.githubusercontent.com/andrinr/cadjoint/main/docs/assets/motion/end-cap-solve.webp)](https://github.com/andrinr/cadjoint/blob/main/scenes/end_cap.py)
100
+
101
+ The same study is a function of the sketch, so `jax.grad` reaches from its
102
+ objective back to a fin's tip coordinate. An `Optimization` declared in the
103
+ scene descends on that gradient, every step a mesh, a solve and an adjoint,
104
+ projected back onto the constraints. The heat sink below starts deliberately
105
+ overbuilt and slims as its peak temperature falls:
106
+
107
+ [![The heat sink's cool-sink optimisation is run from the Optimize panel. Eight gradient steps, each a mesh, a thermal solve and an adjoint, replayed as a time-lapse: the fin comb reproportions as the peak temperature falls in the panel's trace.](https://raw.githubusercontent.com/andrinr/cadjoint/main/docs/assets/motion/heat-sink-optimize.webp)](https://github.com/andrinr/cadjoint/blob/main/scenes/starter.py)
108
+
109
+ A work plane taken from a face (`SketchPlane.on(body.cap("+"))`) is an
110
+ expression over the parent feature's parameters, so a boss extruded from it
111
+ differentiates with respect to its parent's depth. While sketching, the plane
112
+ of the sketch you touch is drawn with its origin and normal (every plane, in
113
+ every mode, is one switch away); the sketch tool shows where a new one will
114
+ land before it exists, and a plane written as literals can be taken by its
115
+ frame and moved, which rewrites the `SketchPlane(origin=...)` in the source:
116
+
117
+ [![The heat sink in the playground, switched to Sketch mode: no plane is drawn yet. The sketch tool is armed and a ghost frame labelled new sketch follows the pointer across the floor. Then the pointer lands on one of the fin comb's handles and the comb's plane appears — a translucent frame, an origin cross and a normal glyph, named — and stays once the handle is clicked; the plane is taken by its frame edge, the gizmo appears at its origin, and dragging the gizmo's Z arrow lifts the whole comb; the editor's SketchPlane(origin=[...]) literal is rewritten on release.](https://raw.githubusercontent.com/andrinr/cadjoint/main/docs/assets/motion/sketch-planes.webp)](https://github.com/andrinr/cadjoint/blob/main/scenes/starter.py)
118
+
119
+ No boundary representation is stored: the field is the model, and every
120
+ surface is derived from it at a resolution you choose.
121
+
122
+ ## What ships
123
+
124
+ - **Geometry** — SDF primitives, smooth booleans, transforms, patterns;
125
+ sketches on work planes extruded, revolved or lofted into solids that share
126
+ their parameters; reference planes taken from faces, offsets and midplanes
127
+ - **Constraints** — distance, angle, coincident, horizontal, vertical,
128
+ parallel, perpendicular, equal-length, point-on-line, fixed
129
+ - **Materials** — a sourced catalogue carrying density, conductivity, elastic
130
+ constants and yield strength in SI, sampled per element by the solver
131
+ - **Meshing** — dual contouring with sharp-feature vertices; TET4/TET10 through
132
+ TetGen, second-order tets through Gmsh, or a voxelize-and-snap HEX8 path;
133
+ OBJ, STL and faceted STEP export
134
+ - **Simulation** — thermal and linear-elastic studies with programmatic node
135
+ selections, solved by jax-fem or CalculiX 2.23; a lattice-Boltzmann flow
136
+ prototype
137
+ - **Optimization** — declared in the scene, descended with optax, every step
138
+ projected back onto the constraints
139
+ - **Plugins** — every non-JAX component (meshers, solvers) is a
140
+ [Tesseract](https://github.com/pasteurlabs/tesseract-core) behind one
141
+ `apply`/`vjp` interface, run in-process, in a container or remotely
142
+ - **Rendering** — a forward raymarcher in JAX, and a StableHLO → WGSL shader
143
+ compiler for the browser
144
+ - **Playground** — a WebGPU app where every edit rewrites the Python source
145
+ that produced it
146
+
147
+ ## Install
148
+
149
+ ```bash
150
+ pip install cadjoint # pin an exact version: the API is not stable
151
+ ```
152
+
153
+ From a checkout:
154
+
155
+ ```bash
156
+ git clone https://github.com/andrinr/cadjoint
157
+ cd cadjoint
158
+ uv sync # CPU JAX — macOS, Linux, Windows
159
+ uv sync --extra cuda # Linux + NVIDIA GPU instead
160
+ ```
161
+
162
+ Everything beyond the geometry core is an extra, one `--extra` per name:
163
+
164
+ | Extra | Pulls in |
165
+ | --- | --- |
166
+ | `fem` | jax-fem finite-element stack (basix, meshio, petsc4py, gmsh) |
167
+ | `tesseract` | tesseract-core + tesseract-jax, the plugin runtime |
168
+ | `gmsh` | Gmsh in-process for the tet10 mesher (GPL, hence its own extra) |
169
+ | `viewer` | Jupyter widget (`anywidget`) and the playground's process monitor (`psutil`) |
170
+ | `editor` | playground lint, completion and signature help (`ruff`, `jedi`) |
171
+ | `stepcheck` | OCCT validation of STEP exports (dev) |
172
+ | `docs` | Quarto API reference (`quartodoc`) |
173
+
174
+ Avoid `--all-extras` on macOS: `cuda` has no macOS wheels.
175
+
176
+ `fem` is the one extra that compiles. petsc4py publishes no wheels, so
177
+ `uv sync --extra fem` builds PETSc from source and needs a C compiler,
178
+ gfortran and BLAS/LAPACK headers (`apt install build-essential gfortran
179
+ libopenblas-dev` on Debian/Ubuntu). To skip the toolchain, run the solvers
180
+ as Tesseracts: their images get PETSc from conda-forge and are published
181
+ prebuilt to GHCR for amd64 and arm64, so Docker is the only requirement
182
+ (see [prebuilt images](https://andrinr.github.io/cadjoint/docs/plugins.html#prebuilt-images)).
183
+
184
+ ### Supported platforms
185
+
186
+ | Platform | `uv sync` | `uv sync --extra fem` |
187
+ | --- | --- | --- |
188
+ | Linux x86_64 | yes | compiles PETSc |
189
+ | Linux ARM64 | yes | no: gmsh has no Linux ARM wheel |
190
+ | macOS arm64 | yes | compiles PETSc |
191
+ | macOS x86_64 (Intel) | no: jaxlib has no Intel-Mac wheel for Python 3.11+ | no |
192
+ | Windows x86_64 | yes | no: PETSc does not build natively |
193
+
194
+ Every "yes" is a fresh `uv sync --locked` and `import cadjoint` in
195
+ [`install.yml`](https://github.com/andrinr/cadjoint/blob/main/.github/workflows/install.yml), run on each push. Where
196
+ the `fem` column says no, the prebuilt solver Tesseracts above run the
197
+ same solvers in Docker.
198
+
199
+ ## The playground
200
+
201
+ ```bash
202
+ uv run cadjoint-viewer --open # serves http://127.0.0.1:8765/
203
+ ```
204
+
205
+ The editor on the left holds `scene.py`; the viewport shows the compiled
206
+ field. Vertex handles, gizmos, material swatches, face picks, constraint chips
207
+ and solver runs all write back into the source. A properties window follows
208
+ the selection and shows every argument the call was written with: literals
209
+ as fields you can edit, expressions as the text they are.
210
+
211
+ [![The properties window in the playground. Clicking the fin comb's extrude row in the object tree fills the window with the call's arguments: the profile, the depth, which is the named parameter fin_depth, and the material. Typing a new depth and pressing Enter rewrites fin_depth's declaration in the editor and the comb deepens; choosing copper from the material dropdown rewrites the extrude call and the comb changes colour.](https://raw.githubusercontent.com/andrinr/cadjoint/main/docs/assets/motion/properties-window.webp)](https://github.com/andrinr/cadjoint/blob/main/scenes/starter.py)
212
+
213
+ Three desks, Model, Sketch and Simulate, share one viewport. Studies solve
214
+ with one click, results land in a labelled legend, and a declared
215
+ optimization streams step by step and writes its optimized values into the
216
+ program.
217
+
218
+ The server only listens on localhost and compiles each edit in a timed child
219
+ process, but it executes Python on your machine: only run code you trust.
220
+
221
+ The [playground guide](https://andrinr.github.io/cadjoint/docs/viewer.html)
222
+ walks through every window with recorded clips.
223
+
224
+ ## In Python
225
+
226
+ ```python
227
+ from cadjoint.construction import PolygonProfile, SketchPlane, extrude
228
+ from cadjoint.constraints import DistanceConstraint, satisfy_constraints
229
+ from cadjoint.geometry import Scalar, Vector2
230
+ from cadjoint.meshing import GridSpec, extract_mesh
231
+
232
+ a = Vector2([0.0, 0.0], free=True, name="a")
233
+ b = Vector2([1.0, 0.0], free=True, name="b")
234
+ c = Vector2([1.0, 1.0], free=True, name="c")
235
+ d = Vector2([0.0, 1.0], free=True, name="d")
236
+ DistanceConstraint(a, b, 1.2)
237
+
238
+ depth = Scalar(0.5, free=True, name="depth")
239
+ block = extrude(PolygonProfile([a, b, c, d], plane=SketchPlane()), depth=depth)
240
+ satisfy_constraints(block) # projects a and b onto the constraint, in place
241
+
242
+ grid = GridSpec.from_bounds((-0.5, -0.5, -0.5), (2.0, 2.0, 1.5), 32)
243
+ mesh = extract_mesh(block, grid)
244
+ ```
245
+
246
+ `functionalize(block)` returns a pure function of the free parameters, so
247
+ `jax.grad` of anything downstream reaches `a`, `b`, `c`, `d` and `depth`. The
248
+ [getting-started guide](https://andrinr.github.io/cadjoint/docs/getting-started.html)
249
+ continues from here to meshing, a thermal study and an optimization;
250
+ `examples/fem_bracket_optimization.py` runs the full chain from the command
251
+ line, with the adjoint checked against finite differences at every boundary.
252
+
253
+ ## Documentation
254
+
255
+ - [Getting started](https://andrinr.github.io/cadjoint/docs/getting-started.html)
256
+ - [Differentiable meshing](https://andrinr.github.io/cadjoint/docs/meshing.html),
257
+ [simulation](https://andrinr.github.io/cadjoint/docs/simulation.html),
258
+ [optimization](https://andrinr.github.io/cadjoint/docs/optimization.html),
259
+ [materials](https://andrinr.github.io/cadjoint/docs/materials.html)
260
+ - [Plugins](https://andrinr.github.io/cadjoint/docs/plugins.html): the Tesseract
261
+ contract, the shipped packages, containers and remote transports
262
+ - [Rendering](https://andrinr.github.io/cadjoint/docs/rendering.html) and the
263
+ [playground](https://andrinr.github.io/cadjoint/docs/viewer.html)
264
+ - [Research notes](https://github.com/andrinr/cadjoint/blob/main/research/README.md): design records for the meshing
265
+ pipeline, FEM integration, the flow solver, the constraint system, and the
266
+ measured [performance profile](https://github.com/andrinr/cadjoint/blob/main/research/performance.md)
267
+
268
+ ## Developing
269
+
270
+ ```bash
271
+ uv run pytest tests -q --ignore=tests/fem # fast gate
272
+ uv run pytest tests/fem -q # needs the fem extra; CalculiX via CADJOINT_CCX
273
+ uv run pre-commit install # ruff on commit
274
+ ```
275
+
276
+ The playground UI is a Solid + TypeScript app in `frontend/`, built into
277
+ `cadjoint/viewer/static` and committed, so installing cadjoint needs no Node
278
+ toolchain. `npm run dev` proxies to a running server, `npm run build` refreshes
279
+ the bundle, `npm test` and `npm run e2e` run the unit and Playwright suites.
280
+
281
+ Docs need [Quarto](https://quarto.org/docs/get-started/) and the `docs` extra:
282
+ `uv run quartodoc build` then `quarto preview`.
283
+
284
+ Performance work is measured, not guessed: `benchmarks/jax_compile_profile.py`
285
+ breaks a worker request into trace, lower, XLA compile and cache time per
286
+ program, and [`research/performance.md`](https://github.com/andrinr/cadjoint/blob/main/research/performance.md) records what
287
+ each lever bought.
288
+
289
+ ## History
290
+
291
+ cadjoint was an entry in the
292
+ [Tesseract Hackathon 2026](https://si-tesseract.discourse.group) (Track 01,
293
+ inverse design and shape optimization). That state is frozen on the
294
+ [`tesseract-hackathon-2026`](https://github.com/andrinr/cadjoint/tree/tesseract-hackathon-2026)
295
+ branch. Inspired by [Fidget](https://www.mattkeeter.com/projects/fidget/) and
296
+ [Inigo Quilez's distance functions](https://iquilezles.org/articles/distfunctions/).
297
+
298
+ ## License
299
+
300
+ [Apache License 2.0](https://github.com/andrinr/cadjoint/blob/main/LICENSE).