<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p
{mso-style-priority:99;
margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
p.msochpdefault, li.msochpdefault, div.msochpdefault
{mso-style-name:msochpdefault;
margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Calibri",sans-serif;}
span.emailstyle17
{mso-style-name:emailstyle17;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Thanks for the response, I’ll try the tag_iterate then.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Grindeanu, Iulian R. [mailto:iulian@mcs.anl.gov]
<br>
<b>Sent:</b> Friday, May 29, 2015 10:22 AM<br>
<b>To:</b> Steve Balderrama; moab-dev@mcs.anl.gov<br>
<b>Subject:</b> RE: MOAB search tag range<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black">There is no mechanism for that. I assume you are talking about dense tags, not sparse tags.<br>
If sparse tags, you will just have to retrieve one by one the tag values, with tag_get_data(()<br>
<br>
I think the most efficient way is to use tag_iterate over your elements of interest (if dense)<br>
By using tag_iterate, you will access tag values directly in memory, no copying involved<br>
You should return either a range or a standard vector, depending on how broken your output sequence will be<br>
<br>
(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)<br>
<br>
so your code could look like this (look in Interface.hpp comments)<br>
<br>
Range output_range;<br>
<br>
Range::iterator iter = ents.begin();<br>
while (iter != ents.end()) {<br>
int count;<br>
// get contiguous block of tag dat<br>
void* ptr;<br>
err = mb.tag_iterate( tag, iter, ents.end(), count, ptr );<br>
if (err) { ... }<br>
// do something with tag data<br>
// assume your tag is type double <br>
double *dptr = ptr<br>
for (int j=0; j<count; j++, dptr++)<br>
if (*dptr<0.25 && *dptr > 0.75)<br>
{<br>
EntityHandle interesting_element = (*iter+j);<br>
output_range.insert( interesting_element )<br>
<br>
}<br>
// advance to next block of data<br>
iter += count;<br>
}<o:p></o:p></span></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black">
<hr size="2" width="100%" align="center">
</span></div>
<div id="divRpF507983">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black">
<a href="mailto:moab-dev-bounces@mcs.anl.gov">moab-dev-bounces@mcs.anl.gov</a> [moab-dev-bounces@mcs.anl.gov] on behalf of Steve Balderrama [sbalderrama@eagle.org]<br>
<b>Sent:</b> Friday, May 29, 2015 9:58 AM<br>
<b>To:</b> <a href="mailto:moab-dev@mcs.anl.gov">moab-dev@mcs.anl.gov</a><br>
<b>Subject:</b> [MOAB-dev] MOAB search tag range</span><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="color:black">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?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">If not, what is the most efficient mechanism to do this in MOAB?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Thanks.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>