Commit 6ded333f authored by Martin Heistermann's avatar Martin Heistermann

Optimize Tetmesh Cell-Vertex iterator

parent dc2e4c4d
Pipeline #12185 failed with stage
in 5 minutes and 13 seconds
...@@ -64,27 +64,24 @@ BaseIter(_mesh, _ref_h, _max_laps) { ...@@ -64,27 +64,24 @@ BaseIter(_mesh, _ref_h, _max_laps) {
HalfEdgeHandle curHE = *_mesh->halfface(curHF).halfedges().begin(); HalfEdgeHandle curHE = *_mesh->halfface(curHF).halfedges().begin();
assert(curHE.is_valid()); assert(curHE.is_valid());
vertices_.push_back(_mesh->halfedge(curHE).to_vertex()); vertices_[0] = _mesh->halfedge(curHE).to_vertex();
curHE = _mesh->next_halfedge_in_halfface(curHE, curHF); curHE = _mesh->next_halfedge_in_halfface(curHE, curHF);
vertices_.push_back(_mesh->halfedge(curHE).to_vertex()); vertices_[1] = _mesh->halfedge(curHE).to_vertex();
curHE = _mesh->next_halfedge_in_halfface(curHE, curHF); curHE = _mesh->next_halfedge_in_halfface(curHE, curHF);
vertices_.push_back(_mesh->halfedge(curHE).to_vertex()); vertices_[2] = _mesh->halfedge(curHE).to_vertex();
curHF = _mesh->adjacent_halfface_in_cell(curHF, curHE); curHF = _mesh->adjacent_halfface_in_cell(curHF, curHE);
curHE = _mesh->opposite_halfedge_handle(curHE); curHE = _mesh->opposite_halfedge_handle(curHE);
curHE = _mesh->next_halfedge_in_halfface(curHE, curHF); curHE = _mesh->next_halfedge_in_halfface(curHE, curHF);
vertices_.push_back(_mesh->halfedge(curHE).to_vertex()); vertices_[3] = _mesh->halfedge(curHE).to_vertex();
cur_index_ = 0; cur_index_ = 0;
BaseIter::valid(vertices_.size() > 0); BaseIter::cur_handle(vertices_[cur_index_]);
if(BaseIter::valid()) {
BaseIter::cur_handle(vertices_[cur_index_]);
}
} }
......
#pragma once
/*===========================================================================*\ /*===========================================================================*\
* * * *
* OpenVolumeMesh * * OpenVolumeMesh *
...@@ -32,20 +33,11 @@ ...@@ -32,20 +33,11 @@
* * * *
\*===========================================================================*/ \*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $Date$ *
* $LastChangedBy$ *
* *
\*===========================================================================*/
#ifndef TETRAHEDRALMESHITERATORS_HH
#define TETRAHEDRALMESHITERATORS_HH
#include "../Core/Iterators.hh" #include "../Core/Iterators.hh"
#include "OpenVolumeMesh/Config/Export.hh" #include "OpenVolumeMesh/Config/Export.hh"
#include <array>
namespace OpenVolumeMesh { namespace OpenVolumeMesh {
class TetrahedralMeshTopologyKernel; class TetrahedralMeshTopologyKernel;
...@@ -109,10 +101,8 @@ public: ...@@ -109,10 +101,8 @@ public:
TetVertexIter& operator--(); TetVertexIter& operator--();
private: private:
std::vector<VertexHandle> vertices_; std::array<VertexHandle, 4> vertices_;
size_t cur_index_; size_t cur_index_;
}; };
} // Namespace OpenVolumeMesh } // Namespace OpenVolumeMesh
#endif /* TETRAHEDRALMESHITERATORS_HH */
#pragma once
/*===========================================================================*\ /*===========================================================================*\
* * * *
* OpenVolumeMesh * * OpenVolumeMesh *
...@@ -32,16 +33,6 @@ ...@@ -32,16 +33,6 @@
* * * *
\*===========================================================================*/ \*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $Date$ *
* $LastChangedBy$ *
* *
\*===========================================================================*/
#ifndef TETRAHEDRALMESHTOPOLOGYKERNEL_HH
#define TETRAHEDRALMESHTOPOLOGYKERNEL_HH
#ifndef NDEBUG #ifndef NDEBUG
#include <iostream> #include <iostream>
...@@ -133,4 +124,3 @@ private: ...@@ -133,4 +124,3 @@ private:
} // Namespace OpenVolumeMesh } // Namespace OpenVolumeMesh
#endif /* TETRAHEDRALMESHTOPOLOGYKERNEL_HH */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment