Dear all,
I need to get the coordinates and velocities vectors for several blocks in my domain for some time snapshots. By now I am looping over each time step and then over each block in order to get the aforementioned values like this:
# Loop over the blocks
for i in nblocks:
***Some code here***
# Loop over the snaps
for j in range(len(dts_anim)):
***Some more code here***
# Allocate lists (vectors)
X_vect = [None] * npoints
Y_vect = [None] * npoints
Z_vect = [None] * npoints
U_vect = [None] * npoints
V_vect = [None] * npoints
W_vect = [None] * npoints
# Loop over the points of the current block
data = paraview.servermanager.Fetch(extractBlock)
block = data.GetBlock(0)
for k in range(npoints):
coors_pnt = block.GetPoint(k)
X_vect[k] = coors_pnt[0]
Y_vect[k] = coors_pnt[1]
Z_vect[k] = coors_pnt[2]
U_vect[k] = block.GetPointData().GetArray('U').GetValue(k)
V_vect[k] = block.GetPointData().GetArray('V').GetValue(k)
W_vect[k] = block.GetPointData().GetArray('W').GetValue(k)
***The code continues from here***
However the loop where i go over the npoints in order to build the *_vect lists is extremely slow (). Since I retrieve the data right before the loop like this:
data = paraview.servermanager.Fetch(extractBlock)
block = data.GetBlock(0)
Isn’t it possible to get directly the vectors without looping over all the points? Using .GetPoint(k) and .GetPointData().GetArray('').GetValue(k)* seems to be quite inefficient.
Thank you in advance!