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

Function allocateSlice

Src/Base/AMReX_MultiFabUtil.cpp:28–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26
27
28 std::unique_ptr<MultiFab> allocateSlice (int dir, const MultiFab& cell_centered_data,
29 int ncomp, const Geometry& geom, Real dir_coord,
30 Vector<int>& slice_to_full_ba_map, RealBox real_slice) {
31
32 // Get our slice and convert to index space
33 real_slice.setLo(dir, dir_coord);
34 real_slice.setHi(dir, dir_coord);
35 Box slice_box = getIndexBox(real_slice, geom);
36
37 // define the multifab that stores slice
38 BoxArray const& ba = cell_centered_data.boxArray();
39 const DistributionMapping& dm = cell_centered_data.DistributionMap();
40 std::vector< std::pair<int, Box> > isects;
41 ba.intersections(slice_box, isects, false, 0);
42 Vector<Box> boxes;
43 Vector<int> procs;
44 for (auto const& is : isects) {
45 procs.push_back(dm[is.first]);
46 boxes.push_back(is.second);
47 slice_to_full_ba_map.push_back(is.first);
48 }
49 if (!boxes.empty()) {
50 BoxArray slice_ba(boxes.data(), static_cast<int>(boxes.size()));
51 DistributionMapping slice_dmap(std::move(procs));
52
53 return std::make_unique<MultiFab>(slice_ba, slice_dmap, ncomp, 0,
54 MFInfo(), FArrayBoxFactory());
55 } else {
56 return nullptr;
57 }
58 }
59}
60
61namespace amrex

Callers 1

get_slice_dataFunction · 0.85

Calls 11

getIndexBoxFunction · 0.85
MFInfoClass · 0.85
DistributionMapMethod · 0.80
intersectionsMethod · 0.80
setLoMethod · 0.45
setHiMethod · 0.45
boxArrayMethod · 0.45
push_backMethod · 0.45
emptyMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected