MCPcopy Create free account
hub / github.com/BLAST-WarpX/warpx / MakeBoxArray_multiple

Function MakeBoxArray_multiple

Source/BoundaryConditions/PML.cpp:193–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191
192
193 BoxArray
194 MakeBoxArray_multiple (
195 const amrex::Geometry& geom, const amrex::BoxArray& grid_ba,
196 const amrex::IntVect& ncell, int do_pml_in_domain,
197 const amrex::IntVect& do_pml_Lo, const amrex::IntVect& do_pml_Hi)
198 {
199 Box domain = geom.Domain();
200 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
201 if (do_pml_Lo[idim]){
202 domain.growLo(idim, ncell[idim]);
203 }
204 if (do_pml_Hi[idim]){
205 domain.growHi(idim, ncell[idim]);
206 }
207 }
208 BoxList bl;
209 const auto grid_ba_size = static_cast<int>(grid_ba.size());
210 for (int i = 0; i < grid_ba_size; ++i)
211 {
212 const Box& grid_bx = grid_ba[i];
213 const IntVect& grid_bx_sz = grid_bx.size();
214
215 if (do_pml_in_domain == 0) {
216 // Make sure that, in the case of several distinct refinement patches,
217 // the PML cells surrounding these patches cannot overlap
218 // The check is only needed along the axis where PMLs are being used.
219 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
220 if (do_pml_Lo[idim] || do_pml_Hi[idim]) {
221 WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
222 grid_bx.length(idim) > ncell[idim],
223 "Consider using larger amr.blocking_factor with PMLs");
224 }
225 }
226 }
227
228 Box bx = grid_bx;
229 bx.grow(ncell);
230 bx &= domain;
231
232 Vector<Box> bndryboxes;
233 #if defined(WARPX_DIM_3D)
234 const int kbegin = -1, kend = 1;
235 #else
236 const int kbegin = 0, kend = 0;
237 #endif
238 for (int kk = kbegin; kk <= kend; ++kk) {
239 for (int jj = -1; jj <= 1; ++jj) {
240 for (int ii = -1; ii <= 1; ++ii) {
241 if (ii != 0 || jj != 0 || kk != 0) {
242 Box b = grid_bx;
243 b.shift(grid_bx_sz * IntVect{AMREX_D_DECL(ii,jj,kk)});
244 b &= bx;
245 if (b.ok()) {
246 bndryboxes.push_back(b);
247 }
248 }
249 }
250 }

Callers 1

MakeBoxArrayFunction · 0.85

Calls 2

sizeMethod · 0.80
okMethod · 0.80

Tested by

no test coverage detected