3.5.1.3 Inheritance

The Input Deck database uses a powerful inheritance mechanism to pass an existing section and its hierarchy to other sections. The inherited hierarchies of sections can be specialized later on. In the example below the whole hierarchy of the Section NumDefaults is inherited by the Section Num:

Num : NumDefaults;

Items in inherited sections can be locally modified. In this case several checks take place to avoid misspelling of names. In the example below a different solver (GMRES) is chosen.

Num : NumDefaults
{  iterativeType  = "GMRES";
   // ...
}

The Input Deck database allows for multiple inheritance from any number of base sections. The base sections must be given in a list in descending order. This means that items in the first base section override items with the same name in the second base section.

Amphibian : Vehicle, Ship
{  // ...
}

Another feature implemented in the Input Deck database is conditional inheritance which is used if the inheritance depends on several conditions. Each base section can be given a single condition. When a condition evaluates to true the corresponding base section is passed on to the inherited section. The condition is not allowed to depend on variables defined in the conditional section to avoid ambiguities. In the following example the section Transport is inherited from section Car if load is less than loadmax. In case load is greater than or equal to loadmax it is inherited from section Truck. The conditions must not depend on variables within the section Transport.

load    = ...
loadmax = ...
Transport : Car   ? (load <  loadmax),
            Truck ? (load >= loadmax)
{  // ...
}

Robert Klima 2003-02-06