Registering the Frustrum   

<<< Graphical Output Chapters Frustrum Functions >>>

Contents

[back to top]


5.1 Introduction

The application writer has several options for providing the Frustrum functions for Parasolid to use.

[back to top]


5.2 Object-file frustrum

When Parasolid is used as an object-file library, the Frustrum, GO and Foreign Geometry functions must also be compiled and linked with it. These functions are specified in Appendix A, "Frustrum Functions" and Appendix B, "Graphical Output Functions".

The functions can be split into logical groups, as shown in Figure 5-1.

 

Group

Functions

Control

FSTART FABORT FSTOP

Memory Management

FMALLO FMFREE

File I/O

FFOPRD FFOPWR FFREAD FFWRIT FFCLOS

Graphics

GOOPSG GOSGMT GOCLSG

Foreign Geometry (curves)

FGCRCU FGEVCU FGPRCU

Foreign Geometry (surfaces)

FGCRSU FGEVSU FGPRSU

Rollback (obsolete)

FFOPRB FFSEEK FFTELL

Shaded Images (obsolete)

GOOPPX GOPIXL GOCLPX

Figure 5-1 Grouping of Frustrum functions

Simple functions are provided for initial testing in the files frustrum.c and fg.c in the Parasolid release area.

[back to top]


5.3 Registered frustrum

Parasolid may be supplied as a shared image as well as an object-file library.

If the following method is used to provide a registered frustrum, the functions do not need to have the 6-letter FORTRAN-style names.

Parasolid still needs to call the Frustrum, GO and Foreign Geometry functions but the image must use a different mechanism to the object-file library. This is done using the PK function PK_SESSION_register_frustrum. The installed Frustrum can then be identified using the PK function PK_SESSION_ask_frustrum.

There is an example of registering the Frustrum in this way included in the file parasolid_test.c in the Parasolid release area.

A C structure is defined, with an element for each required function, and the application must register this with Parasolid before starting the modeler. For example:

 

PK_SESSION_frustrum_t fru;
PK_SESSION_frustrum_o_m(fru);
fru.fmallo = my_fmallo;
fru.fmfree = my_fmfree;
<etc.>
PK_SESSION_register_frustrum(&fru);
STAMOD (&kijon,&nchars,jfilnm,&usrfld,&world,&kivrsn,&ifail);

This mechanism can also be used with the supplied object-file library: it is not specific to the shared image implementation. The advantages to the application of using a registered frustrum are that:

All applications must supply equivalents of FMALLO and FMFREE. The other functions fall into the groups shown in Figure 5-1, and an application can omit group of functions as required.

If a non-registered function is accessed, then Parasolid may fail with ifail KI_fru_missing or PK error code PK_ERROR_fru_missing. As an example, an application which does not make use of of Foreign Geometry might receive a part from another application which does.

An application using the shared image can replace the Parasolid image with an updated version without relinking. It is important that the the Parasolid version in the new library is compatible with the old one. To guard against an incompatible combination, the application can enquire the version number of the installed Parasolid using PK_SESSION_ask_kernel_version. For example:

 

PK_SESSION_kernel_version_t info;
PK_SESSION_ask_kernel_version (&info);
if (info.major_revision<9)
    {
    fprintf (stderr, "Parasolid v9 is required");
    exit (EXIT_FAILURE);
    }

This function may be called at any time, in particular, without starting the modeler, by calling this function in the shared image.

[back to top]


5.4 Application I/O

There is a transmit file format called 'application i/o', or 'applio'. When this format is selected in PK_PART_transmit and PK_PARTITION_transmit, transmit files are written and read using a suite of functions provided by the application. Using these functions enables the application to do further processing of the output data before storing it.

The functions open files, read and write chars, bytes, shorts, ints and doubles to/from these files, and close the files; they are registered using PK_SESSION_register_applio.

Note that the application is responsible for any conversion required between machine types (e.g. for endian byte ordering and floating point representation). The read functions must be handed the correct number of computation-ready data items, as written out by the write functions.

Snapshot files cannot use this format - they must be text or machine-dependent binary.

 

[back to top]

<<< Graphical Output Chapters Frustrum Functions >>>