1 /***********************************************************************
2 *
3 * ***** *** ***
4 * * * * * *
5 * * *** ***
6 * * * * * *
7 * ***** *** ***
8 *
9 * A FREE Finite Elements Analysis Program in ANSI C for the Windows and
10 * the UNIX OS.
11 *
12 * Composed and edited and copyright by
13 * Professor Dr.-Ing. Frank Rieg, University of Bayreuth, Germany
14 *
15 * eMail:
16 * frank.rieg@uni-bayreuth.de
17 * dr.frank.rieg@t-online.de
18 *
19 * V15.0 November 18, 2015
20 *
21 * This program is free software; you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License as published by
23 * the Free Software Foundation; either version 2, or (at your option)
24 * any later version.
25 *
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
30 *
31 * You should have received a copy of the GNU General Public License
32 * along with this program; see the file COPYING. If not, write to
33 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
34 ***********************************************************************/
35 /***********************************************************************
36 * man88r - liest Z88MAN.TXT
37 * int88r - liest Z88INT.TXT
38 * elp88r - liest Z88ELP.TXT
39 * mat88r - liest Z88MAT.TXT + CSV-Dateien
40 *
41 * 2.12.2015 Rieg
42 ***********************************************************************/
43
44 /***********************************************************************
45 * Fuer UNIX
46 ***********************************************************************/
47 #ifdef FR_UNIX
48 #include <z88r.h>
49 #include <stdio.h> /* FILE,NULL,fopen,fclose,rewind */
50 #include <string.h>
51 #endif
52
53 /***********************************************************************
54 * Fuer Windows
55 ***********************************************************************/
56 #ifdef FR_WIN
57 #include <z88r.h>
58 #include <stdio.h> /* FILE,NULL,fopen,fclose,rewind */
59 #include <string.h>
60 #endif
61
62 /***********************************************************************
63 * Formate
64 ***********************************************************************/
65 #ifdef FR_XINT
66 #define CFORMA "%s %d"
67 #define PDB "%d "
68 #define PDE "%d"
69 #endif
70
71 #ifdef FR_XLONG
72 #define CFORMA "%s %ld"
73 #define PDB "%ld "
74 #define PDE "%ld"
75 #endif
76
77 #ifdef FR_XLOLO
78 #define CFORMA "%s %lld"
79 #define PDB "%lld "
80 #define PDE "%lld"
81 #endif
82
83 #ifdef FR_XDOUB
84 #define CFORMA2 "%s %lg"
85 #define PGB "%lg "
86 #define PGE "%lg"
87 #endif
88
89 #ifdef FR_XQUAD
90 #define CFORMA2 "%s %Lg"
91 #define PGB "%Lg "
92 #define PGE "%Lg"
93 #endif
94
95 /****************************************************************************
96 * Function-Declarationen
97 ****************************************************************************/
98 int ale88r(int);
99 int wrim88r(FR_INT4,int);
100 int wlog88r(FR_INT4,int);
101
102 /***********************************************************************
103 * hier beginnt Function man88r
104 ***********************************************************************/
man88r(void)105 int man88r(void)
106 {
107 extern FILE *fman,*fwlo;
108
109 extern FR_DOUBLE eps,rpomega,rpalpha;
110
111 extern FR_INT4 ibflag,ipflag,ihflag,kdflag,isflag;
112 extern FR_INT4 maxit;
113
114 extern char cman[];
115
116 char cdummy[256];
117 char cline[256];
118
119 /*----------------------------------------------------------------------
120 * Manage-Datei z88man.txt oeffnen
121 *---------------------------------------------------------------------*/
122 fman = fopen(cman,"r");
123 if(fman == NULL)
124 {
125 wlog88r(0,LOG_NOMAN);
126 fclose(fwlo);
127 return(AL_NOMAN);
128 }
129 rewind(fman);
130
131 wrim88r(0,TX_REAMAN);
132
133 /*----------------------------------------------------------------------
134 * Sektion DYNAMIC lesen
135 *---------------------------------------------------------------------*/
136 fgets(cline,256,fman);
137
138 if( (strstr(cline,"DYNAMIC START"))!= NULL)
139 {
140 do
141 {
142 fgets(cline,256,fman);
143
144 /*======================================================================
145 * Sektion GLOBAL lesen
146 *=====================================================================*/
147 if( (strstr(cline,"GLOBAL START"))!= NULL)
148 {
149 do
150 {
151 fgets(cline,256,fman);
152 if( (strstr(cline,"IBFLAG"))!= NULL)
153 sscanf(cline,CFORMA,cdummy,&ibflag);
154 if( (strstr(cline,"IPFLAG"))!= NULL)
155 sscanf(cline,CFORMA,cdummy,&ipflag);
156 if( (strstr(cline,"IHFLAG"))!= NULL)
157 sscanf(cline,CFORMA,cdummy,&ihflag);
158 }
159 while( (strstr(cline,"GLOBAL END"))== NULL);
160 }
161
162 /*======================================================================
163 * Sektion SOLVER lesen
164 *=====================================================================*/
165 if( (strstr(cline,"SOLVER START"))!= NULL)
166 {
167 do
168 {
169 fgets(cline,256,fman);
170 if( (strstr(cline,"MAXIT"))!= NULL)
171 sscanf(cline,CFORMA,cdummy,&maxit);
172 if( (strstr(cline,"EPS"))!= NULL)
173 sscanf(cline,CFORMA2,cdummy,&eps);
174 if( (strstr(cline,"RALPHA"))!= NULL)
175 sscanf(cline,CFORMA2,cdummy,&rpalpha);
176 if( (strstr(cline,"ROMEGA"))!= NULL)
177 sscanf(cline,CFORMA2,cdummy,&rpomega);
178 }
179 while( (strstr(cline,"SOLVER END"))== NULL);
180 }
181
182 /*======================================================================
183 * Sektion STRESS lesen
184 *=====================================================================*/
185 if( (strstr(cline,"STRESS START"))!= NULL)
186 {
187 do
188 {
189 fgets(cline,256,fman);
190 if( (strstr(cline,"KDFLAG"))!= NULL)
191 sscanf(cline,CFORMA,cdummy,&kdflag);
192 if( (strstr(cline,"ISFLAG"))!= NULL)
193 sscanf(cline,CFORMA,cdummy,&isflag);
194 }
195 while( (strstr(cline,"STRESS END"))== NULL);
196 }
197
198 }
199 while( (strstr(cline,"DYNAMIC END"))== NULL);
200 }
201 else
202 {
203 wlog88r(0,LOG_WRONGMAN);
204 fclose(fman);
205 fclose(fwlo);
206 return(AL_WRONGMAN);
207 }
208
209 fclose(fman);
210 return 0;
211 }
212
213 /***********************************************************************
214 * hier beginnt Function int88r
215 ***********************************************************************/
int88r(void)216 int int88r(void)
217 {
218 extern FILE *fint,*fwlo;
219
220 extern FR_INT4AY intord;
221 extern FR_INT4AY intos;
222 extern FR_INT4AY ivon_int;
223 extern FR_INT4AY ibis_int;
224
225 extern FR_INT4 mint;
226
227 extern char cint[];
228
229 int i;
230
231 char cline[256];
232
233 /*----------------------------------------------------------------------
234 * Integrationsordnungs-Datei z88int.txt oeffnen
235 *---------------------------------------------------------------------*/
236 fint = fopen(cint,"r");
237 if(fint == NULL)
238 {
239 wlog88r(0,LOG_NOINT);
240 fclose(fwlo);
241 return(AL_NOINT);
242 }
243 rewind(fint);
244
245 /*----------------------------------------------------------------------
246 * Integrationsordnungs-Datei z88int.txt einlesen
247 *---------------------------------------------------------------------*/
248 fgets(cline,256,fint);
249 sscanf(cline,PDE,&mint);
250
251 wrim88r(mint,TX_REAINT);
252
253 for(i = 1; i <= mint; i++)
254 {
255 fgets(cline,256,fint);
256 sscanf(cline,PDB PDB PDB PDE,
257 &ivon_int[i],&ibis_int[i],&intord[i],&intos[i]);
258 }
259
260 /*----------------------------------------------------------------------
261 * Integrationsordnungs-Datei z88int.txt schliessen
262 *---------------------------------------------------------------------*/
263 fclose(fint);
264 return 0;
265 }
266
267 /***********************************************************************
268 * hier beginnt Function elp88r
269 ***********************************************************************/
elp88r(void)270 int elp88r(void)
271 {
272 extern FILE *felp,*fwlo;
273
274 extern FR_DOUBLEAY qpara;
275 extern FR_DOUBLEAY riyy;
276 extern FR_DOUBLEAY eyy;
277 extern FR_DOUBLEAY rizz;
278 extern FR_DOUBLEAY ezz;
279 extern FR_DOUBLEAY rit;
280 extern FR_DOUBLEAY wt;
281 extern FR_DOUBLEAY xcp;
282 extern FR_DOUBLEAY ycp;
283 extern FR_DOUBLEAY zcp;
284 extern FR_DOUBLEAY rkap;
285
286 extern FR_INT4AY ivon_elp;
287 extern FR_INT4AY ibis_elp;
288 extern FR_INT4AY ifbeti;
289
290 extern FR_INT4 melp;
291
292 extern char celp[];
293
294 int i;
295
296 char cline[256];
297
298 /*----------------------------------------------------------------------
299 * Elementparameter-Datei z88elp.txt oeffnen
300 *---------------------------------------------------------------------*/
301 felp = fopen(celp,"r");
302 if(felp == NULL)
303 {
304 wlog88r(0,LOG_NOELP);
305 fclose(fwlo);
306 return(AL_NOELP);
307 }
308 rewind(felp);
309
310 /*----------------------------------------------------------------------
311 * Elementparameter-Datei z88elp.txt einlesen
312 *---------------------------------------------------------------------*/
313 fgets(cline,256,felp);
314 sscanf(cline,PDE,&melp);
315
316 wrim88r(melp,TX_REAELP);
317
318 for(i = 1; i <= melp; i++)
319 {
320 fgets(cline,256,felp);
321 sscanf(cline,PDB PDB PGB PGB PGB PGB PGB PGB PGB PDB PGB PGB PGB PGE,
322 &ivon_elp[i],&ibis_elp[i],
323 &qpara[i],&riyy[i],&eyy[i],&rizz[i],&ezz[i],&rit[i],&wt[i],
324 &ifbeti[i],
325 &xcp[i],&ycp[i],&zcp[i],&rkap[i]);
326 }
327
328 /*----------------------------------------------------------------------
329 * Elementparameter-Datei z88elp.txt schliessen
330 *---------------------------------------------------------------------*/
331 fclose(felp);
332 return 0;
333 }
334
335 /***********************************************************************
336 * hier beginnt Function mat88r
337 ***********************************************************************/
mat88r(void)338 int mat88r(void)
339 {
340 extern FILE *fmat,*fwlo;
341
342 extern FR_DOUBLEAY emod;
343 extern FR_DOUBLEAY rnue;
344
345 extern FR_INT4AY ivon_mat;
346 extern FR_INT4AY ibis_mat;
347
348 extern FR_INT4 mmat;
349
350 extern char cmat[];
351
352 FILE *fcsv;
353
354 int i,j;
355
356 char cline[256];
357 char ccsv[256];
358
359 /*----------------------------------------------------------------------
360 * Material-Datei z88mat.txt oeffnen
361 *---------------------------------------------------------------------*/
362 fmat = fopen(cmat,"r");
363 if(fmat == NULL)
364 {
365 wlog88r(0,LOG_NOMAT);
366 fclose(fwlo);
367 return(AL_NOMAT);
368 }
369 rewind(fmat);
370
371 /*----------------------------------------------------------------------
372 * Material-Datei z88mat.txt und einzelne ?.txt einlesen
373 *---------------------------------------------------------------------*/
374 fgets(cline,256,fmat);
375 sscanf(cline,PDE,&mmat);
376
377 wrim88r(mmat,TX_REAMAT);
378
379 for(i = 1; i <= mmat; i++)
380 {
381 fgets(cline,256,fmat);
382 sscanf(cline,PDB PDB "%s",&ivon_mat[i],&ibis_mat[i],ccsv);
383
384 fcsv= fopen(ccsv,"r");
385 if (fcsv == NULL)
386 {
387 wlog88r(0,LOG_NOMATCSV);
388 fclose(fwlo);
389 return(AL_NOMATCSV);
390 }
391 rewind(fcsv);
392
393 fgets(cline,256,fcsv);
394 sscanf(cline,PGE PGE,&emod[i],&rnue[i]);
395
396 fclose (fcsv);
397 }
398
399 /*----------------------------------------------------------------------
400 * Material-Datei z88mat.txt schliessen
401 *---------------------------------------------------------------------*/
402 fclose(fmat);
403 return 0;
404 }
405
406
407