[MOAB-dev] IDs to index?
Nico Schlömer
nico.schloemer at gmail.com
Wed Dec 2 11:03:02 CST 2015
Hi everyone,
I just checked out the elem values for some mesh,
```
// Get regions, by dimension, so we stay generic to entity type
Range elems;
rval = mb->get_entities_by_dimension(0, 3, elems);MB_CHK_ERR(rval);
cout << "Number of elements is " << elems.size() << endl;
for (size_t k = 0; k < elems.size(); k++) {
std::cout << "elems[" << k << "] = " << elems[k] << std::endl;
}
```
and get
```
elems[0] = 5764607523034234881
elems[1] = 5764607523034234882
elems[2] = 5764607523034234883
// ...
```
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.
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.
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`?
Cheers,
Nico
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/moab-dev/attachments/20151202/b30e328d/attachment.html>
More information about the moab-dev
mailing list