Name Mapping

Expressions normally contain references to other variables. In the description language of the Input Deck database (IDDL) references are specified either by the full name or the relative name of the item. A name is a chain of section names containing the item and the name of the item itself. A full name is an absolute path to the item starting with the `~' character for the root section and ending with the name of the item itself. A relative name is built up like a full name and depicts the relative path to the item starting from the current section. The `^' character can be used to denote the next upper section in the hierarchy.

{  x = 1;

In this short example the section Outer contains the keyword x and a subsection Inner. Within section Inner the keyword x can be referred to by ^.x, within section Outer by x, within the root section by Outer.x, and anywhere else by its full name ~.Outer.x.

In expressions references to variables normally are used very often. Hence the corresponding items have to be found quickly. The Input Deck database uses a dynamic approach of data representation and the corresponding items have to be determined at runtime. Therefore, references cannot be represented internally by nodes holding simple pointers to the item. Instead, the name specified must be used.

As shown in Section referring to an item causes the inheritance algorithm to successively generate a sequence of possible item full names which are used to check if an item exists. Storing names as strings would slow down the inheritance algorithm. Therefore, a different and much faster approach for storing names is implemented: Names are not represented as chains of strings but as chains of IDs. Each subname - which is the name of a section or the name of a variable - is assigned a unique ID number. The '~' has always ID 0, the '^' has ID $ 1$. So each name is internally represented by a series of IDs, where $ -1$ indicates the end of the chain. E.g., if the subnames Outer, x, and Inner of the example above are represented by the IDs $ 2$, $ 3$, and $ 4$ the following ID chains are used to represent the names:

Reference ID chain
~.Outer.x 0, $ 2$, $ 3$, $ -1$
Outer.x $ 2$, $ 3$, $ -1$
x $ 3$, $ -1$
^.one $ 1$, $ 3$, $ -1$

Compared to references implemented by strings this approach speeds up the inheritance algorithm by a factor of about two for typical applications.

Robert Klima 2003-02-06