1 
2 #ifdef WIN32
3   #include <windows.h>
4   #undef near
5   #define DEV_NULL  " "
6   #define DEV_NULL2 " "
7 #else
8   #define DEV_NULL   " >/dev/null"
9   #define DEV_NULL2 " 2>/dev/null"
10   #include <unistd.h>
11 #endif
12 
13 #ifdef DOUBLEPREC
14   #define CGXFLOAT double
15 #else
16   #define CGXFLOAT float
17 #endif
18 #include <math.h>
19 #include <string.h>
20 #include <fcntl.h>
21 #include <stdlib.h>
22 #include <stdio.h>
23 #include <ctype.h>
24 #include <GL/gl.h>
25 #include <GL/glx.h>
26 #include <pthread.h>
27 #include <semaphore.h>
28 
29 #ifdef WIN32
30   #include <GL/glut.h>
31   #define printf printf_fflush
32   #ifdef __cplusplus
33 extern "C" {
34   #endif
35 void printf_fflush(const char *fmt,...);
36   #ifdef __cplusplus
37 }
38   #endif
39 #else
40   #include <GL/glut_cgx.h>
41 #endif
42 
43 #define     PI          3.14159265358979323846264338327950288
44 #define     MAX_INTEGER 2147483647
45 #define     MAX_FLOAT   1.e32
46 
47 #define     MAX_LINE_LENGTH 256
48 #define     OUTSIDE     1.e32
49 #define     NODES       1000000
50 #define     ELEMENTS    1000000
51 
52 
53 /* intpol2.c, spline.c */
54 #define     PNTS  10000
55 
56 /* from #include "f2c.h" */
57 #undef max
58 #undef min
59 #define abs(x) ((x) >= 0 ? (x) : -(x))
60 #define dabs(x) (double)abs(x)
61 #define imin(a,b) ((a) <= (b) ? (a) : (b))
62 #define imax(a,b) ((a) >= (b) ? (a) : (b))
63 #define smin(a,b) (float)imin(a,b)
64 #define smax(a,b) (float)imax(a,b)
65 #define dmin(a,b) (double)imin(a,b)
66 #define dmax(a,b) (double)imax(a,b)
67 
68 
69 typedef struct {
70   char  model[MAX_LINE_LENGTH]; /* model-name header*/
71   char  free;   /* 1: free data of current dataset if a new one is selected   */
72   char  threads;   /* nr of threads to be used */
73   char  **uheader; /* user header */
74   char  **pheader; /* project header (remark: leading dataset-project-headers are stored in the related dataset!) */
75   int   v;         /* number of values */
76   int   u;         /* number of user headers */
77   int   p;         /* number of project headers */
78   int   n;         /* number of nodes */
79   int   e;         /* number of elements  */
80   int   f;         /* number of faces */
81   int   g;         /* number of edges */
82   int   t;         /* number of texts */
83   int   sets;      /* sets (groups) of entities */
84   int   mats;      /* materials   */
85   int   amps;      /* amplitudes  */
86   int   l;         /* number of loadcases (Datasets) */
87   int   b;         /* number of nodeBlocks */
88   int   c;         /* number of 'cuts' over all nodeBlocks (block-to-block interfaces for isaac) */
89   int   etype[100];/* number of elements of a certain type */
90   int   nmax;      /* maximum nodenumber */
91   int   nmin;      /* minimum nodenumber */
92   int   emax;      /* maximum elemnumber */
93   int   emin;      /* minimum elemnumber */
94   int   orignmax;  /* max-node-nr-of-original-nodes (w/o nodes for drawing purposes) */
95   int   orign;     /* nr-of-original-nodes (w/o nodes for drawing purposes) */
96   int   olc;       /* nr-of-original-loadcases (w/o cgx generated datasets (lc)) */
97   int   nnext;     /* next node-nr, eventually defined with asgn */
98   int   enext;     /* next elem-nr, eventually defined with asgn */
99 } Summen;
100 
101 
102 typedef struct {
103   int   nr;              /*   external node-nr (node[node-indx].nr) */
104   int   indx;            /*   node-index (node[ext-node-nr].indx)   */
105   char  pflag;           /*   1 if used for display purposes    */
106                          /*  -1 if the node is deleted          */
107                          /*   0 default                         */
108   double nx;             /*   coordinates  node[ext-node-nr].nx */
109   double ny;
110   double nz;
111   double nv[3];          /* normal vector */
112 } Nodes;
113 
114 
115 typedef struct {
116   int nr;                /* external element-nr */
117   // int indx;              /* -index (elem[external elem-nr].indx)   */
118   int type;              /* element type (1:Hexa8)  */
119   int group;
120   int mat;
121   int attr;              /* -1: unstructured mesh tr3u (-2 for mesh with libGLu tr3g ) */
122                          /*  0: default           */
123                          /*  1: reduced integration he8r he20r */
124                          /*  2: incompatible modes he8i */
125                          /*  3: DASHPOTA be2d */
126                          /*  4: plane strain (CPE) tr3e tr6e qu4e qu8e */
127                          /*  5: plane stress (CPS) tr3s */
128                          /*  6: axisymmetric  (CAX) tr3c */
129                          /*  7: fluid he8f */
130                          /*  8: tet10m */
131                          /*  9: tet10t */
132                          /*  14: reduced integration, plane strain (CPE)  */
133                          /*  15: reduced integration, plane stress (CPS)  */
134                          /*  16: reduced integration, axisymmetric  (CAX) */
135   int nod[27];
136   double **side;         /* side[Nr.][x|y|z]== normal vector */
137 } Elements;
138 
139 
140 typedef struct {
141   int nr;                /* element-face-nr in Abaqus Format  (-1 for shell elements) */
142   int indx[6];           /* face[elemnr].indx[side]==index of the face of that element of that side-nr   */
143   int elem_nr;           /* reference to element number  */
144   int type;
145   int group;
146   int mat;
147   int nod[10];
148   double **side;          /* normal vector: side[Nr.][x|y|z] */
149 } Faces;
150 
151 
152 typedef struct {
153   int p1;
154   int p2;
155 } Edges;
156 
157 
158 typedef struct {
159   int node_nr;           /* reference to node number  */
160   int nFlag;             /* 0: no node-nr */
161   int vFlag;             /* 0: no value */
162   int tFlag;             /* 0: no text */
163   int fFlag;             /* 0: e-format, 1: float, 2: int */
164   int pFlag;             /* textpos 0: last, 1: bottom, 2: front 3: top */
165   double tx;             /*   window coordinates */
166   double ty;
167   double mx;             /*   model coordinates */
168   double my;
169   double mz;
170   char   *text;
171 } Texts;
172 
173 
174 /* for structured cfd meshes */
175 typedef struct {
176   int dim;                /* 2: surf, 3: body */
177   int i,j,k;              /* block dimension in i,j,k direction */
178   int *nod;
179   int geo;                /* related surf/body */
180   int bcface[6];          /* edge index (line/face) of the related surf/body */
181   int neighbor[6];        /* adjacent surface/body index related to v:v<surf[j].nl */
182   int map[6][3];          /* relative orientation of the neighbor 1:i==i_neigh, 4:i==-i_neigh */
183   int strt1[6][3];
184   int end_1[6][3];
185   int strt2[6][3];
186   int end_2[6][3];
187   char bctype[6][MAX_LINE_LENGTH];          /* boundary condition type */
188 } NodeBlocks;
189 
190 
191 typedef struct {
192   char name[MAX_LINE_LENGTH];          // setname with that boundary condition (in,out etc)
193   char bctype[MAX_LINE_LENGTH];        // subsonic-inflow etc, as given in send command
194   int surfs;                           // nr of surfaces (lines) in that set
195   int *surf;                           // duns surface-nr (line)
196   int *nBlock;                         // duns block-nr (cgx surf or body index +1)
197   int *side;                           // cgx surf or body edge index
198 } NodeBlockbou;
199 
200 
201 typedef struct {
202   int nod[3];
203   double ncol[3][3];
204   int elem_nr;
205   int group;
206   int mat;
207 } CTri3;
208 
209 
210 typedef struct{
211   int e;
212   int f;
213   int n;
214   float *v;
215 } Elfaces;
216 
217 
218 typedef struct {
219   char  name[MAX_LINE_LENGTH];
220   double rho;                 /* *DENSITY */
221   int    nela;                /* *ELASTIC */
222   double *tela, *nue, *ela;
223   int    nexp;                /* *EXPANSION */
224   double *texp, *exp;
225   int    ncon;                /* *CONDUCTIVITY */
226   double *tcon, *con;
227   int    nsph;                /* *SPECIFIC HEAT */
228   double *tsph, *sph;
229   int    npl;                /* *PLASTIC */
230   double *spl, *epl, *tpl;
231 } Materials;
232 
233 
234 typedef struct {
235   char  name[MAX_LINE_LENGTH];
236   int    n;
237   double *x, *y;
238 } Amplitudes;
239 
240 
241 typedef struct {
242   char  name[MAX_LINE_LENGTH];
243   FILE *handle;
244   int   stopped;       /* if reading is interrupted:1 else: 0 */
245   int   addFlag;       /* 1: new entity names */
246   fpos_t *filepntr;    /* points to the actual file pos.  (fgetpos) */
247   long byte_offset;    /* position after the stop command, unused */
248 }CommandFile;
249 
250 
251 typedef struct {
252   char  **pheader;    /* project header */
253   int   npheader;              /* number of headers */
254   char  **compName;
255   char  **icname;
256   char  name[MAX_LINE_LENGTH];
257   char  dataset_name[MAX_LINE_LENGTH];
258   char  dataset_text[MAX_LINE_LENGTH];
259   char  analysis_name[MAX_LINE_LENGTH];
260   double value;
261   char  filename[MAX_LINE_LENGTH];
262   FILE *handle;
263   fpos_t *fileptr;
264   int   loaded;       /* if data are stored:1 else: 0 */
265   int format_flag;
266   int analysis_type;
267   int step_number;
268   int ncomps;         /* components of a result of an entity (node, gauspnt) */
269   int irtype;
270   int *menu;
271   int *ictype;
272   int *icind1;
273   int *icind2;
274   int *iexist;
275 #ifdef DOUBLEPREC
276   double **dat;        /* node related data */
277   double ***edat;      /* element related data, not propper implemented */
278   double *max;         /* maximum datum */
279   double *min;         /* minimum datum */
280 #else
281   float **dat;        /* node related data */
282   float ***edat;      /* element related data, not propper implemented */
283   float *max;         /* maximum datum */
284   float *min;         /* minimum datum */
285 #endif
286   int *nmax;          /* node with maximum datum */
287   int *nmin;          /* node with minimum datum */
288 } Datasets;
289 
290 
291 typedef struct {
292   char *name;
293   char flag;                  /* if the set is open: 'o' else: 'c' */
294   char type;                  /* ordered entities:1 (seq) or not: 0 (set) */
295   int material;
296   int index;           /* index of type-0 sets, assigned and updated in prnt(), eval. in getSetNr() */
297   int anz_v;
298   int anz_n;
299   int anz_e;
300   int anz_f;
301   int anz_elf;
302   int anz_p;
303   int anz_l;
304   int anz_c;
305   int anz_s;
306   int anz_b;
307   int anz_nurl;
308   int anz_nurs;
309   int anz_se;
310   int anz_sh;
311   int *valu;
312   int *node;
313   int *elem;
314   int *face;
315   Elfaces *elf;
316   int *pnt;
317   int *line;
318   int *lcmb;
319   int *surf;
320   int *body;
321   int *nurl;
322   int *nurs;
323   int *set;
324   int *shp;
325   int etyp;
326   int eattr;       /* -1:unstructured mesh, 0:default, 1:reduced integration, 2:incompatible modes */
327   int eseq;        /* remember the order of the elty commands */
328   char *eparm;
329 } Sets;
330 
331 
332 typedef struct {
333   int nr;
334   int *set;
335 } OpenSets;
336 
337 
338 /* compiles the actual displayed sets */
339 typedef struct {
340   int nr;
341   char type[MAX_LINE_LENGTH];
342   int col;
343   int width;
344 } Psets;
345 
346 
347 /* sum of char of asci letters */
348 typedef struct {
349   int  max_suma;                   /* maximum value of sum_ascii of aliases stored  */
350   int  *anza;                      /* nr of aliases stored */
351   int  **aindx;                    /* alias indexes       */
352   int  max_sumv;                   /* maximum value of sum_ascii of values stored  */
353   int  *anzv;                      /* nr of values stored */
354   int  **vindx;                    /* value indexes       */
355   int  max_sump;                   /* maximum value of sum_ascii of points stored  */
356   int  *anzp;                      /* nr of points stored */
357   int  **pindx;                    /* point indexes       */
358   int  max_suml;                   /* maximum value of sum_ascii of lines stored  */
359   int  *anzl;                      /* nr of lines stored  */
360   int  **lindx;                    /* line indexes        */
361   int  max_sumc;                   /* maximum value of sum_ascii of lcmbs stored  */
362   int  *anzc;                      /* nr of lcmbs stored  */
363   int  **cindx;                    /* lcmb indexes        */
364   int  max_sums;                   /* maximum value of sum_ascii of surfs stored  */
365   int  *anzs;                      /* nr of surfs stored  */
366   int  **sindx;                    /* surf indexes        */
367   int  max_sumb;                   /* maximum value of sum_ascii of bodies stored  */
368   int  *anzb;                      /* nr of bodys stored  */
369   int  **bindx;                    /* body indexes        */
370   int  max_sumS;                   /* maximum value of sum_ascii of nurs stored  */
371   int  *anzS;                      /* nr of Nurs stored  */
372   int  **Sindx;                    /* nurs indexes        */
373   int  max_sumse;                  /* maximum value of sum_ascii of sets stored  */
374   int  *anzse;                     /* nr of sets stored  */
375   int  **seindx;                   /* set indexes        */
376   int  max_sumsh;                  /* maximum value of sum_ascii of shapes stored  */
377   int  *anzsh;                     /* nr of shapes stored  */
378   int  **shindx;                   /* shape indexes        */
379   int  max_sumamp;                 /* maximum value of sum_ascii of amplitudes stored  */
380   int  *anzamp;                    /* nr of amplitudes stored  */
381   int  **ampindx;                  /* amplitudes indexes        */
382   int  max_summat;                 /* maximum value of sum_ascii of materials stored  */
383   int  *anzmat;                    /* nr of materials stored  */
384   int  **matindx;                  /* materials indexes        */
385 } SumAsci;
386 
387 
388 typedef struct {
389   char  model[MAX_LINE_LENGTH]; /* haeder model */
390   int   alias;                           /* alias-names     */
391   int   p;                               /* points */
392   int   l;                               /* lines  */
393   int   c;                               /* lcmbs  */
394   int   s;                               /* surfs  */
395   int   b;                               /* bodys  */
396   int   sh;                              /* shapes  */
397   int   nurl;                            /* nurbs lines     */
398   int   nurs;                            /* nurbs surfaces  */
399   int   psets;                           /* actal displayed sets */
400 } SumGeo;
401 
402 
403 typedef struct{
404   char   *name;
405   char   *entityName;
406 } Alias;
407 
408 
409 typedef struct {
410   char  *name;
411   int type;              /* 0:plane, 1:cyl, 2: cone, 3:sph, 4:nurbs 5:torus */
412   int p[7];              /* 0:3p, 1:3p, 2:4p 3:7p 4:p[0]=nurbsindx 5:4p*/
413   int ns;                /* nr of related surfs */
414   int *s;                /* related surfs */
415   GLint   npgn;          /* size of feed-back-Buffer pgn */
416   GLdouble *pgn;         /* stores poligons which defines the interiour */
417 } Shapes;
418 
419 
420 typedef struct {
421   char  *name;
422   char  *string;
423   char  flag;     // if 1 not to be written to fbd file
424 } Values;
425 
426 
427 typedef struct {
428   char  *name;
429   double px;     /* coordinates will be scaled during run-time, scalPoints() */
430   double py;
431   double pz;
432   int   nn;
433   int   *nod;
434 } Points;
435 
436 
437 typedef struct {
438   char  *name;
439   char  typ;      /* straight:' ', arc:'a', spline:'s', nurbs:'n' */
440   int   p1;
441   int   p2;
442   int   trk;      /* if arc: 3.pnt, if spline: setname, if nurbs: nurblname */
443   int   div;
444   double bias;
445   int   nip;
446   double *ip;
447   int   fail;             /* if 1 then the meshing failed */
448   int   nn;
449   int   *nod;
450   int   ne;
451   int   *elem;
452   int  etyp;
453   int  eattr;       /* -1:unstructured mesh, 0:default, 1:reduced integration, 2:incompatible modes */
454 } Lines;
455 
456 typedef struct {
457   char  *name;
458   char  nl;
459   char  *o;      /* l-orient +- */
460   int   *l;               /* lines */
461   int   p1;               /* starting point */
462   int   p2;               /* end point */
463   double cx;               /* CG, not used so far */
464   double cy;
465   double cz;
466 } Lcmb;
467 
468 typedef struct {
469   char  *name;
470   char  ori;     /* surface-orientation +- */
471   int   sh;               /* embedded shape  */
472   char   sho;    /* embedded shape (nurs) orientation  */
473   int   nl;               /* corners (either line or lcmb) */
474   char  *typ;    /* type: l=line c=lcmb */
475   char  *o;      /* l-orient +- */
476   int   *l;               /* index of lines, lcmbs, also used to store the index of a substitute surf (last item) */
477   int   *cp;              /* index of points at the junction between  lines, lcmbs, starting at the beginning of the first line */
478   int   nc;               /* number of closed-line-loops (curves) */
479   int   *c;               /* number of lines in each curve */
480   double cx;               /* CG, in orient determined, not scaled during run! */
481   double cy;
482   double cz;
483   int   fail;             /* if 1 then the meshing failed, if 2 trimming had failed */
484   int   nn;
485   int   *nod;
486   int   ne;
487   int   *elem;
488   int   etyp;
489   int   eattr;       /* -1:unstructured mesh, 0:default, 1:reduced integration, 2:incompatible modes */
490   char  *eparm;      /* parameter, so far used to store the mesh-density requirement for the mesher */
491   int   patch;            /* number of trimming patch in the related nurbs */
492   GLint   npgn;           /* size of feed-back-Buffer pgn */
493   GLdouble *pgn;           /* stores poligons of the trimmed nurbs which defines the interiour */
494 } Gsur;
495 
496 typedef struct {
497   char  *name;
498   char  typ;     /* 0: regular, 1:with unbalanced edges */
499   char  ori;     /* body-orientation +- */
500   int   ns;               /* nr. of surfaces (currently must be 6 for meshing) */
501   char  *o;      /* s-orient +- */
502   int   *s;               /* surfaces */
503   double cx;               /* CG, in orient determined, not scaled during run! */
504   double cy;
505   double cz;
506   int   nn;
507   int   *nod;
508   int   ne;
509   int   *elem;
510   int   etyp;
511   int  eattr;       /* -1:unstructured mesh, 0:default, 1:reduced integration, 2:incompatible modes */
512   char  *eparm;
513   // mesher data
514   int   fail;             /* if 1 then the meshing failed */
515   int   unbalance[7];     /* nr of unbalanced edges */
516   int div_l[7][5];
517   int umax;
518   int vmax;
519   int wmax;
520   int offs_sa1;
521   int offs_sa2;
522   int div_sa1;
523   int div_sa2;
524   int bs[6];
525   int ml[5];
526   char mlt[5];
527   int s_indx[6];
528 } Gbod;
529 
530 typedef struct {
531   char  *name;
532   char  endFlag;
533   GLUnurbsObj *Nurb;
534   GLint   u_npnt;
535   GLint   u_exp;
536   GLint   u_nknt;
537   GLfloat *uknt;
538   GLint   u_stride;
539   GLfloat *ctlarray;
540   GLfloat *weight;
541   GLenum  type;
542   GLint   *ctlpnt;
543 } Nurbl;
544 
545 typedef struct {
546   char  *name;
547   char  endFlag;
548   GLUnurbsObj *Nurb;
549   GLint   u_npnt;
550   GLint   u_exp;
551   GLint   u_nknt;
552   GLint   v_npnt;
553   GLint   v_exp;
554   GLint   v_nknt;
555   GLfloat *uknt;
556   GLfloat *vknt;
557   GLint   u_stride;
558   GLint   v_stride;
559   GLfloat *ctlarray;
560   GLenum  type;
561   GLint   **ctlpnt;
562   GLfloat **weight;
563 
564   /* additional values for rendering purposes */
565   int trimFlag;      /* 1: is trimmed, 0: new trimming necessary (not used so far) */
566   double ures, vres;    /* realworldlength(xyz)/nurbslength(uv) */
567   GLfloat *ustep, *vstep;    /* division per u or v for trimmed plotting */
568   int patches;        /* number of trimming patches (separate surfaces)*/
569   int *nc;             /* number of trimming curves */
570   int **np;            /* number of points in each trimming curve */
571   GLfloat ***uv;         /* u,v coordinates of the spline-points of the trimming curves */
572   double ***xyz;        /* x,y,z coordinates of the spline-points of the trimming curves */
573   double tx, ty, tz;   /* average position for the name-string */
574   double *umax, *vmax;   /* max val for u,v, for rendering purposes */
575 
576   /* additional values for meshing purposes (needed for tr6u) */
577   int nurbsType;            /* 0plate, 1cyl, 2torus, 3ball, 4half-ball-bot, 5half-ball-top */
578   int **sum_ambiguousPnts;  /* sum of double points in uv-space in each trimming curve */
579   int **uvflipped;          /* 1 if the uv loop is reversed in a trimming curve*/
580 } Nurbs;
581 
582 
583 
584 typedef struct {
585   double alpha, beta;
586   int nadapt,tetmesher;
587 } Meshp;
588 
589 
590 typedef struct {
591   int e;          /* mother element nr */
592   int n[4];
593   double cg[3];   /* center of grav */
594   double v;       /* volume */
595 } Tetraeder;
596 
597 
598 void adjustMidsideNode(double *P1, double *P2, double *Pm, int method);
599 int strsplt( char *rec_str, char breakchar, char ***ptr);
600 int strfind (char *as1, char *as2);
601 int readEdges( char *datin, Summen *anz, Nodes **nptr, Elements **eptr );
602 int *innerFacesHe8(Elements *elems, int numElems, Faces **ptr);
603 
604 void calcElemNorm_quad4(int i, int n1, int n2, int n3, int n4, int f, Nodes *node, Elements *elem );
605 void calcElemNorm_tri3(int i, int n1, int n2, int n3, int f, Nodes *node, Elements *elem );
606 void calcFaceNorm_quad4(int i, int n1, int n2, int n3, int n4, int f, Nodes *node, Faces *face);
607 void calcFaceNorm_tri3(int i, int n1, int n2, int n3, int f, Nodes *node, Faces *face );
608 void getElemNormalen( Elements *e_enqire, Nodes *node, int elems );
609 void getFaceNormalen( Faces *face, Nodes *node, Summen *anz );
610 
611 
612 int renumberfrd( int firstelem, int firstnode, Summen *anz, Nodes **nptr, Elements **eptr, Datasets **lptr, int **enew_ptr, int **nnew_ptr  );
613 
614 void define_rgb(float v, float *r, float *g, float *b);
615 void text(double x, double y, double z,char *msg, void *glut_font);
616 void scala_rgb( double dx, double dy, int divisions, double bmin, double bmax, double *col, void *glut_font, char format);
617 void scala_indx( double dx, double dy, int divisions, double bmin, double bmax, int offset, int col, void *glut_font, char format);
618 void scala_tex( double ratio, double dx, double dy, int divisions, double bmin, double bmax, double scale, double *col, void *glut_font, char format, char fnr, char lnr);
619 int button(double dx, double dy, char *msg, double mx, double my, void *glut_font);
620 void polymark ( int n, double *col_r, double *col_g, double *col_b, double *x,
621 		double *y, double *z );
622 
623 double nullstelle(double xmin, double xmax, double funktion(double), double *result);
624 int  calcPrinc( double *s, double *p, double *a1, double *a2, double *a3, int sortFlag );
625 int calcPvector( double *s, double *p, double *a );
626 void stopClock(int zaeler);
627 void bsort (double *wert, double *wertsort, int *isort, int anzahl);
628 int *bsort2(double *wert, int anzahl, int n );
629 int *bsortf(double *wert, int anzahl, int n );
630 int *bsortfp(double *wert, int anzahl, int n );
631 int *bsorti( int *wert, int anzahl, int n );
632 int compare (char *str1, char *str2, int length);
633 int compareStrings (char *str1, char *str2);
634 int elemChecker(int sum_e, int *elems, Nodes *node, Elements *elem);
635 int frecord( FILE *handle1,  char *string);
636 int getGeoDataTria( double *p1, double *p2, double *p3, double *Ix, double *Iy, double *Ixy,
637                 double *A, double *pcg);
638 int getrecord (int bufstart, int bufsize, char *inputdata, char *buffer);
639 int gl3grades( long double a, long double b, long double c, double *x);
640 int AsplitA( double *pa1, double *pa2, double *pa3, double *pb1, double *pb2, double *pb3, double *ps1, double *ps2);
641 double AsplitL( double *b, double *eu, double *ev, double *eg );
642 double interpol(double *x, double *y, int nn, double x0);
643 double intpol2(double *x, double *y, int n, double x0, int *method );
644 double intpol3(double *x, double *y, int n, double x0, int *method, double s, int iopt );
645 double intpol(double *x, double *y, int n, double x0 );
646 double normdist( double *p0, double *p1, double *p2, double *p3 );
647 int nearNodes(double *po, int *n, double *p, int *node, int *k, int *flag);
648 int iinsert(int **ipnt, int n, int x0 );
649 int ifind(int **ipnt, int n, int x0 );
650 int iremove(int **ipnt, int n, int x0 );
651 void linelength(double *x, double *y, double *z, int n, double *s );
652 int kbrecord( char *string);
653 int p3_finder(int anzahl_nodes, double *nx, double *nz, int *p);
654 int parser( char gkey, char *record, int *curshft, int commandLineFlag);
655 void freeDataset(Datasets *lcase, int nr);
656 int readAnsys(char *datin, Summen *anz, Nodes **nptr, Elements **eptr, Datasets **lptr, double phi, int frequency );
657 int readDyna( char *datin, Summen *anz, Nodes **nptr, Elements **eptr, Datasets **lptr );
658 int readfrd(char *datin, Summen *anz, Nodes **nptr, Elements **eptr, Datasets **lptr, int read_mode );
659 int readfrdblock( int lc, Summen *anz,   Nodes     *node, Datasets *lcase );
660 int readOneNode( int lc, Summen *anz, Datasets *lcase, int nodenr, double **vptr, long *offset );
661 int read2frd(char *datin, Summen *anz, Nodes **nptr, Elements **eptr, Datasets **lptr );
662 int readFElt(char *datin, Summen *anz, Nodes **nptr, Elements **eptr, Datasets **lptr );
663 int readDuns(char *datin, Summen *anz, Nodes **nptr, Elements **eptr, Datasets **lptr, int elem_type );
664 int readIsaac(char *datin, Summen *anz, Nodes **nptr, Elements **eptr, Datasets **lptr, NodeBlocks **bptr, int elem_type);
665 int readGiff( char *datin, Summen *anz, Nodes **nptr, Elements **eptr, Datasets **lptr );
666 int readNastran( char *datin, Summen *anz, Nodes **nptr, Elements **eptr, Datasets **lptr );
667 int readNG( char *datin, Summen *apre, Sets **sptr, Nodes **nptr, Elements **eptr, Datasets **lptr );
668 int readTG( char *datin, Summen *apre, Sets **sptr, Nodes **nptr, Elements **eptr, Datasets **lptr );
669 int readStl( char *datin, Summen *anz, Nodes **nptr, Elements **eptr, Datasets **lptr );
670 int rotiere(double *x, double *y, int n, double phi, double *xneu, double *yneu);
671 int checkIfNumber( char *string );
672 int srecord( char *handle1,  char *string);
673 double stof(char *string, int a, int b);
674 int stoi(char *string, int a, int b);
675 void stos(char *string, int a, int b, char *puffer);
676 int sins(char *string, int a, int b, char *puffer);
677 int sword( char *string, char *word);
678 int sword2( char *string, char *word);
679 double p_angle(double x, double y);
680 void v_add( double *A, double *B, double *C );
681 double v_betrag(double *a);
682 void  v_matmult(double *v, double *m);
683 double v_norm( double *A, double *C );
684 void v_prod( double *A, double *B, double *C );
685 void v_result( double *A, double *B, double *C );
686 int v_rot(double fi, double *p0, double *v, double *pin, double *pout);
687 void v_scal( double *A, double *B, double *C );
688 void v_scalf( float *A, double *B, double *C );
689 double v_sprod( double *a, double *b);
690 double v_angle( double *v0, double *v1 );
691 double v_angle_ref( double *v0, double *v1, double *en );
692 double v_distA( double *N0, double *N1, double *N2, double *N, double *vray, double  triScale, int *orient);
693 int  v_rec2cyl( double *pr, int axis, int *csys, double *pc );
694 int v_sgg( double *p1, double *p2, double *e1s, double *e2s, double *ps);
695 void v_print( double *a);
696 
697 void vl_add( double *A, double *B, double *C );
698 double vl_betrag(double *a);
699 void  vl_matmult(double *v, double *m);
700 double vl_norm( double *A, double *C );
701 void vl_prod( double *A, double *B, double *C );
702 void vl_result( double *A, double *B, double *C );
703 void vl_scal( double *A, double *B, double *C );
704 double vl_sprod( double *a, double *b);
705 double vl_angle( double *v0, double *v1, double *v2, double *scg, double *bcg );
706 void  m_copy(double *s, double *m);
707 void  m_print( double *m);
708 
709 int m_prod(int *n,double *a,double *b,double *c);
710 int m_prodtr(int *n,double *a,double *b,double *c);
711 
712 void  m_sub(double *ms, double *m, double *s);
713 int write2frd(char *datout, Summen *anz, Nodes *node, Elements *elem, Datasets *lcase, int binFlag );
714 int write2nas(char *datout, Summen *anz, Nodes *node, Elements *elem, Datasets *lcase );
715 int write2aba(char *datout, Summen *anz, Nodes *node, Elements *elem, Datasets *lcase, char **dat, int controlFlag );
716 int write2ansys(char *datout, Summen *anz, Nodes *node, Elements *elem, Datasets *lcase, char **dat );
717 int write2aster(char *datout, Summen *anz, Nodes *node, Elements *elem, Sets *set, Datasets *lcase ); //TODD
718 int write2darwin( char *datout, Summen *anz, Nodes *node, Elements *elem, Datasets *lcase, char **dat );
719 int write2samcef(char *datout, Summen *anz, Nodes *node, Elements *elem, Datasets *lcase );
720 int write2isaac( char *datout, Summen *anz, Nodes *node, Elements *elem, Datasets *lcase, NodeBlocks *nBlock, int bouNr, NodeBlockbou *blockbou );
721 int write2duns( char *datout, Summen *anz, Nodes *node, Elements *elem, Datasets *lcase, NodeBlocks *nBlock, int bouNr, NodeBlockbou *blockbou );
722 
723 
724 
725 void readStdCmap( Display **ptr_dpy, int *ptr_dpycells, Colormap *ptr_cmap, XColor **ptr_c,
726                  unsigned long **ptr_pix, unsigned int *ptr_npixels, int anzCells );
727 
728 /*selectFaces.c */
729 int selectDisplayFacesHe8 (Elements *elems, int numElems, int **pfaces, int *);
730 int selectDisplayFacesHe20 (Elements *elems, int numElems, int **pfaces, int *);
731 int selectDisplayFacesTet4 (Elements *elems, int numElems, int **ptr, int *edges);
732 int selectDisplayFacesTet10 (Elements *elems, int numElems, int **ptr, int *edges);
733 int selectDisplayFacesPe6 (Elements *elems, int numElems, int **ptr, int *edges);
734 int selectDisplayFacesPe20 (Elements *elems, int numElems, int **ptr, int *edges);
735 int commonEdge3 (int *a, int *b);
736 int findCTri3Edges(Elements *elems, int numElems, int **edges);
737 int findCTri6Edges(Elements *elems, int numElems, int **edges);
738 int findCQuad4Edges(Elements *elems, int numElems, int **edges);
739 int findCQuad8Edges(Elements *elems, int numElems, int **edges);
740 int compareFaces (int *a, int *b);
741 int compareFaces3 (int *a, int *b);
742 int compareFaces4 (int *a, int *b);
743 
744 double spline_int( int nc, double xneu, double **c );
745 void createSpline( int n, double **c);
746 int read2fbd( char *datin, SumGeo *anz, Points **pntptr, Lines **lineptr, Lcmb **lcmbptr, Gsur **surptr, Gbod **bodptr, Nurbs **nursptr, Sets *set );
747 
748 void shape4q(double xi, double et, double *xl, double *xsj);
749 void shape6tri(double xi, double et, double *xl, double *xsj);
750 void shape8q(double xi, double et, double *xl, double *xsj);
751 int  attach_new(double *coords,double *conode,int *i,double *ratio,double *dist,double *elemcoords);
752 int distattach_new(double *xig, double *etg, double *pneigh, double *pnode, double *a, double *p, double *ratio, int *nterms);
753 int attachhe20_(double *co, int *nk, int *neigh, int *node, double *xi_loc__,double *et_loc__);
754 int attachhe8_(double *co, int *nk, int *neigh, int *node,double *xi_loc__,double *et_loc__);
755 int distattachhe20_(double *xi,double *et,double *pneigh,double *pnode,double *dist,double *p);
756 int distattachhe8_(double *xi,double * et, double *pneigh, double *pnode, double *dist, double *p);
757 int shapefhe20_(double *xi, double *et, double *coef);
758 int shapefhe8_(double *xi, double *et, double *coef);
759 
760 int mesh2d(int *_nt, int _nb, int *npc, double **_pnt_u, double **_pnt_v, int **_pnt_flag, int **_tri3, double _alpha, double _beta, int _nadapt);
761 
762 void errMsg(char *msg, ...);
763 
764 void transformatrix( double *xab, double *p, double **a);
765 void rectcyl(int icntrl, double *csab, int nr, Nodes *node, Datasets *lcase, int lc, char type);
766 
767 void shapeHe8(double xi,double et,double ze, double xl[20][3],double *xsj,double *shp,int iflag);
768 void shapeHe20(double xi,double et,double ze, double xl[20][3],double *xsj,double *shp,int iflag);
769 void shapeTet10(double xi,double et,double ze, double shp[20]);
770 int shape8h_(double *xi, double *et, double *ze, double *xl, double *xsj);
771 int shape20h_(double *xi, double *et, double *ze, double *xl, double *xsj);
772 int shape10tet_(double *xi, double *et, double *ze, double *xl, double *xsj);
773 int e_c3d_volu_(double *xl,char *elty, double *volu, double *cg );
774 int e_c3d__(double *xl,char *elty);
775 int e_c3d_nodes_(double *xl,char *elty, int *elem, double *eqal);
776 int ident(double *x,double px,int n);
777 void near3d(double *xo,double *yo,double *zo,double *x,double *y,double *z,int *nx,int *ny,int *nz,double xp,double yp,double zp,int n,int *node,int k);
778 int splitElementsToTets(int anz_e, Nodes *node, Elements  *e_enqire, Tetraeder **ptet);
779 
780 int delaun_( int *numpts, int *maxtri, double *smalld, double *x, double *y, int *list, int *pointr, int *v1, int *v2, int *v3, int *numtri);
781 void cartcyl( double *csab, int node, double *node_pos, Datasets *lcase, int lc, char type );
782