[MOAB-dev] Question about getting entities with tag data
Jason Kraftcheck
kraftche at cae.wisc.edu
Tue Aug 18 09:15:59 CDT 2009
Paul Wilson wrote:
> Hi there,
>
> I have been digging through the interface and I can't seem to find a
> function that will return an MBRange of entities formed by matching a
> single tag against a set of tag values. As far as I can tell,
> get_entities_by_type_and_tag will return an MBRange of entities formed
> by matching N tags against N corresponding values, but will not match 1
> tag against M values.
>
> Is there such a function? If not, is there a recommended way to resolve
> this?
You can call the existing function m times, passing the
MBInterface::UNITE flag (or INTERSECT if that's what you want.) Or pass
in m copies of the tag handle.
> My first attempt was to get each entity one at a time, but that
> is extremely slow. Perhaps better to get the tag data for all possible
> entities and then throw out the ones that are not needed?
>
MOAB's search of tag values is O(n). If you need something faster,
you'll have to construct your own map or hash table from value to handle.
- jason
More information about the moab-dev
mailing list