Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_EB2_Level.H
Go to the documentation of this file.
1#ifndef AMREX_EB2_LEVEL_H_
2#define AMREX_EB2_LEVEL_H_
3#include <AMReX_Config.H>
4
5#include <AMReX_ParmParse.H>
6#include <AMReX_Geometry.H>
7#include <AMReX_MultiFab.H>
8#include <AMReX_iMultiFab.H>
9#include <AMReX_LayoutData.H>
10#include <AMReX_VisMF.H>
11#include <AMReX_Array.H>
12#include <AMReX_EBCellFlag.H>
13#include <AMReX_MultiCutFab.H>
14#if (AMREX_SPACEDIM == 3)
15# include <AMReX_MarchingCubes.H>
16#endif
17#include <AMReX_EB2_MultiGFab.H>
18#include <AMReX_EB2_C.H>
20
21#ifdef AMREX_USE_OMP
22#include <omp.h>
23#endif
24
25#include <cmath>
26#include <limits>
27#include <map>
28#include <type_traits>
29#include <unordered_map>
30
31namespace amrex
32{
33 class STLtools;
34}
35
36namespace amrex::EB2 {
37
38class IndexSpace;
39template <typename G> class GShopLevel;
40template <typename G> class IndexSpaceImp;
41
42class Level
43{
44public:
45
47 bool isAllRegular () const noexcept { return m_allregular; }
49 bool isOK () const noexcept { return m_ok; }
60 void fillVolFrac (MultiFab& vfrac, const Geometry& geom) const;
64 void fillCentroid (MultiCutFab& centroid, const Geometry& geom) const;
66 void fillCentroid ( MultiFab& centroid, const Geometry& geom) const;
70 void fillBndryArea (MultiCutFab& bndryarea, const Geometry& geom) const;
72 void fillBndryArea ( MultiFab& bndryarea, const Geometry& geom) const;
76 void fillBndryCent (MultiCutFab& bndrycent, const Geometry& geom) const;
78 void fillBndryCent ( MultiFab& bndrycent, const Geometry& geom) const;
82 void fillBndryNorm (MultiCutFab& bndrynorm, const Geometry& geom) const;
84 void fillBndryNorm ( MultiFab& bndrynorm, const Geometry& geom) const;
88 void fillAreaFrac (Array<MultiCutFab*,AMREX_SPACEDIM> const& areafrac, const Geometry& geom) const;
90 void fillAreaFrac (Array< MultiFab*,AMREX_SPACEDIM> const& areafrac, const Geometry& geom) const;
94 void fillFaceCent (Array<MultiCutFab*,AMREX_SPACEDIM> const& facecent, const Geometry& geom) const;
96 void fillFaceCent (Array< MultiFab*,AMREX_SPACEDIM> const& facecent, const Geometry& geom) const;
100 void fillEdgeCent (Array<MultiCutFab*,AMREX_SPACEDIM> const& edgecent, const Geometry& geom) const;
102 void fillEdgeCent (Array< MultiFab*,AMREX_SPACEDIM> const& edgecent, const Geometry& geom) const;
106 void fillLevelSet (MultiFab& levelset, const Geometry& geom) const;
107
109 const BoxArray& boxArray () const noexcept { return m_grids; }
111 const DistributionMapping& DistributionMap () const noexcept { return m_dmap; }
112
114 Level (IndexSpace const* is, const Geometry& geom) : m_geom(geom), m_parent(is) {}
118 void prepareForCoarsening (const Level& rhs, int max_grid_size, IntVect const& ngrow);
119
121 const Geometry& Geom () const noexcept { return m_geom; }
123 IndexSpace const* getEBIndexSpace () const noexcept { return m_parent; }
124
126 IntVect const& nGrowVect () const noexcept { return m_ngrow; }
127
135 void write_to_chkpt_file (const std::string& fname, bool extend_domain_face, int max_grid_size) const;
136
138 bool hasEBInfo () const noexcept { return m_has_eb_info; }
140 void fillCutCellMask (iMultiFab& cutcellmask, const Geometry& geom) const;
142 void fillCutCellMaskFC (iMultiFab& cutcellmask, int face_dir, const Geometry& geom) const;
143
147 void setShift (int direction, int ncells);
148
152 struct FCData {
162 // Covered region of the refined level, coarsened onto this level. The refined level
163 // is transient, so this has to be captured while it exists. It is not the same as
164 // Level::m_covered_grids: the refined level resolves the body more finely, so once
165 // coarsened its covered region is the larger of the two, and it is the one that
166 // matches where the face-centered data was computed.
167 //
168 // The fill*FC functions apply it before their ParallelCopy, and deliberately do not
169 // shrink it first. A face-centered cell straddles two cell-centered cells, so the
170 // ones on the covered/cut interface may themselves be cut; clearing them here and
171 // letting the copy write over them is correct, because the copy writes exactly where
172 // the face-centered data is valid - the nodal span of the cut boxes, which reaches
173 // the interface and no further. Ordering does the shrinking, so no box has to be
174 // trimmed and two adjacent covered boxes need no special treatment.
176 bool m_built = false;
177 bool m_skipped = false; // tried, but this level cannot have face-centered data
178 char const* m_skip_reason = nullptr;
179 };
180
189 [[nodiscard]] static IntVect fcEdgeType (int idim, int face_dir) noexcept {
190 IntVect edge_type{1};
191 if (idim != face_dir) { edge_type[idim] = 0; }
192 return edge_type;
193 }
194
196 [[nodiscard]] bool hasFCData (int face_dir) const noexcept {
197 return face_dir >= 0 && face_dir < AMREX_SPACEDIM &&
198 m_fc_data[face_dir] && m_fc_data[face_dir]->m_built;
199 }
200
202 [[nodiscard]] bool triedFCData (int face_dir) const noexcept {
203 return face_dir >= 0 && face_dir < AMREX_SPACEDIM && m_fc_data[face_dir] &&
204 (m_fc_data[face_dir]->m_built || m_fc_data[face_dir]->m_skipped);
205 }
206
208 [[nodiscard]] char const* whyNoFCData (int face_dir) const noexcept {
209 if (hasFCData(face_dir)) { return nullptr; }
210 if (triedFCData(face_dir)) { return m_fc_data[face_dir]->m_skip_reason; }
211 return "EB2::BuildFC has not been called for this level";
212 }
213
215 void fillVolFracFC (MultiFab& vfrac, int face_dir, const Geometry& geom) const;
217 void fillAreaFracFC (Array< MultiFab*,AMREX_SPACEDIM> const& areafrac, int face_dir, const Geometry& geom) const;
218 void fillAreaFracFC (Array<MultiCutFab*,AMREX_SPACEDIM> const& areafrac, int face_dir, const Geometry& geom) const;
220 void fillCentroidFC (MultiFab& centroid, int face_dir, const Geometry& geom) const;
221 void fillCentroidFC (MultiCutFab& centroid, int face_dir, const Geometry& geom) const;
223 void fillBndryAreaFC (MultiFab& bndryarea, int face_dir, const Geometry& geom) const;
224 void fillBndryAreaFC (MultiCutFab& bndryarea, int face_dir, const Geometry& geom) const;
226 void fillBndryCentFC (MultiFab& bndrycent, int face_dir, const Geometry& geom) const;
227 void fillBndryCentFC (MultiCutFab& bndrycent, int face_dir, const Geometry& geom) const;
229 void fillBndryNormFC (MultiFab& bndrynorm, int face_dir, const Geometry& geom) const;
230 void fillBndryNormFC (MultiCutFab& bndrynorm, int face_dir, const Geometry& geom) const;
232 void fillEBCellFlagFC (FabArray<EBCellFlagFab>& cellflag, int face_dir, const Geometry& geom) const;
234 void fillFaceCentFC (Array< MultiFab*,AMREX_SPACEDIM> const& facecent, int face_dir, const Geometry& geom) const;
235 void fillFaceCentFC (Array<MultiCutFab*,AMREX_SPACEDIM> const& facecent, int face_dir, const Geometry& geom) const;
237 void fillEdgeCentFC (Array< MultiFab*,AMREX_SPACEDIM> const& edgecent, int face_dir, const Geometry& geom) const;
238 void fillEdgeCentFC (Array<MultiCutFab*,AMREX_SPACEDIM> const& edgecent, int face_dir, const Geometry& geom) const;
239
240// public: // for cuda
248 int coarsenFromFine (Level& fineLevel, bool fill_boundary);
250 void buildCellFlag ();
258 void extendAtDomainFaces (IntVect const& ngrow);
260 void buildCellFlagFC (int face_dir);
262 void buildCutCellMask (Level const& fine_level);
263
264protected:
265
272#if (AMREX_SPACEDIM == 3)
273 std::map<int,std::unique_ptr<MC::MCFab>> m_marching_cubes;
274#endif
287 bool m_allregular = false;
288 bool m_ok = false;
289 bool m_has_eb_info = true;
299
302
303private:
304 template <typename G> friend class GShopLevel;
305 // So that it can update m_parent when a level changes owner.
306 template <typename G> friend class IndexSpaceImp;
307
308 // Need this function to work around a gcc bug.
309 void setRegularLevel () {
310 m_allregular = true;
311 m_ok = true;
312 m_has_eb_info = false;
313 }
314};
315
316template <typename G>
318 : public Level
319{
320public:
324 GShopLevel (IndexSpace const* is, G const& gshop, const Geometry& geom, int max_grid_size,
325 int ngrow, bool extend_domain_face, int num_crse_opt);
329 GShopLevel (IndexSpace const* is, int ilev, int max_grid_size, int ngrow,
330 const Geometry& geom, GShopLevel<G>& fineLevel);
332 GShopLevel (IndexSpace const* is, const Geometry& geom);
334 void define_fine (G const& gshop, const Geometry& geom,
335 int max_grid_size, int ngrow, bool extend_domain_face, int num_crse_opt);
336
337#if (AMREX_SPACEDIM == 3)
341 template <typename GS = G>
342 requires (std::same_as<GS,STLtools>)
343 void define_fine_mvmc (GS const& gshop, const Geometry& geom,
344 int max_grid_size, int ngrow, bool extend_domain_face, int num_crse_opt);
345#endif
346
350 static GShopLevel<G>
351 makeAllRegular(IndexSpace const* is, const Geometry& geom)
352 {
353 GShopLevel<G> r(is, geom);
354 r.setRegularLevel();
355 return r;
356 }
357
359 void buildFCData (G const& gshop, int max_grid_size, bool extend_domain_face, int num_crse_opt);
360
361 // public for cuda
362 void buildFCDir (GShopLevel<G> const& fine, BoxArray const& fc_base_grids,
363 BoxArray const& fc_covered_grids, int face_dir);
364
365private:
366
367 void skipFC (int face_dir, char const* why);
368
369 Box m_bounding_box;
370
371 void prepare_grids (G const& gshop, Geometry const& geom, int max_grid_size, int ngrow,
372 bool extend_domain_face, int num_crse_opt);
373
374};
375
376template <typename G>
378 : Level(is, geom)
379{}
380
381template <typename G>
382GShopLevel<G>::GShopLevel (IndexSpace const* is, G const& gshop, const Geometry& geom,
383 int max_grid_size, int ngrow, bool extend_domain_face, int num_crse_opt)
384 : Level(is, geom)
385{
386 if (std::is_same_v<typename G::FunctionType, AllRegularIF>) {
387 m_allregular = true;
388 m_ok = true;
389 return;
390 }
391
392 if (amrex::Verbose() > 0 && extend_domain_face == false) {
393 amrex::Print() << "AMReX WARNING: extend_domain_face=false is not recommended!\n";
394 }
395
396 define_fine(gshop, geom, max_grid_size, ngrow, extend_domain_face, num_crse_opt);
397}
398
399template <typename G>
400void
401GShopLevel<G>::prepare_grids (G const& gshop, const Geometry& geom,
402 int max_grid_size, int ngrow, bool extend_domain_face, int num_crse_opt)
403{
404 BL_PROFILE("EB2::GShopLevel()-prepare_grids");
405
406 m_extrude_coarse_levels = extend_domain_face;
407
408 // make sure ngrow is multiple of 16
409 m_ngrow = IntVect{static_cast<int>(std::ceil(ngrow/16.)) * 16};
410
411 Box const& domain = geom.Domain();
412 Box domain_grown = domain;
413 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
414 if (geom.isPeriodic(idim)) {
415 m_ngrow[idim] = 0;
416 } else {
417 m_ngrow[idim] = std::min(m_ngrow[idim], domain_grown.length(idim));
418 }
419 }
420 domain_grown.grow(m_ngrow);
421 m_bounding_box = (extend_domain_face) ? domain : domain_grown;
422 m_bounding_box.surroundingNodes();
423
424 BoxList cut_boxes;
425 BoxList covered_boxes;
426
427 const int nprocs = ParallelContext::NProcsSub();
428 const int iproc = ParallelContext::MyProcSub();
429
430 num_crse_opt = std::max(0,std::min(8,num_crse_opt));
431 for (int clev = num_crse_opt; clev >= 0; --clev) {
432 IntVect crse_ratio(1 << clev);
433 if (domain.coarsenable(crse_ratio)) {
434 Box const& crse_bounding_box = amrex::coarsen(m_bounding_box, crse_ratio);
435 Geometry const& crse_geom = amrex::coarsen(geom, crse_ratio);
436 BoxList test_boxes;
437 if (cut_boxes.isEmpty()) {
438 covered_boxes.clear();
439 test_boxes = BoxList(crse_geom.Domain());
440 test_boxes.maxSize(max_grid_size);
441 } else {
442 test_boxes.swap(cut_boxes);
443 test_boxes.coarsen(crse_ratio);
444 test_boxes.maxSize(max_grid_size);
445 }
446
447 const Long nboxes = test_boxes.size();
448 const auto& boxes = test_boxes.data();
449 for (Long i = iproc; i < nboxes; i += nprocs) {
450 const Box& vbx = boxes[i];
451 const Box& gbx = amrex::surroundingNodes(amrex::grow(vbx,1));
452 auto box_type = gshop.getBoxType(gbx&crse_bounding_box,crse_geom,RunOn::Gpu,
453 crse_bounding_box);
454 if (box_type == gshop.allcovered) {
455 covered_boxes.push_back(amrex::refine(vbx, crse_ratio));
456 } else if (box_type == gshop.mixedcells) {
457 cut_boxes.push_back(amrex::refine(vbx, crse_ratio));
458 }
459 }
460
461 amrex::AllGatherBoxes(cut_boxes.data());
462 }
463 }
464
465 amrex::AllGatherBoxes(covered_boxes.data());
466
467 if (m_ngrow != 0) {
468 auto grow_at_domain_boundary = [&] (BoxList& bl)
469 {
470 const IntVect& domlo = domain.smallEnd();
471 const IntVect& domhi = domain.bigEnd();
472 for (auto& b : bl) {
473 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
474 if (m_ngrow[idim] != 0) {
475 if (b.smallEnd(idim) == domlo[idim]) {
476 b.growLo(idim,m_ngrow[idim]);
477 }
478 if (b.bigEnd(idim) == domhi[idim]) {
479 b.growHi(idim,m_ngrow[idim]);
480 }
481 }
482 }
483 }
484 };
485 grow_at_domain_boundary(covered_boxes);
486 grow_at_domain_boundary(cut_boxes);
487 }
488
489 if ( cut_boxes.isEmpty() &&
490 !covered_boxes.isEmpty())
491 {
492 amrex::Abort("AMReX_EB2_Level.H: Domain is completely covered");
493 }
494
495 if (!covered_boxes.isEmpty()) {
496 if (num_crse_opt > 2) { // don't want the box too big
497 covered_boxes.maxSize(max_grid_size*4);
498 }
499 m_covered_grids = BoxArray(std::move(covered_boxes));
500 }
501
502 if (cut_boxes.isEmpty()) {
503 m_grids = BoxArray();
504 m_dmap = DistributionMapping();
505 m_allregular = true;
506 m_ok = true;
507 } else {
508 m_grids = BoxArray(std::move(cut_boxes));
509 m_dmap = DistributionMapping(m_grids);
510 }
511}
512
513template <typename G>
514void
515GShopLevel<G>::define_fine (G const& gshop, const Geometry& geom,
516 int max_grid_size, int ngrow, bool extend_domain_face, int num_crse_opt)
517{
518 BL_PROFILE("EB2::GShopLevel()-fine");
519
520#ifdef AMREX_USE_FLOAT
521 Real small_volfrac = 1.e-5_rt;
522#else
523 Real small_volfrac = 1.e-12;
524#endif
525 bool cover_multiple_cuts = false;
526 int maxiter = 32;
527 {
528 ParmParse pp("eb2");
529 pp.queryAdd("small_volfrac", small_volfrac);
530 pp.queryAdd("cover_multiple_cuts", cover_multiple_cuts);
531 pp.queryAdd("maxiter", maxiter);
532 }
533 maxiter = std::min(100000, maxiter);
534
535 prepare_grids(gshop, geom, max_grid_size, ngrow, extend_domain_face, num_crse_opt);
536
537 if (m_allregular) { return; }
538
539 m_mgf.define(m_grids, m_dmap);
540 const int ng = GFab::ng;
541 MFInfo mf_info;
542 mf_info.SetTag("EB2::Level");
543 m_cellflag.define(m_grids, m_dmap, 1, ng, mf_info);
544 m_volfrac.define(m_grids, m_dmap, 1, ng, mf_info);
545 m_centroid.define(m_grids, m_dmap, AMREX_SPACEDIM, ng, mf_info);
546 m_bndryarea.define(m_grids, m_dmap, 1, ng, mf_info);
547 m_bndrycent.define(m_grids, m_dmap, AMREX_SPACEDIM, ng, mf_info);
548 m_bndrynorm.define(m_grids, m_dmap, AMREX_SPACEDIM, ng, mf_info);
549 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
551 m_dmap, 1, ng, mf_info);
553 m_dmap, AMREX_SPACEDIM-1, ng, mf_info);
554 IntVect edge_type{1}; edge_type[idim] = 0;
555 m_edgecent[idim].define(amrex::convert(m_grids, edge_type), m_dmap, 1, ng, mf_info);
556 }
557
558 const auto dx = geom.CellSizeArray();
559 const auto problo = geom.ProbLoArray();
560
561 auto bounding_box = m_bounding_box;
562 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
563 if (!extend_domain_face || geom.isPeriodic(idim)) {
564 bounding_box.grow(idim,GFab::ng);
565 }
566 }
567
568 RunOn gshop_run_on = (Gpu::inLaunchRegion() && gshop.isGPUable())
570
571 bool hybrid = Gpu::inLaunchRegion() && (gshop_run_on == RunOn::Cpu);
573
574 int iter = 0;
575 for (; iter < maxiter; ++iter)
576 {
577 int nsmallcells = 0;
578 int nmulticuts = 0;
579#ifdef AMREX_USE_OMP
580#pragma omp parallel if (Gpu::notInLaunchRegion()) reduction(+:nsmallcells,nmulticuts)
581#endif
582 {
583#if (AMREX_SPACEDIM == 3)
584 Array<BaseFab<Real>, AMREX_SPACEDIM> M2;
585 EBCellFlagFab cellflagtmp;
586#endif
587 for (MFIter mfi(m_mgf); mfi.isValid(); ++mfi)
588 {
589 auto& gfab = m_mgf[mfi];
590 const Box& vbx = gfab.validbox();
591
592 auto& levelset = gfab.getLevelSet();
593 if (iter == 0) {
594 gshop.fillFab(levelset, geom, gshop_run_on, bounding_box);
595#ifdef AMREX_USE_GPU
596 if (hybrid) {
597 levelset.prefetchToDevice();
598 }
599#endif
600 }
601
602 auto& cellflag = m_cellflag[mfi];
603
604 // From the second iteration on, repeat a box until it stops covering
605 // cells, so a cascade advances a box per iteration instead of a cell.
606 for (int biter = 0; biter < maxiter; ++biter) {
607 gfab.buildTypes(cellflag);
608
609 Array4<Real const> const& clst = levelset.const_array();
610 Array4<Real > const& lst = levelset.array();
611 Array4<EBCellFlag> const& cfg = m_cellflag.array(mfi);
612 Array4<Real> const& vfr = m_volfrac.array(mfi);
613 Array4<Real> const& ctr = m_centroid.array(mfi);
614 Array4<Real> const& bar = m_bndryarea.array(mfi);
615 Array4<Real> const& bct = m_bndrycent.array(mfi);
616 Array4<Real> const& bnm = m_bndrynorm.array(mfi);
617 AMREX_D_TERM(Array4<Real> const& apx = m_areafrac[0].array(mfi);,
618 Array4<Real> const& apy = m_areafrac[1].array(mfi);,
619 Array4<Real> const& apz = m_areafrac[2].array(mfi););
620 AMREX_D_TERM(Array4<Real> const& fcx = m_facecent[0].array(mfi);,
621 Array4<Real> const& fcy = m_facecent[1].array(mfi);,
622 Array4<Real> const& fcz = m_facecent[2].array(mfi););
623
624 auto& facetype = gfab.getFaceType();
625 AMREX_D_TERM(Array4<Type_t> const& ftx = facetype[0].array();,
626 Array4<Type_t> const& fty = facetype[1].array();,
627 Array4<Type_t> const& ftz = facetype[2].array(););
628
629 int nmc = 0;
630 int nsm = 0;
631
632#if (AMREX_SPACEDIM == 3)
633 auto& edgetype = gfab.getEdgeType();
634 Array4<Type_t const> const& xdg = edgetype[0].const_array();
635 Array4<Type_t const> const& ydg = edgetype[1].const_array();
636 Array4<Type_t const> const& zdg = edgetype[2].const_array();
637
638 Array4<Real> const& xip = m_edgecent[0].array(mfi);
639 Array4<Real> const& yip = m_edgecent[1].array(mfi);
640 Array4<Real> const& zip = m_edgecent[2].array(mfi);
641
642 if (iter == 0 && biter == 0) {
643#ifdef AMREX_USE_GPU
644 if (hybrid) {
646 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
647 edgetype[idim].prefetchToHost();
648 m_edgecent[idim][mfi].prefetchToHost();
649 }
650 }
651#endif
652
653 gshop.getIntercept({xip,yip,zip}, {xdg,ydg,zdg}, clst,
654 geom, gshop_run_on, bounding_box);
655
656#ifdef AMREX_USE_GPU
657 if (hybrid) {
658 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
659 edgetype[idim].prefetchToDevice();
660 m_edgecent[idim][mfi].prefetchToDevice();
661 }
662 }
663#endif
664 } else {
665 gshop.updateIntercept({xip,yip,zip}, {xdg,ydg,zdg}, clst, geom);
666 }
667
668 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
669 const Box& b = facetype[idim].box();
670 M2[idim].resize(b,3);
671 }
672 Array4<Real> const& xm2 = M2[0].array();
673 Array4<Real> const& ym2 = M2[1].array();
674 Array4<Real> const& zm2 = M2[2].array();
675
676 nmc = build_faces(vbx, cfg, ftx, fty, ftz, xdg, ydg, zdg, lst,
677 xip, yip, zip, apx, apy, apz, fcx, fcy, fcz,
678 xm2, ym2, zm2, dx, problo, cover_multiple_cuts);
679
680 cellflagtmp.resize(m_cellflag[mfi].box());
681 Elixir cellflagtmp_eli = cellflagtmp.elixir();
682 Array4<EBCellFlag> const& cfgtmp = cellflagtmp.array();
683
684 build_cells(vbx, cfg, ftx, fty, ftz, apx, apy, apz,
685 fcx, fcy, fcz, xm2, ym2, zm2, dx, vfr, ctr,
686 bar, bct, bnm, cfgtmp, lst,
687 small_volfrac, geom, extend_domain_face, cover_multiple_cuts,
688 nsm, nmc);
689
690 // Because it is used in a synchronous reduction kernel in
691 // build_cells, we do not need to worry about M2's lifetime.
692 // But we still need to use Elixir to extend the life of
693 // cellflagtmp.
694
695#elif (AMREX_SPACEDIM == 2)
696 Array4<Real> const& xip = m_edgecent[0].array(mfi);
697 Array4<Real> const& yip = m_edgecent[1].array(mfi);
698
699 if (iter == 0 && biter == 0) {
700#ifdef AMREX_USE_GPU
701 if (hybrid) {
703 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
704 facetype[idim].prefetchToHost();
705 m_edgecent[idim][mfi].prefetchToHost();
706 }
707 }
708#endif
709
710 // yes, factype[1] and then [0]
711 gshop.getIntercept({xip,yip},
712 {facetype[1].const_array(), facetype[0].const_array()},
713 clst, geom, gshop_run_on, bounding_box);
714
715#ifdef AMREX_USE_GPU
716 if (hybrid) {
717 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
718 facetype[idim].prefetchToDevice();
719 m_edgecent[idim][mfi].prefetchToDevice();
720 }
721 }
722#endif
723 } else {
724 gshop.updateIntercept({xip,yip},
725 {facetype[1].const_array(), facetype[0].const_array()},
726 clst, geom);
727 }
728
729 nmc = build_faces(vbx, cfg, ftx, fty, lst, xip, yip, apx, apy, fcx, fcy,
730 dx, problo, cover_multiple_cuts, nsm);
731
732 build_cells(vbx, cfg, ftx, fty, apx, apy, dx, vfr, ctr,
733 bar, bct, bnm, lst, small_volfrac, geom, extend_domain_face,
734 nsm, nmc);
735#endif
736 nsmallcells += nsm;
737 nmulticuts += nmc;
738 if (iter == 0 || (nsm == 0 && nmc == 0)) { break; }
739 }
740 }
741 }
742
744 if (nsmallcells == 0 && nmulticuts == 0) {
745 break;
746 } else {
747 auto ls = m_mgf.getLevelSet();
748 // This is an alias MultiFab, therefore FillBoundary on it is fine.
749 ls.FillBoundary(geom.periodicity());
750 if (amrex::Verbose() > 0) {
751 if (nsmallcells) {
752 amrex::Print() << "AMReX EB: Iter. " << iter+1 << " fixed " << nsmallcells
753 << " small cells" << '\n';
754 }
755 if (nmulticuts) {
756 amrex::Print() << "AMReX EB: Iter. " << iter+1 << " fixed " << nmulticuts
757 << " multicuts" << '\n';
758 }
759 }
760 }
761 }
762
763 AMREX_ALWAYS_ASSERT_WITH_MESSAGE(iter < maxiter, "EB: failed to fix small cells");
764
765#ifdef AMREX_USE_OMP
766#pragma omp parallel if (Gpu::notInLaunchRegion())
767#endif
768 for (MFIter mfi(m_mgf); mfi.isValid(); ++mfi)
769 {
770 auto& gfab = m_mgf[mfi];
771 auto const& levelset = gfab.getLevelSet();
772 Array4<Real const> const& clst = levelset.const_array();
773
774 AMREX_D_TERM(Array4<Real> const& xip = m_edgecent[0].array(mfi);,
775 Array4<Real> const& yip = m_edgecent[1].array(mfi);,
776 Array4<Real> const& zip = m_edgecent[2].array(mfi);)
777#if (AMREX_SPACEDIM == 3)
778 auto const& edgetype = gfab.getEdgeType();
779 Array4<Type_t const> const& xdg = edgetype[0].const_array();
780 Array4<Type_t const> const& ydg = edgetype[1].const_array();
781 Array4<Type_t const> const& zdg = edgetype[2].const_array();
782
783 intercept_to_edge_centroid(xip, yip, zip, xdg, ydg, zdg, clst, dx, problo);
784
785#elif (AMREX_SPACEDIM == 2)
786 auto& facetype = gfab.getFaceType();
787 Array4<Type_t const> const& ftx = facetype[0].const_array();
788 Array4<Type_t const> const& fty = facetype[1].const_array();
789 // fty then ftx
790 intercept_to_edge_centroid(xip, yip, fty, ftx, clst, dx, problo);
791#endif
792 }
793
794 m_levelset = m_mgf.getLevelSet();
795
796 m_ok = true;
797}
798
799#if (AMREX_SPACEDIM == 3)
800template <typename G>
801template <typename GS>
802requires (std::same_as<GS,STLtools>)
803void
804GShopLevel<G>::define_fine_mvmc (GS const& gshop, const Geometry& geom,
805 int max_grid_size, int ngrow, bool extend_domain_face, int num_crse_opt)
806{
807 BL_PROFILE("EB2::GShopLevel()-fine-mvmc");
808
809 prepare_grids(gshop, geom, max_grid_size, ngrow, extend_domain_face, num_crse_opt);
810
811 if (m_allregular) { return; }
812
814
815 m_sdf.define(amrex::convert(m_grids,IntVect(1)), m_dmap, 1, IntVect(1));
816 gshop.fillSignedDistance(m_sdf, m_sdf.nGrowVect(), geom);
817
818 for (MFIter mfi(m_sdf,MFItInfo().DisableDeviceSync()); mfi.isValid(); ++mfi) {
819 m_marching_cubes[mfi.index()] = std::make_unique<MC::MCFab>();
820 }
821
822 MFItInfo info{};
823
824#if defined(AMREX_USE_OMP) && !defined(AMREX_USE_GPU)
825 info.SetDynamic(true);
826#pragma omp parallel
827#endif
828 for (MFIter mfi(m_sdf,info); mfi.isValid(); ++mfi) {
829 amrex::MC::marching_cubes(geom, m_sdf[mfi], *m_marching_cubes[mfi.index()]);
830 }
831
832 MC::write_stl("test.stl", m_marching_cubes);
833
834 m_ok = false; // xxxxx TODO
835}
836#endif
837
838template <typename G>
839GShopLevel<G>::GShopLevel (IndexSpace const* is, int /*ilev*/, int max_grid_size, int ngrow,
840 const Geometry& geom, GShopLevel<G>& fineLevel)
841 : Level(is, geom)
842{
843 if (fineLevel.isAllRegular()) {
844 m_allregular = true;
845 m_ok = true;
846 return;
847 }
848
849 BL_PROFILE("EB2::GShopLevel()-coarse");
850
851 const BoxArray& fine_grids = fineLevel.m_grids;
852 const BoxArray& fine_covered_grids = fineLevel.m_covered_grids;
853
854 const int coarse_ratio = 2;
855 const int min_width = 8;
856 bool coarsenable = fine_grids.coarsenable(coarse_ratio, min_width)
857 && (fine_covered_grids.empty() || fine_covered_grids.coarsenable(coarse_ratio));
858
859 m_ngrow = amrex::coarsen(fineLevel.m_ngrow,2);
860 if (amrex::scale(m_ngrow,2) != fineLevel.m_ngrow) {
861 m_ngrow = IntVect::TheZeroVector();
862 }
863
864 if (coarsenable)
865 {
866 int ierr = coarsenFromFine(fineLevel, true);
867 m_ok = (ierr == 0);
868 }
869 else
870 {
871 Level fine_level_2(is, fineLevel.m_geom);
872 fine_level_2.prepareForCoarsening(fineLevel, max_grid_size, amrex::scale(m_ngrow,2));
873 if (fine_level_2.isAllRegular()) {
874 m_allregular = true;
875 m_ok = true;
876 return;
877 }
878 int ierr = coarsenFromFine(fine_level_2, false);
879 m_ok = (ierr == 0);
880 }
881
883 if (m_ok) {
885 extendAtDomainFaces(IntVect{static_cast<int>(std::ceil(ngrow/16.)) * 16});
886 }
888 }
889}
890
891template <typename G>
892void
893GShopLevel<G>::buildFCData (G const& gshop, int max_grid_size,
894 bool extend_domain_face, int num_crse_opt)
895{
896 BL_PROFILE("EB2::GShopLevel::buildFCData");
897
898 bool all_tried = true;
899 for (int face_dir = 0; face_dir < AMREX_SPACEDIM; ++face_dir) {
900 if (!m_fc_data[face_dir]) { m_fc_data[face_dir] = std::make_unique<FCData>(); }
901 all_tried = all_tried && triedFCData(face_dir);
902 }
903 if (all_tried) { return; }
904
905 if (m_allregular) {
906 // An all-regular level carries no MultiFabs, and there is nothing to coarsen. Mark the
907 // face-centered data built anyway so that hasFCData() is true and a face-centered factory
908 // can be constructed: the fill*FC functions fill the regular values for such a level
909 // without reading anything, exactly as their cell-centered counterparts do.
910 for (auto& fc : m_fc_data) { fc->m_built = true; }
911 return;
912 }
913
914 // **********************************************************************
915 // STEP1: Build the one-level-finer CC data, shared by all face directions
916 // **********************************************************************
917
918 // An even max_grid_size keeps the refined grids coarsenable by 2, and a doubled ngrow
919 // makes the face-centered data reach at least as far outside the domain as m_ngrow.
920 Geometry refined_geom = amrex::refine(m_geom, 2);
921 GShopLevel<G> fine(m_parent, refined_geom);
922 fine.define_fine(gshop, refined_geom,
923 std::max(2, max_grid_size - max_grid_size%2), std::max(4, 2*m_ngrow.max()),
924 extend_domain_face, num_crse_opt);
925
926 if (!fine.isOK()) {
927 amrex::Abort("GShopLevel::buildFCData: failed to build refined level");
928 }
929
930 // Coarse levels can have features too thin for their 2x rebuild to see.
931 if (fine.isAllRegular()) {
932 for (int face_dir = 0; face_dir < AMREX_SPACEDIM; ++face_dir) {
933 skipFC(face_dir, "refined level has no cut cells");
934 }
935 return;
936 }
937
939 fine.m_grids.coarsenable(2) &&
941 "GShopLevel::buildFCData: refined grids are not coarsenable");
942
943 // **********************************************************************
944 // STEP2: Check multi-cut error
945 // **********************************************************************
946
947 // Everything below is local. m_grids, m_dmap and m_levelset describe the cell-centered
948 // level that the IndexSpace hands to every EBFArrayBoxFactory built from it, so building
949 // face-centered data must not touch them: overwriting m_grids would leave Level::boxArray()
950 // describing a different region than the cell-centered data it belongs to, and redefining
951 // m_levelset on those grids would silently change the level set that cell-centered
952 // factories created afterwards report.
953 //
954 // The grids are coarsened from the refined level rather than taken from m_grids so that the
955 // DistributionMapping stays compatible with the refined data we read below.
956 const BoxArray fc_base_grids = amrex::coarsen(fine.m_grids, 2);
957 BoxArray fc_covered_grids;
958 if (!fine.m_covered_grids.empty()) {
959 fc_covered_grids = amrex::coarsen(fine.m_covered_grids, 2).simplified();
960 }
961 const DistributionMapping& fc_dmap = fine.m_dmap;
962
963 // Face-centered data provides no level set, so nothing here coarsens one. The multi-cut check
964 // below only needs an MFIter over the coarse boxes, walking alongside the refined level set
965 // that shares this DistributionMapping, so this MultiFab is declared without data.
966 auto const& f_levelset = fine.m_levelset;
967 MultiFab crse_boxes(amrex::convert(fc_base_grids,IntVect::TheNodeVector()), fc_dmap, 1, 0,
968 MFInfo{}.SetAlloc(false));
969
970 int mvmc_error = 0;
971
973 {
974#ifdef AMREX_USE_OMP
975#pragma omp parallel reduction(max:mvmc_error)
976#endif
977 for (MFIter mfi(crse_boxes,true); mfi.isValid(); ++mfi)
978 {
979 const Box& ccbx = mfi.tilebox(IntVect::TheCellVector());
980 auto const& fls = f_levelset.const_array(mfi);
981
982 int tile_error = 0;
983 amrex::LoopOnCpu(ccbx,
984 [=,&tile_error] (int i, int j, int k) noexcept
985 {
986 int ierror = check_mvmc(i,j,k,fls);
987 tile_error = std::max(tile_error,ierror);
988 });
989
990 mvmc_error = std::max(mvmc_error, tile_error);
991 }
992 }
993 else
994 {
995 ReduceOps<ReduceOpMax> reduce_op;
996 ReduceData<int> reduce_data(reduce_op);
997 using ReduceTuple = typename decltype(reduce_data)::Type;
998
999 for (MFIter mfi(crse_boxes); mfi.isValid(); ++mfi)
1000 {
1001 const Box& ndbx = mfi.validbox();
1002 const Box& ccbx = amrex::enclosedCells(ndbx);
1003 auto const& fls = f_levelset.const_array(mfi);
1004 reduce_op.eval(ndbx, reduce_data,
1005 [=] AMREX_GPU_DEVICE (int i, int j, int k) -> ReduceTuple
1006 {
1007 int ierror;
1008 if (ccbx.contains(IntVect{AMREX_D_DECL(i,j,k)})) {
1009 ierror = check_mvmc(i,j,k,fls);
1010 } else {
1011 ierror = 0;
1012 }
1013 return {ierror};
1014 });
1015 }
1016 ReduceTuple rv = reduce_data.value(reduce_op);
1017 mvmc_error = amrex::max(0, amrex::get<0>(rv));
1018 }
1019
1020 {
1021 bool b = mvmc_error;
1023 mvmc_error = b;
1024 }
1025 if (mvmc_error) {
1026 for (int face_dir = 0; face_dir < AMREX_SPACEDIM; ++face_dir) {
1027 skipFC(face_dir, "multi-valued or multi-cut cells at twice the resolution");
1028 }
1029 return;
1030 }
1031
1032 for (int face_dir = 0; face_dir < AMREX_SPACEDIM; ++face_dir) {
1033 if (!triedFCData(face_dir)) {
1034 buildFCDir(fine, fc_base_grids, fc_covered_grids, face_dir);
1035 }
1036 }
1037}
1038
1039template <typename G>
1040void
1041GShopLevel<G>::skipFC (int face_dir, char const* why)
1042{
1043 // Leave the data unbuilt; a face-centered factory on this level would then fail.
1044 // Remember the attempt so that later BuildFC calls do not repeat it.
1045 if (amrex::Verbose() > 0) {
1046 amrex::Print() << "AMReX EB: no face-centered data for face_dir " << face_dir
1047 << " on domain " << m_geom.Domain() << ": " << why << '\n';
1048 }
1049 m_fc_data[face_dir] = std::make_unique<FCData>();
1050 m_fc_data[face_dir]->m_skipped = true;
1051 m_fc_data[face_dir]->m_skip_reason = why;
1052}
1053
1054template <typename G>
1055void
1056GShopLevel<G>::buildFCDir (GShopLevel<G> const& fine, BoxArray const& fc_base_grids,
1057 BoxArray const& fc_covered_grids, int face_dir)
1058{
1059 m_fc_data[face_dir]->m_covered_grids_fc = fc_covered_grids;
1060 const DistributionMapping& fc_dmap = fine.m_dmap;
1061
1062 // **********************************************************************
1063 // STEP3: Define FC data structures
1064 // **********************************************************************
1065
1066 // FC MultiFabs
1067 auto& fc_cellflag = m_fc_data[face_dir]->m_cellflag_fc;
1068 MultiFab& fc_volfrac = m_fc_data[face_dir]->m_volfrac_fc;
1069 MultiFab& fc_centroid = m_fc_data[face_dir]->m_centroid_fc;
1070 MultiFab& fc_bndryarea = m_fc_data[face_dir]->m_bndryarea_fc;
1071 MultiFab& fc_bndrycent = m_fc_data[face_dir]->m_bndrycent_fc;
1072 MultiFab& fc_bndrynorm = m_fc_data[face_dir]->m_bndrynorm_fc;
1073 auto& fc_areafrac = m_fc_data[face_dir]->m_areafrac_fc;
1074 auto& fc_facecent = m_fc_data[face_dir]->m_facecent_fc;
1075 auto& fc_edgecent = m_fc_data[face_dir]->m_edgecent_fc;
1076
1077 // Index types of the face-centered data. One rule covers all of it: face_dir is nodal,
1078 // because that is how a box spans staggered cells - there is one more of them than there
1079 // are cell-centered cells, and nodal is how AMReX says so. The remaining directions carry
1080 // whatever type the cell-centered path would give.
1081 //
1082 // cellflag / volfrac / centroid / bndry* nodal in face_dir alone, i.e. (N,C,C) for
1083 // face_dir=0, (C,N,C) for 1, (C,C,N) for 2.
1084 // These are the staggered cells themselves.
1085 // areafrac[idim] / facecent[idim] the same, for every idim.
1086 // edgecent[idim] cell in idim and nodal elsewhere, as in the
1087 // cell-centered path, with face_dir forced nodal.
1088 //
1089 // areafrac and facecent are kept uniform across idim on purpose. The cell-centered path
1090 // gives each direction its own nodal index type (areafrac[0] is (N,C,C), areafrac[1] is
1091 // (C,N,C), ...); carrying that over to a grid already staggered in face_dir would put three
1092 // different index types in play at once for no real gain. Here all three are simply indexed
1093 // by the staggered cell they belong to, and areafrac[idim](i,j,k) is that cell's low face in
1094 // direction idim, with areafrac[idim](i+1,j,k) its high one.
1095 //
1096 // Indexing by the staggered cell is why face_dir has to be nodal even here. The valid box
1097 // then holds every staggered cell the box owns, which is what coarsen_from_fine below fills
1098 // and what the fill*FC ParallelCopy can hand out. A cell-typed face_dir would stop one short
1099 // and leave the last staggered cell of every box in the ghost region, where the copy cannot
1100 // reach it: the covered-region mask in fill*FC would clear that plane with nothing able to
1101 // write it back.
1102
1103 // Define FC MultiFabs
1104 BoxArray fc_grids = amrex::convert(fc_base_grids, IntVect::TheDimensionVector(face_dir));
1105 // coarsen_from_fine writes the area fractions on boxes that are nodal in each direction
1106 const int ng = 3;
1107 fc_cellflag.define(fc_grids, fc_dmap, 1, ng);
1108 fc_volfrac.define(fc_grids, fc_dmap, 1, ng);
1109 fc_centroid.define(fc_grids, fc_dmap, AMREX_SPACEDIM, ng);
1110 fc_bndryarea.define(fc_grids, fc_dmap, 1, ng);
1111 fc_bndrycent.define(fc_grids, fc_dmap, AMREX_SPACEDIM, ng);
1112 fc_bndrynorm.define(fc_grids, fc_dmap, AMREX_SPACEDIM, ng);
1113
1114 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
1115 fc_areafrac[idim].define(fc_grids, fc_dmap, 1, ng);
1116 fc_facecent[idim].define(fc_grids, fc_dmap, AMREX_SPACEDIM-1, ng);
1117 fc_edgecent[idim].define(amrex::convert(fc_base_grids, Level::fcEdgeType(idim,face_dir)),
1118 fc_dmap, 1, ng);
1119 }
1120
1121 // **********************************************************************
1122 // STEP4: Coarsen from refined CC to FC with staggered averaging
1123 // **********************************************************************
1124
1125 // Fine CC MultiFabs
1126 auto const& cc_cellflag = fine.m_cellflag;
1127 MultiFab const& cc_volfrac = fine.m_volfrac;
1128 MultiFab const& cc_centroid = fine.m_centroid;
1129 MultiFab const& cc_bndryarea = fine.m_bndryarea;
1130 MultiFab const& cc_bndrycent = fine.m_bndrycent;
1131 MultiFab const& cc_bndrynorm = fine.m_bndrynorm;
1132 auto const& cc_areafrac = fine.m_areafrac;
1133 auto const& cc_facecent = fine.m_facecent;
1134 auto const& cc_edgecent = fine.m_edgecent;
1135
1136 int error = 0;
1137
1139 {
1140#ifdef AMREX_USE_OMP
1141#pragma omp parallel reduction(max:error)
1142#endif
1143 for (MFIter mfi(fc_volfrac,true); mfi.isValid(); ++mfi)
1144 {
1145 // Coarse FC arrays
1146 auto const& cvol = fc_volfrac.array(mfi);
1147 auto const& ccent = fc_centroid.array(mfi);
1148 auto const& cba = fc_bndryarea.array(mfi);
1149 auto const& cbc = fc_bndrycent.array(mfi);
1150 auto const& cbn = fc_bndrynorm.array(mfi);
1151 AMREX_D_TERM(auto const& capx = fc_areafrac[0].array(mfi);,
1152 auto const& capy = fc_areafrac[1].array(mfi);,
1153 auto const& capz = fc_areafrac[2].array(mfi););
1154 AMREX_D_TERM(auto const& cfcx = fc_facecent[0].array(mfi);,
1155 auto const& cfcy = fc_facecent[1].array(mfi);,
1156 auto const& cfcz = fc_facecent[2].array(mfi););
1157 AMREX_D_TERM(auto const& cecx = fc_edgecent[0].array(mfi);,
1158 auto const& cecy = fc_edgecent[1].array(mfi);,
1159 auto const& cecz = fc_edgecent[2].array(mfi););
1160 auto const& cflag = fc_cellflag.array(mfi);
1161
1162 // Fine CC arrays
1163 auto const& fvol = cc_volfrac.const_array(mfi);
1164 auto const& fcent = cc_centroid.const_array(mfi);
1165 auto const& fba = cc_bndryarea.const_array(mfi);
1166 auto const& fbc = cc_bndrycent.const_array(mfi);
1167 auto const& fbn = cc_bndrynorm.const_array(mfi);
1168 AMREX_D_TERM(auto const& fapx = cc_areafrac[0].const_array(mfi);,
1169 auto const& fapy = cc_areafrac[1].const_array(mfi);,
1170 auto const& fapz = cc_areafrac[2].const_array(mfi););
1171 AMREX_D_TERM(auto const& ffcx = cc_facecent[0].const_array(mfi);,
1172 auto const& ffcy = cc_facecent[1].const_array(mfi);,
1173 auto const& ffcz = cc_facecent[2].const_array(mfi););
1174 AMREX_D_TERM(auto const& fecx = cc_edgecent[0].const_array(mfi);,
1175 auto const& fecy = cc_edgecent[1].const_array(mfi);,
1176 auto const& fecz = cc_edgecent[2].const_array(mfi););
1177 auto const& fflag = cc_cellflag.const_array(mfi);
1178
1179 Box const& bx = mfi.validbox();
1180 Box const& ndgbx = mfi.grownnodaltilebox(-1,2);
1181
1182 int tile_error = 0;
1183 amrex::LoopOnCpu(ndgbx,
1184 [=,&tile_error] (int i, int j, int k) noexcept
1185 {
1187 int ierr = coarsen_from_fine(AMREX_D_DECL(i,j,k), bx, 2,
1188 cvol,ccent,cba,cbc,cbn,
1189 AMREX_D_DECL(capx,capy,capz),
1190 AMREX_D_DECL(cfcx,cfcy,cfcz),
1191 AMREX_D_DECL(cecx,cecy,cecz),
1192 cflag,fvol,fcent,fba,fbc,fbn,
1193 AMREX_D_DECL(fapx,fapy,fapz),
1194 AMREX_D_DECL(ffcx,ffcy,ffcz),
1195 AMREX_D_DECL(fecx,fecy,fecz),
1196 fflag, face_dir);
1197 tile_error = std::max(tile_error,ierr);
1198 });
1199
1200 error = std::max(error,tile_error);
1201 }
1202 }
1203 else
1204 {
1205 ReduceOps<ReduceOpMax> reduce_op;
1206 ReduceData<int> reduce_data(reduce_op);
1207 using ReduceTuple = typename decltype(reduce_data)::Type;
1208
1209 for (MFIter mfi(fc_volfrac); mfi.isValid(); ++mfi)
1210 {
1211 auto const& cvol = fc_volfrac.array(mfi);
1212 auto const& ccent = fc_centroid.array(mfi);
1213 auto const& cba = fc_bndryarea.array(mfi);
1214 auto const& cbc = fc_bndrycent.array(mfi);
1215 auto const& cbn = fc_bndrynorm.array(mfi);
1216 AMREX_D_TERM(auto const& capx = fc_areafrac[0].array(mfi);,
1217 auto const& capy = fc_areafrac[1].array(mfi);,
1218 auto const& capz = fc_areafrac[2].array(mfi););
1219 AMREX_D_TERM(auto const& cfcx = fc_facecent[0].array(mfi);,
1220 auto const& cfcy = fc_facecent[1].array(mfi);,
1221 auto const& cfcz = fc_facecent[2].array(mfi););
1222 // We use MultiArray4 instead of Array4 here
1223 // to be below the 2 kB kernel parameter limit for SYCL
1224 AMREX_D_TERM(auto const& cecx = fc_edgecent[0].arrays();,
1225 auto const& cecy = fc_edgecent[1].arrays();,
1226 auto const& cecz = fc_edgecent[2].arrays(););
1227 auto const& cflag = fc_cellflag.array(mfi);
1228
1229 auto const& fvol = cc_volfrac.const_array(mfi);
1230 auto const& fcent = cc_centroid.const_array(mfi);
1231 auto const& fba = cc_bndryarea.const_array(mfi);
1232 auto const& fbc = cc_bndrycent.const_array(mfi);
1233 auto const& fbn = cc_bndrynorm.const_array(mfi);
1234 AMREX_D_TERM(auto const& fapx = cc_areafrac[0].const_array(mfi);,
1235 auto const& fapy = cc_areafrac[1].const_array(mfi);,
1236 auto const& fapz = cc_areafrac[2].const_array(mfi););
1237 AMREX_D_TERM(auto const& ffcx = cc_facecent[0].const_array(mfi);,
1238 auto const& ffcy = cc_facecent[1].const_array(mfi);,
1239 auto const& ffcz = cc_facecent[2].const_array(mfi););
1240 AMREX_D_TERM(auto const& fecx = cc_edgecent[0].const_arrays();,
1241 auto const& fecy = cc_edgecent[1].const_arrays();,
1242 auto const& fecz = cc_edgecent[2].const_arrays(););
1243 auto const& fflag = cc_cellflag.const_array(mfi);
1244
1245 const int lidx = mfi.LocalIndex();
1246 Box const& bx = mfi.validbox();
1247 Box const& gbx = amrex::grow(bx,2);
1248 Box const& ndgbx = amrex::surroundingNodes(gbx);
1249
1250 reduce_op.eval(ndgbx, reduce_data,
1251 [=] AMREX_GPU_DEVICE (int i, int j, int k) -> ReduceTuple
1252 {
1254 int ierr = coarsen_from_fine(AMREX_D_DECL(i,j,k), bx, 2,
1255 cvol,ccent,cba,cbc,cbn,
1256 AMREX_D_DECL(capx,capy,capz),
1257 AMREX_D_DECL(cfcx,cfcy,cfcz),
1258 AMREX_D_DECL(cecx[lidx],cecy[lidx],cecz[lidx]),
1259 cflag,fvol,fcent,fba,fbc,fbn,
1260 AMREX_D_DECL(fapx,fapy,fapz),
1261 AMREX_D_DECL(ffcx,ffcy,ffcz),
1262 AMREX_D_DECL(fecx[lidx],fecy[lidx],fecz[lidx]),
1263 fflag, face_dir);
1264 return {ierr};
1265 });
1266 }
1267
1268 ReduceTuple rv = reduce_data.value(reduce_op);
1269 error = amrex::max(0, amrex::get<0>(rv));
1270 }
1271
1272 {
1273 bool b = error;
1275 error = b;
1276 }
1277
1278 if (error) {
1279 skipFC(face_dir, "coarsening failed");
1280 return;
1281 }
1282
1283 m_fc_data[face_dir]->m_built = true;
1284
1285 buildCellFlagFC(face_dir);
1286}
1287
1288}
1289
1290#endif
Fixed-size array types for use on GPU and CPU.
#define BL_PROFILE(a)
Definition AMReX_BLProfiler.H:593
#define AMREX_ALWAYS_ASSERT_WITH_MESSAGE(EX, MSG)
Definition AMReX_BLassert.H:49
Problem-domain geometry: maps between index space and physical space.
#define AMREX_GPU_DEVICE
Definition AMReX_GpuQualifiers.H:18
#define AMREX_D_TERM(a, b, c)
Definition AMReX_SPACE.H:172
#define AMREX_D_DECL(a, b, c)
Definition AMReX_SPACE.H:171
void resize(const Box &b, int N=1, Arena *ar=nullptr)
This function resizes a BaseFab so it covers the Box b with N components.
Definition AMReX_BaseFab.H:1779
Array4< T const > array() const noexcept
Create an Array4 view over all components.
Definition AMReX_BaseFab.H:496
Elixir elixir() noexcept
Transfer owned storage to an Elixir when running in a GPU launch region.
Definition AMReX_BaseFab.H:1840
Reference-counted collection of Boxes.
Definition AMReX_BoxArray.H:681
BoxArray simplified() const
Return a simplified BoxArray; regular AMR grids only.
Definition AMReX_BoxArray.cpp:1668
bool coarsenable(int refinement_ratio, int min_width=1) const
Check whether every Box is coarsenable by refinement_ratio.
Definition AMReX_BoxArray.cpp:628
bool empty() const noexcept
Return whether the BoxArray is empty.
Definition AMReX_BoxArray.H:764
__host__ __device__ BoxND & grow(int i) noexcept
Grow in all directions by i cells (negative shrinks).
Definition AMReX_Box.H:668
__host__ __device__ const IntVectND< dim > & bigEnd() const &noexcept
Return the inclusive upper bound of the box.
Definition AMReX_Box.H:136
__host__ __device__ IntVectND< dim > length() const noexcept
Return the length of the BoxND.
Definition AMReX_Box.H:167
__host__ __device__ bool contains(const IntVectND< dim > &p) const noexcept
Return true if argument is contained within BoxND.
Definition AMReX_Box.H:233
__host__ __device__ bool coarsenable(const IntVectND< dim > &refrat, const IntVectND< dim > &min_width) const noexcept
Return whether this Box is coarsenable.
Definition AMReX_Box.H:802
__host__ __device__ BoxND & surroundingNodes() noexcept
Convert to NODE type in all directions.
Definition AMReX_Box.H:1042
__host__ __device__ const IntVectND< dim > & smallEnd() const &noexcept
Return the inclusive lower bound of the box.
Definition AMReX_Box.H:124
GpuArray< Real, 3 > CellSizeArray() const noexcept
Returns the cell sizes as a GpuArray for use on host or device.
Definition AMReX_CoordSys.H:85
Calculates the distribution of FABs to MPI processes.
Definition AMReX_DistributionMapping.H:55
static constexpr int ng
Definition AMReX_EB2_MultiGFab.H:26
Definition AMReX_EB2_Level.H:319
void define_fine(G const &gshop, const Geometry &geom, int max_grid_size, int ngrow, bool extend_domain_face, int num_crse_opt)
Define data for the finest level using the supplied GeometryShop.
Definition AMReX_EB2_Level.H:515
void buildFCData(G const &gshop, int max_grid_size, bool extend_domain_face, int num_crse_opt)
Build face-centered EB data for every face direction from one transient 2x refined level.
Definition AMReX_EB2_Level.H:893
void buildFCDir(GShopLevel< G > const &fine, BoxArray const &fc_base_grids, BoxArray const &fc_covered_grids, int face_dir)
Definition AMReX_EB2_Level.H:1056
GShopLevel(IndexSpace const *is, G const &gshop, const Geometry &geom, int max_grid_size, int ngrow, bool extend_domain_face, int num_crse_opt)
Build a level directly from a GeometryShop object.
Definition AMReX_EB2_Level.H:382
static GShopLevel< G > makeAllRegular(IndexSpace const *is, const Geometry &geom)
Build a regular (no EB) level.
Definition AMReX_EB2_Level.H:351
void define_fine_mvmc(GS const &gshop, const Geometry &geom, int max_grid_size, int ngrow, bool extend_domain_face, int num_crse_opt)
Definition AMReX_EB2_Level.H:804
Definition AMReX_EB2.H:86
Definition AMReX_EB2.H:28
Definition AMReX_EB2_Level.H:43
MultiFab m_bndryarea
Definition AMReX_EB2_Level.H:280
bool isOK() const noexcept
Definition AMReX_EB2_Level.H:49
char const * whyNoFCData(int face_dir) const noexcept
Why there is no face-centered data for face_dir, or nullptr if there is.
Definition AMReX_EB2_Level.H:208
void fillFaceCent(Array< MultiCutFab *, 3 > const &facecent, const Geometry &geom) const
Populate face centroids for each direction.
Definition AMReX_EB2_Level.cpp:910
bool triedFCData(int face_dir) const noexcept
Check if building face-centered data for face_dir has been tried, successfully or not.
Definition AMReX_EB2_Level.H:202
MultiFab m_volfrac
Definition AMReX_EB2_Level.H:278
MultiGFab m_mgf
Definition AMReX_EB2_Level.H:275
bool m_allregular
Definition AMReX_EB2_Level.H:287
IntVect m_shift
Definition AMReX_EB2_Level.H:297
iMultiFab m_cutcellmask
Definition AMReX_EB2_Level.H:286
Array< MultiFab, 3 > m_facecent
Definition AMReX_EB2_Level.H:284
void fillBndryAreaFC(MultiFab &bndryarea, int face_dir, const Geometry &geom) const
Fill face-centered boundary areas for face_dir.
Definition AMReX_EB2_Level.cpp:1364
Array< MultiFab, 3 > m_edgecent
Definition AMReX_EB2_Level.H:285
void fillBndryNormFC(MultiFab &bndrynorm, int face_dir, const Geometry &geom) const
Fill face-centered boundary normals for face_dir.
Definition AMReX_EB2_Level.cpp:1400
void prepareForCoarsening(const Level &rhs, int max_grid_size, IntVect const &ngrow)
Prepare for coarsening by copying from rhs, respecting max grid size and grow vector.
Definition AMReX_EB2_Level.cpp:10
void fillCutCellMask(iMultiFab &cutcellmask, const Geometry &geom) const
Populate the cut-cell mask into cutcellmask.
Definition AMReX_EB2_Level.cpp:1063
MultiFab m_centroid
Definition AMReX_EB2_Level.H:279
FabArray< EBCellFlagFab > m_cellflag
Definition AMReX_EB2_Level.H:277
const DistributionMapping & DistributionMap() const noexcept
Definition AMReX_EB2_Level.H:111
BoxArray m_covered_grids
Definition AMReX_EB2_Level.H:269
void fillLevelSet(MultiFab &levelset, const Geometry &geom) const
Write the implicit function values into levelset.
Definition AMReX_EB2_Level.cpp:1024
Geometry m_geom
Definition AMReX_EB2_Level.H:266
Array< MultiFab, 3 > m_areafrac
Definition AMReX_EB2_Level.H:283
IntVect m_ngrow
Definition AMReX_EB2_Level.H:267
void fillEBCellFlagFC(FabArray< EBCellFlagFab > &cellflag, int face_dir, const Geometry &geom) const
Fill face-centered EBCellFlags for face_dir.
Definition AMReX_EB2_Level.cpp:1418
IndexSpace const * m_parent
Definition AMReX_EB2_Level.H:298
BoxArray m_grids
Definition AMReX_EB2_Level.H:268
void fillEdgeCentFC(Array< MultiFab *, 3 > const &edgecent, int face_dir, const Geometry &geom) const
Fill face-centered edge centroids for face_dir.
Definition AMReX_EB2_Level.cpp:1503
const Geometry & Geom() const noexcept
Definition AMReX_EB2_Level.H:121
std::map< int, std::unique_ptr< MC::MCFab > > m_marching_cubes
Definition AMReX_EB2_Level.H:273
bool m_extrude_coarse_levels
Definition AMReX_EB2_Level.H:296
void fillCutCellMaskFC(iMultiFab &cutcellmask, int face_dir, const Geometry &geom) const
Populate the face-centered cut-cell mask, nodal in face_dir, into cutcellmask.
Definition AMReX_EB2_Level.cpp:1073
bool hasEBInfo() const noexcept
Definition AMReX_EB2_Level.H:138
void write_to_chkpt_file(const std::string &fname, bool extend_domain_face, int max_grid_size) const
Write this level’s EB data to a checkpoint file fname.
Definition AMReX_EB2_Level.cpp:1097
void fillEBCellFlag(FabArray< EBCellFlagFab > &cellflag, const Geometry &geom) const
Fill cellflag with EBCellFlag data using geometry geom.
Definition AMReX_EB2_Level.cpp:540
void fillEdgeCent(Array< MultiCutFab *, 3 > const &edgecent, const Geometry &geom) const
Populate edge centroids for each direction.
Definition AMReX_EB2_Level.cpp:951
int coarsenFromFine(Level &fineLevel, bool fill_boundary)
Coarsen EB data from fineLevel into this level.
Definition AMReX_EB2_Level.cpp:92
MultiFab m_bndrynorm
Definition AMReX_EB2_Level.H:282
bool m_has_eb_info
Definition AMReX_EB2_Level.H:289
void fillAreaFrac(Array< MultiCutFab *, 3 > const &areafrac, const Geometry &geom) const
Populate face area fractions for each direction.
Definition AMReX_EB2_Level.cpp:756
MultiFab m_bndrycent
Definition AMReX_EB2_Level.H:281
MultiFab m_levelset
Definition AMReX_EB2_Level.H:276
void setShift(int direction, int ncells)
Shift this level by ncells cells along direction direction (for periodic tiling).
Definition AMReX_EB2_Level.cpp:1188
friend class IndexSpaceImp
Definition AMReX_EB2_Level.H:306
void buildCellFlagFC(int face_dir)
Build the face-centered EBCellFlag connectivity for face_dir from its area fractions.
Definition AMReX_EB2_Level.cpp:1203
bool isAllRegular() const noexcept
Definition AMReX_EB2_Level.H:47
static IntVect fcEdgeType(int idim, int face_dir) noexcept
Index type of the face-centered edge centroids for edge direction idim.
Definition AMReX_EB2_Level.H:189
void fillBndryCent(MultiCutFab &bndrycent, const Geometry &geom) const
Populate boundary centroids into bndrycent.
Definition AMReX_EB2_Level.cpp:708
void fillCentroidFC(MultiFab &centroid, int face_dir, const Geometry &geom) const
Fill face-centered centroids for face_dir.
Definition AMReX_EB2_Level.cpp:1346
void fillBndryNorm(MultiCutFab &bndrynorm, const Geometry &geom) const
Populate boundary normals into bndrynorm.
Definition AMReX_EB2_Level.cpp:732
void fillBndryCentFC(MultiFab &bndrycent, int face_dir, const Geometry &geom) const
Fill face-centered boundary centroids for face_dir.
Definition AMReX_EB2_Level.cpp:1382
MultiFab m_sdf
Definition AMReX_EB2_Level.H:271
IntVect const & nGrowVect() const noexcept
Definition AMReX_EB2_Level.H:126
void fillAreaFracFC(Array< MultiFab *, 3 > const &areafrac, int face_dir, const Geometry &geom) const
Fill face-centered area fractions for face_dir.
Definition AMReX_EB2_Level.cpp:1279
void fillVolFrac(MultiFab &vfrac, const Geometry &geom) const
Populate volume fractions into vfrac using geom.
Definition AMReX_EB2_Level.cpp:594
const BoxArray & boxArray() const noexcept
Definition AMReX_EB2_Level.H:109
Level(IndexSpace const *is, const Geometry &geom)
Construct a Level bound to EB index space is and Geometry geom.
Definition AMReX_EB2_Level.H:114
friend class GShopLevel
Definition AMReX_EB2_Level.H:304
bool m_ok
Definition AMReX_EB2_Level.H:288
void fillCentroid(MultiCutFab &centroid, const Geometry &geom) const
Populate cut-cell centroids into a MultiCutFab.
Definition AMReX_EB2_Level.cpp:660
Array< std::unique_ptr< FCData >, 3 > m_fc_data
Face-centered data, one per face direction.
Definition AMReX_EB2_Level.H:301
void extendAtDomainFaces(IntVect const &ngrow)
Extend the EB data outside non-periodic domain faces to ngrow cells.
Definition AMReX_EB2_Level.cpp:479
DistributionMapping m_dmap
Definition AMReX_EB2_Level.H:270
void fillBndryArea(MultiCutFab &bndryarea, const Geometry &geom) const
Populate boundary-face areas into bndryarea.
Definition AMReX_EB2_Level.cpp:684
void buildCellFlag()
Build EBCellFlag data from the current implicit function field.
Definition AMReX_EB2_Level.cpp:407
void buildCutCellMask(Level const &fine_level)
Build the cut-cell mask by coarsening from fine_level.
Definition AMReX_EB2_Level.cpp:1107
bool hasFCData(int face_dir) const noexcept
Check if face-centered data is available for face_dir (0=x, 1=y, 2=z).
Definition AMReX_EB2_Level.H:196
IndexSpace const * getEBIndexSpace() const noexcept
Definition AMReX_EB2_Level.H:123
void fillVolFracFC(MultiFab &vfrac, int face_dir, const Geometry &geom) const
Fill face-centered volume fractions for face_dir.
Definition AMReX_EB2_Level.cpp:1238
void fillFaceCentFC(Array< MultiFab *, 3 > const &facecent, int face_dir, const Geometry &geom) const
Fill face-centered face centroids for face_dir.
Definition AMReX_EB2_Level.cpp:1471
LayoutData wrapper that allocates a GFab per FAB/Box.
Definition AMReX_EB2_MultiGFab.H:86
FAB storing EBCellFlag data per cell.
Definition AMReX_EBCellFlag.H:324
An Array of FortranArrayBox(FAB)-like Objects.
Definition AMReX_FabArray.H:383
Array4< typename FabArray< FAB >::value_type const > array(const MFIter &mfi) const noexcept
Read-only Array4 view for the FAB referenced by iterator mfi.
Definition AMReX_FabArray.H:649
Array4< typename FabArray< FAB >::value_type const > const_array(const MFIter &mfi) const noexcept
Synonym for array(const MFIter&) that highlights read-only semantics.
Definition AMReX_FabArray.H:677
Rectangular problem domain geometry.
Definition AMReX_Geometry.H:87
const Box & Domain() const noexcept
Returns our rectangular domain.
Definition AMReX_Geometry.H:246
Periodicity periodicity() const noexcept
Return the Periodicity based on the length of the domain.
Definition AMReX_Geometry.H:426
GpuArray< Real, 3 > ProbLoArray() const noexcept
Return the lo end of the problem domain in a GpuArray for device code.
Definition AMReX_Geometry.H:219
bool isPeriodic(int dir) const noexcept
Is the domain periodic in the specified direction?
Definition AMReX_Geometry.H:399
Definition AMReX_GpuElixir.H:13
__host__ static __device__ constexpr IntVectND< dim > TheCellVector() noexcept
Definition AMReX_IntVect.H:839
__host__ static __device__ constexpr IntVectND< dim > TheNodeVector() noexcept
Definition AMReX_IntVect.H:830
__host__ static __device__ constexpr IntVectND< dim > TheDimensionVector(int d) noexcept
Definition AMReX_IntVect.H:797
Iterator for looping ever tiles and boxes of amrex::FabArray based containers.
Definition AMReX_MFIter.H:88
bool isValid() const noexcept
Is the iterator valid i.e. is it associated with a FAB?
Definition AMReX_MFIter.H:176
FabArray façade that only allocates cut-cell Fabs (skipping regular cells).
Definition AMReX_MultiCutFab.H:87
A collection (stored as an array) of FArrayBox objects.
Definition AMReX_MultiFab.H:40
void define(const BoxArray &bxs, const DistributionMapping &dm, int nvar, int ngrow, const MFInfo &info=MFInfo(), const FabFactory< FArrayBox > &factory=FArrayBoxFactory())
Definition AMReX_MultiFab.cpp:524
Parse Parameters From Command Line and Input Files.
Definition AMReX_ParmParse.H:355
int queryAdd(std::string_view name, T &ref)
If name is found, the value in the ParmParse database will be stored in the ref argument....
Definition AMReX_ParmParse.H:1062
This class provides the user with a few print options.
Definition AMReX_Print.H:35
Definition AMReX_Reduce.H:556
Type value()
Definition AMReX_Reduce.H:591
Definition AMReX_Reduce.H:715
void eval(MF const &mf, IntVect const &nghost, D &reduce_data, F &&f)
Definition AMReX_Reduce.H:855
Utility class that loads STL meshes and samples them onto AMReX grids.
Definition AMReX_EB_STL_utils.H:26
A Collection of IArrayBoxes.
Definition AMReX_iMultiFab.H:34
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:80
amrex_long Long
Definition AMReX_INT.H:30
ArrayND< T, 4, true > Array4
Convenient alias for a 4D ArrayND with three spatial dimensions plus a component dimension.
Definition AMReX_Array4.H:1352
__host__ __device__ BoxND< dim > convert(const BoxND< dim > &b, const IntVectND< dim > &typ) noexcept
Return a copy of b converted to the nodal flags typ.
Definition AMReX_Box.H:1632
__host__ __device__ BoxND< dim > surroundingNodes(const BoxND< dim > &b, int dir) noexcept
Return a BoxND with NODE based coordinates in direction dir that encloses BoxND b.
Definition AMReX_Box.H:1584
__host__ __device__ BoxND< dim > coarsen(const BoxND< dim > &b, int ref_ratio) noexcept
Return a copy of b coarsened by the isotropic ratio ref_ratio.
Definition AMReX_Box.H:1471
__host__ __device__ BoxND< dim > enclosedCells(const BoxND< dim > &b, int dir) noexcept
Return a BoxND with CELL based coordinates in direction dir that is enclosed by b.
Definition AMReX_Box.H:1666
__host__ __device__ BoxND< dim > grow(const BoxND< dim > &b, int i) noexcept
Return a copy of b grown uniformly by i cells in every direction.
Definition AMReX_Box.H:1328
__host__ __device__ BoxND< dim > refine(const BoxND< dim > &b, int ref_ratio) noexcept
Return a copy of b refined by the isotropic ratio ref_ratio.
Definition AMReX_Box.H:1512
std::array< T, N > Array
Definition AMReX_Array.H:31
void Or(bool &v, MPI_Comm comm)
Definition AMReX_ParallelReduce.H:236
void Sum(Gpu::DeviceVector< T > &v, MPI_Comm comm)
Definition AMReX_GpuParallelReduce.H:37
__host__ __device__ constexpr const T & max(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:54
Type flags representing regular/covered/etc.
Definition AMReX_EB2_Graph.H:49
Definition AMReX_FabArrayBase.H:38
void streamSynchronize() noexcept
Definition AMReX_GpuDevice.H:329
bool inLaunchRegion() noexcept
Definition AMReX_GpuControl.H:88
bool notInLaunchRegion() noexcept
Definition AMReX_GpuControl.H:89
void write_stl(std::string const &filename, std::map< int, std::unique_ptr< MCFab > > const &mc_fabs)
Write the collected marching-cubes output to an STL file.
Definition AMReX_MarchingCubes.cpp:925
void marching_cubes(Geometry const &geom, FArrayBox &sdf_fab, MCFab &mc_fab)
Run marching cubes on signed-distance field sdf_fab.
Definition AMReX_MarchingCubes.cpp:693
void Initialize()
Initialize internal lookup tables and device buffers for marching cubes.
Definition AMReX_MarchingCubes.cpp:651
MPI_Comm CommunicatorSub() noexcept
sub-communicator for current frame
Definition AMReX_ParallelContext.H:70
int MyProcSub() noexcept
my sub-rank in current frame
Definition AMReX_ParallelContext.H:76
int NProcsSub() noexcept
number of ranks in current frame
Definition AMReX_ParallelContext.H:74
Definition AMReX_Amr.cpp:50
@ hybrid
Definition AMReX_MLMG.H:34
__host__ __device__ void ignore_unused(const Ts &...)
No-op helper that marks variables as intentionally unused.
Definition AMReX.H:273
RunOn
Definition AMReX_GpuControl.H:65
@ Gpu
Definition AMReX_GpuControl.H:65
@ Cpu
Definition AMReX_GpuControl.H:65
void AllGatherBoxes(Vector< Box > &bxs, int n_extra_reserve)
Gather boxes from all MPI ranks into bxs.
Definition AMReX_Box.cpp:124
BoxND< 3 > Box
Box is an alias for amrex::BoxND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:35
__host__ __device__ constexpr IntVectND< dim > scale(const IntVectND< dim > &p, int s) noexcept
Returns a IntVectND obtained by multiplying each of the components of this IntVectND by s.
Definition AMReX_IntVect.H:1135
IntVectND< 3 > IntVect
IntVect is an alias for amrex::IntVectND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:38
int Verbose() noexcept
Return the verbosity level configured via ParmParse or SetVerbose().
Definition AMReX.cpp:179
void Abort(const std::string &msg)
Print a fatal-error message to stderr and abort execution.
Definition AMReX.cpp:239
void LoopOnCpu(Dim3 lo, Dim3 hi, F const &f) noexcept
Definition AMReX_Loop.H:365
@ bndryarea
Definition AMReX_EBData.H:25
@ levelset
Definition AMReX_EBData.H:20
@ centroid
Definition AMReX_EBData.H:22
@ apy
Definition AMReX_EBData.H:26
@ bndrycent
Definition AMReX_EBData.H:23
@ fcx
Definition AMReX_EBData.H:27
@ apx
Definition AMReX_EBData.H:26
@ bndrynorm
Definition AMReX_EBData.H:24
@ fcz
Definition AMReX_EBData.H:27
@ fcy
Definition AMReX_EBData.H:27
@ apz
Definition AMReX_EBData.H:26
@ cellflag
Definition AMReX_EBData.H:29
__host__ __device__ constexpr int get(IntVectND< dim > const &iv) noexcept
Get the Idx-th element of IntVectND<dim>.
Definition AMReX_IntVect.H:1367
Face-centered EB data storage structure.
Definition AMReX_EB2_Level.H:152
bool m_skipped
Definition AMReX_EB2_Level.H:177
bool m_built
Definition AMReX_EB2_Level.H:176
Array< MultiFab, 3 > m_areafrac_fc
Definition AMReX_EB2_Level.H:159
MultiFab m_bndryarea_fc
Definition AMReX_EB2_Level.H:156
Array< MultiFab, 3 > m_edgecent_fc
Definition AMReX_EB2_Level.H:161
BoxArray m_covered_grids_fc
Definition AMReX_EB2_Level.H:175
char const * m_skip_reason
Definition AMReX_EB2_Level.H:178
MultiFab m_bndrycent_fc
Definition AMReX_EB2_Level.H:157
MultiFab m_centroid_fc
Definition AMReX_EB2_Level.H:155
MultiFab m_bndrynorm_fc
Definition AMReX_EB2_Level.H:158
MultiFab m_volfrac_fc
Definition AMReX_EB2_Level.H:154
Array< MultiFab, 3 > m_facecent_fc
Definition AMReX_EB2_Level.H:160
FabArray< EBCellFlagFab > m_cellflag_fc
Definition AMReX_EB2_Level.H:153
FabArray memory allocation information.
Definition AMReX_FabArray.H:73
MFInfo & SetTag() noexcept
Terminate a variadic SetTag() call.
Definition AMReX_FabArray.H:90
MFInfo & SetAlloc(bool a) noexcept
Control whether FAB storage is allocated when the FabArray is defined.
Definition AMReX_FabArray.H:81
Definition AMReX_MFIter.H:20
MFItInfo & SetDynamic(bool f) noexcept
Definition AMReX_MFIter.H:43