   Grid Range Concept

### Grid Range Concept

##### Description

A Grid Range is a part of a grid, its base grid. The underlying mathematical concept is that of (a subset of) a (finite) CW-complex. Some well-known specializations of this concept are triangulations boundary complexes of convex polytopes and regular Cartesian grids.

A Grid Range behaves in most circumstances like a Grid The main difference is that a Grid Range has reference semantics with respect to its underlying base grid, that is, the incidence relationship is determined by the base grid. This influences the behaviour of Incidence Iterators associated with a Grid Range, which may visit grid elements that are contained in the base grid, but not in the grid range X A Grid is a special case of a Grid Range X
NOTE: A grid range as such does offer almost no functionality at all. Any useful model will be a specialization of one or more element ranges X like Grid Vertex Range.

STL Assignable

##### Notation

R is a type which is a model of grid range
r is an object of type R
G is R::grid_type

##### Associated types
 Name Expression Description base grid R::grid_type type of the ranges' base grid X

##### Valid Expressions
 Name Expression Type requirements return type base grid reference r.TheGrid() grid_type const&

##### Expression semantics
 Name Expression Precondition Semantics Postcondition base grid reference G const& g = r.TheGrid() r has not been default constructed get the grid r references &g == &(g.TheGrid()) == &(r.TheGrid())

##### Notes
1. If R is a model of Grid, then R::grid_type is identical to R. An object r of type R then references itself via r.TheGrid(), that is, it has value semantics.
2. Technically, these types are bundled in a struct grid_types<R> which is used by the algorithms to access these types. This opens up the possibility to parameterize algorithms by such a traits class like grid_types<R>, thereby introducing different iterator and element types, for example counting iterators or debug iterators producing graphical output.

In this case, it would be more precise to say that one "associates types with R", instead of speaking of "types associated with R".

3. This may seem as an odd behaviour. However, this faithfully reflects what many locally operating grid-based algorithms are intuitively expected to do when given a proper subrange of a grid: The range restricts the region where some work is to be done, but on each element, the algorithm accesses also some meighboring elements via incidence iterators, which may or may not belong to the range. The most striking example for this occurs if grids are distributed with some overlap: On each part, the algorithm works only on the locally owned range, but it accesses also elements in the overlap which are copied from other parts.
4. It is not necessary to require all possible element types to be defined. Useful examples are Input Grids, such as IstreamComplex2DFmt which are used just to read a grid from a specific file format.   Grid Range Concept