warp-lang 1.7.2__py3-none-win_amd64.whl → 1.8.0__py3-none-win_amd64.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 +3 -1
- warp/__init__.pyi +3489 -1
- warp/autograd.py +45 -122
- warp/bin/warp-clang.dll +0 -0
- warp/bin/warp.dll +0 -0
- warp/build.py +241 -252
- warp/build_dll.py +125 -26
- warp/builtins.py +1907 -384
- warp/codegen.py +257 -101
- warp/config.py +12 -1
- warp/constants.py +1 -1
- warp/context.py +657 -223
- warp/dlpack.py +1 -1
- warp/examples/benchmarks/benchmark_cloth.py +2 -2
- warp/examples/benchmarks/benchmark_tile_sort.py +155 -0
- warp/examples/core/example_sample_mesh.py +1 -1
- warp/examples/core/example_spin_lock.py +93 -0
- warp/examples/core/example_work_queue.py +118 -0
- warp/examples/fem/example_adaptive_grid.py +5 -5
- warp/examples/fem/example_apic_fluid.py +1 -1
- warp/examples/fem/example_burgers.py +1 -1
- warp/examples/fem/example_convection_diffusion.py +9 -6
- warp/examples/fem/example_darcy_ls_optimization.py +489 -0
- warp/examples/fem/example_deformed_geometry.py +1 -1
- warp/examples/fem/example_diffusion.py +2 -2
- warp/examples/fem/example_diffusion_3d.py +1 -1
- warp/examples/fem/example_distortion_energy.py +1 -1
- warp/examples/fem/example_elastic_shape_optimization.py +387 -0
- warp/examples/fem/example_magnetostatics.py +5 -3
- warp/examples/fem/example_mixed_elasticity.py +5 -3
- warp/examples/fem/example_navier_stokes.py +11 -9
- warp/examples/fem/example_nonconforming_contact.py +5 -3
- warp/examples/fem/example_streamlines.py +8 -3
- warp/examples/fem/utils.py +9 -8
- warp/examples/interop/example_jax_ffi_callback.py +2 -2
- warp/examples/optim/example_drone.py +1 -1
- warp/examples/sim/example_cloth.py +1 -1
- warp/examples/sim/example_cloth_self_contact.py +48 -54
- warp/examples/tile/example_tile_block_cholesky.py +502 -0
- warp/examples/tile/example_tile_cholesky.py +2 -1
- warp/examples/tile/example_tile_convolution.py +1 -1
- warp/examples/tile/example_tile_filtering.py +1 -1
- warp/examples/tile/example_tile_matmul.py +1 -1
- warp/examples/tile/example_tile_mlp.py +2 -0
- warp/fabric.py +7 -7
- warp/fem/__init__.py +5 -0
- warp/fem/adaptivity.py +1 -1
- warp/fem/cache.py +152 -63
- warp/fem/dirichlet.py +2 -2
- warp/fem/domain.py +136 -6
- warp/fem/field/field.py +141 -99
- warp/fem/field/nodal_field.py +85 -39
- warp/fem/field/virtual.py +97 -52
- warp/fem/geometry/adaptive_nanogrid.py +91 -86
- warp/fem/geometry/closest_point.py +13 -0
- warp/fem/geometry/deformed_geometry.py +102 -40
- warp/fem/geometry/element.py +56 -2
- warp/fem/geometry/geometry.py +323 -22
- warp/fem/geometry/grid_2d.py +157 -62
- warp/fem/geometry/grid_3d.py +116 -20
- warp/fem/geometry/hexmesh.py +86 -20
- warp/fem/geometry/nanogrid.py +166 -86
- warp/fem/geometry/partition.py +59 -25
- warp/fem/geometry/quadmesh.py +86 -135
- warp/fem/geometry/tetmesh.py +47 -119
- warp/fem/geometry/trimesh.py +77 -270
- warp/fem/integrate.py +107 -52
- warp/fem/linalg.py +25 -58
- warp/fem/operator.py +124 -27
- warp/fem/quadrature/pic_quadrature.py +36 -14
- warp/fem/quadrature/quadrature.py +40 -16
- warp/fem/space/__init__.py +1 -1
- warp/fem/space/basis_function_space.py +66 -46
- warp/fem/space/basis_space.py +17 -4
- warp/fem/space/dof_mapper.py +1 -1
- warp/fem/space/function_space.py +2 -2
- warp/fem/space/grid_2d_function_space.py +4 -1
- warp/fem/space/hexmesh_function_space.py +4 -2
- warp/fem/space/nanogrid_function_space.py +3 -1
- warp/fem/space/partition.py +11 -2
- warp/fem/space/quadmesh_function_space.py +4 -1
- warp/fem/space/restriction.py +5 -2
- warp/fem/space/shape/__init__.py +10 -8
- warp/fem/space/tetmesh_function_space.py +4 -1
- warp/fem/space/topology.py +52 -21
- warp/fem/space/trimesh_function_space.py +4 -1
- warp/fem/utils.py +53 -8
- warp/jax.py +1 -2
- warp/jax_experimental/ffi.py +12 -17
- warp/jax_experimental/xla_ffi.py +37 -24
- warp/math.py +171 -1
- warp/native/array.h +99 -0
- warp/native/builtin.h +174 -31
- warp/native/coloring.cpp +1 -1
- warp/native/exports.h +118 -63
- warp/native/intersect.h +3 -3
- warp/native/mat.h +5 -10
- warp/native/mathdx.cpp +11 -5
- warp/native/matnn.h +1 -123
- warp/native/quat.h +28 -4
- warp/native/sparse.cpp +121 -258
- warp/native/sparse.cu +181 -274
- warp/native/spatial.h +305 -17
- warp/native/tile.h +583 -72
- warp/native/tile_radix_sort.h +1108 -0
- warp/native/tile_reduce.h +237 -2
- warp/native/tile_scan.h +240 -0
- warp/native/tuple.h +189 -0
- warp/native/vec.h +6 -16
- warp/native/warp.cpp +36 -4
- warp/native/warp.cu +574 -51
- warp/native/warp.h +47 -74
- warp/optim/linear.py +5 -1
- warp/paddle.py +7 -8
- warp/py.typed +0 -0
- warp/render/render_opengl.py +58 -29
- warp/render/render_usd.py +124 -61
- warp/sim/__init__.py +9 -0
- warp/sim/collide.py +252 -78
- warp/sim/graph_coloring.py +8 -1
- warp/sim/import_mjcf.py +4 -3
- warp/sim/import_usd.py +11 -7
- warp/sim/integrator.py +5 -2
- warp/sim/integrator_euler.py +1 -1
- warp/sim/integrator_featherstone.py +1 -1
- warp/sim/integrator_vbd.py +751 -320
- warp/sim/integrator_xpbd.py +1 -1
- warp/sim/model.py +265 -260
- warp/sim/utils.py +10 -7
- warp/sparse.py +303 -166
- warp/tape.py +52 -51
- warp/tests/cuda/test_conditional_captures.py +1046 -0
- warp/tests/cuda/test_streams.py +1 -1
- warp/tests/geometry/test_volume.py +2 -2
- warp/tests/interop/test_dlpack.py +9 -9
- warp/tests/interop/test_jax.py +0 -1
- warp/tests/run_coverage_serial.py +1 -1
- warp/tests/sim/disabled_kinematics.py +2 -2
- warp/tests/sim/{test_vbd.py → test_cloth.py} +296 -113
- warp/tests/sim/test_collision.py +159 -51
- warp/tests/sim/test_coloring.py +15 -1
- warp/tests/test_array.py +254 -2
- warp/tests/test_array_reduce.py +2 -2
- warp/tests/test_atomic_cas.py +299 -0
- warp/tests/test_codegen.py +142 -19
- warp/tests/test_conditional.py +47 -1
- warp/tests/test_ctypes.py +0 -20
- warp/tests/test_devices.py +8 -0
- warp/tests/test_fabricarray.py +4 -2
- warp/tests/test_fem.py +58 -25
- warp/tests/test_func.py +42 -1
- warp/tests/test_grad.py +1 -1
- warp/tests/test_lerp.py +1 -3
- warp/tests/test_map.py +481 -0
- warp/tests/test_mat.py +1 -24
- warp/tests/test_quat.py +6 -15
- warp/tests/test_rounding.py +10 -38
- warp/tests/test_runlength_encode.py +7 -7
- warp/tests/test_smoothstep.py +1 -1
- warp/tests/test_sparse.py +51 -2
- warp/tests/test_spatial.py +507 -1
- warp/tests/test_struct.py +2 -2
- warp/tests/test_tuple.py +265 -0
- warp/tests/test_types.py +2 -2
- warp/tests/test_utils.py +24 -18
- warp/tests/tile/test_tile.py +420 -1
- warp/tests/tile/test_tile_mathdx.py +518 -14
- warp/tests/tile/test_tile_reduce.py +213 -0
- warp/tests/tile/test_tile_shared_memory.py +130 -1
- warp/tests/tile/test_tile_sort.py +117 -0
- warp/tests/unittest_suites.py +4 -6
- warp/types.py +462 -308
- warp/utils.py +647 -86
- {warp_lang-1.7.2.dist-info → warp_lang-1.8.0.dist-info}/METADATA +20 -6
- {warp_lang-1.7.2.dist-info → warp_lang-1.8.0.dist-info}/RECORD +178 -166
- warp/stubs.py +0 -3381
- warp/tests/sim/test_xpbd.py +0 -399
- warp/tests/test_mlp.py +0 -282
- {warp_lang-1.7.2.dist-info → warp_lang-1.8.0.dist-info}/WHEEL +0 -0
- {warp_lang-1.7.2.dist-info → warp_lang-1.8.0.dist-info}/licenses/LICENSE.md +0 -0
- {warp_lang-1.7.2.dist-info → warp_lang-1.8.0.dist-info}/top_level.txt +0 -0
warp/native/spatial.h
CHANGED
|
@@ -136,6 +136,13 @@ struct transform_t
|
|
|
136
136
|
CUDA_CALLABLE inline transform_t(vec_t<3,Type> p=vec_t<3,Type>(), quat_t<Type> q=quat_t<Type>()) : p(p), q(q) {}
|
|
137
137
|
CUDA_CALLABLE inline transform_t(Type) {} // helps uniform initialization
|
|
138
138
|
|
|
139
|
+
template<typename OtherType>
|
|
140
|
+
inline explicit CUDA_CALLABLE transform_t(const transform_t<OtherType>& other)
|
|
141
|
+
{
|
|
142
|
+
p = other.p;
|
|
143
|
+
q = other.q;
|
|
144
|
+
}
|
|
145
|
+
|
|
139
146
|
CUDA_CALLABLE inline transform_t(const initializer_array<7, Type> &l)
|
|
140
147
|
{
|
|
141
148
|
p = vec_t<3,Type>(l[0], l[1], l[2]);
|
|
@@ -163,6 +170,35 @@ CUDA_CALLABLE inline transform_t<Type> transform_identity()
|
|
|
163
170
|
return transform_t<Type>(vec_t<3,Type>(), quat_identity<Type>());
|
|
164
171
|
}
|
|
165
172
|
|
|
173
|
+
template<typename Type>
|
|
174
|
+
inline CUDA_CALLABLE transform_t<Type> operator - (const transform_t<Type>& x)
|
|
175
|
+
{
|
|
176
|
+
transform_t<Type> ret;
|
|
177
|
+
|
|
178
|
+
ret.p = -x.p;
|
|
179
|
+
ret.q = -x.q;
|
|
180
|
+
|
|
181
|
+
return ret;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
template<typename Type>
|
|
185
|
+
CUDA_CALLABLE inline transform_t<Type> pos(const transform_t<Type>& x)
|
|
186
|
+
{
|
|
187
|
+
return x;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
template<typename Type>
|
|
191
|
+
CUDA_CALLABLE inline transform_t<Type> neg(const transform_t<Type>& x)
|
|
192
|
+
{
|
|
193
|
+
return -x;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
template<typename Type>
|
|
197
|
+
CUDA_CALLABLE inline void adj_neg(const transform_t<Type>& x, transform_t<Type>& adj_x, const transform_t<Type>& adj_ret)
|
|
198
|
+
{
|
|
199
|
+
adj_x -= adj_ret;
|
|
200
|
+
}
|
|
201
|
+
|
|
166
202
|
template<typename Type>
|
|
167
203
|
inline CUDA_CALLABLE bool operator==(const transform_t<Type>& a, const transform_t<Type>& b)
|
|
168
204
|
{
|
|
@@ -188,6 +224,96 @@ CUDA_CALLABLE inline quat_t<Type> transform_get_rotation(const transform_t<Type>
|
|
|
188
224
|
return t.q;
|
|
189
225
|
}
|
|
190
226
|
|
|
227
|
+
template<typename Type>
|
|
228
|
+
CUDA_CALLABLE inline void adj_transform_get_translation(const transform_t<Type>& t, transform_t<Type>& adj_t, const vec_t<3,Type>& adj_ret)
|
|
229
|
+
{
|
|
230
|
+
adj_t.p += adj_ret;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
template<typename Type>
|
|
234
|
+
CUDA_CALLABLE inline void adj_transform_get_rotation(const transform_t<Type>& t, transform_t<Type>& adj_t, const quat_t<Type>& adj_ret)
|
|
235
|
+
{
|
|
236
|
+
adj_t.q += adj_ret;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
template<typename Type>
|
|
240
|
+
CUDA_CALLABLE inline void transform_set_translation(transform_t<Type>& t, const vec_t<3, Type>& p)
|
|
241
|
+
{
|
|
242
|
+
t.p = p;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
template<typename Type>
|
|
246
|
+
CUDA_CALLABLE inline void transform_set_rotation(transform_t<Type>& t, const quat_t<Type>& q)
|
|
247
|
+
{
|
|
248
|
+
t.q = q;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
template<typename Type>
|
|
252
|
+
CUDA_CALLABLE inline transform_t<Type> transform_set_translation_copy(transform_t<Type>& t, const vec_t<3, Type>& p)
|
|
253
|
+
{
|
|
254
|
+
transform_t<Type> ret(t);
|
|
255
|
+
ret.p = p;
|
|
256
|
+
return ret;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
template<typename Type>
|
|
260
|
+
CUDA_CALLABLE inline transform_t<Type> transform_set_rotation_copy(transform_t<Type>& t, const quat_t<Type>& q)
|
|
261
|
+
{
|
|
262
|
+
transform_t<Type> ret(t);
|
|
263
|
+
ret.q = q;
|
|
264
|
+
return ret;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
template<typename Type>
|
|
268
|
+
CUDA_CALLABLE inline void adj_transform_set_translation(transform_t<Type>& t, const vec_t<3, Type>& p, const transform_t<Type>& adj_t, vec_t<3, Type>& adj_p)
|
|
269
|
+
{
|
|
270
|
+
adj_p += adj_t.p;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
template<typename Type>
|
|
274
|
+
CUDA_CALLABLE inline void adj_transform_set_rotation(transform_t<Type>& t, const quat_t<Type>& q, const transform_t<Type>& adj_t, quat_t<Type>& adj_q)
|
|
275
|
+
{
|
|
276
|
+
adj_q += adj_t.q;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
template<typename Type>
|
|
280
|
+
CUDA_CALLABLE inline void adj_transform_set_translation_copy(transform_t<Type>& t, const vec_t<3, Type>& p, transform_t<Type>& adj_t, vec_t<3, Type>& adj_p, const transform_t<Type>& adj_ret)
|
|
281
|
+
{
|
|
282
|
+
adj_p += adj_ret.p;
|
|
283
|
+
adj_t.q += adj_ret.q;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
template<typename Type>
|
|
287
|
+
CUDA_CALLABLE inline void adj_transform_set_rotation_copy(transform_t<Type>& t, const quat_t<Type>& q, transform_t<Type>& adj_t, quat_t<Type>& adj_q, const transform_t<Type>& adj_ret)
|
|
288
|
+
{
|
|
289
|
+
adj_q += adj_ret.q;
|
|
290
|
+
adj_t.p += adj_ret.p;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
template<typename Type>
|
|
294
|
+
inline CUDA_CALLABLE void transform_add_inplace(transform_t<Type>& t, const vec_t<3, Type>& p)
|
|
295
|
+
{
|
|
296
|
+
t.p += p;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
template<typename Type>
|
|
300
|
+
inline CUDA_CALLABLE void transform_sub_inplace(transform_t<Type>& t, const vec_t<3, Type>& p)
|
|
301
|
+
{
|
|
302
|
+
t.p -= p;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
template<typename Type>
|
|
306
|
+
inline CUDA_CALLABLE void adj_transform_add_inplace(transform_t<Type>& t, const vec_t<3, Type>& p, transform_t<Type>& adj_t, vec_t<3, Type>& adj_p)
|
|
307
|
+
{
|
|
308
|
+
adj_p += adj_t.p;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
template<typename Type>
|
|
312
|
+
inline CUDA_CALLABLE void adj_transform_sub_inplace(transform_t<Type>& t, const vec_t<3, Type>& p, transform_t<Type>& adj_t, vec_t<3, Type>& adj_p)
|
|
313
|
+
{
|
|
314
|
+
adj_p -= adj_t.p;
|
|
315
|
+
}
|
|
316
|
+
|
|
191
317
|
template<typename Type>
|
|
192
318
|
CUDA_CALLABLE inline transform_t<Type> transform_multiply(const transform_t<Type>& a, const transform_t<Type>& b)
|
|
193
319
|
{
|
|
@@ -271,7 +397,6 @@ CUDA_CALLABLE inline transform_t<Type> operator*(Type s, const transform_t<Type>
|
|
|
271
397
|
return mul(a, s);
|
|
272
398
|
}
|
|
273
399
|
|
|
274
|
-
|
|
275
400
|
template<typename Type>
|
|
276
401
|
inline CUDA_CALLABLE Type tensordot(const transform_t<Type>& a, const transform_t<Type>& b)
|
|
277
402
|
{
|
|
@@ -280,17 +405,192 @@ inline CUDA_CALLABLE Type tensordot(const transform_t<Type>& a, const transform_
|
|
|
280
405
|
}
|
|
281
406
|
|
|
282
407
|
template<typename Type>
|
|
283
|
-
inline CUDA_CALLABLE Type extract(const transform_t<Type>& t, int
|
|
408
|
+
inline CUDA_CALLABLE Type extract(const transform_t<Type>& t, int idx)
|
|
284
409
|
{
|
|
285
|
-
|
|
410
|
+
#ifndef NDEBUG
|
|
411
|
+
if (idx < 0 || idx >= 7)
|
|
412
|
+
{
|
|
413
|
+
printf("transformation index %d out of bounds at %s %d\n", idx, __FILE__, __LINE__);
|
|
414
|
+
assert(0);
|
|
415
|
+
}
|
|
416
|
+
#endif
|
|
417
|
+
|
|
418
|
+
return t[idx];
|
|
286
419
|
}
|
|
287
420
|
|
|
288
421
|
template<typename Type>
|
|
289
|
-
inline
|
|
422
|
+
inline CUDA_CALLABLE Type* index(transform_t<Type>& t, int idx)
|
|
290
423
|
{
|
|
291
|
-
|
|
424
|
+
#ifndef NDEBUG
|
|
425
|
+
if (idx < 0 || idx >= 7)
|
|
426
|
+
{
|
|
427
|
+
printf("transformation index %d out of bounds at %s %d\n", idx, __FILE__, __LINE__);
|
|
428
|
+
assert(0);
|
|
429
|
+
}
|
|
430
|
+
#endif
|
|
431
|
+
|
|
432
|
+
return &t[idx];
|
|
292
433
|
}
|
|
293
434
|
|
|
435
|
+
template<typename Type>
|
|
436
|
+
inline CUDA_CALLABLE Type* indexref(transform_t<Type>* t, int idx)
|
|
437
|
+
{
|
|
438
|
+
#ifndef NDEBUG
|
|
439
|
+
if (idx < 0 || idx >= 7)
|
|
440
|
+
{
|
|
441
|
+
printf("transformation store %d out of bounds at %s %d\n", idx, __FILE__, __LINE__);
|
|
442
|
+
assert(0);
|
|
443
|
+
}
|
|
444
|
+
#endif
|
|
445
|
+
|
|
446
|
+
return &((*t)[idx]);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
template<typename Type>
|
|
450
|
+
inline void CUDA_CALLABLE adj_extract(const transform_t<Type>& t, int idx, transform_t<Type>& adj_t, int& adj_idx, Type adj_ret)
|
|
451
|
+
{
|
|
452
|
+
adj_t[idx] += adj_ret;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
template<typename Type>
|
|
456
|
+
inline CUDA_CALLABLE void adj_index(transform_t<Type>& t, int idx,
|
|
457
|
+
transform_t<Type>& adj_t, int adj_idx, const Type& adj_value)
|
|
458
|
+
{
|
|
459
|
+
// nop
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
template<typename Type>
|
|
463
|
+
inline CUDA_CALLABLE void adj_indexref(transform_t<Type>* t, int idx,
|
|
464
|
+
transform_t<Type>& adj_t, int adj_idx, const Type& adj_value)
|
|
465
|
+
{
|
|
466
|
+
// nop
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
template<typename Type>
|
|
470
|
+
inline CUDA_CALLABLE void add_inplace(transform_t<Type>& t, int idx, Type value)
|
|
471
|
+
{
|
|
472
|
+
#ifndef NDEBUG
|
|
473
|
+
if (idx < 0 || idx >= 7)
|
|
474
|
+
{
|
|
475
|
+
printf("transformation index %d out of bounds at %s %d\n", idx, __FILE__, __LINE__);
|
|
476
|
+
assert(0);
|
|
477
|
+
}
|
|
478
|
+
#endif
|
|
479
|
+
|
|
480
|
+
t[idx] += value;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
template<typename Type>
|
|
485
|
+
inline CUDA_CALLABLE void adj_add_inplace(transform_t<Type>& t, int idx, Type value,
|
|
486
|
+
transform_t<Type>& adj_t, int adj_idx, Type& adj_value)
|
|
487
|
+
{
|
|
488
|
+
#ifndef NDEBUG
|
|
489
|
+
if (idx < 0 || idx >= 7)
|
|
490
|
+
{
|
|
491
|
+
printf("transformation index %d out of bounds at %s %d\n", idx, __FILE__, __LINE__);
|
|
492
|
+
assert(0);
|
|
493
|
+
}
|
|
494
|
+
#endif
|
|
495
|
+
|
|
496
|
+
adj_value += adj_t[idx];
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
template<typename Type>
|
|
501
|
+
inline CUDA_CALLABLE void sub_inplace(transform_t<Type>& t, int idx, Type value)
|
|
502
|
+
{
|
|
503
|
+
#ifndef NDEBUG
|
|
504
|
+
if (idx < 0 || idx >= 7)
|
|
505
|
+
{
|
|
506
|
+
printf("transformation index %d out of bounds at %s %d\n", idx, __FILE__, __LINE__);
|
|
507
|
+
assert(0);
|
|
508
|
+
}
|
|
509
|
+
#endif
|
|
510
|
+
|
|
511
|
+
t[idx] -= value;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
template<typename Type>
|
|
516
|
+
inline CUDA_CALLABLE void adj_sub_inplace(transform_t<Type>& t, int idx, Type value,
|
|
517
|
+
transform_t<Type>& adj_t, int adj_idx, Type& adj_value)
|
|
518
|
+
{
|
|
519
|
+
#ifndef NDEBUG
|
|
520
|
+
if (idx < 0 || idx >= 7)
|
|
521
|
+
{
|
|
522
|
+
printf("transformation index %d out of bounds at %s %d\n", idx, __FILE__, __LINE__);
|
|
523
|
+
assert(0);
|
|
524
|
+
}
|
|
525
|
+
#endif
|
|
526
|
+
|
|
527
|
+
adj_value -= adj_t[idx];
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
template<typename Type>
|
|
532
|
+
inline CUDA_CALLABLE void assign_inplace(transform_t<Type>& t, int idx, Type value)
|
|
533
|
+
{
|
|
534
|
+
#ifndef NDEBUG
|
|
535
|
+
if (idx < 0 || idx >= 7)
|
|
536
|
+
{
|
|
537
|
+
printf("transformation index %d out of bounds at %s %d\n", idx, __FILE__, __LINE__);
|
|
538
|
+
assert(0);
|
|
539
|
+
}
|
|
540
|
+
#endif
|
|
541
|
+
|
|
542
|
+
t[idx] = value;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
template<typename Type>
|
|
546
|
+
inline CUDA_CALLABLE void adj_assign_inplace(transform_t<Type>& t, int idx, Type value, transform_t<Type>& adj_t, int& adj_idx, Type& adj_value)
|
|
547
|
+
{
|
|
548
|
+
#ifndef NDEBUG
|
|
549
|
+
if (idx < 0 || idx >= 7)
|
|
550
|
+
{
|
|
551
|
+
printf("transformation index %d out of bounds at %s %d\n", idx, __FILE__, __LINE__);
|
|
552
|
+
assert(0);
|
|
553
|
+
}
|
|
554
|
+
#endif
|
|
555
|
+
|
|
556
|
+
adj_value += adj_t[idx];
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
template<typename Type>
|
|
561
|
+
inline CUDA_CALLABLE transform_t<Type> assign_copy(transform_t<Type>& t, int idx, Type value)
|
|
562
|
+
{
|
|
563
|
+
#ifndef NDEBUG
|
|
564
|
+
if (idx < 0 || idx >= 7)
|
|
565
|
+
{
|
|
566
|
+
printf("transformation index %d out of bounds at %s %d\n", idx, __FILE__, __LINE__);
|
|
567
|
+
assert(0);
|
|
568
|
+
}
|
|
569
|
+
#endif
|
|
570
|
+
|
|
571
|
+
transform_t<Type> ret(t);
|
|
572
|
+
ret[idx] = value;
|
|
573
|
+
return ret;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
template<typename Type>
|
|
577
|
+
inline CUDA_CALLABLE void adj_assign_copy(transform_t<Type>& t, int idx, Type value, transform_t<Type>& adj_t, int& adj_idx, Type& adj_value, const transform_t<Type>& adj_ret)
|
|
578
|
+
{
|
|
579
|
+
#ifndef NDEBUG
|
|
580
|
+
if (idx < 0 || idx >= 7)
|
|
581
|
+
{
|
|
582
|
+
printf("transformation index %d out of bounds at %s %d\n", idx, __FILE__, __LINE__);
|
|
583
|
+
assert(0);
|
|
584
|
+
}
|
|
585
|
+
#endif
|
|
586
|
+
|
|
587
|
+
adj_value += adj_ret[idx];
|
|
588
|
+
for(unsigned i=0; i < 7; ++i)
|
|
589
|
+
{
|
|
590
|
+
if (i != idx)
|
|
591
|
+
adj_t[i] += adj_ret[i];
|
|
592
|
+
}
|
|
593
|
+
}
|
|
294
594
|
|
|
295
595
|
// adjoint methods
|
|
296
596
|
template<typename Type>
|
|
@@ -343,18 +643,6 @@ CUDA_CALLABLE inline void adj_transform_t(const vec_t<3,Type>& p, const quat_t<T
|
|
|
343
643
|
adj_q += adj_ret.q;
|
|
344
644
|
}
|
|
345
645
|
|
|
346
|
-
template<typename Type>
|
|
347
|
-
CUDA_CALLABLE inline void adj_transform_get_translation(const transform_t<Type>& t, transform_t<Type>& adj_t, const vec_t<3,Type>& adj_ret)
|
|
348
|
-
{
|
|
349
|
-
adj_t.p += adj_ret;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
template<typename Type>
|
|
353
|
-
CUDA_CALLABLE inline void adj_transform_get_rotation(const transform_t<Type>& t, transform_t<Type>& adj_t, const quat_t<Type>& adj_ret)
|
|
354
|
-
{
|
|
355
|
-
adj_t.q += adj_ret;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
646
|
template<typename Type>
|
|
359
647
|
CUDA_CALLABLE inline void adj_transform_inverse(const transform_t<Type>& t, transform_t<Type>& adj_t, const transform_t<Type>& adj_ret)
|
|
360
648
|
{
|