19 BL_PROFILE_VAR(
"impose_lateral_base_bcs()",impose_lateral_base_bcs);
25 const int* bxlo = bx.loVect();
26 const int* bxhi = bx.hiVect();
28 const int* dlo = domain.loVect();
29 const int* dhi = domain.hiVect();
31 const auto& dom_lo = lbound(domain);
32 const auto& dom_hi = ubound(domain);
43 Vector<BCRec> bcrs(ncomp);
47 for (
int nc = 0; nc < ncomp; nc++)
49 for (
int dir = 0; dir < AMREX_SPACEDIM; dir++)
51 bcrs[nc].setLo(dir, ( bxlo[dir]<=dlo[dir]
53 bcrs[nc].setHi(dir, ( bxhi[dir]>=dhi[dir]
58 Gpu::DeviceVector<BCRec> bcrs_d(ncomp);
59 Gpu::copyAsync(Gpu::hostToDevice, bcrs.begin(), bcrs.end(), bcrs_d.begin());
60 const BCRec* bc_ptr = bcrs_d.data();
62 GeometryData
const& geomdata =
m_geom.data();
63 bool is_periodic_in_x = geomdata.isPeriodic(0);
64 bool is_periodic_in_y = geomdata.isPeriodic(1);
68 if (!is_periodic_in_x)
71 Box bx_xlo(bx); bx_xlo.setBig (0,dom_lo.x-nghost[0]);
72 Box bx_xhi(bx); bx_xhi.setSmall(0,dom_hi.x+nghost[0]);
75 bx_xlo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
78 int l_bc_type = bc_ptr[n].lo(0);
79 int iflip = dom_lo.x - 1 - i;
81 dest_arr(i,j,k,dest_comp) = dest_arr(dom_lo.x,j,k,dest_comp);
83 dest_arr(i,j,k,dest_comp) = dest_arr(dom_lo.x,j,k,dest_comp);
85 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
88 bx_xhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
91 int h_bc_type = bc_ptr[n].hi(0);
92 int iflip = 2*dom_hi.x + 1 - i;
94 dest_arr(i,j,k,dest_comp) = dest_arr(dom_hi.x,j,k,dest_comp);
96 dest_arr(i,j,k,dest_comp) = dest_arr(dom_hi.x,j,k,dest_comp);
98 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
104 if (!is_periodic_in_y)
107 Box bx_ylo(bx); bx_ylo.setBig (1,dom_lo.y-nghost[1]);
108 Box bx_yhi(bx); bx_yhi.setSmall(1,dom_hi.y+nghost[1]);
109 if (bx_ylo.smallEnd(2) != domain.smallEnd(2)) bx_ylo.growLo(2,nghost[2]);
110 if (bx_ylo.bigEnd(2) != domain.bigEnd(2)) bx_ylo.growHi(2,nghost[2]);
111 if (bx_yhi.smallEnd(2) != domain.smallEnd(2)) bx_yhi.growLo(2,nghost[2]);
112 if (bx_yhi.bigEnd(2) != domain.bigEnd(2)) bx_yhi.growHi(2,nghost[2]);
114 bx_ylo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
117 int l_bc_type = bc_ptr[n].lo(1);
118 int jflip = dom_lo.y - 1 - j;
120 dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_lo.y,k,dest_comp);
122 dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_lo.y,k,dest_comp);
124 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
128 bx_yhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
131 int h_bc_type = bc_ptr[n].hi(1);
132 int jflip = 2*dom_hi.y + 1 - j;
134 dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_hi.y,k,dest_comp);
136 dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_hi.y,k,dest_comp);
138 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
146 if (!is_periodic_in_x)
149 Box bx_xlo(bx); bx_xlo.setBig (0,dom_lo.x-1);
150 Box bx_xhi(bx); bx_xhi.setSmall(0,dom_hi.x+1);
151 if (bx_xlo.smallEnd(2) != domain.smallEnd(2)) bx_xlo.growLo(2,nghost[2]);
152 if (bx_xlo.bigEnd(2) != domain.bigEnd(2)) bx_xlo.growHi(2,nghost[2]);
153 if (bx_xhi.smallEnd(2) != domain.smallEnd(2)) bx_xhi.growLo(2,nghost[2]);
154 if (bx_xhi.bigEnd(2) != domain.bigEnd(2)) bx_xhi.growHi(2,nghost[2]);
156 bx_xlo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
159 int l_bc_type = bc_ptr[n].lo(0);
160 int iflip = dom_lo.x - 1 - i;
162 dest_arr(i,j,k,dest_comp) = dest_arr(dom_lo.x,j,k,dest_comp);
164 dest_arr(i,j,k,dest_comp) = dest_arr(dom_lo.x,j,k,dest_comp);
166 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
168 dest_arr(i,j,k,dest_comp) = -dest_arr(iflip,j,k,dest_comp);
170 Real delta_i = (dom_lo.x - i);
171 dest_arr(i,j,k,dest_comp) = (1.0 + delta_i)*dest_arr(dom_lo.x,j,k,dest_comp) - delta_i*dest_arr(dom_lo.x+1,j,k,dest_comp) ;
174 bx_xhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
177 int h_bc_type = bc_ptr[n].hi(0);
178 int iflip = 2*dom_hi.x + 1 - i;
180 dest_arr(i,j,k,dest_comp) = dest_arr(dom_hi.x,j,k,dest_comp);
182 dest_arr(i,j,k,dest_comp) = dest_arr(dom_hi.x,j,k,dest_comp);
184 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
186 dest_arr(i,j,k,dest_comp) = -dest_arr(iflip,j,k,dest_comp);
188 Real delta_i = (i - dom_hi.x);
189 dest_arr(i,j,k,dest_comp) = (1.0 + delta_i)*dest_arr(dom_hi.x,j,k,dest_comp) - delta_i*dest_arr(dom_hi.x-1,j,k,dest_comp) ;
195 if (!is_periodic_in_y)
198 Box bx_ylo(bx); bx_ylo.setBig (1,dom_lo.y-1);
199 Box bx_yhi(bx); bx_yhi.setSmall(1,dom_hi.y+1);
200 if (bx_ylo.smallEnd(2) != domain.smallEnd(2)) bx_ylo.growLo(2,nghost[2]);
201 if (bx_ylo.bigEnd(2) != domain.bigEnd(2)) bx_ylo.growHi(2,nghost[2]);
202 if (bx_yhi.smallEnd(2) != domain.smallEnd(2)) bx_yhi.growLo(2,nghost[2]);
203 if (bx_yhi.bigEnd(2) != domain.bigEnd(2)) bx_yhi.growHi(2,nghost[2]);
205 bx_ylo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
208 int l_bc_type = bc_ptr[n].lo(1);
209 int jflip = dom_lo.y - 1 - j;
211 dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_lo.y,k,dest_comp);
213 dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_lo.y,k,dest_comp);
215 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
217 dest_arr(i,j,k,dest_comp) = -dest_arr(i,jflip,k,dest_comp);
219 Real delta_j = (dom_lo.y - j);
220 dest_arr(i,j,k,dest_comp) = (1.0 + delta_j)*dest_arr(i,dom_lo.y,k,dest_comp) - delta_j*dest_arr(i,dom_lo.y+1,k,dest_comp) ;
224 bx_yhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
227 int h_bc_type = bc_ptr[n].hi(1);
228 int jflip = 2*dom_hi.y + 1 - j;
230 dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_hi.y,k,dest_comp);
232 dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_hi.y,k,dest_comp);
234 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
236 dest_arr(i,j,k,dest_comp) = -dest_arr(i,jflip,k,dest_comp);
238 Real delta_j = (j - dom_hi.y);
239 dest_arr(i,j,k,dest_comp) = (1.0 + delta_j)*dest_arr(i,dom_hi.y,k,dest_comp) - delta_j*dest_arr(i,dom_hi.y-1,k,dest_comp);
244 Gpu::streamSynchronize();
@ rho0_bc_comp
Definition: ERF_IndexDefines.H:98
@ open
Definition: ERF_IndexDefines.H:197
@ reflect_odd
Definition: ERF_IndexDefines.H:187
@ foextrap
Definition: ERF_IndexDefines.H:190
@ hoextrapcc
Definition: ERF_IndexDefines.H:198
@ int_dir
Definition: ERF_IndexDefines.H:188
@ reflect_even
Definition: ERF_IndexDefines.H:189