HaloScheduleCache Class ReferenceΒΆ

adc_cpp: pops::HaloScheduleCache Class 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
pops::HaloScheduleCache Class Reference

Small per-MultiFab cache of halo schedules, one entry per distinct (Periodicity, domain). More...

#include <halo_schedule.hpp>

+ Collaboration diagram for pops::HaloScheduleCache:

Public Member Functions

std::shared_ptr< const HaloSchedulefind (bool px, bool py, const Box2D &dom) const
 Existing schedule for (px, py, dom), or nullptr if none is cached yet.
 
std::shared_ptr< HaloScheduleadd ()
 Appends a fresh, empty schedule and returns it for the caller to populate.
 
void clear ()
 Drops every cached schedule, forcing a rebuild on the next fill_boundary.
 
std::size_t size () const
 Number of cached schedules (test/instrumentation hook).
 

Detailed Description

Small per-MultiFab cache of halo schedules, one entry per distinct (Periodicity, domain).

In practice a MultiFab is filled with a single (Periodicity, domain) for its role, so this holds one or two entries; lookup is a short linear scan. Entries are shared_ptr so an in-flight HaloExchange can hold a stable handle to the plan it is replaying even if a later call appends a new entry. The cache LIVES ON the MultiFab (multifab.hpp); it is dropped when the MultiFab is reassigned (e.g. AMR regrid builds a fresh MultiFab and move-assigns it over the slot), which is the only way the layout changes, so a stale schedule can never be served. NOT thread-safe (the fill_boundary path is driven from a single host thread; Kokkos parallelism lives inside for_each).

Member Function Documentation

◆ add()

std::shared_ptr< HaloSchedule > pops::HaloScheduleCache::add ( )
inline

Appends a fresh, empty schedule and returns it for the caller to populate.

+ Here is the caller graph for this function:

◆ clear()

void pops::HaloScheduleCache::clear ( )
inline

Drops every cached schedule, forcing a rebuild on the next fill_boundary.

Used by tests to compare the cached path against a fresh rebuild; not needed in production (regrid drops the whole cache by reassigning the MultiFab).

◆ find()

std::shared_ptr< const HaloSchedule > pops::HaloScheduleCache::find ( bool  px,
bool  py,
const Box2D dom 
) const
inline

Existing schedule for (px, py, dom), or nullptr if none is cached yet.

+ Here is the caller graph for this function:

◆ size()

std::size_t pops::HaloScheduleCache::size ( ) const
inline

Number of cached schedules (test/instrumentation hook).


The documentation for this class was generated from the following file: