[Trilinos-Users] [EXTERNAL] Query STK entities for a global index?

Williams, Alan B william at sandia.gov
Thu Dec 29 11:46:18 EST 2016

Hi Kevin,

It isn’t really an intended STK Mesh usage. However, there is a way to have the stk_io component populate such a field for you.
When reading an exodus file using stk_io, you can do something like this:

stk::mesh::MetaData& meta = …
stk::io::StkMeshIoBroker& ioBroker = …

meta.declare_field<stk::mesh::Field<int> >(stk::topology::NODE_RANK, “implicit_node_ids”);

The ‘create_input_mesh()’ call declares some things on the meta-data object, but doesn’t read nodes/elements/etc. Afterwards, you can still declare fields on meta-data up until you call populate_bulk_data(). If you have declared a nodal field with the name “implicit_node_ids”, then populate_bulk_data should populate it with data that looks like your desired [0, 1, 2] and [3, 4] values. I’m not sure whether the values will be 0-based or 1-based.
If you subsequently create new nodes (or delete nodes) during the course of your run, these ‘implicit node ids’ will not be automatically maintained for you.
Most important note: this is a feature that isn’t guaranteed by the API, and I can’t promise whether it is a permanent or well-supported feature.

Regarding addressing matrix/vector locations, I believe that both Epetra and Tpetra maps can be set up to use either global or local ids.


From: Trilinos-Users [mailto:trilinos-users-bounces at trilinos.org] On Behalf Of Kevin Manktelow
Sent: Tuesday, December 27, 2016 8:28 PM
To: trilinos-users at trilinos.org
Subject: [EXTERNAL] [Trilinos-Users] Query STK entities for a global index?

Hi, I'm just beginning to explore Trilinos and in particular the STK package.  The STK package is fantastic and I've been able to get it to do a lot of things with the provided examples like read a decomposed mesh, write transient data and fields, etc., but there is a very simple query that I'm having trouble with:

I would like to obtain a global contiguous index for a given entity such as NODE_RANK or ELEMENT_RANK.  I've created my exodus file so that there is an element number map so that the identifier() function returns IDs which are not sequential.  For example, I may have 5 elements distributed on two MPI processes so that:

All IDs = [200, 400, 600, 800, 900]
Processor 1 ID's = [200, 400, 600]
Processor 2 ID's = [800, 900]

I can query stkBulkData.local_id( entity ) to get [0,1,2] and [0,1].
I can query stkBulkData.identifier( entity ) to get [200, 400, 600] and [800, 900]

Is there a way to query an entity for global index so that I get [0, 1, 2] and [3, 4]?

I've searched all the documentation, code, and examples and can't find anything like this so I have to imagine I'm either (a) overlooking something very obvious, or (b) trying to do something that is not an intended usage of the STK package.  For what it's worth, I'm trying to set up the global indices for a global stiffness matrix where each NODE_RANK entity may have multiple degrees of freedom and using a 'global index' seemed like a natural way to reference the correct rows and columns in the global stiffness matrix.


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

More information about the Trilinos-Users mailing list