include/pops/mesh/index/box2d.hpp File ReferenceΒΆ

adc_cpp: include/pops/mesh/index/box2d.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
box2d.hpp File Reference

Box2D: the integer index space of a 2D cell-centered Cartesian grid. More...

#include <pops/core/foundation/types.hpp>
#include <algorithm>
#include <cstdint>
+ Include dependency graph for box2d.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pops::Box2D
 2D integer index space, cell-centered. More...
 

Namespaces

namespace  pops
 

Functions

POPS_HD constexpr int pops::floor_div (int a, int b)
 Integer division of a by b rounded down (handles a < 0 AND b < 0). POPS_HD constexpr (kernels).
 

Detailed Description

Box2D: the integer index space of a 2D cell-centered Cartesian grid.

Building block of the AMR stack, inspired by AMReX's Box. Corners lo / hi INCLUSIVE (AMReX convention); box EMPTY if hi < lo along a direction. Pure integer arithmetic: no data, no parallelism, fully testable. Indices may be NEGATIVE (ghost layers), hence the FLOOR division in coarsen (consistent on both sides of zero). length/nx/ny are POPS_HD (called from Geometry::dx()/dy() inside a device kernel). Concrete 2D to match the physical targets: 2D is an official, introspectable invariant of the core (pops.capabilities()["dimension"] == 2, ADR-0001 Decision 1; see docs/sphinx/reference/known-limitations.md), not an oversight. The move to a Dim-template (BoxND) is a generalization deferred to a future milestone (Option B).