Finding the volume id of a tet

Hi all

I see that it is possible to find the tet ids within a given volume

I was wondering if it is possible to find the volume id given a tet id

Many thanks

Jon

You can use the parse_cubit_list function to get a list of tets in a volume. In the Script tab (enable in Tools-Options-Layout), type

print cubit.parse_cubit_list(“tet”, “in vol 1”)

Or set a variable

tet_ids = cubit.parse_cubit_list(“tet”, “in vol 1”)
print tet_ids

Hi there

Thanks for the reply

I believe this parse_cubit_list command gives me all the tet ids in the volume

I am after a method of finding the volume given an individual tet id

Using the parse_cubit_list method would require searching through the returned list for every volume to see if the tet id that I have is within that list. Something like the code below

def find_volume_id_given_a_tet_id(tet_id_of_interest) all_volumes_ids = cubit.parse_cubit_list("volume", ' all') for volume_id in all_volumes_ids: list_of_tet_ids_in_volume = cubit.parse_cubit_list("tet", "in vol "+str(volume_id)) if tet_id_of_interest in list_of_tet_ids_in_volume: return volume_id break volume_id_of_interest = find_volume_id_given_a_tet_id(10)
I was hoping for a more direct way and faster method, something like this

volume_id_of_interest = get_tet_volumeid(tetid=10)

Do you know if there is a method like this

Many thanks

Jon

Ah, got it. You could use parse_cubit_list with "in tet ". This below will print the volume that includes tet 1:

print cubit.parse_cubit_list(“volume”, “in tet 1”)

Ah perfect, thanks so much this has really sped up my script :slight_smile: