Template Class base_grid2D
Defined in File base_grid2D.hpp
Inheritance Relationships
Derived Types
public rcppsw::ds::grid2D< ral::mt_size_t >
(Template Class grid2D)public rcppsw::ds::grid2D< T >
(Template Class grid2D)public rcppsw::ds::grid2D_overlay< T >
(Template Class grid2D_overlay)
Class Documentation
-
template<typename T>
class base_grid2D Base class containing functionality common to all types of 2D grids.
Subclassed by rcppsw::ds::grid2D< ral::mt_size_t >, rcppsw::ds::grid2D< T >, rcppsw::ds::grid2D_overlay< T >
Public Types
Public Functions
-
base_grid2D(void) = default
-
virtual ~base_grid2D(void) = default
-
inline T &access(const coord_type &c)
-
inline const T &access(const coord_type &c) const
-
virtual T &access(size_t i, size_t j) = 0
Return a reference to the element at position (i, j) in the grid.
This is provided in the base class so that the pointer/object variants of the grid (grid2D, grid2D_overlay) can reduce code duplication.
-
inline bool contains(const coord_type &pt)
-
inline bool contains(size_t i, size_t j)
-
inline T &operator[](const coord_type &c)
-
inline const T &operator[](const coord_type &c) const
-
inline grid_view subcircle(const coord_type &c, size_t radius)
Get a subcircle gridview from a grid. The subcircle extent is cropped to the maximum boundaries of the parent grid.
This means that rather than getting a 2 x 2 subgrid centered at 0 with the out-of-bounds elements zeroed if you request a subcircle on the boundary of the overall grid, you will get a 1 x 2 subgrid (a lopsided circle).
- Parameters:
c – Coordinates of center of subcircle.
radius – Radius of subcircle.
- Returns:
The subcircle (closed interval).
-
inline const_grid_view subcircle(const coord_type &c, size_t radius) const
-
inline grid_view subgrid(const coord_type &ll, const coord_type &ur)
Create a subgrid from a grid.
- Parameters:
ll – Lower left of the subgrid, inclusive.
ur – Upper right of the subgrid, inclusive.
- Returns:
The subgrid (closed interval).
-
inline const_grid_view subgrid(const coord_type &ll, const coord_type &ur) const
-
virtual size_t xsize(void) const = 0
Get the size of the X dimension of the grid (i.e. what is the array index in X?)
-
virtual size_t ysize(void) const = 0
Get the size of the Y dimension of the grid (i.e. what is the array index in Y?)
-
base_grid2D(void) = default