43 |
surfaceMeshQuadrangles, |
surfaceMeshQuadrangles, |
44 |
} Type; |
} Type; |
45 |
|
|
|
public: |
|
|
typedef Cell* iterator; |
|
|
typedef Cell const * const_iterator; |
|
|
|
|
|
virtual Cell* begin() = 0; |
|
|
|
|
|
virtual Cell const * begin() const = 0; |
|
|
virtual Cell const * end() const = 0; |
|
|
|
|
46 |
private: |
private: |
47 |
//! The type of the mesh |
//! The type of the mesh |
48 |
const Type __type; |
const Type __type; |
49 |
|
|
50 |
protected: |
protected: |
51 |
|
|
52 |
|
template <typename MeshType, |
53 |
|
typename CellType = typename MeshType::ElementsGeometry> |
54 |
|
class T_iterator |
55 |
|
{ |
56 |
|
private: |
57 |
|
MeshType* __mesh; |
58 |
|
CellType* __iterator; |
59 |
|
size_t __number; |
60 |
|
|
61 |
|
public: |
62 |
|
typedef enum { |
63 |
|
Begin, |
64 |
|
End |
65 |
|
} Position; |
66 |
|
|
67 |
|
inline CellType& operator*() |
68 |
|
{ |
69 |
|
return *__iterator; |
70 |
|
} |
71 |
|
|
72 |
|
inline CellType* pointer() const |
73 |
|
{ |
74 |
|
return __iterator; |
75 |
|
} |
76 |
|
|
77 |
|
inline bool end() const |
78 |
|
{ |
79 |
|
return (__number >= __mesh->numberOfCells()); |
80 |
|
} |
81 |
|
|
82 |
|
inline bool operator<(const T_iterator<MeshType, CellType>& i) const |
83 |
|
{ |
84 |
|
return (__number < i.__number); |
85 |
|
} |
86 |
|
|
87 |
|
const T_iterator<MeshType, CellType>& |
88 |
|
operator=(const T_iterator<MeshType, CellType>& i) |
89 |
|
{ |
90 |
|
__mesh = i.__mesh; |
91 |
|
__iterator = i.__iterator; |
92 |
|
__number = i.__number; |
93 |
|
|
94 |
|
return *this; |
95 |
|
} |
96 |
|
|
97 |
|
const T_iterator<MeshType, CellType>& |
98 |
|
operator=(CellType* iterator) |
99 |
|
{ |
100 |
|
__iterator = iterator; |
101 |
|
__number = __mesh->cellNumber(*__iterator); |
102 |
|
|
103 |
|
return *this; |
104 |
|
} |
105 |
|
|
106 |
|
inline T_iterator<MeshType, CellType> operator++(int) |
107 |
|
{ |
108 |
|
T_iterator<MeshType, CellType> i = *this; |
109 |
|
++(*this); |
110 |
|
return i; |
111 |
|
} |
112 |
|
|
113 |
|
inline T_iterator<MeshType, CellType> operator++() |
114 |
|
{ |
115 |
|
++__iterator; |
116 |
|
++__number; |
117 |
|
|
118 |
|
if (not(this->end())) { |
119 |
|
if ((__iterator->isFictitious())) { |
120 |
|
return ++(*this); |
121 |
|
} |
122 |
|
} |
123 |
|
|
124 |
|
return *this; |
125 |
|
} |
126 |
|
|
127 |
|
T_iterator(MeshType& m, |
128 |
|
T_iterator::Position position = T_iterator::Begin) |
129 |
|
: __mesh(&m), |
130 |
|
__iterator(& m.cell(0)), |
131 |
|
__number(0) |
132 |
|
{ |
133 |
|
if (position == T_iterator<MeshType, CellType>::End) { |
134 |
|
__number = __mesh->numberOfCells(); |
135 |
|
} |
136 |
|
} |
137 |
|
|
138 |
|
T_iterator(MeshType& m, |
139 |
|
size_t cellNumber) |
140 |
|
: __mesh(&m), |
141 |
|
__iterator(& m.cell(cellNumber)), |
142 |
|
__number(cellNumber) |
143 |
|
{ |
144 |
|
; |
145 |
|
} |
146 |
|
|
147 |
|
T_iterator(const T_iterator<MeshType, CellType>& i) |
148 |
|
: __mesh(i.__mesh), |
149 |
|
__iterator(i.__iterator), |
150 |
|
__number(i.__number) |
151 |
|
{ |
152 |
|
; |
153 |
|
} |
154 |
|
|
155 |
|
~T_iterator() |
156 |
|
{ |
157 |
|
; |
158 |
|
} |
159 |
|
}; |
160 |
|
|
161 |
//! Container for vertices. |
//! Container for vertices. |
162 |
ReferenceCounting<VerticesSet> __verticesSet; |
ReferenceCounting<VerticesSet> __verticesSet; |
163 |
|
|