PLUTO
rbox.c File Reference

Basic RBox database. More...

#include "pluto.h"
Include dependency graph for rbox.c:

Go to the source code of this file.

Functions

void SetRBox (void)
 
RBoxGetRBox (int side, int vpos)
 

Variables

static RBox rbox_center [8]
 
static RBox rbox_x1face [8]
 
static RBox rbox_x2face [8]
 
static RBox rbox_x3face [8]
 

Detailed Description

Basic RBox database.

The function SetRBox() defines an array of predefined RBox structures needed to loop through different portions (or regions) of the computational domain.

  • rbox_center: an array of RBoxes for looping over the cell-centered data.
  • rbox_x1face: an array of RBoxes for looping over the X1-staggered data.
  • rbox_x2face: an array of RBoxes for looping over the X2-staggered data.
  • rbox_x3face: an array of RBoxes for looping over the X3-staggered data.

Each array of structures has 8 elements corresponding to the six sides of the computational domain (X1_BEG, ... , X3_END) and, in addition, we also define the DOM and TOT array indices to loop over the active computational zones or over the total computational domain (interior + ghost zones), respectively.

The function GetRBox() can be used to retrieve a pointer to a RBox structure given the computational side and the variable position.

Author
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
May 13, 2015

Definition in file rbox.c.

Function Documentation

RBox* GetRBox ( int  side,
int  vpos 
)

Returns a pointer to a local static RBox

Parameters
[in]sidethe region of the computational domain where the box is required. There 8 possible values: X1_BEG, ... , X3_END, DOM, TOT.
[in]vposthe variable position inside the cell: CENTER, X1FACE, X2FACE or X3FACE.

Definition at line 232 of file rbox.c.

243 {
244  if (vpos == CENTER) return &(rbox_center[side-X1_BEG]);
245  else if (vpos == X1FACE) return &(rbox_x1face[side-X1_BEG]);
246  else if (vpos == X2FACE) return &(rbox_x2face[side-X1_BEG]);
247  else if (vpos == X3FACE) return &(rbox_x3face[side-X1_BEG]);
248 }
#define X1_BEG
Boundary region at X1 beg.
Definition: pluto.h:146
#define CENTER
Definition: pluto.h:200
#define X3FACE
Definition: pluto.h:203
#define X1FACE
Definition: pluto.h:201
static RBox rbox_x1face[8]
Definition: rbox.c:30
static RBox rbox_x3face[8]
Definition: rbox.c:30
static RBox rbox_center[8]
Definition: rbox.c:30
static RBox rbox_x2face[8]
Definition: rbox.c:30
#define X2FACE
Definition: pluto.h:202

Here is the caller graph for this function:

void SetRBox ( void  )

Definition at line 33 of file rbox.c.

38 {
39  int s;
40 
41 /* ---------------------------------------------------
42  0. Set X1_BEG grid index ranges
43  --------------------------------------------------- */
44 
45  s = X1_BEG; s -= X1_BEG;
46 
48 
49  rbox_center[s].ib = IBEG-1; rbox_center[s].ie = 0;
50  rbox_center[s].jb = 0; rbox_center[s].je = NX2_TOT-1;
51  rbox_center[s].kb = 0; rbox_center[s].ke = NX3_TOT-1;
52 
54 
55  #ifndef CHOMBO /* -- useless for AMR -- */
59 
60  D_EXPAND(rbox_x1face[s].ib--; rbox_x1face[s].ie--; ,
61  rbox_x2face[s].jb--; ,
62  rbox_x3face[s].kb--;)
63  #endif
64 
65 /* ---------------------------------------------------
66  1. set X1_END grid index ranges
67  --------------------------------------------------- */
68 
69  s = X1_END; s -= X1_BEG;
70 
72 
74  rbox_center[s].jb = 0; rbox_center[s].je = NX2_TOT-1;
75  rbox_center[s].kb = 0; rbox_center[s].ke = NX3_TOT-1;
76 
78 
79  #ifndef CHOMBO /* -- useless for AMR -- */
83 
84  D_EXPAND( ; ,
85  rbox_x2face[s].jb--; ,
86  rbox_x3face[s].kb--;)
87  #endif
88 
89 /* ---------------------------------------------------
90  2. set X2_BEG grid index ranges
91  --------------------------------------------------- */
92 
93  s = X2_BEG; s -= X1_BEG;
94 
96 
97  rbox_center[s].ib = 0; rbox_center[s].ie = NX1_TOT-1;
98  rbox_center[s].jb = JBEG-1; rbox_center[s].je = 0;
99  rbox_center[s].kb = 0; rbox_center[s].ke = NX3_TOT-1;
100 
102 
103  #ifndef CHOMBO /* -- useless for AMR -- */
107 
108  D_EXPAND(rbox_x1face[s].ib--; ,
109  rbox_x2face[s].jb--; rbox_x2face[s].je--; ,
110  rbox_x3face[s].kb--;)
111  #endif
112 
113 /* ---------------------------------------------------
114  3. set X2_END grid index ranges
115  --------------------------------------------------- */
116 
117  s = X2_END; s -= X1_BEG;
118 
120 
121  rbox_center[s].ib = 0; rbox_center[s].ie = NX1_TOT-1;
122  rbox_center[s].jb = JEND+1; rbox_center[s].je = NX2_TOT-1;
123  rbox_center[s].kb = 0; rbox_center[s].ke = NX3_TOT-1;
124 
126 
127  #ifndef CHOMBO /* -- useless for AMR -- */
131 
132  D_EXPAND(rbox_x1face[s].ib--; ,
133  ; ,
134  rbox_x3face[s].kb--;)
135  #endif
136 
137 /* ---------------------------------------------------
138  4. set X3_BEG grid index ranges
139  --------------------------------------------------- */
140 
141  s = X3_BEG; s -= X1_BEG;
142 
144 
145  rbox_center[s].ib = 0; rbox_center[s].ie = NX1_TOT-1;
146  rbox_center[s].jb = 0; rbox_center[s].je = NX2_TOT-1;
147  rbox_center[s].kb = KBEG-1; rbox_center[s].ke = 0;
148 
150 
151  #ifndef CHOMBO /* -- useless for AMR -- */
155 
156  D_EXPAND(rbox_x1face[s].ib--; ,
157  rbox_x2face[s].jb--; ,
158  rbox_x3face[s].kb--; rbox_x3face[s].ke--;)
159  #endif
160 
161 /* ---------------------------------------------------
162  5. set X3_END grid index ranges
163  --------------------------------------------------- */
164 
165  s = X3_END; s -= X1_BEG;
166 
168 
169  rbox_center[s].ib = 0; rbox_center[s].ie = NX1_TOT-1;
170  rbox_center[s].jb = 0; rbox_center[s].je = NX2_TOT-1;
171  rbox_center[s].kb = KEND+1; rbox_center[s].ke = NX3_TOT-1;
172 
174 
175  #ifndef CHOMBO /* -- useless for AMR -- */
179 
180  D_EXPAND(rbox_x1face[s].ib--; ,
181  rbox_x2face[s].jb--; ,
182  ;)
183  #endif
184 
185 /* ---------------------------------------------------
186  6. set DOM index ranges
187  --------------------------------------------------- */
188 
189  s = DOM; s -= X1_BEG;
190 
195 
197 
198  #ifndef CHOMBO /* -- useless for AMR -- */
202 
203  D_EXPAND(rbox_x1face[s].ib--; ,
204  rbox_x2face[s].jb--; ,
205  rbox_x3face[s].kb--;)
206  #endif
207 
208 /* ---------------------------------------------------
209  7. set TOT index ranges
210  --------------------------------------------------- */
211 
212  s = TOT; s -= X1_BEG;
213 
215  rbox_center[s].ib = 0; rbox_center[s].ie = NX1_TOT-1;
216  rbox_center[s].jb = 0; rbox_center[s].je = NX2_TOT-1;
217  rbox_center[s].kb = 0; rbox_center[s].ke = NX3_TOT-1;
218 
220 
221  #ifndef CHOMBO /* -- useless for AMR -- */
225 
226  D_EXPAND(rbox_x1face[s].ib--; ,
227  rbox_x2face[s].jb--; ,
228  rbox_x3face[s].kb--;)
229  #endif
230 }
#define X3_BEG
Boundary region at X3 beg.
Definition: pluto.h:150
#define X1_BEG
Boundary region at X1 beg.
Definition: pluto.h:146
int jb
Lower corner index in the x2 direction.
Definition: structs.h:349
#define CENTER
Definition: pluto.h:200
int vpos
Location of the variable inside the cell.
Definition: structs.h:359
#define X3FACE
Definition: pluto.h:203
long int NX2_TOT
Total number of zones in the X2 direction (boundaries included) for the local processor.
Definition: globals.h:57
int kb
Lower corner index in the x3 direction.
Definition: structs.h:351
#define DOM
Computational domain (interior)
Definition: pluto.h:152
#define X1_END
Boundary region at X1 end.
Definition: pluto.h:147
#define TOT
Computational domain (total)
Definition: pluto.h:153
int ib
Lower corner index in the x1 direction.
Definition: structs.h:347
#define X1FACE
Definition: pluto.h:201
#define X2_END
Boundary region at X2 end.
Definition: pluto.h:149
long int NX3_TOT
Total number of zones in the X3 direction (boundaries included) for the local processor.
Definition: globals.h:59
long int IEND
Upper grid index of the computational domain in the the X1 direction for the local processor...
Definition: globals.h:37
static RBox rbox_x1face[8]
Definition: rbox.c:30
static RBox rbox_x3face[8]
Definition: rbox.c:30
#define s
static RBox rbox_center[8]
Definition: rbox.c:30
#define X3_END
Boundary region at X3 end.
Definition: pluto.h:151
D_EXPAND(tot/[n]=(double) grid[IDIR].np_int_glob;, tot/[n]=(double) grid[JDIR].np_int_glob;, tot/[n]=(double) grid[KDIR].np_int_glob;)
Definition: analysis.c:27
int ie
Upper corner index in the x1 direction.
Definition: structs.h:348
int ke
Upper corner index in the x3 direction.
Definition: structs.h:352
int je
Upper corner index in the x2 direction.
Definition: structs.h:350
long int KBEG
Lower grid index of the computational domain in the the X3 direction for the local processor...
Definition: globals.h:43
#define X2_BEG
Boundary region at X2 beg.
Definition: pluto.h:148
long int KEND
Upper grid index of the computational domain in the the X3 direction for the local processor...
Definition: globals.h:45
static RBox rbox_x2face[8]
Definition: rbox.c:30
long int JBEG
Lower grid index of the computational domain in the the X2 direction for the local processor...
Definition: globals.h:39
#define X2FACE
Definition: pluto.h:202
long int JEND
Upper grid index of the computational domain in the the X2 direction for the local processor...
Definition: globals.h:41
long int NX1_TOT
Total number of zones in the X1 direction (boundaries included) for the local processor.
Definition: globals.h:55
long int IBEG
Lower grid index of the computational domain in the the X1 direction for the local processor...
Definition: globals.h:35

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

RBox rbox_center[8]
static

Definition at line 30 of file rbox.c.

RBox rbox_x1face[8]
static

Definition at line 30 of file rbox.c.

RBox rbox_x2face[8]
static

Definition at line 30 of file rbox.c.

RBox rbox_x3face[8]
static

Definition at line 30 of file rbox.c.