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

Williams, Alan B william at sandia.gov
Fri Aug 26 18:16:12 EDT 2016

The entity key is simply the combination of a rank and a global id. The get_entity that takes a key is equivalent to the version that takes a rank and id. They end up making the same query.


On Aug 26, 2016, at 2:29 PM, Luca Bertagna <luca.bertagna84 at gmail.com<mailto:luca.bertagna84 at gmail.com>> wrote:

It appears that

Entity get_entity ( EntityKey key) const;

is the function I need? I find it a little hard to navigate the intricate labyrinth of stk meshes, so I'm not 100% sure this is correct. Could someone confirm that the key is indeed the global id (not necessarily the entity local offset)?

Thank you.

On Fri, Aug 26, 2016 at 3:17 PM, Luca Bertagna <luca.bertagna84 at gmail.com<mailto:luca.bertagna84 at gmail.com>> wrote:

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...



Trilinos-Users mailing list
Trilinos-Users at trilinos.org<mailto:Trilinos-Users at trilinos.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20160826/cd1dee49/attachment.html>

More information about the Trilinos-Users mailing list