File: wria88x.c

package info (click to toggle)
z88 13.0.0%2Bdfsg2-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 107,800 kB
  • ctags: 3,296
  • sloc: ansic: 45,530; sh: 71; makefile: 14
file content (536 lines) | stat: -rw-r--r-- 16,526 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
/***********************************************************************
* 
*               *****   ***    ***
*                  *   *   *  *   *
*                 *     ***    ***
*                *     *   *  *   *
*               *****   ***    ***
*
* A FREE Finite Elements Analysis Program in ANSI C for the UNIX OS.
*
* Composed and edited and copyright by 
* Professor Dr.-Ing. Frank Rieg, University of Bayreuth, Germany
*
* eMail: 
* frank.rieg@uni-bayreuth.de
* dr.frank.rieg@t-online.de
* 
* V12.0  February 14, 2005
*
* Z88 should compile and run under any UNIX OS and Motif 2.0.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING.  If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
***********************************************************************/ 
/***********************************************************************
* wria88x.c beschreibt Z88I1.TXT,Z88NI.TXT,Z88I2.TXT und Z88I3.TXT
* und oeffnet und schliesst diese Files
* 4.10.2005 Rieg 
***********************************************************************/

/***********************************************************************
* Fuer UNIX
***********************************************************************/
#ifdef FR_UNIX
#include <z88x.h>
#include <stdio.h>   /* FILE,NULL,fopen,fclose,fprintf,fwrite */
                     /* rewind */
#endif

/***********************************************************************
* Fuer Windows95
***********************************************************************/
#ifdef FR_WIN95
#include <z88x.h>
#include <stdio.h>   /* FILE,NULL,fopen,fclose,fprintf,fwrite */
                     /* rewind */
#endif

/***********************************************************************
*  Functions
***********************************************************************/
int wrim88x(FR_INT4,int);
int wlog88x(FR_INT4,int);

/***********************************************************************
* hier beginnt Function wria88x
***********************************************************************/
int wria88x(void)
{
extern FILE *fz88,*fi2,*fi3,*fi5,*fwlo;

extern FR_DOUBLEAY x;
extern FR_DOUBLEAY y;
extern FR_DOUBLEAY z;
extern FR_DOUBLEAY emod;
extern FR_DOUBLEAY rnue;
extern FR_DOUBLEAY qpara;
extern FR_DOUBLEAY riyy;
extern FR_DOUBLEAY eyy;
extern FR_DOUBLEAY rizz;
extern FR_DOUBLEAY ezz;
extern FR_DOUBLEAY rit;
extern FR_DOUBLEAY wt;
extern FR_DOUBLEAY wert;
extern FR_DOUBLEAY pres;
extern FR_DOUBLEAY tr1;
extern FR_DOUBLEAY tr2;

extern FR_INT4AY koi;
extern FR_INT4AY koffs;
extern FR_INT4AY ifrei;
extern FR_INT4AY ityp;
extern FR_INT4AY itypfe;
extern FR_INT4AY ivon;
extern FR_INT4AY ibis;
extern FR_INT4AY intord;
extern FR_INT4AY jel;
extern FR_INT4AY iel;
extern FR_INT4AY kel;
extern FR_INT4AY nkn;
extern FR_INT4AY ifg;
extern FR_INT4AY irflag;
extern FR_INT4AY noi;
extern FR_INT4AY noffs;
extern FR_INT4AY nep;

extern FR_CHARAY cjmode;
extern FR_CHARAY cimode;
extern FR_CHARAY ckmode;

extern FR_DOUBLE epsx,epsy,epsz;

extern FR_INT4 ndim,nkp,ne,nfg,neg,kflag,ibflag,ipflag,iqflag,niflag;
extern FR_INT4 nrb,npr,ninto,ksflag,isflag;
extern FR_INT4 LANG,ICFLAG;

extern char ci1[];
extern char ci2[];
extern char ci3[];
extern char ci5[];
extern char cni[];

FR_INT4 i,j;

/*---------------------------------------------------------------------*
* Beschreiben Z88I1.TXT
*---------------------------------------------------------------------*/
if(ICFLAG == 4 || ICFLAG == 5)
  {
  wlog88x(0,LOG_WRII1);
  wrim88x(0,TX_WRII1);

/*---------------------------------------------------------------------*
* Oeffnen Z88I1.TXT
*---------------------------------------------------------------------*/
  fz88= fopen(ci1,"w");
  if(fz88 == NULL)
    {
    wlog88x(0,LOG_NOI1);
    fclose(fwlo);
    return(AL_NOI1);
    }
  rewind(fz88);

/*---------------------------------------------------------------------*
* Beschreiben Z88I1.TXT, erste Zeile
*---------------------------------------------------------------------*/
  if(kflag == 1) kflag = 0;
  
  if(LANG == 1)
  fprintf(fz88,
  " %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld  \
Z88I1.TXT,erzeugt von Z88X V12.0\n",
  ndim,nkp,ne,nfg,neg,kflag,ibflag,ipflag,iqflag);


  if(LANG == 2)
  fprintf(fz88,
  " %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld  \
Z88I1.TXT,produced by Z88X V12.0\n",
  ndim,nkp,ne,nfg,neg,kflag,ibflag,ipflag,iqflag);
  }

/*---------------------------------------------------------------------*
* Beschreiben Z88NI.TXT
*---------------------------------------------------------------------*/
if(ICFLAG == 6)
  {
  wlog88x(0,LOG_WRINI);
  wrim88x(0,TX_WRINI);

/*---------------------------------------------------------------------*
* Oeffnen Z88NI.TXT
*---------------------------------------------------------------------*/
  fz88= fopen(cni,"w");
  if(fz88 == NULL)
    {
    wlog88x(0,LOG_NONI);
    fclose(fwlo);
    return(AL_NONI);
    }
  rewind(fz88);

/*---------------------------------------------------------------------*
* Beschreiben Z88NI.TXT, erste Zeile
*---------------------------------------------------------------------*/
  if(kflag ==  1) kflag  = 0;
  if(ibflag == 1) ibflag = 0;
  
  if(LANG == 1)
  fprintf(fz88,
  " %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld  \
Z88NI.TXT,erzeugt von Z88X V12.0\n",
  ndim,nkp,ne,nfg,neg,kflag,ibflag,ipflag,iqflag,niflag);

  if(LANG == 2)
  fprintf(fz88,
  " %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld  \
Z88NI.TXT,produced by Z88X V12.0\n",
  ndim,nkp,ne,nfg,neg,kflag,ibflag,ipflag,iqflag,niflag);
  }

/*---------------------------------------------------------------------*
* Beschreiben Z88I1.TXT bzw. Z88NI.TXT, Koordinaten
*---------------------------------------------------------------------*/
for(i= 1; i<= nkp;i++)
  {
  if(LANG == 1)
  fprintf(fz88," %5ld %2ld  %+#13.5lE  %+#13.5lE  %+#13.5lE   Knoten #%ld\n",
  i,ifrei[i],x[i],y[i],z[i],i);

  if(LANG == 2)
  fprintf(fz88," %5ld %2ld  %+#13.5lE  %+#13.5lE  %+#13.5lE   node #%ld\n",
  i,ifrei[i],x[i],y[i],z[i],i);
  }

/*---------------------------------------------------------------------*
* Beschreiben Z88I1.TXT bzw. Z88NI.TXT, Koinzidenz
*---------------------------------------------------------------------*/
for(i= 1; i <= ne; i++)
  {
  if(ityp[i] == 1)
    {
    fprintf(fz88,
    " %5ld %5ld   element #%ld\n %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld\n",
    i,ityp[i],i,
    koi[koffs[i]   ], koi[koffs[i] +1],
    koi[koffs[i] +2], koi[koffs[i] +3],
    koi[koffs[i] +4], koi[koffs[i] +5],
    koi[koffs[i] +6], koi[koffs[i] +7]);
    }

  if(ityp[i] == 10)
    {
    fprintf(fz88,
    " %5ld %5ld   element #%ld\n\
 %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld\
 %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld\n",
    i,ityp[i],i,
    koi[koffs[i]    ], koi[koffs[i] + 2],
    koi[koffs[i] + 4], koi[koffs[i] + 6],
    koi[koffs[i] + 8], koi[koffs[i] +10],
    koi[koffs[i] +12], koi[koffs[i] +14],
    koi[koffs[i] + 1], koi[koffs[i] + 3],
    koi[koffs[i] + 5], koi[koffs[i] + 7],
    koi[koffs[i] + 9], koi[koffs[i] +11],
    koi[koffs[i] +13], koi[koffs[i] +15],
    koi[koffs[i] +16], koi[koffs[i] +17],
    koi[koffs[i] +18], koi[koffs[i] +19]);
    }

  if(ityp[i] == 7 || ityp[i] == 8 || ityp[i] == 20)
    {
    fprintf(fz88,
    " %5ld %5ld   element #%ld\n %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld\n",
    i,ityp[i],i,
    koi[koffs[i]   ], koi[koffs[i] +2],
    koi[koffs[i] +4], koi[koffs[i] +6],
    koi[koffs[i] +1], koi[koffs[i] +3],
    koi[koffs[i] +5], koi[koffs[i] +7]);
    }

  if(ityp[i] == 11 || ityp[i] == 12)
    {
    fprintf(fz88," %5ld %5ld   element #%ld\n\
 %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld\n",
    i,ityp[i],i,
    koi[koffs[i]    ], koi[koffs[i] + 3],
    koi[koffs[i] + 6], koi[koffs[i] + 9],
    koi[koffs[i] + 1], koi[koffs[i] + 2],
    koi[koffs[i] + 4], koi[koffs[i] + 5],
    koi[koffs[i] + 7], koi[koffs[i] + 8],
    koi[koffs[i] +10], koi[koffs[i] +11]);
    }

  if(ityp[i] == 2 || ityp[i] == 4 || ityp[i] == 5 ||
     ityp[i] == 9 || ityp[i] == 13)
    {
    fprintf(fz88," %5ld %5ld   element #%ld\n %5ld %5ld\n",
    i,ityp[i],i,koi[koffs[i]    ], koi[koffs[i] +1]);
    }

  if(ityp[i] == 3 || ityp[i] == 14 || ityp[i] == 15 || ityp[i] == 18)
      {
    fprintf(fz88,
    " %5ld %5ld   element #%ld\n %5ld %5ld %5ld %5ld %5ld %5ld\n",
    i,ityp[i],i,
    koi[koffs[i]   ], koi[koffs[i] +2], koi[koffs[i] +4],
    koi[koffs[i] +1], koi[koffs[i] +3], koi[koffs[i] +5]);
    }

  if(ityp[i] == 6)
    {
    fprintf(fz88,
    " %5ld %5ld   element #%ld\n %5ld %5ld %5ld\n",
    i,ityp[i],i,
    koi[koffs[i]   ], koi[koffs[i] +1], koi[koffs[i] +2]);
    }

  if(ityp[i] == 19)
    {
    fprintf(fz88,
    " %5ld %5ld   element #%ld\n\
 %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld\
 %5ld %5ld %5ld %5ld %5ld %5ld\n",
    i,ityp[i],i,
    koi[koffs[i]    ], koi[koffs[i] + 1],
    koi[koffs[i] + 2], koi[koffs[i] + 3],
    koi[koffs[i] + 4], koi[koffs[i] + 5],
    koi[koffs[i] + 6], koi[koffs[i] + 7],
    koi[koffs[i] + 8], koi[koffs[i] + 9],
    koi[koffs[i] +10], koi[koffs[i] +11],
    koi[koffs[i] +12], koi[koffs[i] +13],
    koi[koffs[i] +14], koi[koffs[i] +15]);
    }
  }

/*---------------------------------------------------------------------*
* Beschreiben Z88I1.TXT bzw. Z88NI.TXT, Elastizitaetsgesetze
*---------------------------------------------------------------------*/
for(i= 1; i <= neg; i++)
  if(ibflag == 0 && ipflag == 0)
    {
    fprintf(fz88," %5ld %5ld %+#13.5lE %+#13.5lE %5ld %+#13.5lE\n",
    ivon[i],ibis[i],emod[i],rnue[i],intord[i],qpara[i]);
    }
  else
   {
    fprintf(fz88," %5ld %5ld %+#13.5lE %+#13.5lE %5ld %+#13.5lE\
 %+#13.5lE %+#13.5lE %+#13.5lE %+#13.5lE %+#13.5lE %+#13.5lE\n",
    ivon[i],ibis[i],emod[i],rnue[i],intord[i],qpara[i],
    riyy[i],eyy[i],rizz[i],ezz[i],rit[i],wt[i]);
   }

/*---------------------------------------------------------------------*
* Z88NI.TXT: Zerlegungs- Infos schreiben
*---------------------------------------------------------------------*/
if(ICFLAG == 6)
  {
  for(i= 1; i <= ne; i++)
    {
    if(LANG == 1)
    fprintf(fz88,
    "%5ld %5ld   Superele. Nr.%ld,Typ %ld, --> Finites Ele. Typ %ld\n",
    i,itypfe[i],i,ityp[i],itypfe[i]);

    if(LANG == 2)
    fprintf(fz88,
    "%5ld %5ld  superele. no.%ld,type %ld, --> finite ele. type %ld\n",
    i,itypfe[i],i,ityp[i],itypfe[i]);

    if(ityp[i] == 1 || ityp[i] == 10)
      {
      fprintf(fz88,"%5ld %c %5ld %c %5ld %c\n",
      jel[i],cjmode[i],iel[i],cimode[i],kel[i],ckmode[i]);
      }
    else
      {
      fprintf(fz88,"%5ld %c %5ld %c\n",
      jel[i],cjmode[i],iel[i],cimode[i]);
      }
    }

  if(niflag == 1)
    {
    if(ityp[i] == 1 || ityp[i] == 10)
      {
      fprintf(fz88,"%+#13.5lE %+#13.5lE %+#13.5lE\n",epsx,epsy,epsz);
      }
    else
      {
      fprintf(fz88,"%+#13.5lE %+#13.5lE\n",epsx,epsy);
      }
    }
  }

fclose(fz88);

/*---------------------------------------------------------------------*
* Beschreiben Z88I2.TXT
*---------------------------------------------------------------------*/
if(ICFLAG == 5)
  {
  wlog88x(0,LOG_WRII2);
  wrim88x(0,TX_WRII2);

/*---------------------------------------------------------------------*
* Oeffnen Z88I2.TXT
*---------------------------------------------------------------------*/
  fi2= fopen(ci2,"w");
  if(fi2 == NULL)
    {
    wlog88x(0,LOG_NOI2);
    fclose(fwlo);
    return(AL_NOI2);
    }
  rewind(fi2);

/*---------------------------------------------------------------------*
* Beschreiben Z88I2.TXT, komplett
*---------------------------------------------------------------------*/
  if(LANG == 1) fprintf(fi2," %5ld    Z88I2.TXT,erzeugt von Z88X V12.0\n",nrb);
  if(LANG == 2) fprintf(fi2," %5ld    Z88I2.TXT,produced by Z88X V12.0\n",nrb);

  for(j= 1; j <= nrb; j++)
    fprintf(fi2," %5ld %5ld %5ld %+#13.5lE\n",
    nkn[j],ifg[j],irflag[j],wert[j]);
  fclose(fi2);
  }

/*---------------------------------------------------------------------*
* Beschreiben Z88I3.TXT
*---------------------------------------------------------------------*/
if(ICFLAG == 5)
  {
  wlog88x(0,LOG_WRII3);
  wrim88x(0,TX_WRII3);

/*---------------------------------------------------------------------*
* Oeffnen Z88I3.TXT
*---------------------------------------------------------------------*/
  fi3= fopen(ci3,"w");
  if(fi3 == NULL)
    {
    wlog88x(0,LOG_NOI3);
    fclose(fwlo);
    return(AL_NOI3);
    }
  rewind(fi3);

/*---------------------------------------------------------------------*
* Beschreiben Z88I3.TXT, komplett
*---------------------------------------------------------------------*/
  if(LANG == 1) 
  fprintf(fi3," %5ld %5ld %5ld    Z88I3.TXT,erzeugt von Z88X V12.0\n",
  ninto,ksflag,isflag);

  if(LANG == 2) 
  fprintf(fi3," %5ld %5ld %5ld    Z88I3.TXT,produced by Z88X V12.0\n",
  ninto,ksflag,isflag);
 
  fclose(fi3);
  }

/*---------------------------------------------------------------------*
* Beschreiben Z88I5.TXT
*---------------------------------------------------------------------*/
if(ICFLAG == 5 && iqflag == 1)
  {
  wlog88x(0,LOG_WRII5);
  wrim88x(0,TX_WRII5);

/*---------------------------------------------------------------------*
* Oeffnen Z88I5.TXT
*---------------------------------------------------------------------*/
  fi5= fopen(ci5,"w");
  if(fi5 == NULL)
    {
    wlog88x(0,LOG_NOI5);
    fclose(fwlo);
    return(AL_NOI5);
    }
  rewind(fi5);

/*---------------------------------------------------------------------*
* Beschreiben Z88I5.TXT, komplett
*---------------------------------------------------------------------*/
  if(LANG == 1) fprintf(fi5," %5ld    Z88I5.TXT,erzeugt von Z88X V12.0\n",npr);
  if(LANG == 2) fprintf(fi5," %5ld    Z88I5.TXT,produced by Z88X V12.0\n",npr);

  for(j= 1; j <= npr; j++)
    {
/*======================================================================
* Elementtypen 7, 8, 14, 15
*=====================================================================*/
    if(ityp[nep[j]]== 7  || ityp[nep[j]]== 8 ||
    ityp[nep[j]]== 14 || ityp[nep[j]]== 15) 
      {
      fprintf(fi5,"%5ld %+#13.5lE %+#13.5lE %5ld %5ld %5ld\n",
      nep[j],pres[j],tr1[j],
      noi[noffs[j]   ],noi[noffs[j] +1],noi[noffs[j] +2]);  
      }

/*======================================================================
* Elementtyp 10
*=====================================================================*/
    if(ityp[nep[j]]== 10) 
      {
      fprintf(fi5,
"%5ld %+#13.5lE %+#13.5lE %+#13.5lE %5ld %5ld %5ld %5ld %5ld %5ld %5ld %5ld\n",
        nep[j],pres[j],tr1[j],tr2[j],
        noi[noffs[j]   ], noi[noffs[j] +1], 
        noi[noffs[j] +2], noi[noffs[j] +3], 
        noi[noffs[j] +4], noi[noffs[j] +5],
        noi[noffs[j] +6], noi[noffs[j] +7]); 
        }

/*======================================================================
* Elementtyp 1
*=====================================================================*/
    if(ityp[nep[j]]== 1) 
      {
      fprintf(fi5,
      "%5ld %+#13.5lE %+#13.5lE %+#13.5lE %5ld %5ld %5ld %5ld\n",
      nep[j],pres[j],tr1[j],tr2[j],
      noi[noffs[j]   ], noi[noffs[j] +1], 
      noi[noffs[j] +2], noi[noffs[j] +3]); 
      }

/*======================================================================
* Elementtypen 11 und 12
*=====================================================================*/
    if(ityp[nep[j]]== 11 || ityp[nep[j]]== 12) 
      {
      fprintf(fi5,"%5ld %+#13.5lE %+#13.5lE %5ld %5ld %5ld %5ld\n",
      nep[j],pres[j],tr1[j],
      noi[noffs[j]   ], noi[noffs[j] +1], 
      noi[noffs[j] +2], noi[noffs[j] +3]); 
      }

/*======================================================================
* Elementtyp 18,19 und 20
*=====================================================================*/
    if(ityp[nep[j]]== 18 || ityp[nep[j]]== 19 || ityp[nep[j]]== 20) 
      {
      fprintf(fi5,"%5ld %+#13.5lE\n",nep[j],pres[j]); 
      }

    } /* Enfe Schleife */

  fclose(fi5);
  }

return(0);
}