Streamer fluid modeling - An overview of ARCoS
1.0
Main Page
Related Pages
Data Types List
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
include
rz_array.h
Go to the documentation of this file.
1
5
#ifndef _RZ_ARRAY_H_
6
7
#include "
cstream.h
"
8
9
typedef
struct
rz_array_t
rz_array_t
;
10
11
struct
rz_array_t
{
12
REAL
*
data
;
13
14
int
strides
[3];
15
int
r0
,
z0
,
theta0
,
nr
,
nz
;
16
int
ntheta
;
17
int
dim
;
18
19
int
len
;
20
21
rz_array_t
*
host
;
22
};
23
24
#define R_INDX 0
25
#define Z_INDX 1
26
#define THETA_INDX 2
27
28
/* The 3D macros */
29
#define RZTP_OK(_A, _R, _Z, _T) \
30
((_R) >= (_A)->r0 && (_R) < (_A)->nr + (_A)->r0 + 4 \
31
&& (_Z) >= (_A)->z0 && (_Z) < (_A)->nz + (_A)->z0 + 4 \
32
&& (_T) >= (_A)->theta0 && (_T) < (_A)->ntheta + (_A)->theta0 + 4) \
33
34
#define __RZTP(_A, _R, _Z, _T) ((_A)->data \
35
+ ((_R) - (_A)->r0) * (_A)->strides[R_INDX] \
36
+ ((_Z) - (_A)->z0) * (_A)->strides[Z_INDX] \
37
+ (((_T) - (_A)->theta0) * (_A)->strides[THETA_INDX]))
38
39
#if defined (DEBUG_LEVEL) && DEBUG_LEVEL > 4
40
/* Look, mum! I am also doing array bound checking.
41
* But, alas, since in some parts of the code we perform direct pointer
42
* arithmetic, this check will not detect all possible out-of-indexes
43
* (but we catch most of them).
44
*/
45
# define RZTP(_A, _R, _Z, _T) (RZTP_OK (_A, _R, _Z, _T)? \
46
__RZTP (_A, _R, _Z, _T): \
47
(fprintf (stderr, \
48
"%s:%d: Out of bounds ir = %d, iz = %d, itheta = %d\n", \
49
__FILE__, __LINE__, _R, _Z, _T), \
50
fprintf (stderr, \
51
"->r0 = %d ->z0 = %d ->theta0 = %d ->nr = %d ->nz = %d ->ntheta = %d\n", \
52
(_A)->r0, (_A)->z0, (_A)->theta0, \
53
(_A)->nr, (_A)->nz, (_A)->ntheta), \
54
exit(-1), (double*) NULL))
55
#else
56
# define RZTP(_A, _R, _Z, _T) __RZTP(_A, _R, _Z, _T)
57
#endif
58
59
#define RZT(_A,_R,_Z,_T) (*RZTP(_A, _R, _Z, _T))
60
#define RZTm(_A,_R,_Z,_T) ((fprintf (stderr, \
61
"%s:%d: CHECK ir = %d, iz = %d, itheta = %d\n", \
62
__FILE__, __LINE__, _R, _Z, _T), \
63
fprintf (stderr, \
64
"->r0 = %d ->z0 = %d ->theta0 = %d ->nr = %d ->nz = %d ->ntheta = %d\n", \
65
(_A)->r0, (_A)->z0, (_A)->theta0, \
66
(_A)->nr, (_A)->nz, (_A)->ntheta), \
67
fprintf (stderr, \
68
"->data = %g\n", \
69
(_A)->data), \
70
exit(-1), (double*) NULL))
71
72
73
/* These are valid for 2D arrays. When applied to a 3D array, they
74
* return the value with theta=0.
75
*/
76
#define RZP(_A,_R,_Z) RZTP(_A, _R, _Z, (_A)->theta0)
77
#define RZ(_A,_R,_Z) RZT(_A, _R, _Z, (_A)->theta0)
78
79
#define BND_CND_HNEUMANN 1
80
#define BND_CND_HDIRICHLET -1
81
82
#define BND_INWARD -1
83
#define BND_OUTWARD 1
84
85
#define _RZ_ARRAY_H_
86
#endif
Generated on Fri Jul 4 2014 15:40:20 for Streamer fluid modeling - An overview of ARCoS by
1.8.2