The Total Grid Function concept refines the Container Grid Function concept. A total grid function reserves storage to hold a value for each element in its range.
Name | Expression | Precondition | Semantics | Postcondition |
construction from grid | F f(g); | construct and bind f to g, allocate memory for f.size() values. |
f is bound to g
write access is allowed read access is undefined f.size() is equal to the cardinality of the range of f | |
construction and initialization | F f(g,t); |
construct and bind f to g,
allocate memory for f.size() values, initialize all values to t |
f is bound to g
write access is allowed f(e) is equal to t for all elements e in the range of f. f.size() is equal to the cardinality of the range of f | |
Binding to grid | f.set_grid(g); | f is unbound |
bind f to g,
allocate memory for f.size() values. |
f is bound to g
write access is allowed, read access is undefined f.size() is equal to the cardinality of the range of f |
Total grid functions for the Complex2D concrete grid, defined in grid-functions.h
For E = Complex2D::Vertex and E = Complex2D::Cell, the total grid functions are derived from grid_function_vector<E,T>; and for E = Complex2D::Edge, the total grid function is derived from grid_function_hash<E,T>. The reason is taht edges are not stored in the Complex2D data structure, and hence there is no consecutive index available for type Complex2D::Edge.