next up previous contents
Next: 2.7 The C++ Programmer Up: 2. The Algorithm Library Previous: 2.5 Definition of Model Classes


2.6 Program Flow

The optimization of all Algorithm Library data structures for highest evaluation performance is achieved to a high extent by relocating all data management algorithms to the initialization routines of Parameter and Model classes. Another detail contributing to the performance gain over traditional application extension concepts and languages is the Parameter linkage concept which avoids efficiently the allocation and duplication of data structures involved in the evaluation of algorithms. Though the management of the involved linkage structures originates some additional effort during the initialization of Parameter classes, this overhead is easily compensated when Parameter values have either to be exchanged between several Model instances or accessed in MDL calculations repeatedly. Thus, instantiating and linking Parameter classes should be avoided within runtime critical parts of the simulator such as inner simulation loops.

This design philosophy of the Algorithm Library has naturally some impact on the design of the applications utilizing its features. In general programs should avoid any not necessary instantiations and destructions of C++ classes provided by the Algorithm Library. The most common mistake in conjunction with these design rules is the usage of automatic variables of such classes within frequently used C++ functions, which will create and destroy the involved objects with every invocation.

The resulting application design which aspires the clean separation of initialization and main execution phases is illustrated in Fig. 2.5. Before an application can use services of the Algorithm Library, the library has to be initialized. Thereafter optional input decks or dynamic extension libraries containing MDL definitions can be parsed or loaded. Next all required Model instances can be instantiated and linked to their interfaces following instructions given on the input deck or the default definitions provided with the Interface definition. This ensures that subsequent Model evaluations in the main simulation loops will compute with the highest possible efficiency. Furthermore a clean application design requires the deletion of all demanded model instances and the shutdown of the Algorithm Library to avoid unnecessary memory leaks.

Figure 2.5: Generalized flow diagram of a simulator using the Algorithm Library
\begin{figure}
\begin{center}
\includegraphics{figures/ProgramFlow.eps}\end{center}\end{figure}


next up previous contents
Next: 2.7 The C++ Programmer Up: 2. The Algorithm Library Previous: 2.5 Definition of Model Classes
Robert Mlekus
1999-11-14