1
// Copyright (C) 2003-2005 Johan Hoffman and Anders Logg.
2
// Licensed under the GNU GPL Version 2.
4
// Modified by Garth N. Wells 2005.
7
// Last changed: 2005-12-01
9
#ifndef __EDGE_ITERATOR_H
10
#define __EDGE_ITERATOR_H
12
#include <dolfin/PArray.h>
13
#include <dolfin/PList.h>
14
#include <dolfin/Table.h>
30
typedef Edge* EdgePointer;
36
EdgeIterator(const Mesh& mesh);
37
EdgeIterator(const Mesh* mesh);
39
EdgeIterator(const Boundary& boundary);
40
EdgeIterator(const Boundary* boundary);
42
EdgeIterator(const Vertex& vertex);
43
EdgeIterator(const VertexIterator& vertexIterator);
45
EdgeIterator(const Cell& cell);
46
EdgeIterator(const CellIterator& cellIterator);
48
EdgeIterator(const Face& face);
49
EdgeIterator(const FaceIterator& faceIterator);
53
operator EdgePointer() const;
55
EdgeIterator& operator++();
60
Edge& operator*() const;
61
Edge* operator->() const;
62
bool operator==(const EdgeIterator& n) const;
63
bool operator!=(const EdgeIterator& n) const;
65
// Base class for edge iterators
66
class GenericEdgeIterator {
69
virtual void operator++() = 0;
70
virtual bool end() = 0;
71
virtual bool last() = 0;
72
virtual int index() = 0;
74
virtual ~GenericEdgeIterator() {};
76
virtual Edge& operator*() const = 0;
77
virtual Edge* operator->() const = 0;
78
virtual Edge* pointer() const = 0;
82
// Iterator for the edges in a mesh
83
class MeshEdgeIterator : public GenericEdgeIterator {
86
MeshEdgeIterator(const Mesh& mesh);
93
Edge& operator*() const;
94
Edge* operator->() const;
95
Edge* pointer() const;
97
Table<Edge>::Iterator edge_iterator;
98
Table<Edge>::Iterator at_end;
102
// Iterator for the edges on a boundary
103
class BoundaryEdgeIterator : public GenericEdgeIterator {
106
BoundaryEdgeIterator(const Boundary& boundary);
112
Edge& operator*() const;
113
Edge* operator->() const;
114
Edge* pointer() const;
118
PList<Edge*>::Iterator edge_iterator;
122
// Iterator for the edges at a vertex
123
class VertexEdgeIterator : public GenericEdgeIterator {
126
VertexEdgeIterator(const Vertex& vertex);
132
Edge& operator*() const;
133
Edge* operator->() const;
134
Edge* pointer() const;
138
PArray<Edge*>::Iterator edge_iterator;
142
// Iterator for the edges in a cell
143
class CellEdgeIterator : public GenericEdgeIterator {
146
CellEdgeIterator(const Cell& cell);
152
Edge& operator*() const;
153
Edge* operator->() const;
154
Edge* pointer() const;
158
PArray<Edge*>::Iterator edge_iterator;
162
// Iterator for the edges in a face
163
class FaceEdgeIterator : public GenericEdgeIterator {
166
FaceEdgeIterator(const Face& face);
172
Edge& operator*() const;
173
Edge* operator->() const;
174
Edge* pointer() const;
178
PArray<Edge*>::Iterator edge_iterator;
184
GenericEdgeIterator* e;