70 template <
typename _Container,
typename _value_type,
typename _size_type,
71 typename _Access,
typename _Compare>
74 template <
typename _Container,
typename _value_type,
typename _size_type,
75 typename _Access,
typename _Compare>
77 IsoCounter<_Container, _value_type, _size_type, _Access, _Compare> > {
88 template <
typename _Container,
89 typename _value_type =
typename _Container::value_type,
96 IsoCounter<_Container, _value_type, _size_type, _Access, _Compare> > {
100 using Base::_increment;
101 using Base::_initial;
119 using Base::operator();
120 using Base::operator[];
121 using Base::operator bool;
146 if (
size() == 0)
return 0;
159 if (!
valid())
return (*
this);
161 bool continue_flag =
valid();
163 for (i = 0; i + 1 <
size(); i++) {
168 if (j ==
size())
break;
179 continue_flag =
false;
186 if (continue_flag || !
valid()) {
225 std::cerr <<
"CRITICAL ERROR: In IsoCounter::set_current(), new state is "
226 "incompatible with this counter.\n"
244 if (
compare(sum_val + sum_val, sum_val) !=
252 for (i = 0; i <
size(); i++) {
Basic std::vector like container (deprecated)
A Counter allows looping over many incrementing variables in one loop.
const value_type & _initial(size_type index) const
const value_type & _upper(size_type index) const
bool & _valid()
non-const reference bool validity flag
const value_type & _final(size_type index) const
bool compare(const value_type &A, const value_type &B)
const value_type & _lower(size_type index) const
const Container & current() const
const Container & initial() const
A IsoCounter allows looping over many incrementing variables in one loop.
value_type m_sum_constraint
void _init()
Called from the constructor to set m_lower and m_upper appropriately.
const value_type & increment() const
IsoCounter()
Default construct a IsoCounter Container must be default constructible value_type must be constructib...
value_type current_sum() const
value_type & _increment()
traits< IsoCounter >::Base Base
IsoCounter & operator++()
void set_sum_constraint(const value_type &new_sum)
void reset()
Reset thse current value of the Counter to the initial value.
const value_type & _increment() const
IsoCounter(const Container &_initial, const Container &_final, const value_type &_increment, const value_type &_sum, Access _access=Access(), Compare _compare=Compare())
Construct a IsoCounter-type object.
const value_type & _sum_constraint() const
void set_current(const Container &new_current)
value_type & _sum_constraint()
typename std::conditional< std::is_integral< T >::value, IntegralLessThan< T >, FloatingPointLessThan< T > >::type MuchLessThan
bool compare(ClusterInvariants const &A, ClusterInvariants const &B, double tol)
Compare ClusterInvariants.
bool almost_zero(const T &val, double tol=TOL)
If T is not integral, use std::abs(val) < tol;.
static bool _compare(T const &a, T const &b, double tol)
Helper Functor for Counter container access using operator[].
BaseCounter< IsoCounter< _Container, _value_type, _size_type, _Access, _Compare > > Base