include/pops/mesh/boundary/fill_boundary.hpp File ReferenceΒΆ

adc_cpp: include/pops/mesh/boundary/fill_boundary.hpp File Reference
adc_cpp 0.3.0
Model-free C++23 core for coupled hyperbolic-elliptic systems on adaptive (AMR) meshes, with MPI and GPU (Kokkos) backends
fill_boundary.hpp File Reference

fill_boundary: INTRA-level halo exchange (fills ghosts from neighbors). More...

#include <pops/mesh/index/box2d.hpp>
#include <pops/mesh/index/box_hash.hpp>
#include <pops/mesh/storage/fab2d.hpp>
#include <pops/mesh/execution/for_each.hpp>
#include <pops/mesh/boundary/halo_schedule.hpp>
#include <pops/mesh/storage/multifab.hpp>
#include <pops/parallel/comm.hpp>
#include <cstdint>
#include <memory>
#include <utility>
#include <vector>
+ Include dependency graph for fill_boundary.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pops::Periodicity
 Per-direction periodicity: halo wrapping in x and/or y during the exchange (false = open edge, left to the physical BCs). More...
 
struct  pops::detail::CopyShiftedKernel
 
struct  pops::detail::PackKernel
 
struct  pops::detail::UnpackKernel
 
struct  pops::HaloExchange
 Opaque state of an in-flight halo exchange, returned by fill_boundary_begin and consumed by fill_boundary_end. More...
 

Namespaces

namespace  pops
 
namespace  pops::detail
 

Functions

void pops::detail::copy_shifted (Fab2D &dst, const Fab2D &src, const Box2D &region, int sx, int sy, int ncomp)
 
void pops::detail::build_halo_schedule (const MultiFab &mf, const Box2D &domain, Periodicity per, HaloSchedule &sched)
 
std::shared_ptr< const HaloSchedulepops::detail::get_halo_schedule (const MultiFab &mf, const Box2D &domain, Periodicity per)
 
HaloExchange pops::fill_boundary_begin (MultiFab &mf, const Box2D &domain, Periodicity per={})
 Phase 1 (non-blocking): does the LOCAL halo copies and posts the Isend/Irecv of the distant halos.
 
void pops::fill_boundary_end (MultiFab &mf, HaloExchange &h)
 Phase 2 (blocking): MPI_Waitall on the transfers posted by begin, then unpacks the received buffers into the ghosts.
 
void pops::fill_boundary (MultiFab &mf, const Box2D &domain, Periodicity per={})
 BLOCKING halo exchange: begin then end immediately (no overlap).
 

Detailed Description

fill_boundary: INTRA-level halo exchange (fills ghosts from neighbors).

Fills the ghosts of each Fab from the VALID regions of neighboring boxes in the same MultiFab, with optional periodic wrapping. Single-rank: direct memory copies. Multi-rank (POPS_HAS_MPI + n_ranks()>1): metadata is REPLICATED -> each rank enumerates DETERMINISTICALLY the same job list, so buffers line up without negotiating sizes (MPI_Isend/Irecv, tag 0). Two-phase API (classic compute/comm overlap): fill_boundary_begin posts the exchanges, fill_boundary_end waits and unpacks; fill_boundary chains both (blocking). Ghosts OUTSIDE the domain without periodicity are NOT touched here (those are the physical BCs, physical_bc.hpp). The pack/unpack kernels are device-clean NAMED FUNCTORS (nvcc limitation).

The job schedule (BoxHash + local/global enumeration) is MEMOIZED per (layout, Periodicity, domain) on the MultiFab (ADC-260, halo_schedule.hpp): it is a pure function of the invariant layout, so only the copy/pack/MPI/unpack of the live data reruns. The plan is replayed in the SAME deterministic order as the original inline enumeration -> bit-identical buffers.