MultiFab Class ReferenceΒΆ

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

Field distributed over a level: decomposition (BoxArray) + distribution (DistributionMapping) + ncomp components + ngrow ghosts. More...

#include <multifab.hpp>

+ Collaboration diagram for pops::MultiFab:

Public Member Functions

 MultiFab ()=default
 
 MultiFab (BoxArray ba, DistributionMapping dm, int ncomp, int ngrow)
 Builds the field: allocates one Fab2D (ncomp components, ngrow ghosts) for EACH box that this rank owns according to dm.
 
const BoxArraybox_array () const
 GLOBAL decomposition of the level (all boxes, all ranks).
 
const DistributionMappingdmap () const
 GLOBAL distribution (owner rank per box).
 
int ncomp () const
 Number of components.
 
int n_grow () const
 Number of ghost layers.
 
int local_size () const
 Number of fabs OWNED by this rank (bound on local indices).
 
Fab2Dfab (int li)
 Local fab at index li (0 <= li < local_size()), for writing.
 
const Fab2Dfab (int li) const
 Local fab at index li, for reading.
 
const Box2Dbox (int li) const
 VALID box of local fab li.
 
int global_index (int li) const
 GLOBAL index (in box_array) of local fab li.
 
int local_index_of (int global) const
 LOCAL index of the global box global, or -1 if it is not owned by this rank.
 
void sync_host ()
 Makes the HOST residence valid (before a host access: operator(), loop, set_val).
 
void sync_device ()
 Marks a DEVICE residence (before a kernel). No-op under unified memory.
 
void set_val (Real v)
 Fills all cells (valid + ghosts) of every local fab with v.
 
HaloScheduleCachehalo_cache () const
 Internal (ADC-260): memoized halo-exchange schedule used by fill_boundary.
 

Detailed Description

Field distributed over a level: decomposition (BoxArray) + distribution (DistributionMapping) + ncomp components + ngrow ghosts.

Allocates only the fabs owned by THIS rank; iteration runs over local_size() (LOCAL indices). global_index/local_index_of bridge local <-> global.

Constructor & Destructor Documentation

◆ MultiFab() [1/2]

pops::MultiFab::MultiFab ( )
default

◆ MultiFab() [2/2]

pops::MultiFab::MultiFab ( BoxArray  ba,
DistributionMapping  dm,
int  ncomp,
int  ngrow 
)
inline

Builds the field: allocates one Fab2D (ncomp components, ngrow ghosts) for EACH box that this rank owns according to dm.

Boxes belonging to other ranks are not allocated here.

+ Here is the call graph for this function:

Member Function Documentation

◆ box()

const Box2D & pops::MultiFab::box ( int  li) const
inline

VALID box of local fab li.

+ Here is the caller graph for this function:

◆ box_array()

const BoxArray & pops::MultiFab::box_array ( ) const
inline

GLOBAL decomposition of the level (all boxes, all ranks).

+ Here is the caller graph for this function:

◆ dmap()

const DistributionMapping & pops::MultiFab::dmap ( ) const
inline

GLOBAL distribution (owner rank per box).

+ Here is the caller graph for this function:

◆ fab() [1/2]

Fab2D & pops::MultiFab::fab ( int  li)
inline

Local fab at index li (0 <= li < local_size()), for writing.

◆ fab() [2/2]

const Fab2D & pops::MultiFab::fab ( int  li) const
inline

Local fab at index li, for reading.

◆ global_index()

int pops::MultiFab::global_index ( int  li) const
inline

GLOBAL index (in box_array) of local fab li.

◆ halo_cache()

HaloScheduleCache & pops::MultiFab::halo_cache ( ) const
inline

Internal (ADC-260): memoized halo-exchange schedule used by fill_boundary.

Lazily created on first use. The schedule is a pure function of (box_array, dmap, n_grow) for a given (Periodicity, domain); since none of ba_/dm_/ngrow_ has an in-place setter, the cache can only go stale through whole-object (re)assignment (e.g. AMR regrid builds a fresh MultiFab and move-assigns it over the level slot), which drops the cache with the object. It is shared on copy (a copy has the same layout), which keeps copies consistent. Not part of the public numerical API. Returned by reference so fill_boundary can populate it.

+ Here is the caller graph for this function:

◆ local_index_of()

int pops::MultiFab::local_index_of ( int  global) const
inline

LOCAL index of the global box global, or -1 if it is not owned by this rank.

+ Here is the caller graph for this function:

◆ local_size()

int pops::MultiFab::local_size ( ) const
inline

Number of fabs OWNED by this rank (bound on local indices).

+ Here is the caller graph for this function:

◆ n_grow()

int pops::MultiFab::n_grow ( ) const
inline

Number of ghost layers.

+ Here is the caller graph for this function:

◆ ncomp()

int pops::MultiFab::ncomp ( ) const
inline

Number of components.

+ Here is the caller graph for this function:

◆ set_val()

void pops::MultiFab::set_val ( Real  v)
inline

Fills all cells (valid + ghosts) of every local fab with v.

Synchronizes host residence first (a kernel may have written these fabs).

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sync_device()

void pops::MultiFab::sync_device ( )
inline

Marks a DEVICE residence (before a kernel). No-op under unified memory.

+ Here is the call graph for this function:

◆ sync_host()

void pops::MultiFab::sync_host ( )
inline

Makes the HOST residence valid (before a host access: operator(), loop, set_val).

Under unified memory = a targeted device_fence().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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