IOSS 2.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
anonymous_namespace{Iocgns_DatabaseIO.C} Namespace Reference

Classes

struct  _cgns_io_ctx_t
 
struct  ParallelGuard
 
struct  SBlock
 

Typedefs

typedef struct anonymous_namespace{Iocgns_DatabaseIO.C}::_cgns_io_ctx_t cgns_io_ctx_t
 

Functions

size_t global_to_zone_local_idx (size_t i, const Ioss::Map *block_map, const Ioss::Map &nodeMap, bool isParallel)
 
template<typename T>
void unpack (int &idx, const T *pack, T *to, int count)
 
size_t handle_block_ids (const Ioss::EntityBlock *eb, Ioss::Map &entity_map, void *ids, size_t num_to_get, const Ioss::Field::BasicType &size)
 

Variables

cgns_io_ctx_t ctx_cgio
 

Typedef Documentation

◆ cgns_io_ctx_t

typedef struct anonymous_namespace{Iocgns_DatabaseIO.C}::_cgns_io_ctx_t anonymous_namespace{Iocgns_DatabaseIO.C}::cgns_io_ctx_t

Function Documentation

◆ global_to_zone_local_idx()

size_t anonymous_namespace{Iocgns_DatabaseIO.C}::global_to_zone_local_idx ( size_t i,
const Ioss::Map * block_map,
const Ioss::Map & nodeMap,
bool isParallel )

◆ handle_block_ids()

size_t anonymous_namespace{Iocgns_DatabaseIO.C}::handle_block_ids ( const Ioss::EntityBlock * eb,
Ioss::Map & entity_map,
void * ids,
size_t num_to_get,
const Ioss::Field::BasicType & size )

CGNS doesn't support element global ids, so the only use of this routine is the case where we may be translating from a mesh that does support global ids and we will then need to map those global ids back to local ids in, for example, the sideset element list.

There will be two maps the 'entity_map.map' map is a 'direct lookup' map which maps current local position to global id and the 'entity_map.reverse' is an associative lookup which maps the global id to 'original local'. There is also a 'entity_map.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 = entity_map.reverse[ElementMap[i+1]] (the entity_map.map and entity_map.reverse are 1-based)

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 'entity_map.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 = entity_map.reverse[entity_map.map[eb_offset+i+1]]-eb_offset-1

NOTE: the maps are built an element block at a time...

◆ unpack()

template<typename T>
void anonymous_namespace{Iocgns_DatabaseIO.C}::unpack ( int & idx,
const T * pack,
T * to,
int count )

Variable Documentation

◆ ctx_cgio

cgns_io_ctx_t anonymous_namespace{Iocgns_DatabaseIO.C}::ctx_cgio
extern