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

Function MakeBoxArray_single

Source/BoundaryConditions/PML.cpp:150–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148
149
150 BoxArray
151 MakeBoxArray_single (
152 const amrex::Box& regular_domain, const amrex::BoxArray& grid_ba,
153 const amrex::IntVect& ncell, const amrex::IntVect& do_pml_Lo,
154 const amrex::IntVect& do_pml_Hi)
155 {
156 BoxList bl;
157 const auto grid_ba_size = static_cast<int>(grid_ba.size());
158 for (int i = 0; i < grid_ba_size; ++i) {
159 Box const& b = grid_ba[i];
160 for (OrientationIter oit; oit.isValid(); ++oit) {
161 // In 3d, a Box has 6 faces. This iterates over the 6 faces.
162 // 3 of them are on the lower side and the others are on the
163 // higher side.
164 const Orientation ori = oit();
165 const int idim = ori.coordDir(); // either 0 or 1 or 2 (i.e., x, y, z-direction)
166 bool pml_bndry = false;
167 if (ori.isLow() && do_pml_Lo[idim]) { // This is one of the lower side faces.
168 pml_bndry = b.smallEnd(idim) == regular_domain.smallEnd(idim);
169 } else if (ori.isHigh() && do_pml_Hi[idim]) { // This is one of the higher side faces.
170 pml_bndry = b.bigEnd(idim) == regular_domain.bigEnd(idim);
171 }
172 if (pml_bndry) {
173 Box bbox = amrex::adjCell(b, ori, ncell[idim]);
174 for (int jdim = 0; jdim < idim; ++jdim) {
175 if (do_pml_Lo[jdim] &&
176 bbox.smallEnd(jdim) == regular_domain.smallEnd(jdim)) {
177 bbox.growLo(jdim, ncell[jdim]);
178 }
179 if (do_pml_Hi[jdim] &&
180 bbox.bigEnd(jdim) == regular_domain.bigEnd(jdim)) {
181 bbox.growHi(jdim, ncell[jdim]);
182 }
183 }
184 bl.push_back(bbox);
185 }
186 }
187 }
188
189 return BoxArray(std::move(bl));
190 }
191
192
193 BoxArray

Callers 1

MakeBoxArrayFunction · 0.85

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected