-
Notifications
You must be signed in to change notification settings - Fork 5
StaticGrid
Philipp Gschwandtner edited this page Jun 6, 2017
·
3 revisions
Defined in header "allscale/api/user/data/static_grid.h"
template<typename T, std::size_t ... Sizes>
class StaticGrid;The StaticGrid data structure represents a regular n-dimensional array of values, with a statically-fixed number of dimensions and a statically-fixed size.
| Member type | Definition |
|---|---|
dimensions |
The number of dimensions of this StaticGrid
|
coordinate_type |
StaticGridPoint<dimensions> |
region_type |
StaticGridRegion<dimensions> |
| Member function | Description |
|---|---|
StaticGrid() |
Constructs a StaticGrid
|
StaticGrid(const StaticGridPoint<dimensions>& size) |
Constructs a StaticGrid accepting a size parameter for compatibility with Grid, size must match the statically-defined size of the StaticGrid
|
StaticGrid(StaticGrid&&) |
Move constructor |
StaticGrid& operator=(StaticGrid&&) |
Move assignment operator |
coordinate_type size() const |
Returns the size of the StaticGrid
|
bool operator==(const StaticGrid& other) const |
Compares the full content of the StaticGrid
|
T& operator[](const coordinate_type& index) |
Mutable read/write access operator |
const T& operator[](const coordinate_type& index) const |
Immutable read/write access operator |
template<typename Op>void forEach(const Op& op) const
|
Sequential scan through all elements of the StaticGrid with immutable element access |
template<typename Op>void forEach(const Op& op)
|
Sequential scan through all elements of the StaticGrid with mutable element access |
template<typename Op>auto pforEach(const Op& op) const
|
Parllel scan through all elements of the StaticGrid with immutable element access |
template<typename Op>auto pforEach(const Op& op)
|
Parallel scan through all elements of the StaticGrid with mutable element access |
#include <allscale/api/user/data/grid.h>
using allscale::api::user::data;
// create a two-dimensional grid of integers of size 10x20
StaticGrid<int,10,20> staticGrid;
// initialize all elements with 1.0
staticGrid.pforEach([](int& element) { element = 1.0; });
// set element at position [7,9] to 5.0
staticGrid[{7,9}] = 5.0;Part of the AllScale project - http://www.allscale.eu