Dsmake Overview
Dsmake (Object Data Dependent Code Generator)
is Altair's proprietary preprocessor, which transforms the Object Definition
contained in the source files into the C source files. Objects can be treated
as simple C struct's
equipped with specialized private functions, and generic capabilities.
These generic capabilities are different from typical properties of objects
in C++ or Smalltalk: there is no data encapsulation, nor inheritance, althoug
limited cabability for derived classes and virtual methods is provided
using programmatic methodology (similiar to the one used in most GUI packages
written in C, like Xt or Motif)
The basic scheme is as follows;
An ASCII text file, called the Object Definition
file, (ObjDefs.defs ), contains a description
of Object types or a given module of a program. This file is then passed
through a program generator, named dsmake, to produce a library
of Object data dependent code. Each Object definition creates one
header file, which contains the definition of the Object's structure,
all required constants, and necessary #include's to other
Objects. Developers then use a standard generic interface to access this
data dependent code (i.e. to manipulate Objects). In C/C++ it is
efficient to use direct access to the content of each struct,
but formalized API's to access each Object from C, Fortran,Tcl and interactively
from GUI are provided. At this level, no attempt is made to provide organizing
data structures to these Objects. This is provided for, on request, by
an automatic Object organizer package (ObjArrays, LinkLists, etc.).
The generated Object data dependent C code
consists of numerous C-functions, and supporting header files. Presently
dsmake
creates C functions, which for any Object allows the developer to;
-
Create and Delete the Object (internal memory
management is hidden from the user); iterators for selected Objects are
automatically maintained
-
Initialize the value of an Object Field (with
default values)
-
Set and Get the value of an Object Field
(including memory references to other Objects and dynamic array allocation
from FORTRAN and GUI)
-
Inquire as to the value and size (for the
dynamic arrays) of an Object Field.
-
Print the value of an Object or any of its
Fields.
dsmake organizes these generated C
functions, by Object and field, into arrays of function pointers. It also
provides a unique symbolic representation for each Object, and for each
of its respective fields, which corresponds to the indices of these arrays.
These arrays, then, coupled with the symbolic representations provide the
programmatic link between the Object data dependent and the Object data
independent code.
After generating the Object data dependent
C code, the developer then compiles and binds this code with the generic
Object data independent kernel. resulting in a working database. The data
independent code contains functions which operate on Objects in a generic
sense, making no assumptions about the form of the data of any particular
Object.
Object Organizers
All Objects can have automatic iterators maintained
consistently with Object's creation and deletion. User can as for number
of objects, for the Object at the position n
(roughly
equivalent to the order of their creation) or for the next object of given
type). Developer can create arbitrary organizer of any type of Objects,
(ObjArray, LinkedList, Stack, etc.), add and remove Objects to/from this
organizer, and iterate through the content of organizer.
Object Set module provides specialized
type of organizers, which is very powerfull and can be used almost everywhere
in the code. Set module allows to define various membership criteria (e.g.
all elements with given material, or nodes within given bounding box) and
create derived sets using Boolean arithmetic (inside the code or from the
GUI form). All resulting sets can be used in the solution process (e.g.
solve the stresses inside the bounding box), adaptivity (estimate errors
and adapt all elements of a given set) and postprocessing (display temperature
and pressure on the boundary of subset of elements with given rock properties).
Set Editor Form allows to inspect
all current sets, create the new ones using standar boolean operators,
and Bounding Box Editor Form
is used to create interactively element sets based on the bounding box.
Set module is very robust: Objects in the set can be deleted, Finite Elements
refined or unrefined, new Objects with given property (e.g. within the
bounding box) can be created, and the content of the set is automatically
maintained. Set definitions are included in the save/restart capability,
so they are automatically recreated when the restart file is loaded into
the code.
User Data Objects
Gridfile module extends the internal definition
of the Objects to the input data file (gridfile - roughly equivalent to
the BULKDATA file used in Nastran codes). This module implements form of
Object Class inheriitance, where typical user data objects (material/property
data, forces, boundary conditions, coordinate systems, etc.) are all descendants
of the generic Object Class. This generic class allows automatical interpretation
of the input data in the free format, with each Object and Object's data
(e.g. Viscosity, Poisson's ratio, etc) can be independently named in the
input file. Developer has to provide simple creator function, which can
simply associate input fields with object fields, but it may be more complex,
allowing to test validity of data, providing for alternate ways to input
values, compute default missing components, interpret textual flags, and
use functions instead of constants for various data values. As an example,
'Viscosity' property in the Material Object may be defined as a function
of temperature at the current point. The actual definition of the function
will be provided in the gridfile, either as a table of values (uniform
or non-uniform spacing, random nodal values for multidimensional functions,
linear or quadratic interpolation), or as a procedural definition in the
form of simple mathematical expression or complex procedure (Tcl
language is used as underlying expression evaluator).