Indexing routines
[GridLAB-D Core]


Detailed Description

Indexing routines allow objects to be organized in ranks.


Classes

struct  s_index

Typedefs

typedef s_index INDEX
 the index structure

Functions

INDEXindex_create (int first_ordinal, int last_ordinal)
 Create an index.
STATUS index_insert (INDEX *index, void *data, int ordinal)
 Insert an item into an index.
void index_shuffle (INDEX *index)
 Shuffle an index to avoid excessive lock contention in models where topologically adjacent objects are loaded sequentially.


Function Documentation

INDEX * index_create ( int  first_ordinal,
int  last_ordinal 
)

Create an index.

Returns:
a pointer to the index structure
Parameters:
first_ordinal  the first ordinal
last_ordinal  the last ordinal

Definition at line 22 of file index.c.

References s_index::first_ordinal, s_index::first_used, s_index::id, s_index::last_ordinal, s_index::last_used, s_index::ordinal, and output_verbose().

STATUS index_insert ( INDEX index,
void *  data,
int  ordinal 
)

Insert an item into an index.

Returns:
STATUS on SUCCESS, FAILED otherwise

Todo:
allow resizing indexes when ordinal is before first (ticket #28)
Parameters:
index  the index to which the item is added
data  a pointer to the item to be added
ordinal  the ordinal to which the item belongs

Definition at line 64 of file index.c.

References FAILED, s_index::first_ordinal, s_index::first_used, s_index::id, s_index::last_ordinal, s_index::last_used, list_append(), list_create(), s_index::ordinal, output_fatal(), output_verbose(), and SUCCESS.

void index_shuffle ( INDEX index  ) 

Shuffle an index to avoid excessive lock contention in models where topologically adjacent objects are loaded sequentially.

Parameters:
index  the index to shuffle

Definition at line 113 of file index.c.

References s_index::first_used, s_index::id, s_index::last_used, list_shuffle(), s_index::ordinal, and output_verbose().


GridLAB-DTM Version 1.0
An open-source project initiated by the US Department of Energy