Box2D Struct 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
|
2D integer index space, cell-centered. More...
#include <box2d.hpp>
Collaboration diagram for pops::Box2D:Public Member Functions | |
| POPS_HD int | length (int d) const |
| Number of cells in direction d (= hi[d] - lo[d] + 1); negative if the box is empty. POPS_HD. | |
| POPS_HD int | nx () const |
| Width (direction 0). POPS_HD (called from Geometry::dx() in a device kernel). | |
| POPS_HD int | ny () const |
| Height (direction 1). POPS_HD (called from Geometry::dy() in a device kernel). | |
| std::int64_t | num_cells () const |
| Total number of cells (nx*ny, floored at 0 per direction): 0 if the box is empty. | |
| bool | empty () const |
| true if the box contains no cell (hi < lo in one direction). | |
| bool | contains (int i, int j) const |
| true if cell (i, j) is inside the box (lo/hi bounds inclusive). | |
| bool | contains (const Box2D &b) const |
| true if box b (non-empty) is entirely contained in *this. | |
| Box2D | grow (int n) const |
| Grows the box by n cells in ALL directions (uniform ghost layer). | |
| Box2D | grow (int d, int n) const |
| Grows by n cells in the SINGLE direction d (n may be negative to shrink). | |
| Box2D | shift (int d, int s) const |
| Translates the box by s cells in direction d (lo and hi shifted by the same s). | |
| Box2D | refine (int r) const |
| Refines by a ratio r: each cell becomes an r x r block ([lo, hi] -> [lo*r, hi*r + r-1]). | |
| Box2D | coarsen (int r) const |
| Coarsens by a ratio r via FLOOR division of each corner (handles the negative ghost indices). | |
| Box2D | intersect (const Box2D &o) const |
| Intersection of the two boxes (possibly empty: hi < lo if they do not overlap). | |
| bool | operator== (const Box2D &) const =default |
Static Public Member Functions | |
| static Box2D | from_extents (int nx, int ny) |
| Box [0, nx-1] x [0, ny-1] covering nx*ny cells from the index origin. | |
Public Attributes | |
| int | lo [2] {0, 0} |
| int | hi [2] {-1, -1} |
Detailed Description
2D integer index space, cell-centered.
Corners lo/hi INCLUSIVE; box empty if hi < lo. Pure POD (no field data): trivially copyable, capturable by value inside a kernel. INVARIANT: indices may be negative (ghosts); refine/coarsen are block-wise bijections (refine then coarsen gives back the box, but coarsen then refine rounds it to the block).
Member Function Documentation
◆ coarsen()
|
inline |
Coarsens by a ratio r via FLOOR division of each corner (handles the negative ghost indices).
Here is the call graph for this function:◆ contains() [1/2]
|
inline |
true if box b (non-empty) is entirely contained in *this.
Here is the call graph for this function:◆ contains() [2/2]
|
inline |
true if cell (i, j) is inside the box (lo/hi bounds inclusive).
Here is the caller graph for this function:◆ empty()
|
inline |
true if the box contains no cell (hi < lo in one direction).
Here is the caller graph for this function:◆ from_extents()
|
inlinestatic |
Box [0, nx-1] x [0, ny-1] covering nx*ny cells from the index origin.
Here is the call graph for this function:
Here is the caller graph for this function:◆ grow() [1/2]
|
inline |
Grows by n cells in the SINGLE direction d (n may be negative to shrink).
◆ grow() [2/2]
|
inline |
Grows the box by n cells in ALL directions (uniform ghost layer).
Here is the caller graph for this function:◆ intersect()
Intersection of the two boxes (possibly empty: hi < lo if they do not overlap).
Here is the caller graph for this function:◆ length()
|
inline |
Number of cells in direction d (= hi[d] - lo[d] + 1); negative if the box is empty. POPS_HD.
Here is the caller graph for this function:◆ num_cells()
|
inline |
Total number of cells (nx*ny, floored at 0 per direction): 0 if the box is empty.
Here is the call graph for this function:
Here is the caller graph for this function:◆ nx()
|
inline |
Width (direction 0). POPS_HD (called from Geometry::dx() in a device kernel).
Here is the call graph for this function:
Here is the caller graph for this function:◆ ny()
|
inline |
Height (direction 1). POPS_HD (called from Geometry::dy() in a device kernel).
Here is the call graph for this function:
Here is the caller graph for this function:◆ operator==()
|
default |
◆ refine()
|
inline |
Refines by a ratio r: each cell becomes an r x r block ([lo, hi] -> [lo*r, hi*r + r-1]).
Here is the caller graph for this function:◆ shift()
|
inline |
Translates the box by s cells in direction d (lo and hi shifted by the same s).
Member Data Documentation
◆ hi
| int pops::Box2D::hi[2] {-1, -1} |
◆ lo
| int pops::Box2D::lo[2] {0, 0} |
The documentation for this struct was generated from the following file:
- include/pops/mesh/index/box2d.hpp
Generated by