/* * OpenHexMeshIterators.hh * * Created on: 27.06.2011 * Author: mike */ #ifndef OPENHEXMESHITERATORS_HH_ #define OPENHEXMESHITERATORS_HH_ //#include "../OpenHexMesh.hh" template class OpenHexMesh; #include "../../OpenVolumeMesh/Utils/Iterators.hh" template class CellSheetCellIter : public BaseIterator::CellHandle, typename OpenVolumeMesh::CellHandle> { private: typedef BaseIterator::CellHandle, typename OpenVolumeMesh::CellHandle> BaseIter; typedef typename OpenVolumeMesh::CellHandle CellHandle; typedef typename OpenVolumeMesh::HalfFaceHandle HalfFaceHandle; public: CellSheetCellIter(const CellHandle& _ref_h, const unsigned char _orthDir, const OpenHexMesh* _mesh); CellSheetCellIter& operator=(const CellSheetCellIter& _c) { BaseIter::operator=(_c); neighb_sheet_cell_hs_ = _c.neighb_sheet_cell_hs_; cur_it_ = neighb_sheet_cell_hs_.begin(); return *this; } // Post increment/decrement operator CellSheetCellIter operator++(int) { CellSheetCellIter cpy = *this; ++(*this); return cpy; } CellSheetCellIter operator--(int) { CellSheetCellIter cpy = *this; --(*this); return cpy; } CellSheetCellIter operator+(int _n) { CellSheetCellIter cpy = *this; for(int i = 0; i < _n; ++i) { ++cpy; } return cpy; } CellSheetCellIter operator-(int _n) { CellSheetCellIter cpy = *this; for(int i = 0; i < _n; ++i) { --cpy; } return cpy; } CellSheetCellIter& operator+=(int _n) { for(int i = 0; i < _n; ++i) { ++(*this); } return *this; } CellSheetCellIter& operator-=(int _n) { for(int i = 0; i < _n; ++i) { --(*this); } return *this; } CellSheetCellIter& operator++(); CellSheetCellIter& operator--(); private: std::set neighb_sheet_cell_hs_; typename std::set::const_iterator cur_it_; }; template class HalfFaceSheetHalfFaceIter : public BaseIterator::HalfFaceHandle, typename OpenVolumeMesh::HalfFaceHandle> { private: typedef BaseIterator::HalfFaceHandle, typename OpenVolumeMesh::HalfFaceHandle> BaseIter; typedef typename OpenVolumeMesh::HalfFaceHandle HalfFaceHandle; typedef typename OpenVolumeMesh::HalfEdgeHandle HalfEdgeHandle; typedef typename OpenVolumeMesh::EdgeHandle EdgeHandle; public: HalfFaceSheetHalfFaceIter(const HalfFaceHandle& _ref_h, const OpenHexMesh* _mesh); HalfFaceSheetHalfFaceIter& operator=(const HalfFaceSheetHalfFaceIter& _c) { BaseIter::operator=(_c); adjacent_halffaces_ = _c.adjacent_halffaces_; cur_it_ = adjacent_halffaces_.begin(); return *this; } // Post increment/decrement operator HalfFaceSheetHalfFaceIter operator++(int) { HalfFaceSheetHalfFaceIter cpy = *this; ++(*this); return cpy; } HalfFaceSheetHalfFaceIter operator--(int) { HalfFaceSheetHalfFaceIter cpy = *this; --(*this); return cpy; } HalfFaceSheetHalfFaceIter operator+(int _n) { HalfFaceSheetHalfFaceIter cpy = *this; for(int i = 0; i < _n; ++i) { ++cpy; } return cpy; } HalfFaceSheetHalfFaceIter operator-(int _n) { HalfFaceSheetHalfFaceIter cpy = *this; for(int i = 0; i < _n; ++i) { --cpy; } return cpy; } HalfFaceSheetHalfFaceIter& operator+=(int _n) { for(int i = 0; i < _n; ++i) { ++(*this); } return *this; } HalfFaceSheetHalfFaceIter& operator-=(int _n) { for(int i = 0; i < _n; ++i) { --(*this); } return *this; } HalfFaceSheetHalfFaceIter& operator++(); HalfFaceSheetHalfFaceIter& operator--(); const EdgeHandle& common_edge() const { return *edge_it_; } private: std::vector adjacent_halffaces_; typename std::vector::const_iterator cur_it_; std::vector common_edges_; typename std::vector::const_iterator edge_it_; }; template class OutsideNeighborHalfFaceIter : public BaseIterator::HalfFaceHandle, typename OpenVolumeMesh::HalfFaceHandle> { private: typedef BaseIterator::HalfFaceHandle, typename OpenVolumeMesh::HalfFaceHandle> BaseIter; typedef typename OpenVolumeMesh::HalfFaceHandle HalfFaceHandle; typedef typename OpenVolumeMesh::HalfEdgeHandle HalfEdgeHandle; typedef typename OpenVolumeMesh::EdgeHandle EdgeHandle; public: OutsideNeighborHalfFaceIter(const HalfFaceHandle& _ref_h, const OpenHexMesh* _mesh); OutsideNeighborHalfFaceIter& operator=(const OutsideNeighborHalfFaceIter& _c) { BaseIter::operator=(_c); neighbor_halffaces_ = _c.adjacent_halffaces_; cur_it_ = neighbor_halffaces_.begin(); return *this; } // Post increment/decrement operator OutsideNeighborHalfFaceIter operator++(int) { OutsideNeighborHalfFaceIter cpy = *this; ++(*this); return cpy; } OutsideNeighborHalfFaceIter operator--(int) { OutsideNeighborHalfFaceIter cpy = *this; --(*this); return cpy; } OutsideNeighborHalfFaceIter operator+(int _n) { OutsideNeighborHalfFaceIter cpy = *this; for(int i = 0; i < _n; ++i) { ++cpy; } return cpy; } OutsideNeighborHalfFaceIter operator-(int _n) { OutsideNeighborHalfFaceIter cpy = *this; for(int i = 0; i < _n; ++i) { --cpy; } return cpy; } OutsideNeighborHalfFaceIter& operator+=(int _n) { for(int i = 0; i < _n; ++i) { ++(*this); } return *this; } OutsideNeighborHalfFaceIter& operator-=(int _n) { for(int i = 0; i < _n; ++i) { --(*this); } return *this; } const EdgeHandle& common_edge() const { return *edge_it_; } OutsideNeighborHalfFaceIter& operator++(); OutsideNeighborHalfFaceIter& operator--(); private: std::vector neighbor_halffaces_; std::vector common_edges_; typename std::vector::const_iterator cur_it_; typename std::vector::const_iterator edge_it_; }; #if defined(INCLUDE_TEMPLATES) && !defined(OPENHEXMESHITERATORST_CC) #include "OpenHexMeshIteratorsT.cc" #endif #endif /* OPENHEXMESHITERATORS_HH_ */