*_property_array fails for scalar-valued properties
When 0-dimensional, i.e. scalar properties are set using set_*_property
, they cannot be queried as a NumPy array afterwards using *_property_array
:
mesh = om.TriMesh()
v0 = mesh.add_vertex([1,0,0])
v1 = mesh.add_vertex([0,1,0])
v2 = mesh.add_vertex([0,0,1])
mesh.set_vertex_property('foo', v0, 1.0)
mesh.set_vertex_property('foo', v1, 2.0)
mesh.set_vertex_property('foo', v2, 3.0)
mesh.vertex_property_array('foo') # fails:
# IndexError: too many indices for an array: 1 (ndim = 0)
Higher-dimensional-valued properties work though:
mesh.set_vertex_property('bar', v0, [1.0])
mesh.set_vertex_property('bar', v1, [2.0])
mesh.set_vertex_property('bar', v2, [3.0])
mesh.vertex_property_array('bar') # works:
# array([[1.],
# [2.],
# [3.]])