# TETlib 1.0 Reference Manual

## Introduction

### What is TETlib?

TETlib stands for Theoretical Electrical engineering Toolkit.

It is a collection of classes and routines that are often needed in theoretical electrical engineering or related fields. The main components currently are special mathematical functions, classes to deal with different coordinate systems, classes that can represent meshes (e.g. for Finite Element or Method of Moments Analysis) and a couple of utility classes.

The main goal of this library is to provide a reusable and well-documented fundament for our groups' daily work (mainly dealing with computational electromagnetics and computational elastodynamics).

Development has been going on at the Dept. of Theoretical Electrical Engineering of the Ruhr-University Bochum, Germany, the Computational Electromagnetics Group of the Christian-Albrechts Universität Kiel, Germany, and the Department of Theoretical Electrical Engineering at the University of Kassel, Germany.

Main architects and contributors are Jens Hannemann (j.hannemann@ieee.org, current maintainer), Michael Zellerhoff (zellerhoff@ieee.org), as well as Regina Hannemann (r.hannemann@ieee.org).

TETlib is provided under the GNU Library (or lesser) General Public License. Please see the file COPYING that is included in the source distribution for further information.

### Acknowledgements

Part of the code for the computation of special functions (see the files tetfunc.h and tetfunc.cpp) has been adapted and ported from FORTRAN to C++ based on the book "\ref chen "Computation of Special Functions"" by Shanjie Zhang and Jianming Jin (j-jin1@uiuc.edu).

GNU Nana, which TETlib utilizes for assertion monitoring (see Nana), is provided by P.J. Maker (pjm@gnu.org).

Doxygen, the wonderful documentation tool is brought to you by Dimitri van Heesch (dimitri@stack.nl)

"Design by Contract" is a trademark of Interactive Software Engineering.

## Installation

For generic installation instructions, see the file INSTALL in the source distribution.

Please note that the compiler's default settings (-g -O2) may be too demanding for your computer, since optimization requires a lot of memory with g++. To change the default, please define the environment variable CXXFLAGS to match your system's resources before configuring the package (you can turn off optimization with -O0 on most compilers). For more detailed instructions on configuration see the section Nana below and the INSTALL file.

### Compilers known to work

TETlib has been developed and has been tested so far with GNU gcc 3.x on Linux, Solaris, AIX, IRIX, HP-UX, and Windows 2000/XP (via the cygwin environment).

We haven't tested other compilers yet, but any compiler that supports ISO C++ should work in the long run.

Note that gcc/egcs versions prior to 3.0 do not compile TETlib because of the limited standard C++ support in these versions.

### Nana

TETlib uses GNU Nana for assertion monitoring. Nana provides a framework for "Design by Contract (TM)" and can efficiently check pre- and postconditions as well as class and loop invariants. It has been developed by P.J. Maker (pjm@gnu.org).

Installation of Nana is recommended, however not necessary to compile or use TETlib. In its default settings, TETlib's configure script disables Nana. The header stubs necessary to compile the code are provided in the directory nana of the source distribution. If you want to enable Nana, pass the --enable-nana option to configure. TETlib uses the Eiffel style of assertion checking. This provides various levels of assertion monitoring. To enable the actual monitoring, you must pass the --enable-eiffel-check=CHECK_LEVEL option to configure, with CHECK_LEVEL being one of:
 CHECK_NO turn off eiffel style checking (and hence almost every check in TETlib) CHECK_REQUIRE default, if no value is given. Check preconditions CHECK_ENSURE additionally, check postconditions CHECK_INVARIANT additionally, check class invariants CHECK_LOOP additionally, check loop invariants CHECK_ALL additionally, check all other assertions specified by the CHECK instruction

An error will be generated if you try to enable eiffel-check without enabling Nana.

On Linux systems, enabling nana might result in the following message


checking whether nana works... no
Could not find nana! Disabling it!

This is the result of Nana not being 100% compatible to standard C++. The problem arises through nana's use of malloc() under Linux, which is not needed for assertion monitoring. You can work around the problem by undefining the #ALWAYS_INCLUDE_MALLOC macro in nana-config.h.

For more details on Nana, have a look at the Nana reference manual.

## Automake Support

TETlib supports automake by providing an appropriate m4 macro to check for correct compilation and linkage in conjunction with other packages. The macro is defined in the file tetlib.m4 which will be installed into the directory \$(datadir)/aclocal (usually /usr/local/share/aclocal). To include it into your ./configure script, run aclocal with the option -I/usr/local/share/aclocal (or wherever your local copy of tetlib.m4 resides) before calling autoconf. After that, you might use the macro TET_TETLIB to check for correct TETlib installation. Syntax is: TET_TETLIB([ACTION-IF-FOUND,[ACTION-IF-NOT-FOUND]]) The standard search paths for the library are /usr/local/lib, /usr/lib and ~/lib and for the headers /usr/local/include/TETlib, /usr/include/TETlib and ~/include/TETlib. For non-standard paths, you can set the environment variables TETDIR for the library (libTET.a) and TETINCDIR for the headers. Programs that compile and link against TETlib have the variables @ and @ available for insertion into configure.in. @ will be replaced by the actual path to the header files and @ provides the path to the library file. When linking against TETlib, be sure to specify -lTET -lfl as linker flags (or better for automake: -lTET @), because TETlib requires the flex/lex library to be present for configuration file parsing). If the test fails and no action is specfied, an error is generated and configure will exit abnormally.

There is also a macro to check for Nana, which is also used by TETlib's configure itself. It can be found under nana/nana.m4, and syntax is similar to the other macros: TET_NANA([ACTION-IF-FOUND,[ACTION-IF-NOT-FOUND]]) Output variables are @ for the headers, @ for the library and @ for the actual linker flag (usually -lnana). If Nana could not be found, it will be automatically disabled and compilation should proceed normally.

## Using TETlib

TETlib is most easily be used in projects using automake and autoconf. In any case, there are a couple of preprocessor symbols that need to be present when compiling code that instantiates TETlib templates. These symbols can be found in the file tetlibconfig.h, which is installed along with the TETlib headers and reflects the settings with which TETlib has been compiled. Be sure that the configuration of the project using TETlib is identical to TETlib's configuration itself to avoid any strange behavior.

## Extra Documentation

In section Mesh we describe how meshes are defined and how they fit into the TETlib.

We also provide a References list.

## Design Rules

### Names

For the choice of names we agreed on the following rules:

If a name is composed of several words, the words are separated by underscores. For class names each word starts with a capital letter. Methods and attributes are written in lower-case letters. Special names with widely accepted meanings (like Bessel, JY) are an exception from this. Typedefs are also denoted like classes, since classes are types. For namespaces, the same conventions as for typedefs and classes apply.

Examples:
 Class TET::Mesh::List Class TET::Mesh::Oriented_List method TET::Math::Numeric_Object::accuracy() method TET::Math::Numeric_Object::set_accuracy() method with special names TET::Func::Jv(const double x, const double x) attribute TET::Math::Numeric_Object::acc typedef Key_Value_Map

Generated on Sun Apr 25 11:54:30 2004 for TETlib by 1.3.6