TheBoussinesqModel  3.2.1
 All Data Structures Files Functions Variables Typedefs Macros Pages
turtle.h
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <string.h>
3 #include <stdlib.h>
4 #include <math.h>
5 #include <time.h>
6 #include <ctype.h>
7 
8 
9 #define isDynamic 1 /*This number will be used to mark a dynamic allocates
10  quantity */
11 
12 #define MAXBUFFERSIZE 50000 /* Many functions uses a buffer to allocate data. A
13  safe habit is to limit its size. */
14 
15 
16 #define MAXLABELSIZE 1024 /* The same as above */
17 
18 
19 #define BUFFERINCREMENT 256 /*Buffers memory is increases when necessary of this
20  storage capability till MAXBUFFERSIZE*/
21 
22 
23 #define LABELINCREMENT 64 /*The same as above */
24 
25 
26 
27 #define NR_END 1 /* Required by the Numerical Recipes' allocation routines
28  */
29 
30 
31 
32 #define FREE_ARG char* /* The same as above */
33 
34 
35 
36 #define OK 1
37 
38 
39 
40 #define NOK -1
41 
42 
43 
44 #define WOK 0
45 
46 
47 
48 #define MAX_KEYWORD_LENGTH 8
49 
50 
51 
52 #define PRINT 1
53 
54 #define NOPRINT 0 /*With the above PRINT is used to set a printint option
55  in some functions */
56 
57 
58 #define NL 1 /* Numerical Recipes allocation routines allow to have
59  arbitrary subscripts for vector and matrixes. The
60  fluid turtle library restrict this freedom by setting
61  their lower value to NL */
62 
63 
64 
65 #define TEST 1
66 
67 
68 #define NOTEST 0
69 
70 
71 #define SQRT2 1.414213562373095
72 
73 
74 #define co element /* The "co" pointer within MATRIX, TENSOR and VECTOR structs contains the string or numerical elements of
75  matrices, tensors and vectors, the word "co" can be replaced with "element" as previously utilized */
76 
85 typedef struct {
86 
87  short isdynamic; /* set to 1 when dynamically allocated */
88 
89  const char * name; /* the name of the data structure */
90 
91  long nl,nh; /* the lower bound, nl, and the upper, nh */
92 
93  float *co; /* the real stuff */
94 
95 
96 
97 } FLOATVECTOR;
98 
99 
100 
101 typedef struct {
102 
103  short isdynamic;
104 
105  const char * name;
106 
107  long nl,nh;
108 
109  int *co;
110 
111 
112 
113 } INTVECTOR;
114 
115 
116 
117 
118 
119 typedef struct {
120 
121  short isdynamic;
122 
123  const char * name;
124 
125  long nl,nh;
126 
127  long *co;
128 
129 
130 
131 } LONGVECTOR;
132 
133 
134 
135 
136 
137 typedef struct {
138 
139  short isdynamic;
140 
141  const char * name;
142 
143  long nl,nh;
144 
145  short *co;
146 
147 
148 
149 } SHORTVECTOR;
150 
151 
152 
153 
154 
155 typedef struct {
156 
157  short isdynamic;
158 
159  const char * name;
160 
161  long nl,nh;
162 
163  double *co;
164 
165 
166 
167 } DOUBLEVECTOR;
168 
169 
170 
171 typedef struct {
172 
173  short isdynamic;
174 
175  const char * name;
176 
177  long nl,nh;
178 
179  char *co;
180 
181 
182 
183 } CHARVECTOR;
184 
185 
186 
187 
188 
198 typedef struct {
199 
200  short isdynamic; /* see FLOATVECTOR */
201 
202  const char * name;
203 
204  long nrl,nrh,ncl,nch; /* lower and upper bound for rows: nrl, nrh;
205 
206  lower and upper bounds for columns: ncl, nch
207 
208  */
209 
210  short **co;
211 
212 
213 
214 } SHORTMATRIX;
215 
216 
217 
218 typedef struct {
219 
220  short isdynamic;
221 
222  const char * name;
223 
224  long nrl,nrh,ncl,nch;
225 
226  int **co;
227 
228 
229 
230 } INTMATRIX;
231 
232 
233 
234 
235 
236 typedef struct {
237 
238  short isdynamic;
239 
240  const char * name;
241 
242  long nrl,nrh,ncl,nch;
243 
244  float **co;
245 
246 
247 
248 } FLOATMATRIX;
249 
250 
251 
252 
253 
254 typedef struct {
255 
256  short isdynamic;
257 
258  const char * name;
259 
260  long nrl,nrh,ncl,nch;
261 
262  double **co;
263 
264 
265 
266 } DOUBLEMATRIX;
267 
268 
269 
270 
271 
272 typedef struct {
273 
274  short isdynamic;
275 
276  const char * name;
277 
278  long nrl,nrh,ncl,nch;
279 
280  long **co;
281 
282 
283 
284 } LONGMATRIX;
285 
286 
287 
288 
289 
301 typedef struct {
302 
303  short isdynamic;
304 
305  const char * name;
306 
307 
308 
309  LONGVECTOR * index; /* The index of the list: see the
310 
311  example file for more informations
312 
313  */
314 
315  short **co;
316 
317 
318 
319 } SHORTBIN;
320 
321 
322 
323 
324 
325 typedef struct {
326 
327  short isdynamic;
328 
329  const char * name;
330 
331 
332 
334 
335  int **co;
336 
337 
338 
339 } INTBIN;
340 
341 
342 
343 typedef struct {
344 
345  short isdynamic;
346 
347  const char * name;
348 
349 
350 
352 
353  long **co;
354 
355 
356 
357 } LONGBIN;
358 
359 
360 
361 typedef struct {
362 
363  short isdynamic;
364 
365  const char * name;
366 
367 
368 
370 
371  float **co;
372 
373 
374 
375 } FLOATBIN;
376 
377 
378 
379 typedef struct db{
380 
381  short isdynamic;
382 
383  const char * name;
384 
385 
386 
388 
389  double **co;
390 
391  struct db *next;
392 
393 } DOUBLEBIN;
394 
395 
396 
397 
398 
399 typedef struct st{
400 
401  short isdynamic;
402 
403  const char * name;
404 
405 
406 
408 
409  char **co;
410 
411  struct st *next;
412 
413 } STRINGBIN;
414 
415 /* Tensor3D */
416 
417 typedef struct {
418 
419  short isdynamic;
420 
421  const char * name;
422 
423  long nrl,nrh,ncl,nch,ndl,ndh;
424 
425  double ***co;
426 
427 
428 
429 } DOUBLETENSOR;
430 
431 
432 
433 
450 typedef struct{
451 
452 
453 
454  long number; /* Its position in file */
455 
456 
457 
458  short gender; /* It can be ascii=1, binary=2 .... */
459 
460 
461 
462  short type; /* type of the vector to be stored:
463 
464  char=1,short=2, int=3, long=4, float=5
465 
466  double=6, string=7
467 
468  */
469 
470 
471 
472  short category; /* array=1, vector=1, matrix=2,list=3 ,tensor3d=4*/
473 
474 
475 
476  long dimensions[4]; /* The length for a vector, the number of
477 
478  rows and columns for a matrix, rows,colums,depth for a tensor3D */
479 
480 
481 
482  char *name; /* Whatever name you choose or NULL */
483 
484 
485 
486 } HEADER;
487 
488 
489 
490 
491 
492 typedef struct {
493 
494 
495 
496 const char *gender[3];
497 
498 const char *type[8];
499 
500 const char *category[6];
501 
502 const char *symbol[3];
503 
504 const char *separator[3];
505 
506 const char *delimiter[3];
507 
508 
509 
510 }t_keywords;
511 
512 
513 
514 
515 
516 
517 
518 
519 
520 
521 
522 /*
523 
524 t_keywords T_KEYWORDS={{"2","ascii","binary"},
525 
526  {"7","char","short","int","long","float","double","string"},
527 
528  {"4","array","vector","matrix","list"},
529 
530  {"2","->","<-"},
531 
532  {"2"," ",","},
533 
534  {"2","{","}"}};
535 
536 
537 
538 
539 
540 
541 
542 */
543 
544 typedef struct { /*header of maps in fluid turtle format*/
545 DOUBLEVECTOR *U; /*dx,dy*/
546 DOUBLEVECTOR *V; /*sign of novalue,novalue*/
547 } T_INIT;
548 
549 
550 /* #include "nr_util.h" */
551 
552 #include "t_alloc.h"
553 
554 #include "t_io.h"
555 
556 #include "t_list.h"
557 
558 /* #include "t_random.h" */
559 
560 /*
561 
562 #include "t_datamanipulation.h"
563 
564 #include "t_probability.h"
565 
566 */
567 
568 void t_error(char *error_text);
569 
570 
571 
572 
573 
574 
575