23 #ifndef __MESH_ENTITY_ITERATOR_H 24 #define __MESH_ENTITY_ITERATOR_H 27 #include "MeshEntity.h" 73 : _entity(), _pos(0), pos_end(0), index(0)
80 _entity.
init(mesh, dim, 0);
90 : _entity(), _pos(0), pos_end(0), index(0)
97 _entity.
init(mesh, dim, 0);
101 if (opt ==
"regular")
103 else if (opt ==
"ghost")
105 else if (opt !=
"all")
107 "initialize MeshEntityIterator",
108 "unknown opt=\"%s\", choose from " 109 "opt=[\"regular\", \"ghost\", \"all\"]", opt.c_str());
115 : _entity(entity.mesh(), dim, 0), _pos(0), index(0)
133 index = c(entity.
index());
139 : _entity(it._entity), _pos(it._pos), pos_end(it.pos_end),
170 return ((const_cast<MeshEntityIterator *>(
this))->
operator*()
171 == (const_cast<MeshEntityIterator *>(&it))->
operator*()
172 && _pos == it._pos && index == it.index);
185 { _entity._local_index = (index ? index[_pos] : _pos);
return &_entity; }
189 {
return _pos >= pos_end; }
224 const unsigned int* index;
MeshEntityIterator end_iterator()
Definition: MeshEntityIterator.h:195
MeshEntityIterator(const MeshEntity &entity, std::size_t dim)
Definition: MeshEntityIterator.h:114
const Mesh & mesh() const
Definition: MeshEntity.h:99
std::size_t index() const
Definition: MeshEntity.h:113
MeshEntity & operator*()
Dereference operator.
Definition: MeshEntityIterator.h:180
MeshEntityIterator(const MeshEntityIterator &it)
Copy constructor.
Definition: MeshEntityIterator.h:138
MeshEntity * operator->()
Member access operator.
Definition: MeshEntityIterator.h:184
MeshEntityIterator & operator++()
Step to next mesh entity (prefix increment)
Definition: MeshEntityIterator.h:146
std::size_t size() const
Return total number of connections.
Definition: MeshConnectivity.h:60
std::size_t size(std::size_t dim) const
Return number of entities for given dimension.
Definition: MeshTopology.cpp:75
std::size_t pos() const
Return current position.
Definition: MeshEntityIterator.h:160
std::size_t init(std::size_t dim) const
Definition: Mesh.cpp:138
bool operator!=(const MeshEntityIterator &it) const
Comparison operator.
Definition: MeshEntityIterator.h:176
bool operator==(const MeshEntityIterator &it) const
Comparison operator.
Definition: MeshEntityIterator.h:164
bool end() const
Check if iterator has reached the end.
Definition: MeshEntityIterator.h:188
std::size_t dim() const
Definition: MeshEntity.h:106
Definition: MeshConnectivity.h:39
std::size_t ghost_offset(std::size_t dim) const
Definition: MeshTopology.cpp:93
bool empty() const
Return true if the total number of connections is equal to zero.
Definition: MeshConnectivity.h:56
MeshTopology & topology()
Definition: Mesh.h:219
Definition: MeshEntityIterator.h:64
std::size_t num_vertices() const
Definition: Mesh.h:134
void init(const Mesh &mesh, std::size_t dim, std::size_t index)
Definition: MeshEntity.cpp:39
Definition: MeshEntity.h:42
MeshEntityIterator(const Mesh &mesh, std::size_t dim)
Create iterator for mesh entities over given topological dimension.
Definition: MeshEntityIterator.h:72
void dolfin_error(std::string location, std::string task, std::string reason,...)
Definition: log.cpp:129
MeshEntityIterator()
Default constructor.
Definition: MeshEntityIterator.h:69
MeshEntityIterator(const Mesh &mesh, std::size_t dim, std::string opt)
Definition: MeshEntityIterator.h:89
MeshEntityIterator & operator--()
Step to the previous mesh entity (prefix decrease)
Definition: MeshEntityIterator.h:153
virtual ~MeshEntityIterator()
Destructor.
Definition: MeshEntityIterator.h:143