Difference in time response between zones and grid point during subcontact cycling

Hey everyone,

I have the following routine to assign pp to subcontacts:

for sbc in it.block.subcontact.list():
pos_sc=sbc.pos()
gp_n=it.block.gridpoint.near(pos_sc)
gp_pp=gp_n.pp()
sbc.set_pp(gp_pp)

For some reason (after running a few other routines), this routine takes more than 5 hours to complete. However, using zones instead of gridpoints, i.e:

gp_n=it.block.zone.near(pos_sc)

makes this function change from 5 hours to less than a minute… Is there a logical reason for this?

Regards!

It seems that zone.near is fast because it uses cell space logic. gp.near does not, so it is slow.

We can fix this and make it fast, but in the short term, you probably don’t need it. Every subcontact has a vertex associated with it. The FISH function you want is block.subcontact.gp (in python it would be it.block.subcontact.gp