18 BL_PROFILE_VAR(
"impose_lateral_base_bcs()",impose_lateral_base_bcs);
24 const int* bxlo = bx.loVect();
25 const int* bxhi = bx.hiVect();
27 const int* dlo = domain.loVect();
28 const int* dhi = domain.hiVect();
30 const auto& dom_lo = lbound(domain);
31 const auto& dom_hi = ubound(domain);
42 Vector<BCRec> bcrs(ncomp);
46 for (
int nc = 0; nc < ncomp; nc++)
48 for (
int dir = 0; dir < AMREX_SPACEDIM; dir++)
50 bcrs[nc].setLo(dir, ( bxlo[dir]<=dlo[dir]
52 bcrs[nc].setHi(dir, ( bxhi[dir]>=dhi[dir]
57 Gpu::DeviceVector<BCRec> bcrs_d(ncomp);
58 Gpu::copyAsync(Gpu::hostToDevice, bcrs.begin(), bcrs.end(), bcrs_d.begin());
59 const BCRec* bc_ptr = bcrs_d.data();
61 GeometryData
const& geomdata =
m_geom.data();
62 bool is_periodic_in_x = geomdata.isPeriodic(0);
63 bool is_periodic_in_y = geomdata.isPeriodic(1);
67 if (!is_periodic_in_x)
70 Box bx_xlo(bx); bx_xlo.setBig (0,dom_lo.x-nghost[0]);
71 Box bx_xhi(bx); bx_xhi.setSmall(0,dom_hi.x+nghost[0]);
74 bx_xlo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
77 int l_bc_type = bc_ptr[n].lo(0);
78 int iflip = dom_lo.x - 1 - i;
80 dest_arr(i,j,k,dest_comp) = dest_arr(dom_lo.x,j,k,dest_comp);
82 dest_arr(i,j,k,dest_comp) = dest_arr(dom_lo.x,j,k,dest_comp);
84 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
87 bx_xhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
90 int h_bc_type = bc_ptr[n].hi(0);
91 int iflip = 2*dom_hi.x + 1 - i;
93 dest_arr(i,j,k,dest_comp) = dest_arr(dom_hi.x,j,k,dest_comp);
95 dest_arr(i,j,k,dest_comp) = dest_arr(dom_hi.x,j,k,dest_comp);
97 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
103 if (!is_periodic_in_y)
106 Box bx_ylo(bx); bx_ylo.setBig (1,dom_lo.y-nghost[1]);
107 Box bx_yhi(bx); bx_yhi.setSmall(1,dom_hi.y+nghost[1]);
108 if (bx_ylo.smallEnd(2) != domain.smallEnd(2)) bx_ylo.growLo(2,nghost[2]);
109 if (bx_ylo.bigEnd(2) != domain.bigEnd(2)) bx_ylo.growHi(2,nghost[2]);
110 if (bx_yhi.smallEnd(2) != domain.smallEnd(2)) bx_yhi.growLo(2,nghost[2]);
111 if (bx_yhi.bigEnd(2) != domain.bigEnd(2)) bx_yhi.growHi(2,nghost[2]);
113 bx_ylo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
116 int l_bc_type = bc_ptr[n].lo(1);
117 int jflip = dom_lo.y - 1 - j;
119 dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_lo.y,k,dest_comp);
121 dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_lo.y,k,dest_comp);
123 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
127 bx_yhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
130 int h_bc_type = bc_ptr[n].hi(1);
131 int jflip = 2*dom_hi.y + 1 - j;
133 dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_hi.y,k,dest_comp);
135 dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_hi.y,k,dest_comp);
137 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
145 if (!is_periodic_in_x)
148 Box bx_xlo(bx); bx_xlo.setBig (0,dom_lo.x-1);
149 Box bx_xhi(bx); bx_xhi.setSmall(0,dom_hi.x+1);
150 if (bx_xlo.smallEnd(2) != domain.smallEnd(2)) bx_xlo.growLo(2,nghost[2]);
151 if (bx_xlo.bigEnd(2) != domain.bigEnd(2)) bx_xlo.growHi(2,nghost[2]);
152 if (bx_xhi.smallEnd(2) != domain.smallEnd(2)) bx_xhi.growLo(2,nghost[2]);
153 if (bx_xhi.bigEnd(2) != domain.bigEnd(2)) bx_xhi.growHi(2,nghost[2]);
155 bx_xlo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
158 int l_bc_type = bc_ptr[n].lo(0);
159 int iflip = dom_lo.x - 1 - i;
161 dest_arr(i,j,k,dest_comp) = dest_arr(dom_lo.x,j,k,dest_comp);
163 dest_arr(i,j,k,dest_comp) = dest_arr(dom_lo.x,j,k,dest_comp);
165 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
167 dest_arr(i,j,k,dest_comp) = -dest_arr(iflip,j,k,dest_comp);
169 Real delta_i = (dom_lo.x - i);
170 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) ;
173 bx_xhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
176 int h_bc_type = bc_ptr[n].hi(0);
177 int iflip = 2*dom_hi.x + 1 - i;
179 dest_arr(i,j,k,dest_comp) = dest_arr(dom_hi.x,j,k,dest_comp);
181 dest_arr(i,j,k,dest_comp) = dest_arr(dom_hi.x,j,k,dest_comp);
183 dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp);
185 dest_arr(i,j,k,dest_comp) = -dest_arr(iflip,j,k,dest_comp);
187 Real delta_i = (i - dom_hi.x);
188 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) ;
194 if (!is_periodic_in_y)
197 Box bx_ylo(bx); bx_ylo.setBig (1,dom_lo.y-1);
198 Box bx_yhi(bx); bx_yhi.setSmall(1,dom_hi.y+1);
199 if (bx_ylo.smallEnd(2) != domain.smallEnd(2)) bx_ylo.growLo(2,nghost[2]);
200 if (bx_ylo.bigEnd(2) != domain.bigEnd(2)) bx_ylo.growHi(2,nghost[2]);
201 if (bx_yhi.smallEnd(2) != domain.smallEnd(2)) bx_yhi.growLo(2,nghost[2]);
202 if (bx_yhi.bigEnd(2) != domain.bigEnd(2)) bx_yhi.growHi(2,nghost[2]);
204 bx_ylo, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
207 int l_bc_type = bc_ptr[n].lo(1);
208 int jflip = dom_lo.y - 1 - j;
210 dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_lo.y,k,dest_comp);
212 dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_lo.y,k,dest_comp);
214 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
216 dest_arr(i,j,k,dest_comp) = -dest_arr(i,jflip,k,dest_comp);
218 Real delta_j = (dom_lo.y - j);
219 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) ;
223 bx_yhi, ncomp, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k,
int n)
226 int h_bc_type = bc_ptr[n].hi(1);
227 int jflip = 2*dom_hi.y + 1 - j;
229 dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_hi.y,k,dest_comp);
231 dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_hi.y,k,dest_comp);
233 dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp);
235 dest_arr(i,j,k,dest_comp) = -dest_arr(i,jflip,k,dest_comp);
237 Real delta_j = (j - dom_hi.y);
238 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);
243 Gpu::streamSynchronize();
@ base_bc
Definition: ERF_IndexDefines.H:87
@ open
Definition: ERF_IndexDefines.H:186
@ reflect_odd
Definition: ERF_IndexDefines.H:176
@ foextrap
Definition: ERF_IndexDefines.H:179
@ hoextrapcc
Definition: ERF_IndexDefines.H:187
@ int_dir
Definition: ERF_IndexDefines.H:177
@ reflect_even
Definition: ERF_IndexDefines.H:178