1 #ifndef AMReX_extrapolater_3D_K_H_
2 #define AMReX_extrapolater_3D_K_H_
3 #include <AMReX_Config.H>
15 using namespace amrex::literals;
17 constexpr
int finecell = 1;
18 constexpr
int crsecell = 0;
23 for (
int n = 0; n <
nComp; n++) {
28 for (
int j = lo.y-1; j <= hi.y+1; ++j) {
29 for (
int i = lo.x-1; i <= hi.x+1; ++i) {
30 if (
mask(i,j,k) == crsecell) { data(i,j,k,n) = Real(0.0); }
34 for (
int j = lo.y-1; j <= hi.y+1; ++j) {
35 for (
int i = lo.x-1; i <= hi.x+1; ++i) {
36 if (
mask(i,j,k) == crsecell) { data(i,j,k,n) = Real(0.0); }
42 for (
int k = lo.z-1; k <= hi.z+1; ++k) {
43 for (
int i = lo.x-1; i <= hi.x+1; ++i) {
44 if (
mask(i,j,k) == crsecell) { data(i,j,k,n) = Real(0.0); }
48 for (
int k = lo.z-1; k <= hi.z+1; ++k) {
49 for (
int i = lo.x-1; i <= hi.x+1; ++i) {
50 if (
mask(i,j,k) == crsecell) { data(i,j,k,n) = Real(0.0); }
56 for (
int k = lo.z-1; k <= hi.z+1; ++k) {
57 for (
int j = lo.y-1; j <= hi.y+1; ++j) {
58 if (
mask(i,j,k) == crsecell) { data(i,j,k,n) = Real(0.0); }
62 for (
int k = lo.z-1; k <= hi.z+1; ++k) {
63 for (
int j = lo.y-1; j <= hi.y+1; ++j) {
64 if (
mask(i,j,k) == crsecell) { data(i,j,k,n) = Real(0.0); }
75 if (
mask(i,j,k) == crsecell ) {
76 if ( (
mask(i+1,j,k) == finecell ) ||
77 (
mask(i,j+1,k) == finecell ) ||
78 (
mask(i,j,k+1) == finecell ) ) {
79 data(i,j,k,n) = ( Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
80 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
81 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
83 }
else if ( (
mask(i+1,j+1,k) == finecell ) ||
84 (
mask(i+1,j,k+1) == finecell ) ||
85 (
mask(i,j+1,k+1) == finecell ) ) {
86 data(i,j,k,n) = ( Real(
mask(i+1,j+1,k)) * data(i+1,j+1,k,n)
87 + Real(
mask(i+1,j,k+1)) * data(i+1,j,k+1,n)
88 + Real(
mask(i,j+1,k+1)) * data(i,j+1,k+1,n) )
89 / Real(
mask(i+1,j+1,k) +
mask(i+1,j,k+1) +
mask(i,j+1,k+1) );
91 data(i,j,k,n) = data(i+1,j+1,k+1,n);
100 if (
mask(i,j,k) == crsecell ) {
101 if ( (
mask(i+1,j,k) == finecell ) ||
102 (
mask(i,j+1,k) == finecell ) ||
103 (
mask(i,j,k-1) == finecell ) ) {
104 data(i,j,k,n) = ( Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
105 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
106 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n) )
107 / Real(
mask(i+1,j,k) +
mask(i,j+1,k) +
mask(i,j,k-1) );
108 }
else if ( (
mask(i+1,j+1,k) == finecell ) ||
109 (
mask(i+1,j,k-1) == finecell ) ||
110 (
mask(i,j+1,k-1) == finecell ) ) {
111 data(i,j,k,n) = ( Real(
mask(i+1,j+1,k)) * data(i+1,j+1,k,n)
112 + Real(
mask(i+1,j,k-1)) * data(i+1,j,k-1,n)
113 + Real(
mask(i,j+1,k-1)) * data(i,j+1,k-1,n) )
114 / Real(
mask(i+1,j+1,k) +
mask(i+1,j,k-1) +
mask(i,j+1,k-1) );
116 data(i,j,k,n) = data(i+1,j+1,k-1,n);
125 if (
mask(i,j,k) == crsecell ) {
126 if ( (
mask(i+1,j,k) == finecell ) ||
127 (
mask(i,j-1,k) == finecell ) ||
128 (
mask(i,j,k+1) == finecell ) ) {
129 data(i,j,k,n) = ( Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
130 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
131 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
132 / Real(
mask(i+1,j,k) +
mask(i,j-1,k) +
mask(i,j,k+1) );
133 }
else if ( (
mask(i+1,j-1,k) == finecell ) ||
134 (
mask(i+1,j,k+1) == finecell ) ||
135 (
mask(i,j-1,k+1) == finecell ) ) {
136 data(i,j,k,n) = ( Real(
mask(i+1,j-1,k)) * data(i+1,j-1,k,n)
137 + Real(
mask(i+1,j,k+1)) * data(i+1,j,k+1,n)
138 + Real(
mask(i,j-1,k+1)) * data(i,j-1,k+1,n) )
139 / Real(
mask(i+1,j-1,k) +
mask(i+1,j,k+1) +
mask(i,j-1,k+1) );
141 data(i,j,k,n) = data(i+1,j-1,k+1,n);
150 if (
mask(i,j,k) == crsecell ) {
151 if ( (
mask(i+1,j,k) == finecell ) ||
152 (
mask(i,j-1,k) == finecell ) ||
153 (
mask(i,j,k-1) == finecell ) ) {
154 data(i,j,k,n) = ( Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
155 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
156 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n) )
157 / Real(
mask(i+1,j,k) +
mask(i,j-1,k) +
mask(i,j,k-1) );
158 }
else if ( (
mask(i+1,j-1,k) == finecell ) ||
159 (
mask(i+1,j,k-1) == finecell ) ||
160 (
mask(i,j-1,k-1) == finecell ) ) {
161 data(i,j,k,n) = ( Real(
mask(i+1,j-1,k)) * data(i+1,j-1,k,n)
162 + Real(
mask(i+1,j,k-1)) * data(i+1,j,k-1,n)
163 + Real(
mask(i,j-1,k-1)) * data(i,j-1,k-1,n) )
164 / Real(
mask(i+1,j-1,k) +
mask(i+1,j,k-1) +
mask(i,j-1,k-1) );
166 data(i,j,k,n) = data(i+1,j-1,k-1,n);
175 if (
mask(i,j,k) == crsecell ) {
176 if ( (
mask(i-1,j,k) == finecell ) ||
177 (
mask(i,j+1,k) == finecell ) ||
178 (
mask(i,j,k+1) == finecell ) ) {
179 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
180 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
181 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
182 / Real(
mask(i-1,j,k) +
mask(i,j+1,k) +
mask(i,j,k+1) );
183 }
else if ( (
mask(i-1,j+1,k) == finecell ) ||
184 (
mask(i-1,j,k+1) == finecell ) ||
185 (
mask(i,j+1,k+1) == finecell ) ) {
186 data(i,j,k,n) = ( Real(
mask(i-1,j+1,k)) * data(i-1,j+1,k,n)
187 + Real(
mask(i-1,j,k+1)) * data(i-1,j,k+1,n)
188 + Real(
mask(i,j+1,k+1)) * data(i,j+1,k+1,n) )
189 / Real(
mask(i-1,j+1,k) +
mask(i-1,j,k+1) +
mask(i,j+1,k+1) );
191 data(i,j,k,n) = data(i-1,j+1,k+1,n);
200 if (
mask(i,j,k) == crsecell ) {
201 if ( (
mask(i-1,j,k) == finecell ) ||
202 (
mask(i,j+1,k) == finecell ) ||
203 (
mask(i,j,k-1) == finecell ) ) {
204 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
205 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
206 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n) )
207 / Real(
mask(i-1,j,k) +
mask(i,j+1,k) +
mask(i,j,k-1) );
208 }
else if ( (
mask(i-1,j+1,k) == finecell ) ||
209 (
mask(i-1,j,k-1) == finecell ) ||
210 (
mask(i,j+1,k-1) == finecell ) ) {
211 data(i,j,k,n) = ( Real(
mask(i-1,j+1,k)) * data(i-1,j+1,k,n)
212 + Real(
mask(i-1,j,k-1)) * data(i-1,j,k-1,n)
213 + Real(
mask(i,j+1,k-1)) * data(i,j+1,k-1,n) )
214 / Real(
mask(i-1,j+1,k) +
mask(i-1,j,k-1) +
mask(i,j+1,k-1) );
216 data(i,j,k,n) = data(i-1,j+1,k-1,n);
225 if (
mask(i,j,k) == crsecell ) {
226 if ( (
mask(i-1,j,k) == finecell ) ||
227 (
mask(i,j-1,k) == finecell ) ||
228 (
mask(i,j,k+1) == finecell ) ) {
229 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
230 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
231 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
232 / Real(
mask(i-1,j,k) +
mask(i,j-1,k) +
mask(i,j,k+1) );
233 }
else if ( (
mask(i-1,j-1,k) == finecell ) ||
234 (
mask(i-1,j,k+1) == finecell ) ||
235 (
mask(i,j-1,k+1) == finecell ) ) {
236 data(i,j,k,n) = ( Real(
mask(i-1,j-1,k)) * data(i-1,j-1,k,n)
237 + Real(
mask(i-1,j,k+1)) * data(i-1,j,k+1,n)
238 + Real(
mask(i,j-1,k+1)) * data(i,j-1,k+1,n) )
239 / Real(
mask(i-1,j-1,k) +
mask(i-1,j,k+1) +
mask(i,j-1,k+1) );
241 data(i,j,k,n) = data(i-1,j-1,k+1,n);
250 if (
mask(i,j,k) == crsecell ) {
251 if ( (
mask(i-1,j,k) == finecell ) ||
252 (
mask(i,j-1,k) == finecell ) ||
253 (
mask(i,j,k-1) == finecell ) ) {
254 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
255 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
256 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n) )
257 / Real(
mask(i-1,j,k) +
mask(i,j-1,k) +
mask(i,j,k-1) );
258 }
else if ( (
mask(i-1,j-1,k) == finecell ) ||
259 (
mask(i-1,j,k-1) == finecell ) ||
260 (
mask(i,j-1,k-1) == finecell ) ) {
261 data(i,j,k,n) = ( Real(
mask(i-1,j-1,k)) * data(i-1,j-1,k,n)
262 + Real(
mask(i-1,j,k-1)) * data(i-1,j,k-1,n)
263 + Real(
mask(i,j-1,k-1)) * data(i,j-1,k-1,n) )
264 / Real(
mask(i-1,j-1,k) +
mask(i-1,j,k-1) +
mask(i,j-1,k-1) );
266 data(i,j,k,n) = data(i-1,j-1,k-1,n);
275 for (
int k = lo.z; k <= hi.z; ++k) {
276 if (
mask(i,j,k) == crsecell ) {
277 if ( (
mask(i+1,j,k) == finecell ) ||
278 (
mask(i,j+1,k) == finecell ) ||
279 (
mask(i,j,k-1) == finecell ) ||
280 (
mask(i,j,k+1) == finecell ) ) {
281 data(i,j,k,n) = ( Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
282 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
283 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n)
284 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
287 data(i,j,k,n) = ( data(i+1,j+1,k,n)
288 + Real(
mask(i+1,j,k-1)) * data(i+1,j,k-1,n)
289 + Real(
mask(i+1,j,k+1)) * data(i+1,j,k+1,n)
290 + Real(
mask(i,j+1,k-1)) * data(i,j+1,k-1,n)
291 + Real(
mask(i,j+1,k+1)) * data(i,j+1,k+1,n) )
292 / Real( 1 +
mask(i+1,j,k-1) +
mask(i+1,j,k+1) +
mask(i,j+1,k-1) +
mask(i,j+1,k+1) );
301 for (
int k = lo.z; k <= hi.z; ++k) {
302 if (
mask(i,j,k) == crsecell ) {
303 if ( (
mask(i+1,j,k) == finecell ) ||
304 (
mask(i,j-1,k) == finecell ) ||
305 (
mask(i,j,k-1) == finecell ) ||
306 (
mask(i,j,k+1) == finecell ) ) {
307 data(i,j,k,n) = ( Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
308 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
309 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n)
310 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
313 data(i,j,k,n) = ( data(i+1,j-1,k,n)
314 + Real(
mask(i+1,j,k-1)) * data(i+1,j,k-1,n)
315 + Real(
mask(i+1,j,k+1)) * data(i+1,j,k+1,n)
316 + Real(
mask(i,j-1,k-1)) * data(i,j-1,k-1,n)
317 + Real(
mask(i,j-1,k+1)) * data(i,j-1,k+1,n) )
318 / Real( 1 +
mask(i+1,j,k-1) +
mask(i+1,j,k+1) +
mask(i,j-1,k-1) +
mask(i,j-1,k+1) );
327 for (
int k = lo.z; k <= hi.z; ++k) {
328 if (
mask(i,j,k) == crsecell ) {
329 if ( (
mask(i-1,j,k) == finecell ) ||
330 (
mask(i,j+1,k) == finecell ) ||
331 (
mask(i,j,k-1) == finecell ) ||
332 (
mask(i,j,k+1) == finecell ) ) {
333 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
334 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
335 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n)
336 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
339 data(i,j,k,n) = ( data(i-1,j+1,k,n)
340 + Real(
mask(i-1,j,k-1)) * data(i-1,j,k-1,n)
341 + Real(
mask(i-1,j,k+1)) * data(i-1,j,k+1,n)
342 + Real(
mask(i,j+1,k-1)) * data(i,j+1,k-1,n)
343 + Real(
mask(i,j+1,k+1)) * data(i,j+1,k+1,n) )
344 / Real( 1 +
mask(i-1,j,k-1) +
mask(i-1,j,k+1) +
mask(i,j+1,k-1) +
mask(i,j+1,k+1) );
353 for (
int k = lo.z; k <= hi.z; ++k) {
354 if (
mask(i,j,k) == crsecell ) {
355 if ( (
mask(i-1,j,k) == finecell ) ||
356 (
mask(i,j-1,k) == finecell ) ||
357 (
mask(i,j,k-1) == finecell ) ||
358 (
mask(i,j,k+1) == finecell ) ) {
359 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
360 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
361 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n)
362 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
365 data(i,j,k,n) = ( data(i-1,j-1,k,n)
366 + Real(
mask(i-1,j,k-1)) * data(i-1,j,k-1,n)
367 + Real(
mask(i-1,j,k+1)) * data(i-1,j,k+1,n)
368 + Real(
mask(i,j-1,k-1)) * data(i,j-1,k-1,n)
369 + Real(
mask(i,j-1,k+1)) * data(i,j-1,k+1,n) )
370 / Real( 1 +
mask(i-1,j,k-1) +
mask(i-1,j,k+1) +
mask(i,j-1,k-1) +
mask(i,j-1,k+1) );
379 for (
int j = lo.y; j <= hi.y; ++j) {
380 if (
mask(i,j,k) == crsecell ) {
381 if ( (
mask(i+1,j,k) == finecell ) ||
382 (
mask(i,j-1,k) == finecell ) ||
383 (
mask(i,j+1,k) == finecell ) ||
384 (
mask(i,j,k+1) == finecell ) ) {
385 data(i,j,k,n) = ( Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
386 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
387 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
388 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
391 data(i,j,k,n) = ( Real(
mask(i+1,j-1,k)) * data(i+1,j-1,k,n)
392 + Real(
mask(i+1,j+1,k)) * data(i+1,j+1,k,n)
394 + Real(
mask(i,j-1,k+1)) * data(i,j-1,k+1,n)
395 + Real(
mask(i,j+1,k+1)) * data(i,j+1,k+1,n) )
396 / Real(
mask(i+1,j-1,k) +
mask(i+1,j+1,k) + 1 +
mask(i,j-1,k+1) +
mask(i,j+1,k+1) );
405 for (
int j = lo.y; j <= hi.y; ++j) {
406 if (
mask(i,j,k) == crsecell ) {
407 if ( (
mask(i+1,j,k) == finecell ) ||
408 (
mask(i,j-1,k) == finecell ) ||
409 (
mask(i,j+1,k) == finecell ) ||
410 (
mask(i,j,k-1) == finecell ) ) {
411 data(i,j,k,n) = ( Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
412 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
413 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
414 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n) )
417 data(i,j,k,n) = ( Real(
mask(i+1,j-1,k)) * data(i+1,j-1,k,n)
418 + Real(
mask(i+1,j+1,k)) * data(i+1,j+1,k,n)
420 + Real(
mask(i,j-1,k-1)) * data(i,j-1,k-1,n)
421 + Real(
mask(i,j+1,k-1)) * data(i,j+1,k-1,n) )
422 / Real(
mask(i+1,j-1,k) +
mask(i+1,j+1,k) + 1 +
mask(i,j-1,k-1) +
mask(i,j+1,k-1) );
431 for (
int j = lo.y; j <= hi.y; ++j) {
432 if (
mask(i,j,k) == crsecell ) {
433 if ( (
mask(i-1,j,k) == finecell ) ||
434 (
mask(i,j-1,k) == finecell ) ||
435 (
mask(i,j+1,k) == finecell ) ||
436 (
mask(i,j,k+1) == finecell ) ) {
437 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
438 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
439 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
440 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
443 data(i,j,k,n) = ( Real(
mask(i-1,j-1,k)) * data(i-1,j-1,k,n)
444 + Real(
mask(i-1,j+1,k)) * data(i-1,j+1,k,n)
446 + Real(
mask(i,j-1,k+1)) * data(i,j-1,k+1,n)
447 + Real(
mask(i,j+1,k+1)) * data(i,j+1,k+1,n) )
448 / Real(
mask(i-1,j-1,k) +
mask(i-1,j+1,k) + 1 +
mask(i,j-1,k+1) +
mask(i,j+1,k+1) );
457 for (
int j = lo.y; j <= hi.y; ++j) {
458 if (
mask(i,j,k) == crsecell ) {
459 if ( (
mask(i-1,j,k) == finecell ) ||
460 (
mask(i,j-1,k) == finecell ) ||
461 (
mask(i,j+1,k) == finecell ) ||
462 (
mask(i,j,k-1) == finecell ) ) {
463 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
464 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
465 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
466 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n) )
469 data(i,j,k,n) = ( Real(
mask(i-1,j-1,k)) * data(i-1,j-1,k,n)
470 + Real(
mask(i-1,j+1,k)) * data(i-1,j+1,k,n)
472 + Real(
mask(i,j-1,k-1)) * data(i,j-1,k-1,n)
473 + Real(
mask(i,j+1,k-1)) * data(i,j+1,k-1,n) )
474 / Real(
mask(i-1,j-1,k) +
mask(i-1,j+1,k) + 1 +
mask(i,j-1,k-1) +
mask(i,j+1,k-1) );
483 for (
int i = lo.x; i <= hi.x; ++i) {
484 if (
mask(i,j,k) == crsecell ) {
485 if ( (
mask(i-1,j,k) == finecell ) ||
486 (
mask(i+1,j,k) == finecell ) ||
487 (
mask(i,j+1,k) == finecell ) ||
488 (
mask(i,j,k+1) == finecell ) ) {
489 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
490 + Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
491 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
492 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
495 data(i,j,k,n) = ( Real(
mask(i-1,j+1,k)) * data(i-1,j+1,k,n)
496 + Real(
mask(i+1,j+1,k)) * data(i+1,j+1,k,n)
497 + Real(
mask(i-1,j,k+1)) * data(i-1,j,k+1,n)
498 + Real(
mask(i+1,j,k+1)) * data(i+1,j,k+1,n)
499 + data(i,j+1,k+1,n) )
500 / Real(
mask(i-1,j+1,k) +
mask(i+1,j+1,k) +
mask(i-1,j,k+1) +
mask(i+1,j,k+1) + 1 );
509 for (
int i = lo.x; i <= hi.x; ++i) {
510 if (
mask(i,j,k) == crsecell ) {
511 if ( (
mask(i-1,j,k) == finecell ) ||
512 (
mask(i+1,j,k) == finecell ) ||
513 (
mask(i,j+1,k) == finecell ) ||
514 (
mask(i,j,k-1) == finecell ) ) {
515 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
516 + Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
517 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
518 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n) )
521 data(i,j,k,n) = ( Real(
mask(i-1,j+1,k)) * data(i-1,j+1,k,n)
522 + Real(
mask(i+1,j+1,k)) * data(i+1,j+1,k,n)
523 + Real(
mask(i-1,j,k-1)) * data(i-1,j,k-1,n)
524 + Real(
mask(i+1,j,k-1)) * data(i+1,j,k-1,n)
525 + data(i,j+1,k-1,n) )
526 / Real(
mask(i-1,j+1,k) +
mask(i+1,j+1,k) +
mask(i-1,j,k-1) +
mask(i+1,j,k-1) + 1 );
535 for (
int i = lo.x; i <= hi.x; ++i) {
536 if (
mask(i,j,k) == crsecell ) {
537 if ( (
mask(i-1,j,k) == finecell ) ||
538 (
mask(i+1,j,k) == finecell ) ||
539 (
mask(i,j-1,k) == finecell ) ||
540 (
mask(i,j,k+1) == finecell ) ) {
541 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
542 + Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
543 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
544 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
547 data(i,j,k,n) = ( Real(
mask(i-1,j-1,k)) * data(i-1,j-1,k,n)
548 + Real(
mask(i+1,j-1,k)) * data(i+1,j-1,k,n)
549 + Real(
mask(i-1,j,k+1)) * data(i-1,j,k+1,n)
550 + Real(
mask(i+1,j,k+1)) * data(i+1,j,k+1,n)
551 + data(i,j-1,k+1,n) )
552 / Real(
mask(i-1,j-1,k) +
mask(i+1,j-1,k) +
mask(i-1,j,k+1) +
mask(i+1,j,k+1) + 1 );
561 for (
int i = lo.x; i <= hi.x; ++i) {
562 if (
mask(i,j,k) == crsecell ) {
563 if ( (
mask(i-1,j,k) == finecell ) ||
564 (
mask(i+1,j,k) == finecell ) ||
565 (
mask(i,j-1,k) == finecell ) ||
566 (
mask(i,j,k-1) == finecell ) ) {
567 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
568 + Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
569 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
570 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n) )
573 data(i,j,k,n) = ( Real(
mask(i-1,j-1,k)) * data(i-1,j-1,k,n)
574 + Real(
mask(i+1,j-1,k)) * data(i+1,j-1,k,n)
575 + Real(
mask(i-1,j,k-1)) * data(i-1,j,k-1,n)
576 + Real(
mask(i+1,j,k-1)) * data(i+1,j,k-1,n)
577 + data(i,j-1,k-1,n) )
578 / Real(
mask(i-1,j-1,k) +
mask(i+1,j-1,k) +
mask(i-1,j,k-1) +
mask(i+1,j,k-1) + 1 );
587 for (
int k = lo.z; k <= hi.z; ++k) {
588 for (
int j = lo.y; j <= hi.y; ++j) {
589 if (
mask(i,j,k) == crsecell ) {
590 data(i,j,k,n) = ( data(i+1,j,k,n)
591 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
592 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
593 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n)
594 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
595 / Real( 1 +
mask(i,j-1,k) +
mask(i,j+1,k) +
mask(i,j,k-1) +
mask(i,j,k+1) );
603 for (
int k = lo.z; k <= hi.z; ++k) {
604 for (
int j = lo.y; j <= hi.y; ++j) {
605 if (
mask(i,j,k) == crsecell ) {
606 data(i,j,k,n) = ( data(i-1,j,k,n)
607 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
608 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
609 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n)
610 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
611 / Real( 1 +
mask(i,j-1,k) +
mask(i,j+1,k) +
mask(i,j,k-1) +
mask(i,j,k+1) );
619 for (
int k = lo.z; k <= hi.z; ++k) {
620 for (
int i = lo.x; i <= hi.x; ++i) {
621 if (
mask(i,j,k) == crsecell ) {
622 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
623 + Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
625 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n)
626 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
627 / Real(
mask(i-1,j,k) +
mask(i+1,j,k) + 1 +
mask(i,j,k-1) +
mask(i,j,k+1) );
635 for (
int k = lo.z; k <= hi.z; ++k) {
636 for (
int i = lo.x; i <= hi.x; ++i) {
637 if (
mask(i,j,k) == crsecell ) {
638 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
639 + Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
641 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n)
642 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
643 / Real(
mask(i-1,j,k) +
mask(i+1,j,k) + 1 +
mask(i,j,k-1) +
mask(i,j,k+1) );
651 for (
int j = lo.y; j <= hi.y; ++j) {
652 for (
int i = lo.x; i <= hi.x; ++i) {
653 if (
mask(i,j,k) == crsecell ) {
654 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
655 + Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
656 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
657 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
659 / Real(
mask(i-1,j,k) +
mask(i+1,j,k) +
mask(i,j-1,k) +
mask(i,j+1,k) + 1 );
667 for (
int j = lo.y; j <= hi.y; ++j) {
668 for (
int i = lo.x; i <= hi.x; ++i) {
669 if (
mask(i,j,k) == crsecell ) {
670 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
671 + Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
672 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
673 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
675 / Real(
mask(i-1,j,k) +
mask(i+1,j,k) +
mask(i,j-1,k) +
mask(i,j+1,k) + 1 );
691 using namespace amrex::literals;
693 constexpr
int finecell = 1;
694 constexpr
int crsecell = 0;
699 if (
mask(i,j,k) == crsecell ) {
702 if ( ( i == lo.x-1) && ( j == lo.y-1 ) && ( k == lo.z-1 ) ) {
703 if ( (
mask(i+1,j,k) == finecell ) ||
704 (
mask(i,j+1,k) == finecell ) ||
705 (
mask(i,j,k+1) == finecell ) ) {
706 data(i,j,k,n) = ( Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
707 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
708 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
709 / Real(
mask(i+1,j,k) +
mask(i,j+1,k) +
mask(i,j,k+1) );
710 }
else if ( (
mask(i+1,j+1,k) == finecell ) ||
711 (
mask(i+1,j,k+1) == finecell ) ||
712 (
mask(i,j+1,k+1) == finecell ) ) {
713 data(i,j,k,n) = ( Real(
mask(i+1,j+1,k)) * data(i+1,j+1,k,n)
714 + Real(
mask(i+1,j,k+1)) * data(i+1,j,k+1,n)
715 + Real(
mask(i,j+1,k+1)) * data(i,j+1,k+1,n) )
716 / Real(
mask(i+1,j+1,k) +
mask(i+1,j,k+1) +
mask(i,j+1,k+1) );
718 data(i,j,k,n) = data(i+1,j+1,k+1,n);
721 }
else if ( ( i == lo.x-1) && ( j == lo.y-1 ) && ( k == hi.z+1 ) ) {
722 if ( (
mask(i+1,j,k) == finecell ) ||
723 (
mask(i,j+1,k) == finecell ) ||
724 (
mask(i,j,k-1) == finecell ) ) {
725 data(i,j,k,n) = ( Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
726 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
727 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n) )
728 / Real(
mask(i+1,j,k) +
mask(i,j+1,k) +
mask(i,j,k-1) );
729 }
else if ( (
mask(i+1,j+1,k) == finecell ) ||
730 (
mask(i+1,j,k-1) == finecell ) ||
731 (
mask(i,j+1,k-1) == finecell ) ) {
732 data(i,j,k,n) = ( Real(
mask(i+1,j+1,k)) * data(i+1,j+1,k,n)
733 + Real(
mask(i+1,j,k-1)) * data(i+1,j,k-1,n)
734 + Real(
mask(i,j+1,k-1)) * data(i,j+1,k-1,n) )
735 / Real(
mask(i+1,j+1,k) +
mask(i+1,j,k-1) +
mask(i,j+1,k-1) );
737 data(i,j,k,n) = data(i+1,j+1,k-1,n);
740 }
else if ( ( i == lo.x-1) && ( j == hi.y+1 ) && ( k == lo.z-1 ) ) {
741 if ( (
mask(i+1,j,k) == finecell ) ||
742 (
mask(i,j-1,k) == finecell ) ||
743 (
mask(i,j,k+1) == finecell ) ) {
744 data(i,j,k,n) = ( Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
745 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
746 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
747 / Real(
mask(i+1,j,k) +
mask(i,j-1,k) +
mask(i,j,k+1) );
748 }
else if ( (
mask(i+1,j-1,k) == finecell ) ||
749 (
mask(i+1,j,k+1) == finecell ) ||
750 (
mask(i,j-1,k+1) == finecell ) ) {
751 data(i,j,k,n) = ( Real(
mask(i+1,j-1,k)) * data(i+1,j-1,k,n)
752 + Real(
mask(i+1,j,k+1)) * data(i+1,j,k+1,n)
753 + Real(
mask(i,j-1,k+1)) * data(i,j-1,k+1,n) )
754 / Real(
mask(i+1,j-1,k) +
mask(i+1,j,k+1) +
mask(i,j-1,k+1) );
756 data(i,j,k,n) = data(i+1,j-1,k+1,n);
759 }
else if ( ( i == lo.x-1) && ( j == hi.y+1 ) && ( k == hi.z+1 ) ) {
760 if ( (
mask(i+1,j,k) == finecell ) ||
761 (
mask(i,j-1,k) == finecell ) ||
762 (
mask(i,j,k-1) == finecell ) ) {
763 data(i,j,k,n) = ( Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
764 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
765 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n) )
766 / Real(
mask(i+1,j,k) +
mask(i,j-1,k) +
mask(i,j,k-1) );
767 }
else if ( (
mask(i+1,j-1,k) == finecell ) ||
768 (
mask(i+1,j,k-1) == finecell ) ||
769 (
mask(i,j-1,k-1) == finecell ) ) {
770 data(i,j,k,n) = ( Real(
mask(i+1,j-1,k)) * data(i+1,j-1,k,n)
771 + Real(
mask(i+1,j,k-1)) * data(i+1,j,k-1,n)
772 + Real(
mask(i,j-1,k-1)) * data(i,j-1,k-1,n) )
773 / Real(
mask(i+1,j-1,k) +
mask(i+1,j,k-1) +
mask(i,j-1,k-1) );
775 data(i,j,k,n) = data(i+1,j-1,k-1,n);
778 }
else if ( ( i == hi.x+1) && ( j == lo.y-1 ) && ( k == lo.z-1 ) ) {
779 if ( (
mask(i-1,j,k) == finecell ) ||
780 (
mask(i,j+1,k) == finecell ) ||
781 (
mask(i,j,k+1) == finecell ) ) {
782 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
783 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
784 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
785 / Real(
mask(i-1,j,k) +
mask(i,j+1,k) +
mask(i,j,k+1) );
786 }
else if ( (
mask(i-1,j+1,k) == finecell ) ||
787 (
mask(i-1,j,k+1) == finecell ) ||
788 (
mask(i,j+1,k+1) == finecell ) ) {
789 data(i,j,k,n) = ( Real(
mask(i-1,j+1,k)) * data(i-1,j+1,k,n)
790 + Real(
mask(i-1,j,k+1)) * data(i-1,j,k+1,n)
791 + Real(
mask(i,j+1,k+1)) * data(i,j+1,k+1,n) )
792 / Real(
mask(i-1,j+1,k) +
mask(i-1,j,k+1) +
mask(i,j+1,k+1) );
794 data(i,j,k,n) = data(i-1,j+1,k+1,n);
797 }
else if ( ( i == hi.x+1) && ( j == lo.y-1 ) && ( k == hi.z+1 ) ) {
798 if ( (
mask(i-1,j,k) == finecell ) ||
799 (
mask(i,j+1,k) == finecell ) ||
800 (
mask(i,j,k-1) == finecell ) ) {
801 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
802 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
803 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n) )
804 / Real(
mask(i-1,j,k) +
mask(i,j+1,k) +
mask(i,j,k-1) );
805 }
else if ( (
mask(i-1,j+1,k) == finecell ) ||
806 (
mask(i-1,j,k-1) == finecell ) ||
807 (
mask(i,j+1,k-1) == finecell ) ) {
808 data(i,j,k,n) = ( Real(
mask(i-1,j+1,k)) * data(i-1,j+1,k,n)
809 + Real(
mask(i-1,j,k-1)) * data(i-1,j,k-1,n)
810 + Real(
mask(i,j+1,k-1)) * data(i,j+1,k-1,n) )
811 / Real(
mask(i-1,j+1,k) +
mask(i-1,j,k-1) +
mask(i,j+1,k-1) );
813 data(i,j,k,n) = data(i-1,j+1,k-1,n);
816 }
else if ( ( i == hi.x+1) && ( j == hi.y+1 ) && ( k == lo.z-1 ) ) {
817 if ( (
mask(i-1,j,k) == finecell ) ||
818 (
mask(i,j-1,k) == finecell ) ||
819 (
mask(i,j,k+1) == finecell ) ) {
820 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
821 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
822 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
823 / Real(
mask(i-1,j,k) +
mask(i,j-1,k) +
mask(i,j,k+1) );
824 }
else if ( (
mask(i-1,j-1,k) == finecell ) ||
825 (
mask(i-1,j,k+1) == finecell ) ||
826 (
mask(i,j-1,k+1) == finecell ) ) {
827 data(i,j,k,n) = ( Real(
mask(i-1,j-1,k)) * data(i-1,j-1,k,n)
828 + Real(
mask(i-1,j,k+1)) * data(i-1,j,k+1,n)
829 + Real(
mask(i,j-1,k+1)) * data(i,j-1,k+1,n) )
830 / Real(
mask(i-1,j-1,k) +
mask(i-1,j,k+1) +
mask(i,j-1,k+1) );
832 data(i,j,k,n) = data(i-1,j-1,k+1,n);
835 }
else if ( ( i == hi.x+1) && ( j == hi.y+1 ) && ( k == hi.z+1 ) ) {
836 if ( (
mask(i-1,j,k) == finecell ) ||
837 (
mask(i,j-1,k) == finecell ) ||
838 (
mask(i,j,k-1) == finecell ) ) {
839 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
840 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
841 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n) )
842 / Real(
mask(i-1,j,k) +
mask(i,j-1,k) +
mask(i,j,k-1) );
843 }
else if ( (
mask(i-1,j-1,k) == finecell ) ||
844 (
mask(i-1,j,k-1) == finecell ) ||
845 (
mask(i,j-1,k-1) == finecell ) ) {
846 data(i,j,k,n) = ( Real(
mask(i-1,j-1,k)) * data(i-1,j-1,k,n)
847 + Real(
mask(i-1,j,k-1)) * data(i-1,j,k-1,n)
848 + Real(
mask(i,j-1,k-1)) * data(i,j-1,k-1,n) )
849 / Real(
mask(i-1,j-1,k) +
mask(i-1,j,k-1) +
mask(i,j-1,k-1) );
851 data(i,j,k,n) = data(i-1,j-1,k-1,n);
855 }
else if ( ( i == lo.x-1) && ( j == lo.y-1 ) &&
856 ( k >= lo.z ) && ( k <= hi.z ) ) {
857 if ( (
mask(i+1,j,k) == finecell ) ||
858 (
mask(i,j+1,k) == finecell ) ||
859 (
mask(i,j,k-1) == finecell ) ||
860 (
mask(i,j,k+1) == finecell ) ) {
861 data(i,j,k,n) = ( Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
862 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
863 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n)
864 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
867 data(i,j,k,n) = ( data(i+1,j+1,k,n)
868 + Real(
mask(i+1,j,k-1)) * data(i+1,j,k-1,n)
869 + Real(
mask(i+1,j,k+1)) * data(i+1,j,k+1,n)
870 + Real(
mask(i,j+1,k-1)) * data(i,j+1,k-1,n)
871 + Real(
mask(i,j+1,k+1)) * data(i,j+1,k+1,n) )
872 / Real( 1 +
mask(i+1,j,k-1) +
mask(i+1,j,k+1) +
mask(i,j+1,k-1) +
mask(i,j+1,k+1) );
875 }
else if ( ( i == lo.x-1) && ( j == hi.y+1 ) &&
876 ( k >= lo.z ) && ( k <= hi.z ) ) {
877 if ( (
mask(i+1,j,k) == finecell ) ||
878 (
mask(i,j-1,k) == finecell ) ||
879 (
mask(i,j,k-1) == finecell ) ||
880 (
mask(i,j,k+1) == finecell ) ) {
881 data(i,j,k,n) = ( Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
882 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
883 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n)
884 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
887 data(i,j,k,n) = ( data(i+1,j-1,k,n)
888 + Real(
mask(i+1,j,k-1)) * data(i+1,j,k-1,n)
889 + Real(
mask(i+1,j,k+1)) * data(i+1,j,k+1,n)
890 + Real(
mask(i,j-1,k-1)) * data(i,j-1,k-1,n)
891 + Real(
mask(i,j-1,k+1)) * data(i,j-1,k+1,n) )
892 / Real( 1 +
mask(i+1,j,k-1) +
mask(i+1,j,k+1) +
mask(i,j-1,k-1) +
mask(i,j-1,k+1) );
895 }
else if ( ( i == hi.x+1) && ( j == lo.y-1 ) &&
896 ( k >= lo.z ) && ( k <= hi.z ) ) {
897 if ( (
mask(i-1,j,k) == finecell ) ||
898 (
mask(i,j+1,k) == finecell ) ||
899 (
mask(i,j,k-1) == finecell ) ||
900 (
mask(i,j,k+1) == finecell ) ) {
901 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
902 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
903 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n)
904 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
907 data(i,j,k,n) = ( data(i-1,j+1,k,n)
908 + Real(
mask(i-1,j,k-1)) * data(i-1,j,k-1,n)
909 + Real(
mask(i-1,j,k+1)) * data(i-1,j,k+1,n)
910 + Real(
mask(i,j+1,k-1)) * data(i,j+1,k-1,n)
911 + Real(
mask(i,j+1,k+1)) * data(i,j+1,k+1,n) )
912 / Real( 1 +
mask(i-1,j,k-1) +
mask(i-1,j,k+1) +
mask(i,j+1,k-1) +
mask(i,j+1,k+1) );
915 }
else if ( ( i == hi.x+1) && ( j == hi.y+1 ) &&
916 ( k >= lo.z ) && ( k <= hi.z ) ) {
917 if ( (
mask(i-1,j,k) == finecell ) ||
918 (
mask(i,j-1,k) == finecell ) ||
919 (
mask(i,j,k-1) == finecell ) ||
920 (
mask(i,j,k+1) == finecell ) ) {
921 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
922 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
923 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n)
924 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
927 data(i,j,k,n) = ( data(i-1,j-1,k,n)
928 + Real(
mask(i-1,j,k-1)) * data(i-1,j,k-1,n)
929 + Real(
mask(i-1,j,k+1)) * data(i-1,j,k+1,n)
930 + Real(
mask(i,j-1,k-1)) * data(i,j-1,k-1,n)
931 + Real(
mask(i,j-1,k+1)) * data(i,j-1,k+1,n) )
932 / Real( 1 +
mask(i-1,j,k-1) +
mask(i-1,j,k+1) +
mask(i,j-1,k-1) +
mask(i,j-1,k+1) );
935 }
else if ( ( i == lo.x-1) && ( j >= lo.y ) &&
936 ( j <= hi.y ) && ( k == lo.z-1 ) ) {
937 if ( (
mask(i+1,j,k) == finecell ) ||
938 (
mask(i,j-1,k) == finecell ) ||
939 (
mask(i,j+1,k) == finecell ) ||
940 (
mask(i,j,k+1) == finecell ) ) {
941 data(i,j,k,n) = ( Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
942 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
943 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
944 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
947 data(i,j,k,n) = ( Real(
mask(i+1,j-1,k)) * data(i+1,j-1,k,n)
948 + Real(
mask(i+1,j+1,k)) * data(i+1,j+1,k,n)
950 + Real(
mask(i,j-1,k+1)) * data(i,j-1,k+1,n)
951 + Real(
mask(i,j+1,k+1)) * data(i,j+1,k+1,n) )
952 / Real(
mask(i+1,j-1,k) +
mask(i+1,j+1,k) + 1 +
mask(i,j-1,k+1) +
mask(i,j+1,k+1) );
955 }
else if ( ( i == lo.x-1) && ( j >= lo.y ) &&
956 ( j <= hi.y ) && ( k == hi.z+1 ) ) {
957 if ( (
mask(i+1,j,k) == finecell ) ||
958 (
mask(i,j-1,k) == finecell ) ||
959 (
mask(i,j+1,k) == finecell ) ||
960 (
mask(i,j,k-1) == finecell ) ) {
961 data(i,j,k,n) = ( Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
962 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
963 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
964 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n) )
967 data(i,j,k,n) = ( Real(
mask(i+1,j-1,k)) * data(i+1,j-1,k,n)
968 + Real(
mask(i+1,j+1,k)) * data(i+1,j+1,k,n)
970 + Real(
mask(i,j-1,k-1)) * data(i,j-1,k-1,n)
971 + Real(
mask(i,j+1,k-1)) * data(i,j+1,k-1,n) )
972 / Real(
mask(i+1,j-1,k) +
mask(i+1,j+1,k) + 1 +
mask(i,j-1,k-1) +
mask(i,j+1,k-1) );
975 }
else if ( ( i == hi.x+1) && ( j >= lo.y ) &&
976 ( j <= hi.y ) && ( k == lo.z-1 ) ) {
977 if ( (
mask(i-1,j,k) == finecell ) ||
978 (
mask(i,j-1,k) == finecell ) ||
979 (
mask(i,j+1,k) == finecell ) ||
980 (
mask(i,j,k+1) == finecell ) ) {
981 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
982 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
983 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
984 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
987 data(i,j,k,n) = ( Real(
mask(i-1,j-1,k)) * data(i-1,j-1,k,n)
988 + Real(
mask(i-1,j+1,k)) * data(i-1,j+1,k,n)
990 + Real(
mask(i,j-1,k+1)) * data(i,j-1,k+1,n)
991 + Real(
mask(i,j+1,k+1)) * data(i,j+1,k+1,n) )
992 / Real(
mask(i-1,j-1,k) +
mask(i-1,j+1,k) + 1 +
mask(i,j-1,k+1) +
mask(i,j+1,k+1) );
995 }
else if ( ( i == hi.x+1) && ( j >= lo.y ) &&
996 ( j <= hi.y ) && ( k == hi.z+1 ) ) {
997 if ( (
mask(i-1,j,k) == finecell ) ||
998 (
mask(i,j-1,k) == finecell ) ||
999 (
mask(i,j+1,k) == finecell ) ||
1000 (
mask(i,j,k-1) == finecell ) ) {
1001 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
1002 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
1003 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
1004 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n) )
1007 data(i,j,k,n) = ( Real(
mask(i-1,j-1,k)) * data(i-1,j-1,k,n)
1008 + Real(
mask(i-1,j+1,k)) * data(i-1,j+1,k,n)
1010 + Real(
mask(i,j-1,k-1)) * data(i,j-1,k-1,n)
1011 + Real(
mask(i,j+1,k-1)) * data(i,j+1,k-1,n) )
1012 / Real(
mask(i-1,j-1,k) +
mask(i-1,j+1,k) + 1 +
mask(i,j-1,k-1) +
mask(i,j+1,k-1) );
1015 }
else if ( ( i >= lo.x) && ( i <= hi.x ) &&
1016 ( j == lo.y-1 ) && ( k == lo.z-1 ) ) {
1017 if ( (
mask(i-1,j,k) == finecell ) ||
1018 (
mask(i+1,j,k) == finecell ) ||
1019 (
mask(i,j+1,k) == finecell ) ||
1020 (
mask(i,j,k+1) == finecell ) ) {
1021 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
1022 + Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
1023 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
1024 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
1027 data(i,j,k,n) = ( Real(
mask(i-1,j+1,k)) * data(i-1,j+1,k,n)
1028 + Real(
mask(i+1,j+1,k)) * data(i+1,j+1,k,n)
1029 + Real(
mask(i-1,j,k+1)) * data(i-1,j,k+1,n)
1030 + Real(
mask(i+1,j,k+1)) * data(i+1,j,k+1,n)
1031 + data(i,j+1,k+1,n) )
1032 / Real(
mask(i-1,j+1,k) +
mask(i+1,j+1,k) +
mask(i-1,j,k+1) +
mask(i+1,j,k+1) + 1 );
1035 }
else if ( ( i >= lo.x) && ( i <= hi.x ) &&
1036 ( j == lo.y-1 ) && ( k == hi.z+1 ) ) {
1037 if ( (
mask(i-1,j,k) == finecell ) ||
1038 (
mask(i+1,j,k) == finecell ) ||
1039 (
mask(i,j+1,k) == finecell ) ||
1040 (
mask(i,j,k-1) == finecell ) ) {
1041 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
1042 + Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
1043 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
1044 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n) )
1047 data(i,j,k,n) = ( Real(
mask(i-1,j+1,k)) * data(i-1,j+1,k,n)
1048 + Real(
mask(i+1,j+1,k)) * data(i+1,j+1,k,n)
1049 + Real(
mask(i-1,j,k-1)) * data(i-1,j,k-1,n)
1050 + Real(
mask(i+1,j,k-1)) * data(i+1,j,k-1,n)
1051 + data(i,j+1,k-1,n) )
1052 / Real(
mask(i-1,j+1,k) +
mask(i+1,j+1,k) +
mask(i-1,j,k-1) +
mask(i+1,j,k-1) + 1 );
1055 }
else if ( ( i >= lo.x) && ( i <= hi.x ) &&
1056 ( j == hi.y+1 ) && ( k == lo.z-1 ) ) {
1057 if ( (
mask(i-1,j,k) == finecell ) ||
1058 (
mask(i+1,j,k) == finecell ) ||
1059 (
mask(i,j-1,k) == finecell ) ||
1060 (
mask(i,j,k+1) == finecell ) ) {
1061 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
1062 + Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
1063 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
1064 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
1067 data(i,j,k,n) = ( Real(
mask(i-1,j-1,k)) * data(i-1,j-1,k,n)
1068 + Real(
mask(i+1,j-1,k)) * data(i+1,j-1,k,n)
1069 + Real(
mask(i-1,j,k+1)) * data(i-1,j,k+1,n)
1070 + Real(
mask(i+1,j,k+1)) * data(i+1,j,k+1,n)
1071 + data(i,j-1,k+1,n) )
1072 / Real(
mask(i-1,j-1,k) +
mask(i+1,j-1,k) +
mask(i-1,j,k+1) +
mask(i+1,j,k+1) + 1 );
1075 }
else if ( ( i >= lo.x) && ( i <= hi.x ) &&
1076 ( j == hi.y+1 ) && ( k == hi.z+1 ) ) {
1077 if ( (
mask(i-1,j,k) == finecell ) ||
1078 (
mask(i+1,j,k) == finecell ) ||
1079 (
mask(i,j-1,k) == finecell ) ||
1080 (
mask(i,j,k-1) == finecell ) ) {
1081 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
1082 + Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
1083 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
1084 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n) )
1087 data(i,j,k,n) = ( Real(
mask(i-1,j-1,k)) * data(i-1,j-1,k,n)
1088 + Real(
mask(i+1,j-1,k)) * data(i+1,j-1,k,n)
1089 + Real(
mask(i-1,j,k-1)) * data(i-1,j,k-1,n)
1090 + Real(
mask(i+1,j,k-1)) * data(i+1,j,k-1,n)
1091 + data(i,j-1,k-1,n) )
1092 / Real(
mask(i-1,j-1,k) +
mask(i+1,j-1,k) +
mask(i-1,j,k-1) +
mask(i+1,j,k-1) + 1 );
1096 }
else if ( ( i == lo.x-1) &&
1097 ( j >= lo.y ) && ( j <= hi.y ) &&
1098 ( k >= lo.z ) && ( k <= hi.z ) ) {
1099 data(i,j,k,n) = ( data(i+1,j,k,n)
1100 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
1101 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
1102 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n)
1103 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
1104 / Real( 1 +
mask(i,j-1,k) +
mask(i,j+1,k) +
mask(i,j,k-1) +
mask(i,j,k+1) );
1106 }
else if ( ( i == hi.x+1) &&
1107 ( j >= lo.y ) && ( j <= hi.y ) &&
1108 ( k >= lo.z ) && ( k <= hi.z ) ) {
1109 data(i,j,k,n) = ( data(i-1,j,k,n)
1110 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
1111 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
1112 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n)
1113 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
1114 / Real( 1 +
mask(i,j-1,k) +
mask(i,j+1,k) +
mask(i,j,k-1) +
mask(i,j,k+1) );
1116 }
else if ( ( i >= lo.x ) && ( i <= hi.x ) &&
1118 ( k >= lo.z ) && ( k <= hi.z ) ) {
1119 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
1120 + Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
1122 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n)
1123 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
1124 / Real(
mask(i-1,j,k) +
mask(i+1,j,k) + 1 +
mask(i,j,k-1) +
mask(i,j,k+1) );
1126 }
else if ( ( i >= lo.x ) && ( i <= hi.x ) &&
1128 ( k >= lo.z ) && ( k <= hi.z ) ) {
1129 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
1130 + Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
1132 + Real(
mask(i,j,k-1)) * data(i,j,k-1,n)
1133 + Real(
mask(i,j,k+1)) * data(i,j,k+1,n) )
1134 / Real(
mask(i-1,j,k) +
mask(i+1,j,k) + 1 +
mask(i,j,k-1) +
mask(i,j,k+1) );
1136 }
else if ( ( i >= lo.x ) && ( i <= hi.x ) &&
1137 ( j >= lo.y ) && ( j <= hi.y ) &&
1139 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
1140 + Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
1141 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
1142 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
1144 / Real(
mask(i-1,j,k) +
mask(i+1,j,k) +
mask(i,j-1,k) +
mask(i,j+1,k) + 1 );
1146 }
else if ( ( i >= lo.x ) && ( i <= hi.x ) &&
1147 ( j >= lo.y ) && ( j <= hi.y ) &&
1149 data(i,j,k,n) = ( Real(
mask(i-1,j,k)) * data(i-1,j,k,n)
1150 + Real(
mask(i+1,j,k)) * data(i+1,j,k,n)
1151 + Real(
mask(i,j-1,k)) * data(i,j-1,k,n)
1152 + Real(
mask(i,j+1,k)) * data(i,j+1,k,n)
1154 / Real(
mask(i-1,j,k) +
mask(i+1,j,k) +
mask(i,j-1,k) +
mask(i,j+1,k) + 1 );
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
#define AMREX_GPU_HOST
Definition: AMReX_GpuQualifiers.H:17
Array4< int const > mask
Definition: AMReX_InterpFaceRegister.cpp:93
Definition: AMReX_Amr.cpp:49
int nComp(FabArrayBase const &fa)
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 ubound(Array4< T > const &a) noexcept
Definition: AMReX_Array4.H:315
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 lbound(Array4< T > const &a) noexcept
Definition: AMReX_Array4.H:308
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void amrex_first_order_extrap_gpu(int i, int j, int k, int n, amrex::Box const &bx, amrex::Array4< const int > const &mask, amrex::Array4< amrex::Real > const &data) noexcept
Definition: AMReX_extrapolater_1D_K.H:36
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void amrex_first_order_extrap_cpu(amrex::Box const &bx, int nComp, amrex::Array4< const int > const &mask, amrex::Array4< amrex::Real > const &data) noexcept
Definition: AMReX_extrapolater_1D_K.H:10
Definition: AMReX_Array4.H:61