Graphics
/ Postprocessing - Overviev
The following technical summary of
the graphics / postprocessing package introduces various features of the
package, describes in more detail some of the entities that make the package
especially useful for interactive 3D visualization, describes the particular
devices supported, and gives a brief overview of the internal structure
of the package.
Examples
The following examples are included to show
some of the capabilities of the PHLEX postprocessor. See also other examples
included in this web site with the specific solver packages.All images
are shown in separate window
Postprocessor Interfacing
To an application developer, the PHLEX postprocessor
appears not as a library but rather as a finished package, with a few simple
interface functions required to provide data to the package.
-
For the purpose of user interaction, the developer
has to define the names of all the components of the solution (stresses,
deflections, temperature, etc.), and provide a single function, which computes
the derived components based on primary solution components (for example,
in CFD the primary components could be: the density, energy, and velocities,
while the derived components are the Mach number or temperature. For solid
mechanics problems they are usually respectively: deformation and stresses).
These equations can also be defined at runtime as interpreted formulas.
-
After defining the components, the initialization
consists of one single call with no parameters, preceded optionally by
calls to customization functions (their purpose is to enable or disable
specialized functionality of the postprocessor, eg. particle traces or
velocity vectors).
-
In addition, developers can create their own
forms and drawing modules, or add other objects to the postprocessor. Some
examples include: well properties for an oil reservoir simulation package,
contact surfaces for a nonlinear structural mechanics code, or special
element types. This capability is very useful for creating various ad
hoc forms used to visualize internal structures in the database (hp-constraints,
enrichment patterns, etc)
This interface was designed to be as general
as possible so that the postprocessing package remains an independent library
and can be immediately included in other numerical programs. All functions
of the preprocessor are controlled from various GUI forms, but it is also
possible to control postprocessor from simple Tcl scripts, which can be
used e.g. to prepare 'canned' demo runs, or for automatic generation of
series of images for reports or animations.
D3: graphics library
PHLEX postprocessor is built on top of our
proprietary graphics library. The entire package is called d3, and
it consists of following modules:
-
graphics module, which contains routines to
define, manipulate and display graphical entities,
-
device drives, interfacing graphics module
with specific system dependent drawing routines (see Devices, below)
-
graphics widget module, provides routines
to build and define form widgets, and to define and implement particular
mouse actions (such as zoom, tumble, and trackball). This module is also
considered part of the GUI, or, Graphical User Interface. To avoid operating
system dependencies, this module is built on top of the Tcl/Tk
package
D3 library is fully platform independent
(compiles cleanly - out of the box on Windows NT/95 platforms and various
flavors of Unix). It can be used as a completely independent package, useful
in building various graphics utilities, and also (by utilizing only GUI
module) to build various small utilities equipped with a graphical user
interface utilizing Widgets and Forms. Altair has built a small preprocessor
(FEM mesh generator) QM (quad-mesh), allowing end user to prepare interactively
2D and 2.5D meshes for PHLEX applications, as well as a specialized preprocessor
for Oil reservoir projects.
Devices
There are three classes of supported devices:
hardware graphics , X11, and PostScript. Each device represents a different
way of "doing" graphics, but they all have in common the raster model of
hardware. This implies that they can fill polygons, as opposed to just
drawing lines like a pen plotter. Each device is implemented in "immediate"
mode, in which the application re-draws the entire picture for each new
view of data.
The hardware graphics device represents
the top end in interactive graphic capabilities. The hardware features
used by the graphics package include viewing transforms, Z-buffering, Gouraud
shading, alpha transparency, full RGB color and double buffering. Currently
D3 library supports following hardware graphics:
-
Silicon Graphics: GL
-
Hewlet Packard: Starbase
-
multiplatform: Open GL.
The X11 class of devices includes most Unix
workstations. Due to the inadequate design of graphics in X11, the best
interactive performance on such devices is achieved by letting the X server
do the graphics, rather than the client. In practice, this limits applications
to lines and flat-filled polygons. Due to the software implemented hidden
line algorithm, this device may be slow for the display of graphics with
a large number of details. The X11 device does not support Gouraud shading
and alpha transparency (screen door transparency is implemented instead).
As an alternative to hardware graphics, the software implementation of
OpenGL (MESA),
is implemented on all platforms, providing images of much better quality
than X11 graphics, and usually faster (except for remote display mode).
MESA is implemented in parallel to hardware OpenGL, so e.g. on SGI platforms
either one can be selected (to draw on remote, non-OpenGL display, or to
produce screen dump images in the batch mode).
The PostScript device is the standard device
for hardcopy. A PostScript file is produced by interpreting all icon graphics
currently visible and creating a file containing the equivalent moves and
draws in the PostScript language to produce a hardcopy of the image. Both
grayscale and color PostScript files may be produced. A hardcopy represents
a copy of the actual interactive image, however transparency and Gouraud
shading are not supported.
OpenGL and MESA devices also have the capability
to produce RGB (bitmap) images ("screen dump"), which could be externally
converted into other formats (gif, jpeg, etc) or into the animated sequences
(animated gif, mpeg, and other formats). Both devices also can be swithed
to grayscale stereo mode (using red/blue glasses) to aid in the visualization
of complex three-dimensional geometries.