warp-lang 1.3.2__py3-none-manylinux2014_x86_64.whl → 1.4.0__py3-none-manylinux2014_x86_64.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.
- warp/__init__.py +6 -0
- warp/autograd.py +59 -6
- warp/bin/warp.so +0 -0
- warp/build_dll.py +8 -10
- warp/builtins.py +126 -4
- warp/codegen.py +435 -53
- warp/config.py +1 -1
- warp/context.py +678 -403
- warp/dlpack.py +2 -0
- warp/examples/benchmarks/benchmark_cloth.py +10 -0
- warp/examples/core/example_render_opengl.py +12 -10
- warp/examples/fem/example_adaptive_grid.py +251 -0
- warp/examples/fem/example_apic_fluid.py +1 -1
- warp/examples/fem/example_diffusion_3d.py +2 -2
- warp/examples/fem/example_magnetostatics.py +1 -1
- warp/examples/fem/example_streamlines.py +1 -0
- warp/examples/fem/utils.py +23 -4
- warp/examples/sim/example_cloth.py +50 -6
- warp/fem/__init__.py +2 -0
- warp/fem/adaptivity.py +493 -0
- warp/fem/field/field.py +2 -1
- warp/fem/field/nodal_field.py +18 -26
- warp/fem/field/test.py +4 -4
- warp/fem/field/trial.py +4 -4
- warp/fem/geometry/__init__.py +1 -0
- warp/fem/geometry/adaptive_nanogrid.py +843 -0
- warp/fem/geometry/nanogrid.py +55 -28
- warp/fem/space/__init__.py +1 -1
- warp/fem/space/nanogrid_function_space.py +69 -35
- warp/fem/utils.py +113 -107
- warp/jax_experimental.py +28 -15
- warp/native/array.h +0 -1
- warp/native/builtin.h +103 -6
- warp/native/bvh.cu +2 -0
- warp/native/cuda_util.cpp +14 -0
- warp/native/cuda_util.h +2 -0
- warp/native/error.cpp +4 -2
- warp/native/exports.h +99 -17
- warp/native/mat.h +97 -0
- warp/native/mesh.cpp +36 -0
- warp/native/mesh.cu +51 -0
- warp/native/mesh.h +1 -0
- warp/native/quat.h +43 -0
- warp/native/spatial.h +6 -0
- warp/native/vec.h +74 -0
- warp/native/warp.cpp +2 -1
- warp/native/warp.cu +10 -3
- warp/native/warp.h +8 -1
- warp/paddle.py +382 -0
- warp/sim/__init__.py +1 -0
- warp/sim/collide.py +519 -0
- warp/sim/integrator_euler.py +18 -5
- warp/sim/integrator_featherstone.py +5 -5
- warp/sim/integrator_vbd.py +1026 -0
- warp/sim/model.py +49 -23
- warp/stubs.py +459 -0
- warp/tape.py +2 -0
- warp/tests/aux_test_dependent.py +1 -0
- warp/tests/aux_test_name_clash1.py +32 -0
- warp/tests/aux_test_name_clash2.py +32 -0
- warp/tests/aux_test_square.py +1 -0
- warp/tests/test_array.py +222 -0
- warp/tests/test_async.py +3 -3
- warp/tests/test_atomic.py +6 -0
- warp/tests/test_closest_point_edge_edge.py +93 -1
- warp/tests/test_codegen.py +62 -15
- warp/tests/test_codegen_instancing.py +1457 -0
- warp/tests/test_collision.py +486 -0
- warp/tests/test_compile_consts.py +3 -28
- warp/tests/test_dlpack.py +170 -0
- warp/tests/test_examples.py +22 -8
- warp/tests/test_fast_math.py +10 -4
- warp/tests/test_fem.py +64 -0
- warp/tests/test_func.py +46 -0
- warp/tests/test_implicit_init.py +49 -0
- warp/tests/test_jax.py +58 -0
- warp/tests/test_mat.py +84 -0
- warp/tests/test_mesh_query_point.py +188 -0
- warp/tests/test_module_hashing.py +40 -0
- warp/tests/test_multigpu.py +3 -3
- warp/tests/test_overwrite.py +8 -0
- warp/tests/test_paddle.py +852 -0
- warp/tests/test_print.py +89 -0
- warp/tests/test_quat.py +111 -0
- warp/tests/test_reload.py +31 -1
- warp/tests/test_scalar_ops.py +2 -0
- warp/tests/test_static.py +412 -0
- warp/tests/test_streams.py +64 -3
- warp/tests/test_struct.py +4 -4
- warp/tests/test_torch.py +24 -0
- warp/tests/test_triangle_closest_point.py +137 -0
- warp/tests/test_types.py +1 -1
- warp/tests/test_vbd.py +386 -0
- warp/tests/test_vec.py +143 -0
- warp/tests/test_vec_scalar_ops.py +139 -0
- warp/tests/test_volume.py +30 -0
- warp/tests/unittest_suites.py +12 -0
- warp/tests/unittest_utils.py +9 -5
- warp/thirdparty/dlpack.py +3 -1
- warp/types.py +157 -34
- warp/utils.py +37 -14
- {warp_lang-1.3.2.dist-info → warp_lang-1.4.0.dist-info}/METADATA +10 -8
- {warp_lang-1.3.2.dist-info → warp_lang-1.4.0.dist-info}/RECORD +106 -94
- warp/tests/test_point_triangle_closest_point.py +0 -143
- {warp_lang-1.3.2.dist-info → warp_lang-1.4.0.dist-info}/LICENSE.md +0 -0
- {warp_lang-1.3.2.dist-info → warp_lang-1.4.0.dist-info}/WHEEL +0 -0
- {warp_lang-1.3.2.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)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|