Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <cstddef> 7 : 8 : template <size_t Dim> 9 : class ElementId; 10 : 11 : namespace domain { 12 : /// \brief Computes the Z-curve index of a given `ElementId` 13 : /// 14 : /// \details The Z-curve index is computed by interleaving the bits of the 15 : /// `ElementId`'s `Segment` indices. Here is a sketch of a 2D block with 4x2 16 : /// elements, with bit indices and the resulting z-curve: 17 : /// 18 : /// \code 19 : /// x--> 20 : /// 00 01 10 11 21 : /// y 0 | 0 2 4 6 22 : /// | | 23 : /// v 1 | 1 3 5 7 24 : /// \endcode 25 : /// 26 : /// \param element_id the `ElementId` for which to compute the Z-curve index 27 : template <size_t Dim> 28 1 : size_t z_curve_index(const ElementId<Dim>& element_id); 29 : } // namespace domain