IOSS 2.0

Functions
Iofx::anonymous_namespace{Iofx_DatabaseIO.C} Namespace Reference

## Functions
size_t | handle_block_ids (const Ioss::EntityBlock *eb, ex_entity_type map_type, Ioss::State db_state, Ioss::Map &entity_map, void *ids, size_t int_byte_size, size_t num_to_get, int file_pointer)

## Function Documentation

## ◆ handle_block_ids()

size_t Iofx::anonymous_namespace{Iofx_DatabaseIO.C}::handle_block_ids | ( | const Ioss::EntityBlock * | eb,
|  | ex_entity_type | map_type,
|  | Ioss::State | db_state,
|  | Ioss::Map & | entity_map,
|  | void * | ids,
|  | size_t | int_byte_size,
|  | size_t | num_to_get,
|  | int | file_pointer
| ) |  |

NOTE: "element" is generic for "element", "face", or "edge"

There are two modes we need to support in this routine:

1. Initial definition of element map (local->global) and elemMap.reverse (global->local).
2. Redefinition of element map via 'reordering' of the original map when the elements on this processor are the same, but their order is changed.

So, there will be two maps the 'elemMap.map' map is a 'direct lookup' map which maps current local position to global id and the 'elemMap.reverse' is an associative lookup which maps the global id to 'original local'. There is also a 'elemMap.reorder' which is direct lookup and maps current local position to original local.

The ids coming in are the global ids; their position is the local id -1 (That is, data[0] contains the global id of local element 1 in this element block). The 'model-local' id is given by eb_offset + 1 + position:

int local_position = elemMap.reverseElementMap[i+1]

But, this assumes 1..numel elements are being output at the same time; we are actually outputting a blocks worth of elements at a time, so we need to consider the block offsets. So... local-in-block position 'i' is index 'eb_offset+i' in 'elemMap.map' and the 'local_position' within the element blocks data arrays is 'local_position-eb_offset'. With this, the position within the data array of this element block is:

int eb_position = elemMap.reverse[elemMap.map[eb_offset+i+1]]-eb_offset-1

To determine which map to update on a call to this function, we use the following hueristics: – If the database state is 'Ioss::STATE_MODEL:', then update the 'elemMap.reverse'. – If the database state is not Ioss::STATE_MODEL, then leave the 'elemMap.reverse' alone since it corresponds to the information already written to the database. [May want to add a Ioss::STATE_REDEFINE_MODEL] – Always update elemMap.map to match the passed in 'ids' array.

NOTE: the maps are built an element block at a time... NOTE: The mapping is done on TRANSIENT fields only; MODEL fields should be in the orginal order...