[MOAB-dev] Attaching a C++ class to Mesh entities?

Jed Brown jedbrown at mcs.anl.gov
Fri Oct 11 14:07:44 CDT 2013


Anthony Scopatz <scopatz at gmail.com> writes:
> Yes this is exactly what we want to do because the species that live on the
> mesh will change as a function of time. There are ~4000 known nuclides, a
> cell may start with 2 of them and may grow to 400 of them...or not.  Hard
> coding an array of approved species is one of the great failings of many NE
> codes, in my opinion.

So note that if on each time step/iteration you change the length of the
species, you'll typically be reallocating.  It is in fact very fast to
create a single new array of the size you need and then copy over
(expanding some cells, contacting others, etc).  But if you prefer
std::map, you're welcome to use that too.  (Use a custom allocator if
that becomes a performance issue, which it probably won't from the
sounds of your traversal.  std::map is pretty slow, but you can replace
it with a sorted array or hash table.)

>> > 2. Keep an external dictionary / map which is keyed by the entity and
>> > valued by Material objects
>>
>> Arrays work well for this.
>>
>
> Wouldn't using arrays assume some nominal ordering of the cells?  

Tag the cells you want to use with a sequential integer index, or even
just use the cell index from your cell iterator if you never need
neighbor access.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/moab-dev/attachments/20131011/87098b40/attachment.pgp>


More information about the moab-dev mailing list