Template Function wavemap::morton::encode

Function Documentation

template<int dim, bool check_sign = false>
MortonIndex wavemap::morton::encode(const Index<dim> &index)

Method to convert regular n-dimensional indices into Morton indices.

Template Parameters:
  • dim – Dimension of the index.

  • check_sign – Whether to check that each index coefficient is positive. Note that negative signs are not preserved when encoding and decoding Morton indices. The check can be enabled to throw an error in cases where round trip conversions would not yield an identical index. Since we often only perform one way conversions and use the Morton indices as relative offsets, the check is disabled by default. Note that since the check is a DCHECK, it only triggers when the code is built with the DCHECK_ALWAYS_ON flag enabled or in debug mode.