|
Classes | |
| struct | GrAL::grid_types< Grid > |
| Empty traits class for parameterized namespaces associated with a grid.
This has to be specialized for concrete grid types. More... | |
| struct | GrAL::grid_types_detail::grid_types_root |
| Class to be inherited by concrete grid_types base classes. More... | |
| struct | GrAL::grid_types_base< GTBASE > |
| Plugin-in base class for grid_types<> specializations. More... | |
| struct | GrAL::iterator< E, A, GT > |
Meta-function returning iterator with anchor A and value E. More... | |
grid_types is the main vehicle to collect and transport type information on a grid. The specializations of grid_types for a concrete grid type provide access to grid related types likeVertex, Edge, ....vertex_handle, ...VertexIterator, ....archetype_type,archetype_iterator,archetype_handle,archgt
See grid_types_base<> for advice and an example of specialization.
Example for code using grid types:
typedef grid_types<Complex2D> gt; for(gt::VertexIterator v = G.FirstVertex(); ...) do_something(*v);
Dimension-independent access to sequence and incidence iterators: There are a number of meta-functions available to ease access to dimension-dependent types like elements and iterators:
// same as gt::VertexIterator typedef typename sequence_iterator <gt,vertex_type_tag>::type VIterator; typedef typename sequence_iterator_d<gt,0 >::type VIterator; // same as gt::VertexOnCellIterator typedef typename incidence_iterator <gt,vertex_type_tag, cell_type_tag>::type VoCIterator; const int D = gt::dimension_tag::dim; typedef typename incidence_iterator_d<gt,0, D>::type VoCIterator;
This is useful in context which are generic over the element category, that is, are intended to work uniformly for vertices, edges etc., and where for instance the type of an iterator must be synthetized from an element type:
template<class ELEMENT> class SomeAlgorithm { typedef grid_types<ELEMENT> gt; typedef typename ELEMENT::element_type_tag etag; typedef typename sequence_iterator<gt, etag>::type ElementIterator; typedef typename incidence_iterator<gt, etag, cell_type_tag>::type ElementOnCellIterator; ... };
As can be seen, those meta-functions come in two flavors, taking tag types and intgral dimensions:
| tagged version | numeric version |
| GrAL::element | GrAL::element_d |
| GrAL::element_handle | GrAL::element_handle_d |
| GrAL::sequence_iterator | GrAL::sequence_iterator_d |
| GrAL::incidence_iterator | GrAL::incidence_iterator_d |
The tagged versions cover grid of dimension up to 4 (because there are 5 predefined tags: GrAL::vertex_type_tag (dim=1), GrAL::edge_type_tag (dim=2), GrAL::face_type_tag (dim=3), GrAL::facet_type_tag (codim=1), GrAL::cell_type_tag (codim=0), and for these grids the above meta functions are defined automatically.
For higher-dimensional grids, the implementor of the grid type should specialize the numeric versions (xxx_d) to deliver the correct results for all dimensions. See for instance the GrAL-CartesianND package.
1.5.8