Functions: geom_get_tags, geom_uniqify_tag, geom_update_tags obsolete?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Functions: geom_get_tags, geom_uniqify_tag, geom_update_tags obsolete?

randress
The functions in the geom/ group geom_get_tags, geom_uniqify_tag, and geom_update_tags that are found in the Version 1.8 pdf documentation do not seem to be present in the current release of FEATool.  Or are they still present and I am simply unable to locate them?

Following explains why I ask:

I have found that if I add an object (Block, Sphere, Cylinder, etc.), obj, to a geometry object, mygeo, using;
geom_add_gobj( mygeo, obj );
and the tag field of obj is already present in gobj (as mygeo.tags{} or mygeoj.objects{}.tag - I am not yet sure whether or not the presence in mygeo.tags{} alone is sufficient for the condition), then the obj is added to mygeo but with a different value in the obj.tag field so as to be unique.

I wondered if geom_add_gobj returned a value that was the tag actually added, but this does not seem to be the case.

In the particular instance, where I add an obj with a known tag, I need to know that I have given it a unique tag so that I may reference it by its tag in a subsequent function call.

Finding no existing method to determine uniqueness or the value of the tag actually added by geom_add_gobj, I have written:

is_tag_unique.m

It purports to determine if the tag I have chosen (obj.tag = 'TAG1') is being used or not in mygeo:
If (is_tag_unique(mygeo, 'TAG1'))
    geom_add_gobj (mygeo, obj);
   ....
end

If there is no other way to determine or assure uniqueness, will this function (is_tag_unique) reliably do what I need it to do?

Kind reagards,
Randal


Reply | Threaded
Open this post in threaded view
|

Re: Functions: geom_get_tags, geom_uniqify_tag, geom_update_tags obsolete?

Precise Simulation
Administrator
randress wrote
The functions in the geom/ group geom_get_tags, geom_uniqify_tag, and geom_update_tags that are found in the Version 1.8 pdf documentation do not seem to be present in the current release of FEATool.  Or are they still present and I am simply unable to locate them?
Only a subset of functions that are deemed "useful" are currently exposed as indicated in the current documentation and github repository.

randress wrote
I wondered if geom_add_gobj returned a value that was the tag actually added, but this does not seem to be the case.
The new object and uniqified tag will always are appended last to the input struct as:

  geom.objects = [ geom.objects {new_gobj} ];
  geom.tags = [ geom.tags {new_tag} ];


randress wrote
If there is no other way to determine or assure uniqueness, will this function (is_tag_unique) reliably do what I need it to do?
Something like this should be sufficient:

  all_tags = cellfun( @(o)o.tag, mygeo.objects, 'UniformOutput', false );
  is_tag_unique = ismember( tag, all_tags );

If I recall the geom.tags field is generally not used for command line/script usage. But you should ensure you don't have geometry objects with duplicate tags (you can manually set the tags when you create/define an object).
Reply | Threaded
Open this post in threaded view
|

Re: Functions: geom_get_tags, geom_uniqify_tag, geom_update_tags obsolete?

randress
Precise Simulation wrote
Something like this should be sufficient:

  all_tags = cellfun( @(o)o.tag, mygeo.objects, 'UniformOutput', false );
  is_tag_unique = ismember( tag, all_tags );
Thank you for the code snip.  Much more elegant than my brute force for loops... and it expands my knowledge of the MATLAB way of doing things...cellfun and ismember.

Precise Simulation wrote
If I recall the geom.tags field is generally not used for command line/script usage. But you should ensure you don't have geometry objects with duplicate tags (you can manually set the tags when you create/define an object).
I accidentally added an object with a duplicate tag and I believe (???) the add function (geom_add_gobj) changed the tag...which is what alerted me to the need of keeping them unique.

Kind regards,
Randal