next up previous contents
Next: A.4. Parameter Definition Up: A. A Tiny Algorithm Previous: A.2. Application Body


A.3. MDL Function Definition

Appendix A.6 describes an MDL input deck which generates an ASCII file containing data samples of the complementary error function erfc (A.1). The format of this ASCII file is compatible with the gnuplot program which can be used for the visualization of the tinyapp results.


\begin{displaymath}
\mathop{\rm erfc}(x) = 1 - \frac{2}{\sqrt{\pi}}{\cdot}\int_{0}^{x} e^{-t^2} {\cdot} dt
\end{displaymath} (A.1)

Since this function is not provided by the Algorithm Library standard distribution, it is required to define an MDL function extension library. Because the required erfc function is already contained in the standard C library for generating the erfc MDL function it is sufficient to supply the UNFUG tuple file TinyAppFuncLib.tup (Example A.4) and the VMAKE makefile in Example A.5. Both files are generated by replacing various place holders in the templates given in Example 2.6, respectively Example 2.8 as described in Section 2.8.

\includegraphics[width=0.6cm]{figures/exaLeft.eps}

;; The internal name of the library
(defun LocalParamLibraryName () "TinyAppFuncLib")

(tuple
 '(ModelLib-FunctionExpressions
   ( mdlExpr   exprDesc         cxxExpr     parFkt     
     instTuple              
     errorMsg                                                             )
   ( "erfc"    "ErfcExprDescr"  "ErfcExpr"  "parErfc"  
     ModelLib-Parameter::erfc-function
     "The 'erfc' function is not defined for arguments of the type '%s'!" )
   ))

(tuple
 '(ModelLib-Parameter::erfc-function
   (resType  op1Type     valFkt   resAlias  op1Alias    (  header    ))
   ("double" "double"    "erfc"   "double"  "double"    (  "math.h"  ))
   ))

Example A.4: UNFUG tuple file for a tiny MDL function extension library

\includegraphics[width=0.6cm]{figures/exaLeft.eps}

;;- Symbolic VMAKE directory name
(Module-Directory TinyAppFuncLib-Directory)
(Name TinyAppFuncLib-Tuple :file "TinyAppFuncLib.tup")

;;-------------------------
;;- Objects for the MDL-Function-Extension-Library |
;;-------------------------
(Unfug-Target TinyAppFuncLib-Functions-Source
              :template Vienna-Model-Library-ParamExtensionDefinition-Tpl
              :tuple    Vienna-Template-Instantiation-Tup
                        Vienna-Model-Library-Main-Tup
                        Vienna-Model-Library-ModelExtensionTuple
                        TinyAppFuncLib-Tuple
              :target   "TinyAppFuncLib.acc"
)

(Unfug-Target TinyAppFuncLib-Functions-Header
              :template Vienna-Model-Library-ModelExtensionDeclaration-Tpl
              :tuple    Vienna-Template-Instantiation-Tup
                        Vienna-Model-Library-ModelExtensionTuple
                        TinyAppFuncLib-Tuple
              :target   "TinyAppFuncLib.ahh"
)

(C++-Target TinyAppFuncLib-Auto-Objs
            :source TinyAppFuncLib-Functions-Source
            :defines (LOCAL_FUNCS_LIBRARY_DEFINITION 1)
)

(C++-Target TinyAppFuncLib-User-Objs
            :source :wildcard "*.cc"
)

;;----------------------
;; The local MDL-Function-Extension-Library |
;;----------------------
(Library-Target TinyAppFuncLib-Library
                :libname "TinyAppFuncLib"
                :objects TinyAppFuncLib-User-Objs
                         TinyAppFuncLib-Auto-Objs
                :shared
                :depends Vienna-Model-Library
)

(Include-Target :include TinyAppFuncLib-Functions-Header)

Example A.5: VMAKE makefile for a tiny MDL function extension library


next up previous contents
Next: A.4. Parameter Definition Up: A. A Tiny Algorithm Previous: A.2. Application Body
Robert Mlekus
1999-11-14