warp-lang 1.3.3__py3-none-macosx_10_13_universal2.whl → 1.4.0__py3-none-macosx_10_13_universal2.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.

Potentially problematic release.


This version of warp-lang might be problematic. Click here for more details.

Files changed (107) hide show
  1. warp/__init__.py +6 -0
  2. warp/autograd.py +59 -6
  3. warp/bin/libwarp-clang.dylib +0 -0
  4. warp/bin/libwarp.dylib +0 -0
  5. warp/build_dll.py +8 -10
  6. warp/builtins.py +126 -4
  7. warp/codegen.py +435 -53
  8. warp/config.py +1 -1
  9. warp/context.py +678 -403
  10. warp/dlpack.py +2 -0
  11. warp/examples/benchmarks/benchmark_cloth.py +10 -0
  12. warp/examples/core/example_render_opengl.py +12 -10
  13. warp/examples/fem/example_adaptive_grid.py +251 -0
  14. warp/examples/fem/example_apic_fluid.py +1 -1
  15. warp/examples/fem/example_diffusion_3d.py +2 -2
  16. warp/examples/fem/example_magnetostatics.py +1 -1
  17. warp/examples/fem/example_streamlines.py +1 -0
  18. warp/examples/fem/utils.py +23 -4
  19. warp/examples/sim/example_cloth.py +50 -6
  20. warp/fem/__init__.py +2 -0
  21. warp/fem/adaptivity.py +493 -0
  22. warp/fem/field/field.py +2 -1
  23. warp/fem/field/nodal_field.py +18 -26
  24. warp/fem/field/test.py +4 -4
  25. warp/fem/field/trial.py +4 -4
  26. warp/fem/geometry/__init__.py +1 -0
  27. warp/fem/geometry/adaptive_nanogrid.py +843 -0
  28. warp/fem/geometry/nanogrid.py +55 -28
  29. warp/fem/space/__init__.py +1 -1
  30. warp/fem/space/nanogrid_function_space.py +69 -35
  31. warp/fem/utils.py +113 -107
  32. warp/jax_experimental.py +28 -15
  33. warp/native/array.h +0 -1
  34. warp/native/builtin.h +103 -6
  35. warp/native/bvh.cu +2 -0
  36. warp/native/cuda_util.cpp +14 -0
  37. warp/native/cuda_util.h +2 -0
  38. warp/native/error.cpp +4 -2
  39. warp/native/exports.h +99 -17
  40. warp/native/mat.h +97 -0
  41. warp/native/mesh.cpp +36 -0
  42. warp/native/mesh.cu +51 -0
  43. warp/native/mesh.h +1 -0
  44. warp/native/quat.h +43 -0
  45. warp/native/spatial.h +6 -0
  46. warp/native/vec.h +74 -0
  47. warp/native/warp.cpp +2 -1
  48. warp/native/warp.cu +10 -3
  49. warp/native/warp.h +8 -1
  50. warp/paddle.py +382 -0
  51. warp/sim/__init__.py +1 -0
  52. warp/sim/collide.py +519 -0
  53. warp/sim/integrator_euler.py +18 -5
  54. warp/sim/integrator_featherstone.py +5 -5
  55. warp/sim/integrator_vbd.py +1026 -0
  56. warp/sim/model.py +49 -23
  57. warp/stubs.py +459 -0
  58. warp/tape.py +2 -0
  59. warp/tests/aux_test_dependent.py +1 -0
  60. warp/tests/aux_test_name_clash1.py +32 -0
  61. warp/tests/aux_test_name_clash2.py +32 -0
  62. warp/tests/aux_test_square.py +1 -0
  63. warp/tests/test_array.py +188 -0
  64. warp/tests/test_async.py +3 -3
  65. warp/tests/test_atomic.py +6 -0
  66. warp/tests/test_closest_point_edge_edge.py +93 -1
  67. warp/tests/test_codegen.py +62 -15
  68. warp/tests/test_codegen_instancing.py +1457 -0
  69. warp/tests/test_collision.py +486 -0
  70. warp/tests/test_compile_consts.py +3 -28
  71. warp/tests/test_dlpack.py +170 -0
  72. warp/tests/test_examples.py +22 -8
  73. warp/tests/test_fast_math.py +10 -4
  74. warp/tests/test_fem.py +64 -0
  75. warp/tests/test_func.py +46 -0
  76. warp/tests/test_implicit_init.py +49 -0
  77. warp/tests/test_jax.py +58 -0
  78. warp/tests/test_mat.py +84 -0
  79. warp/tests/test_mesh_query_point.py +188 -0
  80. warp/tests/test_module_hashing.py +40 -0
  81. warp/tests/test_multigpu.py +3 -3
  82. warp/tests/test_overwrite.py +8 -0
  83. warp/tests/test_paddle.py +852 -0
  84. warp/tests/test_print.py +89 -0
  85. warp/tests/test_quat.py +111 -0
  86. warp/tests/test_reload.py +31 -1
  87. warp/tests/test_scalar_ops.py +2 -0
  88. warp/tests/test_static.py +412 -0
  89. warp/tests/test_streams.py +64 -3
  90. warp/tests/test_struct.py +4 -4
  91. warp/tests/test_torch.py +24 -0
  92. warp/tests/test_triangle_closest_point.py +137 -0
  93. warp/tests/test_types.py +1 -1
  94. warp/tests/test_vbd.py +386 -0
  95. warp/tests/test_vec.py +143 -0
  96. warp/tests/test_vec_scalar_ops.py +139 -0
  97. warp/tests/unittest_suites.py +12 -0
  98. warp/tests/unittest_utils.py +9 -5
  99. warp/thirdparty/dlpack.py +3 -1
  100. warp/types.py +150 -28
  101. warp/utils.py +37 -14
  102. {warp_lang-1.3.3.dist-info → warp_lang-1.4.0.dist-info}/METADATA +10 -8
  103. {warp_lang-1.3.3.dist-info → warp_lang-1.4.0.dist-info}/RECORD +106 -94
  104. warp/tests/test_point_triangle_closest_point.py +0 -143
  105. {warp_lang-1.3.3.dist-info → warp_lang-1.4.0.dist-info}/LICENSE.md +0 -0
  106. {warp_lang-1.3.3.dist-info → warp_lang-1.4.0.dist-info}/WHEEL +0 -0
  107. {warp_lang-1.3.3.dist-info → warp_lang-1.4.0.dist-info}/top_level.txt +0 -0
@@ -1,143 +0,0 @@
1
- # Copyright (c) 2024 NVIDIA CORPORATION. All rights reserved.
2
- # NVIDIA CORPORATION and its licensors retain all intellectual property
3
- # and proprietary rights in and to this software, related documentation
4
- # and any modifications thereto. Any use, reproduction, disclosure or
5
- # distribution of this software and related documentation without an express
6
- # license agreement from NVIDIA CORPORATION is strictly prohibited.
7
-
8
- import unittest
9
-
10
- from warp.sim.collide import triangle_closest_point_barycentric
11
- from warp.tests.unittest_utils import *
12
-
13
-
14
- # a-b is the edge where the closest point is located at
15
- @wp.func
16
- def check_edge_feasible_region(p: wp.vec3, a: wp.vec3, b: wp.vec3, c: wp.vec3, eps: float):
17
- ap = p - a
18
- bp = p - b
19
- ab = b - a
20
-
21
- if wp.dot(ap, ab) < -eps:
22
- return False
23
-
24
- if wp.dot(bp, ab) > eps:
25
- return False
26
-
27
- ab_sqr_norm = wp.dot(ab, ab)
28
- if ab_sqr_norm < eps:
29
- return False
30
-
31
- t = wp.dot(ab, c - a) / ab_sqr_norm
32
-
33
- perpendicular_foot = a + t * ab
34
-
35
- if wp.dot(c - perpendicular_foot, p - perpendicular_foot) > eps:
36
- return False
37
-
38
- return True
39
-
40
-
41
- # closest point is a
42
- @wp.func
43
- def check_vertex_feasible_region(p: wp.vec3, a: wp.vec3, b: wp.vec3, c: wp.vec3, eps: float):
44
- ap = p - a
45
- ba = a - b
46
- ca = a - c
47
-
48
- if wp.dot(ap, ba) < -eps:
49
- return False
50
-
51
- if wp.dot(p, ca) < -eps:
52
- return False
53
-
54
- return True
55
-
56
-
57
- @wp.func
58
- def return_true():
59
- return True
60
-
61
-
62
- def test_point_triangle_closest_point(test, device):
63
- passed = wp.array([True], dtype=wp.bool, device=device)
64
-
65
- @wp.kernel
66
- def test_point_triangle_closest_point_kernel(tri: wp.array(dtype=wp.vec3), passed: wp.array(dtype=wp.bool)):
67
- state = wp.uint32(wp.rand_init(wp.int32(123), wp.int32(0)))
68
- eps = 1e-5
69
-
70
- for _i in range(1000):
71
- l = wp.float32(0.0)
72
- while l < eps:
73
- p = wp.vec3(wp.randn(state), wp.randn(state), wp.randn(state))
74
- l = wp.length(p)
75
-
76
- # project to a sphere with r=2
77
- p = 2.0 * p / l
78
-
79
- bary = triangle_closest_point_barycentric(tri[0], tri[1], tri[2], p)
80
-
81
- for dim in range(3):
82
- v1_index = (dim + 1) % 3
83
- v2_index = (dim + 2) % 3
84
- v1 = tri[v1_index]
85
- v2 = tri[v2_index]
86
- v3 = tri[dim]
87
-
88
- # on edge
89
- if bary[dim] == 0.0 and bary[v1_index] != 0.0 and bary[v2_index] != 0.0:
90
- if not check_edge_feasible_region(p, v1, v2, v3, eps):
91
- passed[0] = False
92
- return
93
-
94
- # p-closest_p must be perpendicular to v1-v2
95
- closest_p = a * bary[0] + b * bary[1] + c * bary[2]
96
- e = v1 - v2
97
- err = wp.dot(e, closest_p - p)
98
- if wp.abs(err) > eps:
99
- passed[0] = False
100
- return
101
-
102
- if bary[v1_index] == 0.0 and bary[v2_index] == 0.0:
103
- if not check_vertex_feasible_region(p, v3, v1, v2, eps):
104
- passed[0] = False
105
- return
106
-
107
- if bary[dim] != 0.0 and bary[v1_index] != 0.0 and bary[v2_index] != 0.0:
108
- closest_p = a * bary[0] + b * bary[1] + c * bary[2]
109
- e1 = v1 - v2
110
- e2 = v1 - v3
111
- if wp.abs(wp.dot(e1, closest_p - p)) > eps or wp.abs(wp.dot(e2, closest_p - p)) > eps:
112
- passed[0] = False
113
- return
114
-
115
- a = wp.vec3(1.0, 0.0, 0.0)
116
- b = wp.vec3(0.0, 0.0, 0.0)
117
- c = wp.vec3(0.0, 1.0, 0.0)
118
-
119
- tri = wp.array([a, b, c], dtype=wp.vec3, device=device)
120
- wp.launch(test_point_triangle_closest_point_kernel, dim=1, inputs=[tri, passed], device=device)
121
- passed = passed.numpy()
122
-
123
- test.assertTrue(passed.all())
124
-
125
-
126
- devices = get_test_devices()
127
-
128
-
129
- class TestTriangleClosestPoint(unittest.TestCase):
130
- pass
131
-
132
-
133
- add_function_test(
134
- TestTriangleClosestPoint,
135
- "test_point_triangle_closest_point",
136
- test_point_triangle_closest_point,
137
- devices=devices,
138
- check_output=True,
139
- )
140
-
141
- if __name__ == "__main__":
142
- wp.clear_kernel_cache()
143
- unittest.main(verbosity=2)