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

Function computeNeighborProcs

Src/Particle/AMReX_ParticleUtil.cpp:22–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22Vector<int> computeNeighborProcs (const ParGDBBase* a_gdb, int ngrow)
23{
24 BL_PROFILE("amrex::computeNeighborProcs");
25
26 Vector<int> neighbor_procs;
27 for (int src_lev = 0; src_lev < a_gdb->finestLevel()+1; ++src_lev)
28 {
29 const auto& src_ba = a_gdb->ParticleBoxArray(src_lev);
30 const auto& src_dm = a_gdb->ParticleDistributionMap(src_lev);
31 for (MFIter mfi(src_ba, src_dm); mfi.isValid(); ++mfi)
32 {
33 const Box& src_box = mfi.validbox();
34 std::vector< std::pair<int, Box> > isects;
35 for (int lev = 0; lev < a_gdb->finestLevel()+1; ++lev)
36 {
37 Box box = src_box;
38 const IntVect& ref_fac = computeRefFac(a_gdb, src_lev, lev);
39 if (ref_fac < IntVect::TheZeroVector()) { box.coarsen(-1*ref_fac); }
40 else if (ref_fac > IntVect::TheZeroVector()) { box.refine(ref_fac); }
41 box.grow(computeRefFac(a_gdb, 0, src_lev)*ngrow);
42
43 const Periodicity& periodicity = a_gdb->Geom(lev).periodicity();
44 const std::vector<IntVect>& pshifts = periodicity.shiftIntVect();
45 const BoxArray& ba = a_gdb->ParticleBoxArray(lev);
46
47 for (auto const& pshift : pshifts)
48 {
49 const Box& pbox = box + pshift;
50 bool first_only = false;
51 ba.intersections(pbox, isects, first_only, 0);
52 for (const auto& isec : isects)
53 {
54 const int grid = isec.first;
55 const int global_proc = a_gdb->ParticleDistributionMap(lev)[grid];
56 const int proc = ParallelContext::global_to_local_rank(global_proc);
57 neighbor_procs.push_back(proc);
58 }
59 }
60 }
61 }
62 }
63
64 RemoveDuplicates(neighbor_procs);
65 return neighbor_procs;
66}
67}
68
69#ifdef AMREX_USE_HDF5_ASYNC

Callers 1

NeighborProcsMethod · 0.85

Calls 13

computeRefFacFunction · 0.85
global_to_local_rankFunction · 0.85
RemoveDuplicatesFunction · 0.85
refineMethod · 0.80
periodicityMethod · 0.80
GeomMethod · 0.80
shiftIntVectMethod · 0.80
intersectionsMethod · 0.80
finestLevelMethod · 0.45
isValidMethod · 0.45
validboxMethod · 0.45
coarsenMethod · 0.45

Tested by

no test coverage detected