MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / get_slice_data

Function get_slice_data

Src/Base/AMReX_MultiFabUtil.cpp:597–650  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

595 }
596
597 std::unique_ptr<MultiFab> get_slice_data(int dir, Real coord, const MultiFab& cc, const Geometry& geom, int start_comp, int ncomp, bool interpolate, RealBox const& bnd_rbx) {
598
599 BL_PROFILE("amrex::get_slice_data");
600
601 if (interpolate) {
602 AMREX_ASSERT(cc.nGrowVect().allGE(1));
603 }
604
605 const auto geomdata = geom.data();
606 RealBox real_slice;
607 if (bnd_rbx.ok()) {
608 real_slice = bnd_rbx;
609 } else {
610 real_slice = geom.ProbDomain();
611 }
612
613 Vector<int> slice_to_full_ba_map;
614 std::unique_ptr<MultiFab> slice = allocateSlice(dir, cc, ncomp, geom, coord, slice_to_full_ba_map, real_slice);
615
616 if (!slice) {
617 return nullptr;
618 }
619
620#ifdef AMREX_USE_OMP
621#pragma omp parallel if (Gpu::notInLaunchRegion())
622#endif
623 for (MFIter mfi(*slice, TilingIfNotGPU()); mfi.isValid(); ++mfi)
624 {
625 int slice_gid = mfi.index();
626 int full_gid = slice_to_full_ba_map[slice_gid];
627 auto& slice_fab = (*slice)[mfi];
628 auto const& full_fab = cc[full_gid];
629 Array4<Real> const& slice_arr = slice_fab.array();
630 Array4<Real const> const& full_arr = full_fab.const_array();
631
632 const Box& tile_box = mfi.tilebox();
633
634 if (interpolate)
635 {
636 AMREX_LAUNCH_HOST_DEVICE_LAMBDA( tile_box, thread_box,
637 {
638 amrex_fill_slice_interp(thread_box, slice_arr, full_arr,
639 0, start_comp, ncomp,
640 dir, coord, geomdata);
641 });
642 }
643 else
644 {
645 slice_fab.copy<RunOn::Device>(full_fab, tile_box, start_comp, tile_box, 0, ncomp);
646 }
647 }
648
649 return slice;
650 }
651
652 iMultiFab makeFineMask (const BoxArray& cba, const DistributionMapping& cdm,
653 const BoxArray& fba, const IntVect& ratio,

Callers

nothing calls this directly

Calls 13

allocateSliceFunction · 0.85
TilingIfNotGPUFunction · 0.85
amrex_fill_slice_interpFunction · 0.85
allGEMethod · 0.80
ProbDomainMethod · 0.80
tileboxMethod · 0.80
nGrowVectMethod · 0.45
dataMethod · 0.45
okMethod · 0.45
isValidMethod · 0.45
indexMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected