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

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


Hello,

When you declare an entity with a given rank and id it can later be retrieved on the same mpi process, using get_entity with the same rank and id, as long as it hasn't been deleted. The global id provided to declare_entity has nothing to do with the m_value (local offset) of the entity.

If get_entity fails to retrieve a valid entity, it means that the entity has been deleted. Note that entities only exist on the mpi process where they were declared, unless they end up being shared or ghosted to other processes.

An entity's m_value (local offset) generally has no meaning outside of bulkdata, it is used internally.

Alan


> On Aug 26, 2016, at 1:17 PM, Luca Bertagna <luca.bertagna84 at gmail.com> wrote:
> 
> Hello,
> 
> 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...
> 
> Thanks!
> 
> Luca
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at trilinos.org
> https://trilinos.org/mailman/listinfo/trilinos-users


More information about the Trilinos-Users mailing list