Typedefs | |
typedef struct EpkIdMap_struct | EpkIdMap |
Enumerations | |
enum | epk_idmap_mode_t { EPK_IDMAP_DENSE, EPK_IDMAP_SPARSE } |
Functions | |
Functions | |
EpkIdMap * | epk_idmap_create (epk_idmap_mode_t mode, size_t capacity) |
void | epk_idmap_free (EpkIdMap *instance) |
size_t | epk_idmap_size (const EpkIdMap *instance) |
epk_idmap_mode_t | epk_idmap_mode (const EpkIdMap *instance) |
void | epk_idmap_clear (EpkIdMap *instance) |
void | epk_idmap_add (EpkIdMap *instance, elg_ui4 local_id, elg_ui4 global_id) |
elg_ui4 | epk_idmap_get (const EpkIdMap *instance, elg_ui4 local_id) |
const elg_ui4 * | epk_idmap_data (const EpkIdMap *instance, size_t *count) |
This mapping data structure can operate in two different modes (see epk_idmap_mode_t): A dense mapping can be used if the local identifiers are consecutively enumerated from 0 to N-1. In this case, only the global identifier are stored in the table at the corresponding entry, leading to compact storage and fast look-up. By contrast, if the local identifiers can consist of arbitrary numbers, a sparse mapping is necessary. Here, (local_id, global_id) tuples are stored, which requires a more complicated look-up procedure.
assert()
macro to check various conditions (especially the values of given parameters) at runtime, which can cause a performance penalty. typedef struct EpkIdMap_struct EpkIdMap |
Opaque data structure representing an ID mapping table.
enum epk_idmap_mode_t |
void epk_idmap_add | ( | EpkIdMap * | instance, | |
elg_ui4 | local_id, | |||
elg_ui4 | global_id | |||
) |
Adds the given mapping from local_id to global_id to the mapping table instance. If the current capacity does not suffice, the data structure is automatically resized. If this memory reallocation request can not be fulfilled, an error message is printed and the program is aborted.
instance | Object to add the mapping to | |
local_id | Local identifier | |
global_id | Global identifier |
void epk_idmap_clear | ( | EpkIdMap * | instance | ) |
Removes all entries in the given mapping table instance. It can be used, e.g., to reuse an mapping table object for new input data.
instance | Object to remove entries from |
EpkIdMap* epk_idmap_create | ( | epk_idmap_mode_t | mode, | |
size_t | capacity | |||
) |
Creates and returns a new instance of EpkIdMap with the given mode and initial capacity. If the memory allocation request can not be fulfilled, an error message is printed and the program is aborted.
mode | Mapping mode | |
capacity | Initial capacity |
const elg_ui4* epk_idmap_data | ( | const EpkIdMap * | instance, | |
size_t * | count | |||
) |
Returns an pointer to the raw data of the given mapping table instance. In addition, the total number of IDs is stored at the location pointed to by count. For a dense mapping, this number is equal to the number of entries, whereas for a sparse mapping it is twice as much, since each entry consists of an local and an global identifier (in this order).
void epk_idmap_free | ( | EpkIdMap * | instance | ) |
Destroys the given instance of EpkIdMap and releases the allocated memory.
instance | Object to be freed |
elg_ui4 epk_idmap_get | ( | const EpkIdMap * | instance, | |
elg_ui4 | local_id | |||
) |
Returns the global identifier for the given local_id stored in the mapping table instance. If no entry can be found, ELG_NO_ID is returned.
instance | Queried object | |
local_id | Local identifier |
epk_idmap_mode_t epk_idmap_mode | ( | const EpkIdMap * | instance | ) |
Returns the identifier mapping mode (dense/sparse) used for the given mapping table instance.
instance | Queried object |
size_t epk_idmap_size | ( | const EpkIdMap * | instance | ) |
Returns the actual number of entries stored in the given mapping table instance.
instance | Queried object |
![]() |
Copyright © 1998–2009 Forschungszentrum Jülich, Jülich Supercomputing Centre |