// Copyright 2018-2022 David Robillard // Copyright 2006-2007 Chris Hamilton // SPDX-License-Identifier: GPL-2.0-or-later #ifndef CHILBERT_HILBERT_HPP #define CHILBERT_HILBERT_HPP #include namespace chilbert { /** Map the point `p` to a Hilbert Index. * * @tparam P Array-like type with [] operator that represents a point. * @tparam H Hilbert Index. * * @param p Point with `n` dimensions. * @param m Precision of each dimension in bits. * @param n Number of dimensions. * @param[out] h Hilbert Index. */ template inline void coords_to_index(const P& p, size_t m, size_t n, H& h); /** Map the Hilbert Index `p` to a point. * * @tparam P Array-like type with [] operator that represents a point. * @tparam H Hilbert Index. * * @param[out] p Point with `n` dimensions. * @param m Precision of each dimension in bits. * @param n Number of dimensions. * @param h Hilbert Index. */ template inline void index_to_coords(P& p, size_t m, size_t n, const H& h); /** Map the point `p` to a Compact Hilbert Index. * * @tparam P Array-like type with [] operator that represents a point. * @tparam H Compact Hilbert Index. * * @param p Point with `n` dimensions. * @param ms Array of `n` precision values for each dimension in bits. * @param n Number of dimensions. * @param[out] hc Compact Hilbert Index. * @param M Optional net precision (sum of `ms`), the size of `hc` in bits. * @param m Optional largest precision in `m`. */ template inline void coords_to_compact_index(const P& p, const size_t* ms, size_t n, H& hc, size_t M = 0, size_t m = 0); /** Map the Compact Hilbert Index `hc` to a point. * * @tparam P Array-like type with [] operator that represents a point. * @tparam H Compact Hilbert Index. * * @param[out] p Point with `n` dimensions. * @param ms Array of `n` precision values for each dimension in bits. * @param n Number of dimensions. * @param hc Compact Hilbert Index. * @param M Optional net precision (sum of `ms`), the size of `hc` in bits. * @param m Optional largest precision in `m`. */ template inline void compact_index_to_coords(P& p, const size_t* ms, size_t n, const H& hc, size_t M = 0, size_t m = 0); } // namespace chilbert #include "chilbert/chilbert.ipp" // IWYU pragma: export #endif