I have the following problem to which i haven't found any helpful hints anywhere so far.
I have two arrays which look like this:
sample_nodes = [[ ID_1 x1 y1 z1]
[ ID_2 x2 y2 z2]
[ ID_3 x3 y3 z4]
.
.
.
[ ID_n xn yn zn]]
and
sample_elements = [[[ ID_7 0 0 0]
[ ID_21 0 0 0]
[ ID_991 0 0 0]
[ ID_34 0 0 0]]
[[ ID_67 0 0 0]
[ ID_1 0 0 0]
[ ID_42 0 0 0]
[ ID_15 0 0 0]]
.
.
.
[[ ID_33 0 0 0]
[ ID_42 0 0 0]
[ ID_82 0 0 0]
[ ID_400 0 0 0]]]
The sample_nodes has the x, y and z coordinates which are needed by the sample_elements where the IDs are arranged in a random order. So, I have to look at each ID of each row in the sample_elements array and find out the corresponding x, y and z coordinates from the sample_nodes and replace the zero values back again in the sample_elements array corresponding to the IDs.
I am very new to both python and numpy and hence, have no idea how to go about this. Thanks in advance guys for any pointers for solving this question.
Also, all he IDs in the sample_elements are present in the sample_nodes. Only in the sample_elements are they arranged in random because they are generated by a meshing software called Gmsh. I am actually trying to parse it's output mesh file.