[Trilinos-Users] STK entity with id different from local offset

Luca Bertagna luca.bertagna84 at gmail.com
Fri Aug 26 15:17:23 EDT 2016


I am having an issue related to how stk BulkData stores entities. In
particular, I am adding nodes to my mesh with a predefined id. For
instance, let's say my bulk data has 2 nodes, which I add like this

bulkData.declare_entity(stk::topology::NODE_RANK, 10);
bulkData.declare_entity(stk::topology::NODE_RANK, 20);

Later on, I try to extract the entity with Id 10, but the following does
not work:

stk::mesh::Entity e = bulkData.get_entity(stk::topology::NODE_RANK,10);

and returns an entity with m_value=0 (that is, an invalid entity). It
appears that bulkData looks for an entity with local offset equal to 10,
which clearly does not exist.

Now, since I know the global id of the node, I could just create the Entity
myself, as

stk::mesh::Entity e(10);

However, I was wondering if there is a way to access entities information
using the Entity id instead of the local offset. I know that that
information is stored in the entity repository, since within gdb I can see
that the m_entities map inside the repo has

std::map with 2 elements = {[{m_value = 1}] = {m_value = 10}, [{m_value =
2}] = {m_value = 20}}

so the information about the global ID of the entity IS stored
somewhere. It appears to me that the two entities above will be created
with m_value equal to 1 and 2 (respectively), and that the id I pass is
stored in the entity repo. Bu then, the following signatures

Entity declare_entity( EntityRank ent_rank , EntityId ent_id);// Mod Mark
Entity get_entity( EntityRank ent_rank , EntityId entity_id ) const;

give different meaning to the second argument. In particular, for
declare_entity, a new Entity is created, whose m_value will not necessarily
be equal to the given ent_id, while get_entity looks for an entity whose
m_value attribute matches the input one. In a way, in the declare method we
pass the global id of the entity, while in the second we pass the local id.

Is this correct? And if so, how can I query BulkData for, say, the presence
of an entity with a given global ID?

I hope this makes sense...


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20160826/10612699/attachment.html>

More information about the Trilinos-Users mailing list