Hi,
I am trying to extract in python a face boundary, to track certain properties over the face. To do that I first need to get the pointer to the faces that compose this boundary (the zone pointer and face index pair to be precise).
This is relatively easy with the code below:
def get_wall(group: str, slot: str):
faces = [] for zn in it.zone.list(): for i in range(0, 6): if zn.face_in_group(i, group, slot): faces.append((zn, i)) return faces
My issue is that when you have a very big model, the nested loop above become very slow because loops are slow in python and the Zone.face_in_group method is also relatively slow.
I was wondering if there was a faster way to do it. I have been trying my luck with the numpy interface mixing call to itasca.zonearray and itasca.gridpointarray but I have I failed so far.
I have also tried with a list comprehension approach like below but I only get a ~20% faster, that is not really sufficient.
res = [ (zn, i) for i in range(0, 6) for zn in it.zone.list() if zn.face_in_group(i, “Wall”, “BC”) ]
Would anyone have some experience with this type of problem could suggest me a solution?
Thank you in advance.
Stéphane