Bug Description
SquareNedelecFirstKindShapeFunctions.make_node_coords_in_element() and SquareRaviartThomasShapeFunctions.make_node_coords_in_element() each return an inner node_coords_in_element() function. That inner function constructs a Coords value named coords, but does not return it. It therefore returns None instead of the expected value.
Source:
|
def node_coords_in_element( |
|
def node_coords_in_element( |
Repro Script:
import warp as wp
from warp.fem.space.shape import (
SquareNedelecFirstKindShapeFunctions,
SquareRaviartThomasShapeFunctions,
)
wp.init()
def run(shape_type, name: str, device: str = "cpu"):
shape = shape_type(degree=1)
node_coords_in_element = shape.make_node_coords_in_element()
@wp.kernel
def get_first_node_coords(out: wp.array(dtype=wp.vec3)):
out[0] = node_coords_in_element(0)
out = wp.empty(1, dtype=wp.vec3, device=device)
try:
wp.launch(get_first_node_coords, dim=1, inputs=[out], device=device)
wp.synchronize_device(device)
except RuntimeError as error:
print(f"{name}: BUG REPRODUCED")
print(error)
return
print(f"{name}: OK")
print(out.numpy().tolist())
run(SquareNedelecFirstKindShapeFunctions, "Square Nedelec N1")
run(SquareRaviartThomasShapeFunctions, "Square Raviart-Thomas RT")
Expected output:
For a valid node index such as 0, both functions should return its coordinate instead of None.
Square Nedelec N1: OK
[[0.5, 0.0, 0.0]]
Square Raviart-Thomas RT: OK
[[0.5, 0.0, 0.0]]
Actual output:
Square Nedelec N1: BUG REPRODUCED
Error while parsing function "get_first_node_coords" at /tmp/repro_square_n1_rt_node_coords.py:17:
out[0] = node_coords_in_element(0)
;array_store() value argument type (builtins.NoneType) must be of the same type as the array (vec3f)
Square Raviart-Thomas RT: BUG REPRODUCED
Error while parsing function "get_first_node_coords" at /tmp/repro_square_n1_rt_node_coords.py:17:
out[0] = node_coords_in_element(0)
;array_store() value argument type (builtins.NoneType) must be of the same type as the array (vec3f)
Notes:
Both functions construct coords but do not return it from the node_coords_in_element().
Adding return coords makes the test complete successfully.
System Information
- Warp: 1.15.0rc3
- JAX: 0.10.2
- Python: 3.12
- OS: L4T R38.2
- Device: NVIDIA Jetson Thor
- CUDA: 13.0.0
Bug Description
SquareNedelecFirstKindShapeFunctions.make_node_coords_in_element()andSquareRaviartThomasShapeFunctions.make_node_coords_in_element()each return an innernode_coords_in_element()function. That inner function constructs a Coords value namedcoords, but does not return it. It therefore returns None instead of the expected value.Source:
warp/warp/_src/fem/space/shape/square_shape_function.py
Line 817 in 987f70a
warp/warp/_src/fem/space/shape/square_shape_function.py
Line 935 in 987f70a
Repro Script:
Expected output:
For a valid node index such as 0, both functions should return its coordinate instead of None.
Actual output:
Notes:
Both functions construct
coordsbut do not return it from thenode_coords_in_element().Adding
return coordsmakes the test complete successfully.System Information