21 #ifndef D_BIN_COORDINATES_IMPL_H 22 #define D_BIN_COORDINATES_IMPL_H 24 #ifndef SHEAF_DLL_SPEC_H 25 #include "SheafSystem/sheaf_dll_spec.h" 28 #ifndef ASSERT_CONTRACT_H 29 #include "SheafSystem/assert_contract.h" 32 #ifndef D_BIN_COORDINATES_H 33 #include "SheafSystem/d_bin_coordinates.h" 37 #include "SheafSystem/std_bitset.h" 41 #include "SheafSystem/std_limits.h" 51 template <
int DC,
int DB>
55 for(
int i=0; i<DC; ++i)
65 template <
int DC,
int DB>
71 require(precondition_of(
operator=(xother)));
79 ensure(postcondition_of(
operator=(xother)));
82 template <
int DC,
int DB>
88 require(precondition_of(
operator=(xcoord)));
96 ensure(postcondition_of(
operator=(xcoord)));
99 template <
int DC,
int DB>
104 template <
int DC,
int DB>
115 invariance_for_all(i, 0, DC, int_value()[i] < ub());
120 template <
int DC,
int DB>
125 for(
int i=0; i<DC; ++i)
127 _int_value[i] = xother._int_value[i];
137 template <
int DC,
int DB>
144 require_for_all(i, 0, DC, 0.0 <= xcoord[i]);
145 require_for_all(i, 0, DC,
floor(xcoord[i]) < ub());
149 for(
int i=0; i<DC; ++i)
151 _int_value[i] =
static_cast<int_type>(xcoord[i]);
161 template <
int DC,
int DB>
167 for(
int i=0; i<DC; ++i)
169 result = result && (_int_value[i] == xother._int_value[i]);
175 template <
int DC,
int DB>
181 for(
int i=0; i<DC; ++i)
183 result = result && (_int_value[i] == xother);
189 template <
int DC,
int DB>
195 for(
int i=0; i<DC; ++i)
197 result = result && (_int_value[i] < xother._int_value[i]);
203 template <
int DC,
int DB>
209 for(
int i=0; i<DC; ++i)
211 result = result && (_int_value[i] <= xother._int_value[i]);
217 template <
int DC,
int DB>
224 require(xbits < bits());
228 for(
int i=0; i<DC; ++i)
230 _int_value[i] >>= xbits;
242 template <
int DC,
int DB>
251 for(
int i=0; i<DC; ++i)
253 _int_value[i] -= xother._int_value[i];
265 template <
int DC,
int DB>
285 template <
int DC,
int DB>
305 template <
int DC,
int DB>
314 static_cast<int_type>(1) << (std::numeric_limits<int_type>::digits - 1);
319 template <
int DC,
int DB>
324 static const size_type result = std::numeric_limits<int_type>::digits;
328 template <
int DC,
int DB>
337 template <
int DC,
int DB>
345 template <
int DC,
int DB>
353 template <
int DC,
int DB>
361 template <
int DC,
int DB>
369 template <
int DC,
int DB>
380 return _int_value[xi];
383 template <
int DC,
int DB>
394 return _int_value[xi];
397 template <
int DC,
int DB>
403 require(xint_value < ub());
407 for(
int i=0; i<DC; ++i)
409 _int_value[i] = xint_value;
423 #ifndef DOXYGEN_SHOULD_SKIP_THIS 424 template <
int DC,
int DB>
425 std::ostream& geometry::operator<<(std::ostream& xos, const geometry::d_bin_coordinates<DC, DB>& xcoords)
427 for(
int i=0; i<xcoords.dc(); ++i)
430 << std::bitset<std::numeric_limits<typename d_bin_coordinates<DC, DB>::int_type>
431 ::digits>(xcoords.int_value()[i]);
435 #endif // ifndef DOXYGEN_SHOULD_SKIP_THIS 437 #endif // ifndef D_BIN_COORDINATES_IMPL_H const int_type * int_value() const
The value of this as an int_type.
unsigned long long int_type
The type used for integer coordinates.
static size_type dc()
The dimension of the tree this is a coordinate for.
bool operator==(const d_bin_coordinates< DC, DB > &xother) const
True if and only if this has the same value as xother.
void put_branch(size_type xbit, size_type xbranch)
Set the branch index at bit position xbit to xbranch.
bool invariant() const
Class invariant.
const int_type & operator[](size_type xi) const
The xi-th coordinate of this.
static size_type leftmost_bit_id()
The index of the leftmost bit.
d_bin_coordinates()
Default constructor.
Fixed point relative coordinates for a tree domain.
static int_type ub()
The upper bound for components.
size_type branch(size_type xbit) const
The branch index at bit position xbit.
~d_bin_coordinates()
Destructor.
static size_type bits()
The number of bits in a tree coordinate.
d_bin_coordinates< DC, DB > & operator>>=(int xbits)
Right shift and assignment of this by xbits.
d_bin_coordinates & operator=(const d_bin_coordinates< DC, DB > &xother)
Assignment from d_bin_coordinates.
bool operator<=(const d_bin_coordinates< DC, DB > &xother) const
True if and only if the value of this is less than or equal to the value of xother.
sheaf::size_type size_type
An unsigned integral type used to represent sizes and capacities.
static size_type rightmost_bit_id()
The index of the rightmost bit.
SHEAF_DLL_SPEC void floor(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute floor of x0 (floor(x0)) (pre-allocated version).
bool operator<(const d_bin_coordinates< DC, DB > &xother) const
True if and only if the value of this is less than the value of xother.
d_bin_coordinates & operator-=(const d_bin_coordinates< DC, DB > &xother)
Substraction and assignemnt.
static size_type degree()
The degree of the tree this is a coordinate for.
Namespace for geometry component of sheaf system.
section_evaluator::value_type value_type
The type used for floating point coordinates.