<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<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 tabindex="-1">
<div style="direction: ltr;" id="divRpF728508"><font size="2" color="#000000" face="Tahoma"><b>From:</b> moab-dev-bounces@mcs.anl.gov [moab-dev-bounces@mcs.anl.gov] on behalf of Nico Schlömer [nico.schloemer@gmail.com]<br>
<b>Sent:</b> Wednesday, December 02, 2015 11:03 AM<br>
<b>To:</b> moab-dev@mcs.anl.gov<br>
<b>Subject:</b> [MOAB-dev] IDs to index?<br>
</font><br>
</div>
<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>
</body>
</html>