[MOAB-dev] Question about getting entities with tag data

Paul Wilson wilsonp at engr.wisc.edu
Tue Aug 18 13:19:27 CDT 2009


Jason Kraftcheck wrote:
> 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.
That's what I did - got all tag values, put it into 
map<tag_value,MBEntityHandle> and used STL algorithms to achieve what I 
needed.

Paul

-- 
-- --------------------------------------------------------- --
Paul P H Wilson                  UW-Madison Engineering Physics
Associate Professor               419 Engineering Research Bldg
wilsonp at engr.wisc.edu                       1500 Engineering Dr
608/263-0807 fax:608/263-4499                 Madison, WI 53706
http://www.cae.wisc.edu/~wilsonp    http://www.engr.wisc.edu/ep
                       My calendar
http://www.google.com/calendar/embed?src=paul@nagus-wilson.net

          Contributing to the joy and improvement
                  of all those around me

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3320 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.mcs.anl.gov/pipermail/moab-dev/attachments/20090818/7e80f7d3/attachment.bin>


More information about the moab-dev mailing list