A demo using parasolid to test its SSI, evaluation and other functions.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

698 lines
31 KiB

#include <stdio.h>
#include <string.h>
#include "parasolid_kernel.h"
#include "kernel_interface.h"
int main() {
/*
From V7.0, Parasolid is `DLL-capable', ie, the Parasolid library contains
stub functions which transfer the Downward Interface calls to registered
callback functions, allowing Parasolid to be delivered as a self-contained
image as well as an archive/object library. This does affect how the
application is linked against Parasolid in order to obtain a correct
runtime match between the application's Frustrum and the Parasolid stubs,
ie, for the parasolid_test.c program, the behaviour of the example
frustrum.lib and fg.lib.
We choose to always register all our example routines: when linking
against the archive library
cc parasolid_test.c frustrum.lib fg.lib parasolid.lib
or cc parasolid_test.c frustrum.o fg.o parasolid.lib
then our routines are preloaded into the image and the stubs in
parasolid.lib are never required - the registry does occur but nothing in
Parasolid then uses the registration. Note that the V6 equivalent
cc parasolid_test.c parasolid.lib frustrum.lib fg.lib
will not work: only the stub routines are loaded from the Parasolid library
and STAMOD will fail. When linking against a standalone image
cc parasolid_test.c frustrum.lib fg.lib parasolid.so
or cc parasolid_test.c frustrum.o fg.o parasolid.so
then both the example routines and the Parasolid stubs are loaded, the
stubs being hidden in the image and performing immediate transfer to the
active code from the example libraries.
*/
int x = 1;
int y = 2;
extern void FSTART(int *);
extern void FABORT(int *);
extern void FSTOP(int *);
extern void FMALLO(int *, char **, int *);
extern void FMFREE(int *, char **, int *);
extern void GOSGMT(const int *, const int *, const int *, const int *,
const double *, const int *, const int *, int *);
extern void GOOPSG(const int *, const int *, const int *, const int *,
const double *, const int *, const int *, int *);
extern void GOCLSG(const int *, const int *, const int *, const int *,
const double *, const int *, const int *, int *);
extern void GOPIXL(const int *, const double *, const int *, const int *,
int *);
extern void GOOPPX(const int *, const double *, const int *, const int *,
int *);
extern void GOCLPX(const int *, const double *, const int *, const int *,
int *);
extern void FFOPRD(const int *, const int *, const char *, const int *,
const int *, int *, int *);
extern void FFOPWR(const int *, const int *, const char *, const int *,
const char *, const int *, int *, int *);
extern void FFCLOS(const int *, const int *, const int *, int *);
extern void FFREAD(const int *, const int *, const int *, char *, int *,
int *);
extern void FFWRIT(const int *, const int *, const int *, const char *,
int *);
extern void FFOPRB(const int *, const int *, const int *, int *, int *,
int *);
extern void FFSEEK(const int *, const int *, const int *, int *);
extern void FFTELL(const int *, const int *, int *, int *);
extern void FGCRCU(const char *, int *, int *, int *, int *, double *,
int *, double *, int *);
extern void FGCRSU(const char *, int *, int *, int *, int *, double *,
int *, double *, int *);
extern void FGEVCU(int *, double *, double *, double *, int *,
double *, int *);
extern void FGEVSU(int *, double *, double *, double *, double *,
int *, int *, int *, double *, int *);
extern void FGPRCU(int *, double *, double *, double *, int *, int *);
extern void FGPRSU(int *, double *, double *, double *, int *, int *);
PK_SESSION_frustrum_t fru;
printf("Registering Example Frustrum ...\n");
PK_SESSION_frustrum_o_m(fru);
// fru.fstart = FSTART;
// fru.fabort = FABORT;
// fru.fstop = FSTOP;
// fru.fmallo = FMALLO;
fru.fmfree = FMFREE;
fru.gosgmt = GOSGMT;
// fru.goopsg = GOOPSG;
// fru.goclsg = GOCLSG;
// fru.gopixl = GOPIXL;
// fru.gooppx = GOOPPX;
// fru.goclpx = GOCLPX;
// fru.ffoprd = FFOPRD;
// fru.ffopwr = FFOPWR;
// fru.ffclos = FFCLOS;
// fru.ffread = FFREAD;
// fru.ffwrit = FFWRIT;
// fru.ffoprb = FFOPRB;
// fru.ffseek = FFSEEK;
// fru.fftell = FFTELL;
// fru.fgcrcu = FGCRCU;
// fru.fgcrsu = FGCRSU;
// fru.fgevcu = FGEVCU;
// fru.fgevsu = FGEVSU;
// fru.fgprcu = FGPRCU;
// fru.fgprsu = FGPRSU;
PK_SESSION_register_frustrum(&fru);
PK_BSURF_sf_t a;
a.u_degree = 3;
a.v_degree = 3;
a.n_u_vertices = 4;
a.n_v_vertices = 4;
a.vertex_dim = 4;
a.is_rational = PK_LOGICAL_false;
// double vertex_a[64] = {0, 0.3, 0.9, 1, 0, 0.6, 1, 1, 0, 0.9, 1.1, 1, 0, 1.2, 1, 1,
// 0.33, 0.3, 0.12, 1, 0.33, 0.6, 0.12, 1, 0.33, 0.9, 0.12, 1, 0.33, 1.2, 0.12, 1,
// 0.66, 0.3, 0.12, 1, 0.66, 0.6, 0.12, 1, 0.66, 0.9, 0.12, 1, 0.66, 1.2, 0.12, 1,
// 1, 0.3, 0.8, 1, 1, 0.6, 1, 1, 1, 0.9, 1.1, 1, 1, 1.2, 1, 1
// };
// double vertex_a[64] = {0,1,0,1, 0,0,0,1, 0,0,0,1, 0,1,0,1,
// 1,1,0.8,1, 1,0,0.8,1, 1,0,0.8,1, 1,1,0.8,1,
// 0,1,0.8,1, 0,0,0.8,1, 0,0,0.8,1, 0,1,0.8,1,
// 1,1,0,1, 1,0,0,1, 1,0,0,1, 1,1,0,1,
// };
// double vertex_a[64] = {-3,-6,0,1, -1,-6,4,1, 1,-6,4,1, 3,-6,0,1,
// -3,-2,0,1, -1,-2,4,1, 1,-2,4,1, 3,-2,0,1,
// -3,2,0,1, -1,2,4,1, 1,2,4,1, 3,2,0,1,
// -3,6,0,1, -1,6,4,1, 1,6,4,1, 3,6,0,1,
// };
// double vertex_a[64] = {0.2, 0, 0, 1, 0.2, 0.33, 0, 1, 0.2, 0.66, 0, 1, 0.2, 1, 0, 1,
// 1.2, 0, 1.2, 1, 1.2, 0.33, 1.2, 1, 1.2, 0.66, 1.2, 1, 1.2, 1, 1.2, 1,
// -0.2, 0, 1.2, 1, -0.2, 0.33, 1.2, 1, -0.2, 0.66, 1.2, 1, -0.2, 1, 1.2, 1,
// 0.8, 0, 0, 1, 0.8, 0.33, 0, 1, 0.8, 0.66, 0, 1, 0.8, 1, 0, 1,
// };
double vertex_a[64] = {0.5625,-0.703125,-1.25,1, 0.5625,-0.703125,-0.416667,1, 0.5625,-0.703125,0.416667,1, 0.5625,-0.703125,1.25,1,
-1.52083,2.36979,-1.25,1, -1.52083,2.36979,-0.416667,1, -1.52083,2.36979,0.416667,1, -1.52083,2.36979,1.25,1,
-1.52083,-2.36979,-1.25,1, -1.52083,-2.36979,-0.416667,1, -1.52083,-2.36979,0.416667,1, -1.52083,-2.36979,1.25,1,
0.5625,0.703125,-1.25,1, 0.5625,0.703125,-0.416667,1, 0.5625,0.703125,0.416667,1, 0.5625,0.703125,1.25,1,
};
a.form = PK_BCURVE_form_unset_c;
a.vertex = vertex_a;
a.n_u_knots = 8;
a.n_v_knots = 8;
// int u_knot_mult_a[8] = {1, 1, 1, 1, 1, 1, 1, 1};
// double u_knot_a[8] = {0., 0.15, 0.3, 0.45, 0.6, 0.75, 0.9, 1.};
int u_knot_mult_a[2] = {4, 4};
double u_knot_a[2] = {0., 1.};
a.u_knot_mult = u_knot_mult_a;
a.u_knot = u_knot_a;
// int v_knot_mult_a[8] = {1, 1, 1, 1, 1, 1, 1, 1};
// double v_knot_a[8] = {0., 0.15, 0.3, 0.45, 0.6, 0.75, 0.9, 1.};
int v_knot_mult_a[2] = {4, 4};
double v_knot_a[2] = {0., 1.};
a.v_knot_mult = v_knot_mult_a;
a.v_knot = v_knot_a;
PK_BSURF_sf_t b;
b.u_degree = 3;
b.v_degree = 3;
b.n_u_vertices = 4;
b.n_v_vertices = 4;
b.vertex_dim = 4;
b.is_rational = PK_LOGICAL_false;
// double vertex_b[64] = {0, 0.3, 0.9, 1, 0, 0.6, 1, 1, 0, 0.9, 1.1, 1, 0, 1.2, 1, 1,
// 0.33, 0.3, 0.12, 1, 0.33, 0.6, 0.42, 1, 0.33, 0.9, -0.62, 1, 0.33, 1.2, -1.756, 1,
// 0.66, 0.3, 0.12, 1, 0.66, 0.6, 0.42, 1, 0.66, 0.9, -0.62, 1, 0.66, 1.2, -1.756, 1,
// 1, 0.3, 0.8, 1, 1, 0.6, 1, 1, 1, 0.9, 1.1, 1, 1, 1.2, 1, 1,
// };
// double vertex_b[64] = {0,0,0.9,1, 0,0.33,1,1, 0,0.66,1.1,1, 0,1,1,1,
// 0.33,0,0.12,1, 0.33,0.33,0.12,1, 0.33,0.66,0.12,1, 0.33,1,0.12,1,
// 0.66,0,0.12,1, 0.66,0.33,0.12,1, 0.66,0.66,0.12,1, 0.66,1,0.12,1,
// 1,0,0.8,1, 1,0.33,1,1, 1,0.66,1.1,1, 1,1,1,1,
// };
// double vertex_b[64] = {-6, -3, 0, 1, -2, -3, 0, 1, 2, -3, 0, 1, 6, -3, 0, 1,
// -6, -1, 4, 1, -2, -1, 4, 1, 2, -1, 4, 1, 6, -1, 4, 1,
// -6, 1, 4, 1, -2, 1, 4, 1, 2, 1, 4, 1, 6, 1, 4, 1,
// -6, 3, 0, 1, -2, 3, 0, 1, 2, 3, 0, 1, 6, 3, 0, 1,
// };
// double vertex_b[64] = {0.2, 0.2, 0.9, 1, 0.2, 0.33, 1, 1, 0.2, 0.66, 1.1, 1, 0.2, 0.8, 1, 1,
// 0.33, 0.2, 0.02, 1, 0.33, 0.33, 0.02, 1, 0.33, 0.66, 0.02, 1, 0.33, 0.8, 0.02, 1,
// 0.66, 0.2, 0.02, 1, 0.66, 0.33, 0.02, 1, 0.66, 0.66, 0.02, 1, 0.66, 0.8, 0.02, 1,
// 0.8, 0.2, 0.8, 1, 0.8, 0.33, 1, 1, 0.8, 0.66, 1.1, 1, 0.8, 0.8, 1, 1,
// };
double vertex_b[64] = {-1,2,-1.25,1, -1,2,-0.416667,1, -1,2,0.416667,1, -1,2,1.25,1,
-0.333333,0,-1.25,1, -0.333333,0,-0.416667,1, -0.333333,0,0.416667,1, -0.333333,0,1.25,1,
0.333333,-0.666667,-1.25,1, 0.333333,-0.666667,-0.416667,1, 0.333333,-0.666667,0.416667,1, 0.333333,-0.666667,1.25,1,
1,0,-1.25,1, 1,0,-0.416667,1, 1,0,0.416667,1, 1,0,1.25,1,
};
a.form = PK_BCURVE_form_unset_c;
b.vertex = vertex_b;
b.n_u_knots = 8;
b.n_v_knots = 8;
// int u_knot_mult_b[8] = {1, 1, 1, 1, 1, 1, 1, 1};
// double u_knot_b[8] = {0., 0.15, 0.3, 0.45, 0.6, 0.75, 0.9, 1.};
int u_knot_mult_b[2] = {4, 4};
double u_knot_b[2] = {0., 1.};
b.u_knot_mult = u_knot_mult_b;
b.u_knot = u_knot_b;
// int v_knot_mult_b[8] = {1, 1, 1, 1, 1, 1, 1, 1};
// double v_knot_b[8] = {0., 0.15, 0.3, 0.45, 0.6, 0.75, 0.9, 1.};
int v_knot_mult_b[2] = {4, 4};
double v_knot_b[2] = {0., 1.};
b.v_knot_mult = v_knot_mult_b;
b.v_knot = v_knot_b;
a.u_knot_type = PK_knot_bezier_ends_c;
a.v_knot_type = PK_knot_bezier_ends_c;
a.is_u_periodic = PK_LOGICAL_false;
a.is_v_periodic = PK_LOGICAL_false;
a.is_u_closed = PK_LOGICAL_false;
a.is_v_closed = PK_LOGICAL_false;
a.self_intersecting = PK_LOGICAL_false;
a.convexity = PK_convexity_arbitrary_c;
b.u_knot_type = PK_knot_bezier_ends_c;
b.v_knot_type = PK_knot_bezier_ends_c;
b.is_u_periodic = PK_LOGICAL_false;
b.is_v_periodic = PK_LOGICAL_false;
b.is_u_closed = PK_LOGICAL_false;
b.is_v_closed = PK_LOGICAL_false;
b.self_intersecting = PK_LOGICAL_false;
b.convexity = PK_convexity_arbitrary_c;
PK_SURF_intersect_surf_o_t intersection_options;
PK_SURF_intersect_surf_o_m(intersection_options);
int n_vectors = 0;
PK_VECTOR_t *vectors = NULL;
int n_curves = 0;
PK_CURVE_t *curves = NULL;
PK_INTERVAL_t *bounds = NULL;
PK_intersect_curve_t *types = NULL;
PK_VECTOR_t point_on_blend_face[1];
PK_BSURF_t bsurf_a = 0;
PK_BSURF_t bsurf_b = 0;
int errCreate = PK_BSURF_create(&a, &bsurf_a);
printf("errCreate: %d\n", errCreate);
PK_BSURF_create(&b, &bsurf_b);
// std::cout<<PK_ERROR_zero_interval<<std::endl;
// std::cout<<PK_ERROR_periodic_open<<std::endl;
// std::cout<<PK_ERROR_periodic_not_smooth<<std::endl;
// std::cout<<PK_ERROR_bad_dimension<<std::endl;
// std::cout<<PK_ERROR_cant_make_bspline<<std::endl;
int ERR = PK_SURF_intersect_surf(bsurf_a, bsurf_b, &intersection_options, &n_vectors, &vectors, &n_curves, &curves,
&bounds,
&types);
printf("ERR: %d\n", ERR);
printf("n_vectors: %d\n", n_vectors);
printf("vectors:\n");
for (int i = 0; i < n_vectors; i++) {
double *coord = vectors[i].coord;
printf("(%llf, %llf, %llf) ", coord[0], coord[1], coord[2]);
}
printf("n_curves: %d\n", n_curves);
return 0;
}
/*==========================================================
parasolid_test.c
Copyright 2017 Siemens Product Lifecycle Management Software Inc.
All rights reserved.
This software and related documentation are proprietary to
Siemens Product Lifecycle Management Software Inc.
Siemens Product Lifecycle Management Software assumes no
responsibility for the use or reliability of this software.
It is sample code, provided to give application writers an
example of basic calls to Parasolid.
============================================================
The frustrum ifails and tokens *.h files are not included
here (they already appear in the frustrum.c file, which is
being linked with this file).
The script "parasolid_link.com" shows how parasolid_test.c
is compiled and linked.
============================================================
==========================================================*/
/*
MS Windows: cl /I%PARASOLID%
Unix and Unix-like: cc -I$PARASOLID
*/
//#include <stdio.h>
//#include <string.h>
//#include "parasolid_kernel.h"
//#include "kernel_interface.h"
//
//int report_ifail(int ifail, int expect)
//{
//if ( ifail != expect )
//{
//printf("Non-zero ifail %d. Expected %d\n",ifail,expect);
//return 1;
//}
//else
//{
//return 0;
//}
//}
//void wrong_result(int nwrong)
//{
//printf("*********Unexpected number %d *********\n",nwrong);
//}
//void parasolid_test ()
//{
// double vec1[3], vec2[3];
// double cyl_rad = 2.0;
// double cyl_ht = 12.0;
// double distance = 99.0;
// double width = 6.0;
// double height = 8.0;
// double depth = 10.0;
// int ifail,nfaces,nbod,vrsion,nchars;
// int pos,nitems;
// int tworld,tass1,tget,tass2,ttran,tbox1,tbox2;
// int tcyl,tfl1,tfl2,tbyli,tbody[1];
// int usrfld = 0;
// int pcode = 5;
// int pival = 2000000;
// double prval = 0.0;
// int fault_tokens;
// int fault_tags;
// int chcken_mxflts = 0;
// int chcken_nopts = 0;
// int chcken_option[1];
// int pdata;
// int nfault;
// int fg_key_len = 5;
// char fg_key[6] = "dummy";
// int fg_nspace = 0;
// int fg_nints = 0;
// int fg_ints[1];
// int fg_nreals = 0;
// double fg_reals[1];
// int fg_tag_surf;
// int token1, token2;
// printf(" Parasolid Acceptance Test\n");
// printf(" =========================\n");
// printf("\n");
// printf(" This acceptance test will try out some of the features which\n");
// printf("are available through the Kernel Interface of Parasolid.\n");
// printf(" Although the tests are not exhaustive, they make use\n");
// printf("use of some of the major parts of the system, including:\n");
// printf(" - starting and stopping the modeller\n");
// printf(" - model creation and deletion\n");
// printf(" - Boolean operations\n");
// printf(" - archived model files\n");
// printf(" - snapshot files of tag memory\n");
// printf(" - error handling\n");
// printf(" - rollback.\n");
// printf("\n");
// printf(" The following Parasolid routines are called:\n");
// printf("\n");
// printf("APPTRA CHCKEN CLABYS CRBXSO CRCYSO CRETRA DELENT GETMOD GETSNP\n");
// printf("GTTGLI IDCOEN INTBYS MERGEN ROLBLM ROLSMK SAVMOD SAVSNP SEINTP\n");
// printf("STAMOD STOMOD UNIBYS\n");
// printf("\n");
// printf(" The following files will be generated by the test, and can be\n");
// printf("deleted on completion:\n");
// printf(" - jfile.jnl_txt (journal file)\n");
// printf(" - xfile.xmt_txt (archived body)\n");
// printf(" - sfile.snp_bin (snapshot file)\n");
// printf("\n");
// printf(" As the test proceeds, messages are output which give the name\n");
// printf("of the Parasolid routine about to be called, and a brief\n");
// printf("description of what it will do. If an unexpected result is \n");
// printf("detected, the tests will stop. Hence, the routine causing an\n");
// printf("error can be found from the messages.\n");
// printf("\n");
// printf("\n");
// {
///*
// From V7.0, Parasolid is `DLL-capable', ie, the Parasolid library contains
// stub functions which transfer the Downward Interface calls to registered
// callback functions, allowing Parasolid to be delivered as a self-contained
// image as well as an archive/object library. This does affect how the
// application is linked against Parasolid in order to obtain a correct
// runtime match between the application's Frustrum and the Parasolid stubs,
// ie, for the parasolid_test.c program, the behaviour of the example
// frustrum.lib and fg.lib.
//
// We choose to always register all our example routines: when linking
// against the archive library
// cc parasolid_test.c frustrum.lib fg.lib parasolid.lib
// or cc parasolid_test.c frustrum.o fg.o parasolid.lib
// then our routines are preloaded into the image and the stubs in
// parasolid.lib are never required - the registry does occur but nothing in
// Parasolid then uses the registration. Note that the V6 equivalent
// cc parasolid_test.c parasolid.lib frustrum.lib fg.lib
// will not work: only the stub routines are loaded from the Parasolid library
// and STAMOD will fail. When linking against a standalone image
// cc parasolid_test.c frustrum.lib fg.lib parasolid.so
// or cc parasolid_test.c frustrum.o fg.o parasolid.so
// then both the example routines and the Parasolid stubs are loaded, the
// stubs being hidden in the image and performing immediate transfer to the
// active code from the example libraries.
//*/
// extern void FSTART( int *);
// extern void FABORT( int *);
// extern void FSTOP( int *);
// extern void FMALLO( int *, char **, int *);
// extern void FMFREE( int *, char **, int *);
// extern void GOSGMT( const int *, const int *, const int *, const int *,
// const double *, const int *, const int *, int *);
// extern void GOOPSG( const int *, const int *, const int *, const int *,
// const double *, const int *, const int *, int *);
// extern void GOCLSG( const int *, const int *, const int *, const int *,
// const double *, const int *, const int *, int *);
// extern void GOPIXL( const int *, const double *, const int *, const int *,
// int *);
// extern void GOOPPX( const int *, const double *, const int *, const int *,
// int *);
// extern void GOCLPX( const int *, const double *, const int *, const int *,
// int *);
// extern void FFOPRD( const int *, const int *, const char *, const int *,
// const int *, int *, int *);
// extern void FFOPWR( const int *, const int *, const char *, const int *,
// const char *, const int *, int *, int *);
// extern void FFCLOS( const int *, const int *, const int *, int *);
// extern void FFREAD( const int *, const int *, const int *, char *, int *,
// int *);
// extern void FFWRIT( const int *, const int *, const int *, const char *,
// int *);
// extern void FFOPRB( const int *, const int *, const int *, int *, int *,
// int *);
// extern void FFSEEK( const int *, const int *, const int *, int *);
// extern void FFTELL( const int *, const int *, int *, int *);
// extern void FGCRCU( const char *, int *, int *, int *, int *, double *,
// int *, double *, int *);
// extern void FGCRSU( const char *, int *, int *, int *, int *, double *,
// int *, double *, int *);
// extern void FGEVCU( int *, double *, double *, double *, int *,
// double *, int *);
// extern void FGEVSU( int *, double *, double *, double *, double *,
// int *, int *, int *, double *, int *);
// extern void FGPRCU( int *, double *, double *, double *, int *, int *);
// extern void FGPRSU( int *, double *, double *, double *, int *, int *);
// PK_SESSION_frustrum_t fru;
// printf("Registering Example Frustrum ...\n");
// PK_SESSION_frustrum_o_m( fru );
//// fru.fstart = FSTART;
//// fru.fabort = FABORT;
//// fru.fstop = FSTOP;
//// fru.fmallo = FMALLO;
//// fru.fmfree = FMFREE;
//// fru.gosgmt = GOSGMT;
//// fru.goopsg = GOOPSG;
//// fru.goclsg = GOCLSG;
//// fru.gopixl = GOPIXL;
//// fru.gooppx = GOOPPX;
//// fru.goclpx = GOCLPX;
//// fru.ffoprd = FFOPRD;
//// fru.ffopwr = FFOPWR;
//// fru.ffclos = FFCLOS;
//// fru.ffread = FFREAD;
//// fru.ffwrit = FFWRIT;
//// fru.ffoprb = FFOPRB;
//// fru.ffseek = FFSEEK;
//// fru.fftell = FFTELL;
//// fru.fgcrcu = FGCRCU;
//// fru.fgcrsu = FGCRSU;
//// fru.fgevcu = FGEVCU;
//// fru.fgevsu = FGEVSU;
//// fru.fgprcu = FGPRCU;
//// fru.fgprsu = FGPRSU;
// PK_SESSION_register_frustrum( &fru );
// }
// printf("STAMOD: Start the modeller and check that the version is suitable.\n");
// printf(" A journal file jfile.jnl_txt will be written.\n");
// nchars = 5;
// token1 = KI_TRUE;
// STAMOD(&token1,&nchars,"jfile",&usrfld, &tworld, &vrsion, &ifail);
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("STAMOD: returns version %d\n",vrsion);
// printf("SEINTP: Set interface parameter to allow rollback and rollforward\n");
// SEINTP( &pcode, &pival, &prval, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("DELENT: Attempt to delete invalid entity (the null tag)\n");
// printf(" This should result in the ifail KI_not_a_tag 22\n");
// token1 = NULTAG;
// DELENT( &token1, &ifail );
// if ( report_ifail(ifail,KI_not_a_tag) != 0 ) return;
// printf("CRBXSO: Create a block\n");
// vec1[0] = 0.0;
// vec1[1] = 0.0;
// vec1[2] = 0.0;
// vec2[0] = 0.0;
// vec2[1] = 0.0;
// vec2[2] = 1.0;
// CRBXSO( vec1, vec2, &width, &height, &depth, &tbox1, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("IDCOEN: Get a list of all the faces and check that there are\n");
// printf(" the correct number of them (6).\n");
// token1 = TYTOFA;
// IDCOEN( &tbox1, &token1, &tfl1, &nfaces, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// if( nfaces != 6 ) wrong_result( nfaces);
// printf(
// "SAVMOD: Save the block in a file XFILE. This will be read in later.\n");
// nchars = 5;
// SAVMOD( &tbox1, &nchars, "xfile", &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("DELENT: Delete the block.\n");
// DELENT( &tbox1, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("CRBXSO: Create another solid block\n");
// vec1[0] = 0.0;
// vec1[1] = 0.0;
// vec1[2] = 0.0;
// vec2[0] = 0.0;
// vec2[1] = 0.0;
// vec2[2] = 1.0;
// CRBXSO( vec1, vec2, &width, &height, &depth, &tbox2, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("CRCYSO: Create a solid cylinder\n");
// vec1[0] = 0.0;
// vec1[1] = 0.0;
// vec1[2] = -1.0;
// vec2[0] = 0.0;
// vec2[1] = 0.0;
// vec2[2] = 1.0;
// cyl_rad = 2.0;
// cyl_ht = 12.0;
// CRCYSO( vec1, vec2, &cyl_rad, &cyl_ht, &tcyl, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("CRETRA: Create a translation transformation\n");
// vec1[0] = 1.0;
// vec1[1] = 0.0;
// vec1[2] = 0.0;
// distance = 99.0;
// CRETRA( vec1, &distance, &ttran, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("ROLSMK: Set rollback mark\n");
// ROLSMK( &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("APPTRA: Apply transformation to the cylinder to move it away from\n");
// printf(" the block.\n");
// APPTRA( &tcyl, &ttran, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("CLABYS: Test if the bodies clash, which they should not do.\n");
// token1 = NULTAG;
// token2 = KI_FALSE;
// CLABYS( &tbox2, &token1, &tcyl,&token1, &token2,
// &tfl1, &tfl2, &nfaces, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf(" Number of faces returned by CLABYS %d\n", nfaces);
// if( nfaces != 0 ) wrong_result( nfaces );
// printf("ROLBLM: Roll back to undo the transformation.\n");
// ROLBLM( &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("CLABYS: Test that the bodies now do clash.\n");
// token1 = NULTAG;
// token2 = KI_TRUE;
// CLABYS( &tbox2, &token1, &tcyl, &token1, &token2,
// &tfl1, &tfl2, &nfaces, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf(" Number of faces now returned by CLABYS %d\n", nfaces);
// if( nfaces != 2 ) wrong_result( nfaces);
// printf("INTBYS: Intersect the block and the cylinder\n");
// printf(" A single new body should be created\n");
// INTBYS( &tcyl, &tbox2, &tass1, &nbod, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// if(nbod != 1 ) wrong_result( nbod );
// printf("IDCOEN: Get a list of the bodies in the resulting assembly\n");
// token1 = TYTOBY;
// IDCOEN( &tass1, &token1, &tbyli, &nbod, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// if(nbod != 1 ) wrong_result( nbod );
// printf("GTTGLI: Get the body from the list\n");
// pos = 1;
// nitems = 1;
// GTTGLI( &tbyli, &pos, &nitems, tbody, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("CHCKEN: Check the body\n");
// CHCKEN( &tbody[0], &chcken_mxflts, &chcken_nopts, chcken_option,
// &fault_tokens, &fault_tags,
// &pdata, &nfault, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("SAVSNP: Save the state of tag memory to a file\n");
// nchars = 5;
// token1 = KI_FALSE;
// SAVSNP( &nchars, "sfile", &token1, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("DELENT: Delete the assembly\n");
// DELENT( &tass1, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("STOMOD: Stop the modeller.\n");
// STOMOD(&ifail);
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("STAMOD: Restart the modeller, this time without a journal file.\n");
// nchars = 0;
// token1 = KI_FALSE;
// STAMOD(&token1,&nchars,"jfile",&usrfld, &tworld, &vrsion, &ifail);
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("GETSNP: Restore the saved state of tag memory\n");
// nchars = 5;
// token1 = KI_FALSE;
// GETSNP( &nchars, "sfile", &token1, &token1, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("GETMOD: Try to get non-existent model. This should result in\n");
// printf(" ifail KI_key_not_found 58\n");
// nchars = 6;
// GETMOD( &nchars, "xyz123", &tget, &ifail );
// if ( report_ifail(ifail,KI_key_not_found) != 0 ) return;
// printf("GETMOD: Get the saved body.\n");
// nchars = 5;
// GETMOD( &nchars, "xfile", &tget, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("CRCYSO: Create another solid cylinder\n");
// vec1[0] = 0.0;
// vec1[1] = 0.0;
// vec1[2] = 0.0;
// vec2[0] = 0.0;
// vec2[1] = 0.0;
// vec2[2] = 1.0;
// cyl_rad = 2.0;
// cyl_ht = 12.0;
// CRCYSO( vec1, vec2, &cyl_rad, &cyl_ht, &tcyl, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("UNIBYS: Unite the new cylinder and saved block\n");
// UNIBYS( &tget, &tcyl, &tass2, &nbod, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// if(nbod != 1 ) wrong_result( nbod );
// printf("IDCOEN: Get a list of the bodies from the resulting assembly\n");
// token1 = TYTOBY;
// IDCOEN( &tass2, &token1, &tbyli, &nbod, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// if(nbod != 1 ) wrong_result( nbod);
// printf("GTTGLI: Get the body from the list\n");
// pos = 1;
// nitems = 1;
// GTTGLI( &tbyli, &pos, &nitems, tbody, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("CHCKEN: Check the body\n");
// CHCKEN( &tbody[0], &chcken_mxflts, &chcken_nopts, chcken_option,
// &fault_tokens, &fault_tags,
// &pdata, &nfault, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("IDCOEN: Get a list of all the faces and check that there are 9\n");
// token1 = TYTOFA;
// IDCOEN( &tbody[0], &token1, &tfl1, &nfaces, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// if(nfaces != 9 ) wrong_result( nfaces );
// printf("MERGEN: Merge the superfluous faces away.\n");
// MERGEN( &tbody[0], &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("IDCOEN: Get a list of all the faces and check that there are 8\n");
// token1 = TYTOFA;
// IDCOEN( &tbody[0], &token1, &tfl1, &nfaces, &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// if(nfaces != 8 ) wrong_result( nfaces );
// printf("CRFGSU: Cause a dummy call to be made to a FG routine (FGCRSU)\n");
// CRFGSU( &fg_key_len, fg_key,
// &fg_nspace, &fg_nints, fg_ints, &fg_nreals, fg_reals,
// &fg_tag_surf, &ifail );
// printf("STOMOD: Close down the modeller\n");
// STOMOD( &ifail );
// if ( report_ifail(ifail,0) != 0 ) return;
// printf("*** TEST SUCCEEDED ***\n");
//}
//#ifdef PS_IOS
///* This is for iOS, where building a main program entirely from C is
// hard-to-impossible, and we need to be passed a directory to do file
// i/o in. The Xcode app will have main(), and this function is used
// to pass needed pathnames and run the test.
//
// These pathnames have to be passed in by the app that calls
// run_ios_parasolid_test, as ordinary C strings. The first normally has
// to come from a system enquiry function, which is only provided for
// Objective-C or Swift.
//*/
//
//int run_ios_parasolid_test(
// const char *homepath, /* App's documents dir, usually with a GUID */
// const char *workdir, /* working dir, eg, "Parasolid/parasolid_test" */
// const char *schemadir /* eg, "schemas", must be subdir of working dir. */
// )
//{
//extern int implement_ios_paths( const char *, const char *, const char *);
//
//if( 0 == implement_ios_paths( homepath, workdir, schemadir))
// parasolid_test();
//return 0;
//}
//#else
//int main()
//{
// parasolid_test();
// return 0;
//}
//#endif /* PS_IOS */