<div dir="ltr">> you can use Core::id_from_handle( ) to return 1, 2, 3 in your example<br><br><div>Just what I was looking for.</div><div>Am I right assuming that this EntityId is a local (per-process) ID and that it is 1-based?</div><div><br></div><div>Cheers,</div><div>Nico</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 2, 2015 at 6:25 PM Grindeanu, Iulian R. <<a href="mailto:iulian@mcs.anl.gov">iulian@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">the EntityHandle is a special MOAB entity, you can think of as a pointer. (it is unsigned long on linux)<br>
first 4 bits are used for type, next are used for entity id<br>
<br>
Range is a std-like container for those entity handles<br>
<br>
if you convert to hex, you will see this::<br>
<br>
(gdb) p /x 5764607523034234881<br>
$6 = 0x5000000000000001<br>
<br>
it means it is of type 5 (tet), and the first one in the sequence<br>
you can use Core::id_from_handle( ) to return 1, 2, 3 in your example<br>
<br>
You can use "iterate" methods to loop through, some examples are here<br>
<a href="http://ftp.mcs.anl.gov/pub/fathom/moab-docs/classmoab_1_1Interface.html#ab1251d0eb25a27ea3e655d2279b3fa01" target="_blank">http://ftp.mcs.anl.gov/pub/fathom/moab-docs/classmoab_1_1Interface.html#ab1251d0eb25a27ea3e655d2279b3fa01</a><br>
<br>
<a href="http://ftp.mcs.anl.gov/pub/fathom/moab-docs/DirectAccessNoHoles_8cpp-example.html#a17" target="_blank">http://ftp.mcs.anl.gov/pub/fathom/moab-docs/DirectAccessNoHoles_8cpp-example.html#a17</a><br>
<br>
<a href="http://ftp.mcs.anl.gov/pub/fathom/moab-docs/contents.html#twotwo" target="_blank">http://ftp.mcs.anl.gov/pub/fathom/moab-docs/contents.html#twotwo</a><br>
<br>
in most cases, you will have only one sequence (from 1 to the number of entities of that type)<br>
<br>
Iulian<br>
<br>
<br>
<div style="font-family:Times New Roman;color:#000000;font-size:16px">
<hr>
<div style="direction:ltr"><font size="2" color="#000000" face="Tahoma"><b>From:</b> <a href="mailto:moab-dev-bounces@mcs.anl.gov" target="_blank">moab-dev-bounces@mcs.anl.gov</a> [<a href="mailto:moab-dev-bounces@mcs.anl.gov" target="_blank">moab-dev-bounces@mcs.anl.gov</a>] on behalf of Nico Schlömer [<a href="mailto:nico.schloemer@gmail.com" target="_blank">nico.schloemer@gmail.com</a>]<br>
<b>Sent:</b> Wednesday, December 02, 2015 11:03 AM<br>
<b>To:</b> <a href="mailto:moab-dev@mcs.anl.gov" target="_blank">moab-dev@mcs.anl.gov</a><br>
<b>Subject:</b> [MOAB-dev] IDs to index?<br>
</font><br>
</div></div></div></div><div><div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt"><div style="font-family:Times New Roman;color:#000000;font-size:16px">
<div></div>
<div>
<div dir="ltr">Hi everyone,
<div><br>
</div>
<div>I just checked out the elem values for some mesh,</div>
<div>```</div>
<div>
<div> // Get regions, by dimension, so we stay generic to entity type</div>
<div> Range elems;</div>
<div> rval = mb->get_entities_by_dimension(0, 3, elems);MB_CHK_ERR(rval);</div>
<div> cout << "Number of elements is " << elems.size() << endl;</div>
<div><br>
</div>
<div> for (size_t k = 0; k < elems.size(); k++) {</div>
<div> std::cout << "elems[" << k << "] = " << elems[k] << std::endl;</div>
<div> }</div>
</div>
<div>```</div>
<div>and get</div>
<div>```</div>
<div>
<div>elems[0] = 5764607523034234881</div>
<div>elems[1] = 5764607523034234882</div>
<div>elems[2] = 5764607523034234883</div>
</div>
<div>// ...</div>
<div>```</div>
<div>That came as a bit of a surprise to me since I had expected low consecutive numbers, but I guess there's no guarantee for that.</div>
<div><br>
</div>
<div>Now, I would like to store additional data per element, and I initially planned to just create a `std::vector<double>`. However, to associate the data `data[42]` with a particular `elem`, I'll have to do something else. I suppose I could use a `std::map<EntityHandle,
double>` instead.</div>
<div><br>
</div>
<div>How to you typically organize this? Is there, for example, a helper method that converts an `elem` ID into something that I can use as an index into `data`?</div>
<div><br>
</div>
<div>Cheers,</div>
<div>Nico</div>
</div>
</div>
</div></div></div></blockquote></div>