43#include <boost/operators.hpp>
54template <
class IndexTagT>
57template <
class IndexTagT>
59operator>>(std::istream& is, MeshIndex<IndexTagT>&);
61template <
class IndexTagT>
63: boost::totally_ordered<
65 boost::unit_steppable<MeshIndex<IndexTagT>,
66 boost::additive<MeshIndex<IndexTagT>
71 using Base = boost::totally_ordered<
73 boost::unit_steppable<MeshIndex<IndexTagT>,
74 boost::additive<MeshIndex<IndexTagT>>>>;
83 explicit MeshIndex(
const int index) : index_(index) {}
117 return (this->
get() < other.get());
124 return (this->
get() == other.get());
147 index_ += other.get();
155 index_ -= other.get();
168template <
class IndexTagT>
172 return (os << index.
get());
176template <
class IndexTagT>
180 return (is >> index.index_);
224toEdgeIndex(
const HalfEdgeIndex& index)
226 return (index.isValid() ? EdgeIndex(index.get() / 2) : EdgeIndex());
235toHalfEdgeIndex(
const EdgeIndex& index,
const bool get_first =
true)
237 return (index.isValid()
238 ? HalfEdgeIndex(index.get() * 2 +
static_cast<int>(!get_first))
void invalidate()
Invalidate the index.
boost::totally_ordered< MeshIndex< IndexTagT >, boost::unit_steppable< MeshIndex< IndexTagT >, boost::additive< MeshIndex< IndexTagT > > > > Base
Self & operator--()
Decrement operators (with boost::operators): -- (pre and post)
MeshIndex< IndexTagT > Self
bool isValid() const
Returns true if the index is valid.
void set(const int index)
Set the index.
Self & operator++()
Increment operators (with boost::operators): ++ (pre and post)
int get() const
Get the index.
bool operator==(const Self &other) const
Comparison operators (with boost::operators): == !=.
Self & operator+=(const Self &other)
Addition operators (with boost::operators): + +=.
Self & operator-=(const Self &other)
Subtraction operators (with boost::operators): - -=.
bool operator<(const Self &other) const
Comparison operators (with boost::operators): < > <= >=.
MeshIndex(const int index)
Constructor.
std::ostream & operator<<(std::ostream &os, const MeshIndex< IndexTagT > &index)
ostream operator.
std::istream & operator>>(std::istream &is, MeshIndex< IndexTagT > &)
istream operator.