23 #ifndef __MESH_ENTITY_ITERATOR_BASE_H 24 #define __MESH_ENTITY_ITERATOR_BASE_H 28 #include "MeshEntity.h" 42 : _entity(mesh, 0), _pos(0), pos_end(0), index(0)
49 const std::size_t dim = _entity.dim();
59 : _entity(mesh, 0), _pos(0), pos_end(0), index(0)
65 const std::size_t dim = _entity.dim();
71 else if (opt ==
"ghost")
73 else if (opt !=
"all")
75 "initialize MeshEntityIterator",
76 "unknown opt=\"%s\", choose from " 77 "opt=[\"regular\", \"ghost\", \"all\"]", opt.c_str());
82 : _entity(entity.mesh(), 0), _pos(0), index(0)
100 index = c(entity.
index());
106 : _entity(it._entity), _pos(it._pos), pos_end(it.pos_end), index(it.index) {}
138 && _pos == it._pos && index == it.index);
151 { _entity._local_index = (index ? index[_pos] : _pos);
return &_entity; }
155 {
return _pos >= pos_end; }
189 const unsigned int* index;
T & operator*()
Dereference operator.
Definition: MeshEntityIteratorBase.h:146
MeshEntityIteratorBase(const Mesh &mesh)
Create iterator for mesh entities over given topological dimension.
Definition: MeshEntityIteratorBase.h:41
const Mesh & mesh() const
Definition: MeshEntity.h:99
std::size_t index() const
Definition: MeshEntity.h:113
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: MeshEntityIteratorBase.h:126
std::size_t init(std::size_t dim) const
Definition: Mesh.cpp:138
MeshEntityIteratorBase end_iterator()
Definition: MeshEntityIteratorBase.h:161
MeshEntityIteratorBase(const MeshEntityIteratorBase &it)
Copy constructor.
Definition: MeshEntityIteratorBase.h:105
std::size_t dim() const
Definition: MeshEntity.h:106
Definition: MeshConnectivity.h:39
MeshEntityIteratorBase & operator--()
Step to the previous mesh entity (prefix decrease)
Definition: MeshEntityIteratorBase.h:119
MeshEntityIteratorBase & operator++()
Step to next mesh entity (prefix increment)
Definition: MeshEntityIteratorBase.h:112
~MeshEntityIteratorBase()
Destructor.
Definition: MeshEntityIteratorBase.h:109
MeshEntityIteratorBase(const Mesh &mesh, std::string opt)
Definition: MeshEntityIteratorBase.h:58
bool end() const
Check if iterator has reached the end.
Definition: MeshEntityIteratorBase.h:154
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
std::size_t num_vertices() const
Definition: Mesh.h:134
bool operator==(const MeshEntityIteratorBase &it) const
Comparison operator.
Definition: MeshEntityIteratorBase.h:130
Definition: MeshEntity.h:42
void dolfin_error(std::string location, std::string task, std::string reason,...)
Definition: log.cpp:129
MeshEntityIteratorBase(const MeshEntity &entity)
Create iterator for entities of given dimension connected to given entity.
Definition: MeshEntityIteratorBase.h:81
bool operator!=(const MeshEntityIteratorBase &it) const
Comparison operator.
Definition: MeshEntityIteratorBase.h:142
T * operator->()
Member access operator.
Definition: MeshEntityIteratorBase.h:150
Base class for MeshEntityIterators.
Definition: MeshEntityIteratorBase.h:36