![]() |
00001 // Copyright (C) 2003 Johan Hoffman and Anders Logg. 00002 // Licensed under the GNU GPL Version 2. 00003 00004 #ifndef __FACE_ITERATOR_H 00005 #define __FACE_ITERATOR_H 00006 00007 #include <dolfin/Array.h> 00008 #include <dolfin/List.h> 00009 #include <dolfin/Table.h> 00010 00011 namespace dolfin { 00012 00013 class Mesh; 00014 class Cell; 00015 class Face; 00016 class Boundary; 00017 00018 typedef Face* FacePointer; 00019 00020 class FaceIterator { 00021 public: 00022 00023 FaceIterator(const Mesh& mesh); 00024 FaceIterator(const Mesh* mesh); 00025 00026 FaceIterator(const Boundary& boundary); 00027 FaceIterator(const Boundary* boundary); 00028 00029 FaceIterator(const Cell& cell); 00030 FaceIterator(const CellIterator& cellIterator); 00031 00032 ~FaceIterator(); 00033 00034 operator FacePointer() const; 00035 00036 FaceIterator& operator++(); 00037 bool end(); 00038 bool last(); 00039 int index(); 00040 00041 Face& operator*() const; 00042 Face* operator->() const; 00043 bool operator==(const FaceIterator& f) const; 00044 bool operator!=(const FaceIterator& f) const; 00045 bool operator==(const Face& f) const; 00046 bool operator!=(const Face& f) const; 00047 00048 // Base class for face iterators 00049 class GenericFaceIterator { 00050 public: 00051 00052 virtual void operator++() = 0; 00053 virtual bool end() = 0; 00054 virtual bool last() = 0; 00055 virtual int index() = 0; 00056 00057 virtual Face& operator*() const = 0; 00058 virtual Face* operator->() const = 0; 00059 virtual Face* pointer() const = 0; 00060 00061 }; 00062 00063 // Iterator for the faces in a mesh 00064 class MeshFaceIterator : public GenericFaceIterator { 00065 public: 00066 00067 MeshFaceIterator(const Mesh& mesh); 00068 00069 void operator++(); 00070 bool end(); 00071 bool last(); 00072 int index(); 00073 00074 Face& operator*() const; 00075 Face* operator->() const; 00076 Face* pointer() const; 00077 00078 Table<Face>::Iterator face_iterator; 00079 Table<Face>::Iterator at_end; 00080 00081 }; 00082 00083 // Iterator for the faces on a boundary 00084 class BoundaryFaceIterator : public GenericFaceIterator { 00085 public: 00086 00087 BoundaryFaceIterator(const Boundary& boundary); 00088 void operator++(); 00089 bool end(); 00090 bool last(); 00091 int index(); 00092 00093 Face& operator*() const; 00094 Face* operator->() const; 00095 Face* pointer() const; 00096 00097 private: 00098 00099 List<Face*>::Iterator face_iterator; 00100 00101 }; 00102 00103 // Iterator for the faces in a cell 00104 class CellFaceIterator : public GenericFaceIterator { 00105 public: 00106 00107 CellFaceIterator(const Cell& cell); 00108 void operator++(); 00109 bool end(); 00110 bool last(); 00111 int index(); 00112 00113 Face& operator*() const; 00114 Face* operator->() const; 00115 Face* pointer() const; 00116 00117 private: 00118 00119 Array<Face*>::Iterator face_iterator; 00120 00121 }; 00122 00123 private: 00124 00125 GenericFaceIterator* f; 00126 00127 }; 00128 00129 } 00130 00131 #endif
Documentation automatically generated with Doxygen on 10 Sep 2004.