[MOAB-dev] MOAB search tag range
Steve Balderrama
sbalderrama at eagle.org
Fri May 29 10:24:10 CDT 2015
Thanks for the response, I'll try the tag_iterate then.
From: Grindeanu, Iulian R. [mailto:iulian at mcs.anl.gov]
Sent: Friday, May 29, 2015 10:22 AM
To: Steve Balderrama; moab-dev at mcs.anl.gov
Subject: RE: MOAB search tag range
There is no mechanism for that. I assume you are talking about dense tags, not sparse tags.
If sparse tags, you will just have to retrieve one by one the tag values, with tag_get_data(()
I think the most efficient way is to use tag_iterate over your elements of interest (if dense)
By using tag_iterate, you will access tag values directly in memory, no copying involved
You should return either a range or a standard vector, depending on how broken your output sequence will be
(so if your output will be hex1-10, hex 101-120, it is better to have a range; if it is hex1, hex 5, hex 11, (very sparse), it is better to output a vector)
so your code could look like this (look in Interface.hpp comments)
Range output_range;
Range::iterator iter = ents.begin();
while (iter != ents.end()) {
int count;
// get contiguous block of tag dat
void* ptr;
err = mb.tag_iterate( tag, iter, ents.end(), count, ptr );
if (err) { ... }
// do something with tag data
// assume your tag is type double
double *dptr = ptr
for (int j=0; j<count; j++, dptr++)
if (*dptr<0.25 && *dptr > 0.75)
{
EntityHandle interesting_element = (*iter+j);
output_range.insert( interesting_element )
}
// advance to next block of data
iter += count;
}
________________________________
From: moab-dev-bounces at mcs.anl.gov<mailto:moab-dev-bounces at mcs.anl.gov> [moab-dev-bounces at mcs.anl.gov] on behalf of Steve Balderrama [sbalderrama at eagle.org]
Sent: Friday, May 29, 2015 9:58 AM
To: moab-dev at mcs.anl.gov<mailto:moab-dev at mcs.anl.gov>
Subject: [MOAB-dev] MOAB search tag range
Is there a direct function in MOAB for searching for a range of tag values, for example, looking for elements with a tag within a numeric range such as > .25 and < .75, or something similar?
If not, what is the most efficient mechanism to do this in MOAB?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/moab-dev/attachments/20150529/5a721a6e/attachment.html>
More information about the moab-dev
mailing list