Fab2D Class ReferenceΒΆ

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

Single-grid data on a Box2D: VALID box + ng ghost layers, ncomp components, component-slow layout. More...

#include <fab2d.hpp>

+ Collaboration diagram for pops::Fab2D:

Public Member Functions

 Fab2D ()=default
 
 Fab2D (const Box2D &valid, int ncomp, int ng)
 Allocates the valid box grown by ng ghosts, ncomp components, initialized to 0.
 
const Box2D & box () const
 VALID box (without ghosts).
 
const Box2D & grown_box () const
 Grown box (valid + ng ghosts) = actual memory footprint.
 
int ncomp () const
 Number of components.
 
int n_ghost () const
 Number of ghost layers.
 
std::int64_t size () const
 Buffer size (nx_tot * ny_tot * ncomp).
 
Real & operator() (int i, int j, int c=0)
 HOST write access (i, j, c) (bounds assert in debug).
 
Real operator() (int i, int j, int c=0) const
 HOST read access (i, j, c) (bounds assert in debug).
 
Array4 array ()
 WRITE handle (POD device-copyable) over this Fab. Valid as long as the Fab lives.
 
ConstArray4 const_array () const
 READ handle (POD device-copyable) over this Fab. Valid as long as the Fab lives.
 
Real * data ()
 Raw pointer to the buffer (passed directly to MPI in unified memory, for instance).
 
const Real * data () const
 
void set_val (Real v)
 Fills the whole buffer (valid + ghosts) with value v.
 

Detailed Description

Single-grid data on a Box2D: VALID box + ng ghost layers, ncomp components, component-slow layout.

OWNS its buffer (unified memory). Exposes Array4 / ConstArray4 handles to kernels (capture by value), never the Fab itself.

Constructor & Destructor Documentation

◆ Fab2D() [1/2]

pops::Fab2D::Fab2D ( )
default

◆ Fab2D() [2/2]

pops::Fab2D::Fab2D ( const Box2D &  valid,
int  ncomp,
int  ng 
)
inline

Allocates the valid box grown by ng ghosts, ncomp components, initialized to 0.

Member Function Documentation

◆ array()

Array4 pops::Fab2D::array ( )
inline

WRITE handle (POD device-copyable) over this Fab. Valid as long as the Fab lives.

+ Here is the caller graph for this function:

◆ box()

const Box2D & pops::Fab2D::box ( ) const
inline

VALID box (without ghosts).

+ Here is the caller graph for this function:

◆ const_array()

ConstArray4 pops::Fab2D::const_array ( ) const
inline

READ handle (POD device-copyable) over this Fab. Valid as long as the Fab lives.

+ Here is the caller graph for this function:

◆ data() [1/2]

Real * pops::Fab2D::data ( )
inline

Raw pointer to the buffer (passed directly to MPI in unified memory, for instance).

◆ data() [2/2]

const Real * pops::Fab2D::data ( ) const
inline

◆ grown_box()

const Box2D & pops::Fab2D::grown_box ( ) const
inline

Grown box (valid + ng ghosts) = actual memory footprint.

+ Here is the caller graph for this function:

◆ n_ghost()

int pops::Fab2D::n_ghost ( ) const
inline

Number of ghost layers.

+ Here is the caller graph for this function:

◆ ncomp()

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

Number of components.

◆ operator()() [1/2]

Real & pops::Fab2D::operator() ( int  i,
int  j,
int  c = 0 
)
inline

HOST write access (i, j, c) (bounds assert in debug).

Do not call inside a device kernel: go through array() (POD handle).

◆ operator()() [2/2]

Real pops::Fab2D::operator() ( int  i,
int  j,
int  c = 0 
) const
inline

HOST read access (i, j, c) (bounds assert in debug).

◆ set_val()

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

Fills the whole buffer (valid + ghosts) with value v.

◆ size()

std::int64_t pops::Fab2D::size ( ) const
inline

Buffer size (nx_tot * ny_tot * ncomp).

+ Here is the caller graph for this function:

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