I have a an array of objects in python:
meshnodearray = ['MeshNode object', 'MeshNode object', 'MeshNode object', ...]
Where for example first 'MeshNode object' is:
({'coordinates': (15.08, 273.01, 322.61), 'instanceName': None, 'label': 1})
I need to create an array of coordinates like this:
NODEcoo = np.zeros((nnod,3),dtype='float64')
for i in meshnodearray:
NODEcoo[i.label-1,0:] = np.array(i.coordinates)
For large arrays this is slow. Is there a more efficient way of doing this, maybe without the for loop?