AmrHierarchy Class ReferenceΒΆ

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

Stack of refined levels (domain + BoxArray + MultiFab per level), level 0 the coarsest. More...

#include <amr_hierarchy.hpp>

+ Collaboration diagram for pops::AmrHierarchy:

Public Member Functions

 AmrHierarchy (const Box2D &coarse_domain, int max_grid_size, int ncomp, int ngrow, int ref_ratio=kAmrRefRatio)
 Builds the hierarchy with only its level 0 (coarse).
 
void add_level (const BoxArray &fine_ba)
 Adds a fine level defined by its BoxArray (in fine index space).
 
void install_level (int lev, const BoxArray &fine_ba, MultiFab data)
 Installs (adds or replaces) a fine level at index lev.
 
void clear_above (int lev)
 Removes all levels strictly finer than lev (no-op if lev is already the finest).
 
int num_levels () const
 Number of levels present (>= 1: level 0 always exists).
 
int ref_ratio () const
 Integer refinement ratio between consecutive levels.
 
int ncomp () const
 Number of field components per cell.
 
int n_grow () const
 Number of ghost layers of the MultiFab.
 
const Box2D & domain (int lev) const
 Domain of level lev in index space (INCLUSIVE lo/hi corners).
 
const BoxArray & boxes (int lev) const
 BoxArray (split into boxes) of level lev.
 
MultiFab & data (int lev)
 Field of level lev (mutable access).
 
const MultiFab & data (int lev) const
 Field of level lev (const access).
 

Detailed Description

Stack of refined levels (domain + BoxArray + MultiFab per level), level 0 the coarsest.

Usage: built with only level 0 (coarse), then expanded by add_level / install_level (static) or by regrid_level (dynamic). Contract: fixed integer ref_ratio; domain(lev) follows from domain(lev-1) by refine(ref_ratio). Invariants: domain_, ba_ and data_ stay of length num_levels(); install/clear truncate the finer levels to keep the stack consistent.

Constructor & Destructor Documentation

◆ AmrHierarchy()

pops::AmrHierarchy::AmrHierarchy ( const Box2D &  coarse_domain,
int  max_grid_size,
int  ncomp,
int  ngrow,
int  ref_ratio = kAmrRefRatio 
)
inline

Builds the hierarchy with only its level 0 (coarse).

Parameters
coarse_domaindomain of level 0 in index space (INCLUSIVE lo/hi corners).
max_grid_sizemax box size for the split into BoxArray.
ncompnumber of field components per cell.
ngrownumber of ghost layers of the MultiFab.
ref_ratiointeger refinement ratio; only kAmrRefRatio (2) is supported today and any other value is rejected at construction (see refinement_ratio.hpp).
+ Here is the call graph for this function:

Member Function Documentation

◆ add_level()

void pops::AmrHierarchy::add_level ( const BoxArray &  fine_ba)
inline

Adds a fine level defined by its BoxArray (in fine index space).

Parameters
fine_baboxes of the new level, expressed in the refined index space. The level domain is deduced by refine(ref_ratio) from the previous level domain.
+ Here is the call graph for this function:

◆ boxes()

const BoxArray & pops::AmrHierarchy::boxes ( int  lev) const
inline

BoxArray (split into boxes) of level lev.

◆ clear_above()

void pops::AmrHierarchy::clear_above ( int  lev)
inline

Removes all levels strictly finer than lev (no-op if lev is already the finest).

+ Here is the call graph for this function:

◆ data() [1/2]

MultiFab & pops::AmrHierarchy::data ( int  lev)
inline

Field of level lev (mutable access).

+ Here is the caller graph for this function:

◆ data() [2/2]

const MultiFab & pops::AmrHierarchy::data ( int  lev) const
inline

Field of level lev (const access).

◆ domain()

const Box2D & pops::AmrHierarchy::domain ( int  lev) const
inline

Domain of level lev in index space (INCLUSIVE lo/hi corners).

◆ install_level()

void pops::AmrHierarchy::install_level ( int  lev,
const BoxArray &  fine_ba,
MultiFab  data 
)
inline

Installs (adds or replaces) a fine level at index lev.

Used by the regrid.

Parameters
levindex of the level to install; must satisfy 1 <= lev <= num_levels().
fine_baboxes of the level in the refined index space.
dataMultiFab already built for this level (transferred by move). Replacing an existing level INVALIDATES and removes all finer levels.
+ Here is the call graph for this function:

◆ n_grow()

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

Number of ghost layers of the MultiFab.

◆ ncomp()

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

Number of field components per cell.

+ Here is the caller graph for this function:

◆ num_levels()

int pops::AmrHierarchy::num_levels ( ) const
inline

Number of levels present (>= 1: level 0 always exists).

+ Here is the caller graph for this function:

◆ ref_ratio()

int pops::AmrHierarchy::ref_ratio ( ) const
inline

Integer refinement ratio between consecutive levels.

+ Here is the caller graph for this function:

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