| |
|
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| |
|
| | #ifndef MESH_ITERATOR_H
|
| | #define MESH_ITERATOR_H
|
| |
|
| |
|
| | #include <Base/Matrix.h>
|
| |
|
| | #include "MeshKernel.h"
|
| |
|
| |
|
| | namespace MeshCore
|
| | {
|
| |
|
| | class MeshKernel;
|
| | class MeshGeomFacet;
|
| | class MeshPoint;
|
| | class MeshGeomEdge;
|
| | class MeshIndexEdge;
|
| | class MeshHelpEdge;
|
| |
|
| | |
| | |
| | |
| | |
| | |
| |
|
| | class MeshFacetIterator
|
| | {
|
| | public:
|
| |
|
| |
|
| |
|
| | inline explicit MeshFacetIterator(const MeshKernel& rclM);
|
| |
|
| | inline MeshFacetIterator(const MeshKernel& rclM, FacetIndex ulPos);
|
| |
|
| | inline MeshFacetIterator(const MeshFacetIterator& rclI);
|
| | inline MeshFacetIterator(MeshFacetIterator&& rclI);
|
| | ~MeshFacetIterator() = default;
|
| |
|
| |
|
| |
|
| |
|
| |
|
| | inline void Transform(const Base::Matrix4D& rclTrf);
|
| |
|
| |
|
| |
|
| |
|
| |
|
| | const MeshGeomFacet& operator*()
|
| | {
|
| | return Dereference();
|
| | }
|
| |
|
| | const MeshGeomFacet* operator->()
|
| | {
|
| | return &Dereference();
|
| | }
|
| |
|
| |
|
| | const MeshFacetIterator& operator++()
|
| | {
|
| | ++_clIter;
|
| | return *this;
|
| | }
|
| |
|
| |
|
| | const MeshFacetIterator& operator--()
|
| | {
|
| | --_clIter;
|
| | return *this;
|
| | }
|
| |
|
| | const MeshFacetIterator& operator+=(int k)
|
| | {
|
| | _clIter += k;
|
| | return *this;
|
| | }
|
| |
|
| | const MeshFacetIterator& operator-=(int k)
|
| | {
|
| | _clIter -= k;
|
| | return *this;
|
| | }
|
| |
|
| | inline MeshFacetIterator& operator=(const MeshFacetIterator& rpI);
|
| | inline MeshFacetIterator& operator=(MeshFacetIterator&& rpI);
|
| |
|
| | bool operator<(const MeshFacetIterator& rclI) const
|
| | {
|
| | return _clIter < rclI._clIter;
|
| | }
|
| |
|
| | bool operator>(const MeshFacetIterator& rclI) const
|
| | {
|
| | return _clIter > rclI._clIter;
|
| | }
|
| |
|
| | bool operator==(const MeshFacetIterator& rclI) const
|
| | {
|
| | return _clIter == rclI._clIter;
|
| | }
|
| |
|
| | void Begin()
|
| | {
|
| | _clIter = _rclFAry.begin();
|
| | }
|
| |
|
| | void End()
|
| | {
|
| | _clIter = _rclFAry.end();
|
| | }
|
| |
|
| | FacetIndex Position() const
|
| | {
|
| | return _clIter - _rclFAry.begin();
|
| | }
|
| |
|
| | bool EndReached() const
|
| | {
|
| | return !(_clIter < _rclFAry.end());
|
| | }
|
| |
|
| | void Init()
|
| | {
|
| | Begin();
|
| | }
|
| |
|
| | bool More() const
|
| | {
|
| | return !EndReached();
|
| | }
|
| |
|
| | void Next()
|
| | {
|
| | operator++();
|
| | }
|
| |
|
| | inline bool Set(FacetIndex ulIndex);
|
| |
|
| | inline MeshFacet GetIndices() const
|
| | {
|
| | return *_clIter;
|
| | }
|
| |
|
| | inline const MeshFacet& GetReference() const
|
| | {
|
| | return *_clIter;
|
| | }
|
| |
|
| | inline void GetNeighbours(
|
| | MeshFacetIterator& rclN0,
|
| | MeshFacetIterator& rclN1,
|
| | MeshFacetIterator& rclN2
|
| | ) const;
|
| |
|
| | inline void SetToNeighbour(unsigned short usN);
|
| |
|
| | inline unsigned long GetProperty() const;
|
| |
|
| | inline bool IsValid() const
|
| | {
|
| | return (_clIter >= _rclFAry.begin()) && (_clIter < _rclFAry.end());
|
| | }
|
| |
|
| | |
| |
|
| |
|
| | void SetFlag(MeshFacet::TFlagType tF) const
|
| | {
|
| | this->_clIter->SetFlag(tF);
|
| | }
|
| | void ResetFlag(MeshFacet::TFlagType tF) const
|
| | {
|
| | this->_clIter->ResetFlag(tF);
|
| | }
|
| | bool IsFlag(MeshFacet::TFlagType tF) const
|
| | {
|
| | return this->_clIter->IsFlag(tF);
|
| | }
|
| | void SetProperty(unsigned long uP) const
|
| | {
|
| | this->_clIter->SetProperty(uP);
|
| | }
|
| |
|
| |
|
| | protected:
|
| | inline const MeshGeomFacet& Dereference();
|
| |
|
| | private:
|
| | const MeshKernel& _rclMesh;
|
| | const MeshFacetArray& _rclFAry;
|
| | const MeshPointArray& _rclPAry;
|
| | MeshFacetArray::_TConstIterator _clIter;
|
| | MeshGeomFacet _clFacet;
|
| | bool _bApply;
|
| | Base::Matrix4D _clTrf;
|
| |
|
| |
|
| | friend class MeshKernel;
|
| | };
|
| |
|
| | |
| | |
| | |
| |
|
| | class MeshExport MeshPointIterator
|
| | {
|
| | public:
|
| |
|
| |
|
| | inline explicit MeshPointIterator(const MeshKernel& rclM);
|
| | inline MeshPointIterator(const MeshKernel& rclM, PointIndex ulPos);
|
| | inline MeshPointIterator(const MeshPointIterator& rclI);
|
| | inline MeshPointIterator(MeshPointIterator&& rclI);
|
| | ~MeshPointIterator() = default;
|
| |
|
| |
|
| |
|
| |
|
| |
|
| | inline void Transform(const Base::Matrix4D& rclTrf);
|
| |
|
| |
|
| |
|
| |
|
| |
|
| | const MeshPoint& operator*() const
|
| | {
|
| | return Dereference();
|
| | }
|
| |
|
| | const MeshPoint* operator->() const
|
| | {
|
| | return &Dereference();
|
| | }
|
| |
|
| |
|
| | const MeshPointIterator& operator++()
|
| | {
|
| | ++_clIter;
|
| | return *this;
|
| | }
|
| |
|
| |
|
| | const MeshPointIterator& operator--()
|
| | {
|
| | --_clIter;
|
| | return *this;
|
| | }
|
| |
|
| | inline MeshPointIterator& operator=(const MeshPointIterator& rpI);
|
| | inline MeshPointIterator& operator=(MeshPointIterator&& rpI);
|
| |
|
| | bool operator<(const MeshPointIterator& rclI) const
|
| | {
|
| | return _clIter < rclI._clIter;
|
| | }
|
| |
|
| | bool operator>(const MeshPointIterator& rclI) const
|
| | {
|
| | return _clIter > rclI._clIter;
|
| | }
|
| |
|
| | bool operator==(const MeshPointIterator& rclI) const
|
| | {
|
| | return _clIter == rclI._clIter;
|
| | }
|
| |
|
| | void Begin()
|
| | {
|
| | _clIter = _rclPAry.begin();
|
| | }
|
| |
|
| | void End()
|
| | {
|
| | _clIter = _rclPAry.end();
|
| | }
|
| |
|
| | PointIndex Position() const
|
| | {
|
| | return _clIter - _rclPAry.begin();
|
| | }
|
| |
|
| | bool EndReached() const
|
| | {
|
| | return !(_clIter < _rclPAry.end());
|
| | }
|
| |
|
| | void Init()
|
| | {
|
| | Begin();
|
| | }
|
| |
|
| | bool More() const
|
| | {
|
| | return !EndReached();
|
| | }
|
| |
|
| | void Next()
|
| | {
|
| | operator++();
|
| | }
|
| |
|
| | inline bool Set(PointIndex ulIndex);
|
| |
|
| | inline bool IsValid() const
|
| | {
|
| | return (_clIter >= _rclPAry.begin()) && (_clIter < _rclPAry.end());
|
| | }
|
| |
|
| | |
| |
|
| |
|
| | void SetFlag(MeshPoint::TFlagType tF) const
|
| | {
|
| | this->_clIter->SetFlag(tF);
|
| | }
|
| | void ResetFlag(MeshPoint::TFlagType tF) const
|
| | {
|
| | this->_clIter->ResetFlag(tF);
|
| | }
|
| | bool IsFlag(MeshPoint::TFlagType tF) const
|
| | {
|
| | return this->_clIter->IsFlag(tF);
|
| | }
|
| | void SetProperty(unsigned long uP) const
|
| | {
|
| | this->_clIter->SetProperty(uP);
|
| | }
|
| |
|
| |
|
| | private:
|
| | inline const MeshPoint& Dereference() const;
|
| |
|
| | private:
|
| | const MeshKernel& _rclMesh;
|
| | const MeshPointArray& _rclPAry;
|
| | mutable MeshPoint _clPoint;
|
| | MeshPointArray::_TConstIterator _clIter;
|
| | bool _bApply;
|
| | Base::Matrix4D _clTrf;
|
| |
|
| |
|
| | friend class MeshKernel;
|
| | };
|
| |
|
| | class MeshFastFacetIterator
|
| | {
|
| | public:
|
| | inline explicit MeshFastFacetIterator(const MeshKernel& rclM);
|
| | virtual ~MeshFastFacetIterator() = default;
|
| |
|
| | void Init()
|
| | {
|
| | _clIter = _rclFAry.begin();
|
| | }
|
| | inline void Next();
|
| | bool More()
|
| | {
|
| | return _clIter != _rclFAry.end();
|
| | }
|
| |
|
| | Base::Vector3f _afPoints[3];
|
| |
|
| | private:
|
| | const MeshFacetArray& _rclFAry;
|
| | const MeshPointArray& _rclPAry;
|
| | MeshFacetArray::_TConstIterator _clIter;
|
| |
|
| | public:
|
| | MeshFastFacetIterator(const MeshFastFacetIterator&) = delete;
|
| | MeshFastFacetIterator(MeshFastFacetIterator&&) = delete;
|
| | void operator=(const MeshFastFacetIterator&) = delete;
|
| | void operator=(MeshFastFacetIterator&&) = delete;
|
| | };
|
| |
|
| | inline MeshFastFacetIterator::MeshFastFacetIterator(const MeshKernel& rclM)
|
| | : _rclFAry(rclM._aclFacetArray)
|
| | , _rclPAry(rclM._aclPointArray)
|
| | , _clIter(_rclFAry.begin())
|
| | {}
|
| |
|
| | inline void MeshFastFacetIterator::Next()
|
| | {
|
| | const PointIndex* paulPt = _clIter->_aulPoints;
|
| | Base::Vector3f* pfPt = _afPoints;
|
| | *(pfPt++) = _rclPAry[*(paulPt++)];
|
| | *(pfPt++) = _rclPAry[*(paulPt++)];
|
| | *pfPt = _rclPAry[*paulPt];
|
| | }
|
| |
|
| | inline MeshFacetIterator::MeshFacetIterator(const MeshKernel& rclM)
|
| | : _rclMesh(rclM)
|
| | , _rclFAry(rclM._aclFacetArray)
|
| | , _rclPAry(rclM._aclPointArray)
|
| | , _clIter(rclM._aclFacetArray.begin())
|
| | , _bApply(false)
|
| | {}
|
| |
|
| | inline MeshFacetIterator::MeshFacetIterator(const MeshKernel& rclM, FacetIndex ulPos)
|
| | : _rclMesh(rclM)
|
| | , _rclFAry(rclM._aclFacetArray)
|
| | , _rclPAry(rclM._aclPointArray)
|
| | , _clIter(rclM._aclFacetArray.begin() + ulPos)
|
| | , _bApply(false)
|
| | {}
|
| |
|
| | inline MeshFacetIterator::MeshFacetIterator(const MeshFacetIterator& rclI)
|
| | : _rclMesh(rclI._rclMesh)
|
| | , _rclFAry(rclI._rclFAry)
|
| | , _rclPAry(rclI._rclPAry)
|
| | , _clIter(rclI._clIter)
|
| | , _bApply(rclI._bApply)
|
| | , _clTrf(rclI._clTrf)
|
| | {}
|
| |
|
| | inline MeshFacetIterator::MeshFacetIterator(MeshFacetIterator&& rclI)
|
| | : _rclMesh(rclI._rclMesh)
|
| | , _rclFAry(rclI._rclFAry)
|
| | , _rclPAry(rclI._rclPAry)
|
| | , _clIter(rclI._clIter)
|
| | , _bApply(rclI._bApply)
|
| | , _clTrf(rclI._clTrf)
|
| | {}
|
| |
|
| | inline void MeshFacetIterator::Transform(const Base::Matrix4D& rclTrf)
|
| | {
|
| | _clTrf = rclTrf;
|
| | Base::Matrix4D tmp;
|
| |
|
| | _clTrf != tmp ? _bApply = true : _bApply = false;
|
| | }
|
| |
|
| | inline const MeshGeomFacet& MeshFacetIterator::Dereference()
|
| | {
|
| | MeshFacet rclF = *_clIter;
|
| | const PointIndex* paulPt = &(_clIter->_aulPoints[0]);
|
| | Base::Vector3f* pclPt = _clFacet._aclPoints;
|
| | *(pclPt++) = _rclPAry[*(paulPt++)];
|
| | *(pclPt++) = _rclPAry[*(paulPt++)];
|
| | *pclPt = _rclPAry[*paulPt];
|
| | _clFacet._ulProp = rclF._ulProp;
|
| | _clFacet._ucFlag = rclF._ucFlag;
|
| | _clFacet.NormalInvalid();
|
| | if (_bApply) {
|
| | _clFacet._aclPoints[0] = _clTrf * _clFacet._aclPoints[0];
|
| | _clFacet._aclPoints[1] = _clTrf * _clFacet._aclPoints[1];
|
| | _clFacet._aclPoints[2] = _clTrf * _clFacet._aclPoints[2];
|
| | }
|
| | return _clFacet;
|
| | }
|
| |
|
| | inline bool MeshFacetIterator::Set(FacetIndex ulIndex)
|
| | {
|
| | if (ulIndex < _rclFAry.size()) {
|
| | _clIter = _rclFAry.begin() + ulIndex;
|
| | return true;
|
| | }
|
| |
|
| | _clIter = _rclFAry.end();
|
| | return false;
|
| | }
|
| |
|
| | inline MeshFacetIterator& MeshFacetIterator::operator=(const MeshFacetIterator& rpI)
|
| | {
|
| | _clIter = rpI._clIter;
|
| | _bApply = rpI._bApply;
|
| | _clTrf = rpI._clTrf;
|
| | return *this;
|
| | }
|
| |
|
| | inline MeshFacetIterator& MeshFacetIterator::operator=(MeshFacetIterator&& rpI)
|
| | {
|
| | _clIter = rpI._clIter;
|
| | _bApply = rpI._bApply;
|
| | _clTrf = rpI._clTrf;
|
| | return *this;
|
| | }
|
| |
|
| | inline unsigned long MeshFacetIterator::GetProperty() const
|
| | {
|
| | return _clIter->_ulProp;
|
| | }
|
| |
|
| | inline void MeshFacetIterator::GetNeighbours(
|
| | MeshFacetIterator& rclN0,
|
| | MeshFacetIterator& rclN1,
|
| | MeshFacetIterator& rclN2
|
| | ) const
|
| | {
|
| | if (_clIter->_aulNeighbours[0] != FACET_INDEX_MAX) {
|
| | rclN0.Set(_clIter->_aulNeighbours[0]);
|
| | }
|
| | else {
|
| | rclN0.End();
|
| | }
|
| |
|
| | if (_clIter->_aulNeighbours[1] != FACET_INDEX_MAX) {
|
| | rclN1.Set(_clIter->_aulNeighbours[1]);
|
| | }
|
| | else {
|
| | rclN1.End();
|
| | }
|
| |
|
| | if (_clIter->_aulNeighbours[2] != FACET_INDEX_MAX) {
|
| | rclN2.Set(_clIter->_aulNeighbours[2]);
|
| | }
|
| | else {
|
| | rclN2.End();
|
| | }
|
| | }
|
| |
|
| | inline void MeshFacetIterator::SetToNeighbour(unsigned short usN)
|
| | {
|
| | if (_clIter->_aulNeighbours[usN] != FACET_INDEX_MAX) {
|
| | _clIter = _rclFAry.begin() + _clIter->_aulNeighbours[usN];
|
| | }
|
| | else {
|
| | End();
|
| | }
|
| | }
|
| |
|
| | inline MeshPointIterator::MeshPointIterator(const MeshKernel& rclM)
|
| | : _rclMesh(rclM)
|
| | , _rclPAry(_rclMesh._aclPointArray)
|
| | , _bApply(false)
|
| | {
|
| | _clIter = _rclPAry.begin();
|
| | }
|
| |
|
| | inline MeshPointIterator::MeshPointIterator(const MeshKernel& rclM, PointIndex ulPos)
|
| | : _rclMesh(rclM)
|
| | , _rclPAry(_rclMesh._aclPointArray)
|
| | , _bApply(false)
|
| | {
|
| | _clIter = _rclPAry.begin() + ulPos;
|
| | }
|
| |
|
| | inline MeshPointIterator::MeshPointIterator(const MeshPointIterator& rclI)
|
| | : _rclMesh(rclI._rclMesh)
|
| | , _rclPAry(rclI._rclPAry)
|
| | , _clIter(rclI._clIter)
|
| | , _bApply(rclI._bApply)
|
| | , _clTrf(rclI._clTrf)
|
| | {}
|
| |
|
| | inline MeshPointIterator::MeshPointIterator(MeshPointIterator&& rclI)
|
| | : _rclMesh(rclI._rclMesh)
|
| | , _rclPAry(rclI._rclPAry)
|
| | , _clIter(rclI._clIter)
|
| | , _bApply(rclI._bApply)
|
| | , _clTrf(rclI._clTrf)
|
| | {}
|
| |
|
| | inline void MeshPointIterator::Transform(const Base::Matrix4D& rclTrf)
|
| | {
|
| | _clTrf = rclTrf;
|
| | Base::Matrix4D tmp;
|
| |
|
| | _clTrf != tmp ? _bApply = true : _bApply = false;
|
| | }
|
| |
|
| | inline const MeshPoint& MeshPointIterator::Dereference() const
|
| | {
|
| |
|
| | _clPoint = *_clIter;
|
| | if (_bApply) {
|
| | _clPoint = _clTrf * _clPoint;
|
| | }
|
| | return _clPoint;
|
| | }
|
| |
|
| | inline bool MeshPointIterator::Set(PointIndex ulIndex)
|
| | {
|
| | if (ulIndex < _rclPAry.size()) {
|
| | _clIter = _rclPAry.begin() + ulIndex;
|
| | return true;
|
| | }
|
| |
|
| | _clIter = _rclPAry.end();
|
| | return false;
|
| | }
|
| |
|
| | inline MeshPointIterator& MeshPointIterator::operator=(const MeshPointIterator& rpI)
|
| | {
|
| | _clIter = rpI._clIter;
|
| | _bApply = rpI._bApply;
|
| | _clTrf = rpI._clTrf;
|
| | return *this;
|
| | }
|
| |
|
| | inline MeshPointIterator& MeshPointIterator::operator=(MeshPointIterator&& rpI)
|
| | {
|
| | _clIter = rpI._clIter;
|
| | _bApply = rpI._bApply;
|
| | _clTrf = rpI._clTrf;
|
| | return *this;
|
| | }
|
| |
|
| |
|
| | }
|
| |
|
| |
|
| | #endif
|
| |
|