I am a usecase whereby I need to transpose values from a 2D Numpy array to a 2D FiPy grid which will then be used to solve the system.
My code is as follows:
for x in range(0, size[0]):
for y in range(0, size[1]):
source.setValue(tmpSource.getGrid()[x][y], where=(X < x + 1) & (X > x) & (Y > y) & (Y < y + 1))
sink.setValue(tmpSink.getGrid()[x][y], where=(X < x + 1) & (X > x) & (Y > y) & (Y < y + 1))
Where tmpSource and tmpSink are said Numpy arrays.
While this approach works, it is extremely slow to run. Does anybody have any advice on alternative approaches that could make it faster?
Thanks!