OpenVolumeMesh is shipped with a set of useful iterators and circulators to comfortably address the entities (local neighborhood of entities) in a polyhedral mesh. See Section Iterators and Circulators for a more detailed description of all available iterators and circulators. In this tutorial, we examine how to use the iterators that come along with OpenVolumeMesh.
In the first example, we simply iterate over all half-edges of a mesh using the OpenVolumeMesh::HalfEdgeIter iterator class:
In the next example, we iterate over all incident outgoing half-edges of a given vertex. Note that this iterator needs bottom-up incidences which are computed automatically per default. Otherwise, the iterator would not be valid. See Section The Bottom-Up Incidence Relation for information on the bottom-up incidences.
In the last example, we create a hexahedral mesh and use its specialized OpenVolumeMesh::CellSheetCellIter iterator class. This iterator expects a cell handle as parameter and iterates over all adjacent cells in the same sheet. A sheet is, in the terms of the spatial twist continuum, short STC, a "layer" of hexahedra as illustrated in the following figure. For rurther reading on STC, refer to MurdochSTC. The gray shaded hexahedra form a sheet, all other cells (except the outlines of the boundary cells) are invisible in this illustration.
Starting from a hexahedron, we determine its virtual axis that is orthogonal to the desired sheet (note that there are always two opposing virtual axes that are orthogonal to such a sheet). We create our sheet iterator by passing the reference cell's handle as well as an orthogonal virtual axis with respect to that cell to the iterator's constructor. The iterators then iterates over all directly adjacent cells in the same sheet (those hexahedra that share a common face with the reference hexahedron). Consider the following code: