diff options
author | David Robillard <d@drobilla.net> | 2018-08-19 16:47:38 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-09-29 14:49:01 +0200 |
commit | 03f39c8be08d632d1f982f5ba5f2e95256be1122 (patch) | |
tree | 41ae78da247659bf8261bdd2397fadf32550d2d9 /chilbert/Hilbert.ipp | |
parent | fa3d8f677b6a30c2115e7d167d4938e293dfad81 (diff) | |
download | chilbert-03f39c8be08d632d1f982f5ba5f2e95256be1122.tar.gz chilbert-03f39c8be08d632d1f982f5ba5f2e95256be1122.tar.bz2 chilbert-03f39c8be08d632d1f982f5ba5f2e95256be1122.zip |
Use consistent naming scheme
Diffstat (limited to 'chilbert/Hilbert.ipp')
-rw-r--r-- | chilbert/Hilbert.ipp | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/chilbert/Hilbert.ipp b/chilbert/Hilbert.ipp index 726b204..66849ea 100644 --- a/chilbert/Hilbert.ipp +++ b/chilbert/Hilbert.ipp @@ -93,7 +93,7 @@ transform(const I& e, const size_t d, const size_t n, I& a) // Inverse 'transforms' a point. template <class I> inline void -transformInv(const I& e, const size_t d, const size_t n, I& a) +transform_inv(const I& e, const size_t d, const size_t n, I& a) { assert(a.size() == n); a.rotl(d); @@ -146,12 +146,12 @@ update2(const I& l, const I& t, const size_t n, I& e, size_t& d) template <class P, class H, class I> inline void -_coordsToIndex(const P* const p, - const size_t m, - const size_t n, - H& h, - I&& scratch, - size_t* const ds = nullptr // #HACK +_coords_to_index(const P* const p, + const size_t m, + const size_t n, + H& h, + I&& scratch, + size_t* const ds = nullptr // #HACK ) { I e{std::move(scratch)}; @@ -162,7 +162,7 @@ _coordsToIndex(const P* const p, // Initialize e.reset(); l.reset(); - resetBits(h); + reset_bits(h); // Work from MSB to LSB size_t d = D0; @@ -174,7 +174,7 @@ _coordsToIndex(const P* const p, } // Get corner of sub-hypercube where point lies. - getLocation<P, I>(p, n, static_cast<size_t>(i), l); + get_location<P, I>(p, n, static_cast<size_t>(i), l); // Mirror and reflect the location. // t = T_{(e,d)}(l) @@ -188,13 +188,13 @@ _coordsToIndex(const P* const p, // Concatenate to the index. ho -= n; - setBits<H, I>(h, n, ho, w); + set_bits<H, I>(h, n, ho, w); // Update the entry point and direction. update2<I>(l, t, n, e, d); } - grayCodeInv(h); + gray_code_inv(h); } // This is wrapper to the basic Hilbert curve index @@ -205,10 +205,10 @@ _coordsToIndex(const P* const p, // Assumes h is big enough for the output (n*m bits!) template <class P, class H> inline void -coordsToIndex(const P* const p, // [in ] point - const size_t m, // [in ] precision of each dimension in bits - const size_t n, // [in ] number of dimensions - H& h // [out] Hilbert index +coords_to_index(const P* const p, // [in ] point + const size_t m, // [in ] precision of each dimension in bits + const size_t n, // [in ] number of dimensions + H& h // [out] Hilbert index ) { assert(num_bits(h) >= n * m); @@ -216,16 +216,16 @@ coordsToIndex(const P* const p, // [in ] point if (n <= FBV_BITS) { // Intermediate variables will fit in fixed width - _coordsToIndex<P, H, CFixBitVec>(p, m, n, h, CFixBitVec(n)); + _coords_to_index<P, H, CFixBitVec>(p, m, n, h, CFixBitVec(n)); } else { // Otherwise, they must be BigBitVecs - _coordsToIndex<P, H, CBigBitVec>(p, m, n, h, CBigBitVec(n)); + _coords_to_index<P, H, CBigBitVec>(p, m, n, h, CBigBitVec(n)); } } template <class P, class H, class I> inline void -_indexToCoords(P* p, const size_t m, const size_t n, const H& h, I&& scratch) +_index_to_coords(P* p, const size_t m, const size_t n, const H& h, I&& scratch) { I e{std::move(scratch)}; I l{e}; @@ -236,7 +236,7 @@ _indexToCoords(P* p, const size_t m, const size_t n, const H& h, I&& scratch) e.reset(); l.reset(); for (size_t j = 0; j < n; j++) { - resetBits(p[j]); + reset_bits(p[j]); } // Work from MSB to LSB @@ -245,20 +245,20 @@ _indexToCoords(P* p, const size_t m, const size_t n, const H& h, I&& scratch) for (intptr_t i = static_cast<intptr_t>(m - 1); i >= 0; i--) { // Get the Hilbert index bits ho -= n; - getBits<H, I>(h, n, ho, w); + get_bits<H, I>(h, n, ho, w); // t = GrayCode(w) t = w; - grayCode(t); + gray_code(t); // Reverse the transform // l = T^{-1}_{(e,d)}(t) l = t; - transformInv<I>(e, d, n, l); + transform_inv<I>(e, d, n, l); // Distribute these bits // to the coordinates. - setLocation<P, I>(p, n, static_cast<size_t>(i), l); + set_location<P, I>(p, n, static_cast<size_t>(i), l); // Update the entry point and direction. update1<I>(l, t, w, n, e, d); @@ -274,10 +274,10 @@ _indexToCoords(P* p, const size_t m, const size_t n, const H& h, I&& scratch) // appropriate variable. template <class P, class H> inline void -indexToCoords(P* const p, // [out] point - const size_t m, // [in ] precision of each dimension in bits - const size_t n, // [in ] number of dimensions - const H& h // [out] Hilbert index +index_to_coords(P* const p, // [out] point + const size_t m, // [in ] precision of each dimension in bits + const size_t n, // [in ] number of dimensions + const H& h // [out] Hilbert index ) { assert(m > 0); @@ -287,22 +287,22 @@ indexToCoords(P* const p, // [out] point if (n <= FBV_BITS) { // Intermediate variables will fit in fixed width - _indexToCoords<P, H, CFixBitVec>(p, m, n, h, CFixBitVec(n)); + _index_to_coords<P, H, CFixBitVec>(p, m, n, h, CFixBitVec(n)); } else { // Otherwise, they must be BigBitVecs - _indexToCoords<P, H, CBigBitVec>(p, m, n, h, CBigBitVec(n)); + _index_to_coords<P, H, CBigBitVec>(p, m, n, h, CBigBitVec(n)); } } template <class P, class HC, class I> inline void -_coordsToCompactIndex(const P* const p, - const size_t* const ms, - const size_t n, - HC& hc, - I&& scratch, - size_t M = 0, - size_t m = 0) +_coords_to_compact_index(const P* const p, + const size_t* const ms, + const size_t n, + HC& hc, + I&& scratch, + size_t M = 0, + size_t m = 0) { // Get total precision and max precision if not supplied if (M == 0 || m == 0) { @@ -327,12 +327,12 @@ _coordsToCompactIndex(const P* const p, if (mn > FBV_BITS) { CBigBitVec h(mn); - _coordsToIndex<P, CBigBitVec, I>(p, m, n, h, std::move(scratch), ds); - compactIndex<CBigBitVec, HC>(ms, ds, n, m, h, hc); + _coords_to_index<P, CBigBitVec, I>(p, m, n, h, std::move(scratch), ds); + compact_index<CBigBitVec, HC>(ms, ds, n, m, h, hc); } else { CFixBitVec h(mn); - _coordsToIndex<P, CFixBitVec, I>(p, m, n, h, std::move(scratch), ds); - compactIndex<CFixBitVec, HC>(ms, ds, n, m, h, hc); + _coords_to_index<P, CFixBitVec, I>(p, m, n, h, std::move(scratch), ds); + compact_index<CFixBitVec, HC>(ms, ds, n, m, h, hc); } delete[] ds; @@ -346,7 +346,7 @@ _coordsToCompactIndex(const P* const p, // Assumes h is big enough for the output (n*m bits!) template <class P, class HC> inline void -coordsToCompactIndex( +coords_to_compact_index( const P* const p, // [in ] point const size_t* const ms, // [in ] precision of each dimension in bits size_t n, // [in ] number of dimensions @@ -356,24 +356,24 @@ coordsToCompactIndex( { if (n <= FBV_BITS) { // Intermediate variables will fit in fixed width? - _coordsToCompactIndex<P, HC, CFixBitVec>( + _coords_to_compact_index<P, HC, CFixBitVec>( p, ms, n, hc, CFixBitVec(n), M, m); } else { // Otherwise, they must be BigBitVecs. - _coordsToCompactIndex<P, HC, CBigBitVec>( + _coords_to_compact_index<P, HC, CBigBitVec>( p, ms, n, hc, CBigBitVec(n), M, m); } } template <class P, class HC, class I> inline void -_compactIndexToCoords(P* const p, - const size_t* ms, - const size_t n, - const HC& hc, - I&& scratch, - size_t M, - size_t m) +_compact_index_to_coords(P* const p, + const size_t* ms, + const size_t n, + const HC& hc, + I&& scratch, + size_t M, + size_t m) { I e{std::move(scratch)}; I l{e}; @@ -411,7 +411,7 @@ _compactIndexToCoords(P* const p, for (intptr_t i = static_cast<intptr_t>(m - 1); i >= 0; i--) { // Get the mask and ptrn size_t b = 0; - extractMask<I>(ms, n, d, static_cast<size_t>(i), mask, b); + extract_mask<I>(ms, n, d, static_cast<size_t>(i), mask, b); ptrn = e; assert(ptrn.size() == n); ptrn.rotr(d); @@ -419,20 +419,20 @@ _compactIndexToCoords(P* const p, // Get the Hilbert index bits M -= b; r.reset(); // GetBits doesn't do this - getBits<HC, I>(hc, b, M, r); + get_bits<HC, I>(hc, b, M, r); // w = GrayCodeRankInv(r) // t = GrayCode(w) - grayCodeRankInv<I>(mask, ptrn, r, n, b, t, w); + gray_code_rank_inv<I>(mask, ptrn, r, n, b, t, w); // Reverse the transform // l = T^{-1}_{(e,d)}(t) l = t; - transformInv<I>(e, d, n, l); + transform_inv<I>(e, d, n, l); // Distribute these bits // to the coordinates. - setLocation<P, I>(p, n, static_cast<size_t>(i), l); + set_location<P, I>(p, n, static_cast<size_t>(i), l); // Update the entry point and direction. update1<I>(l, t, w, n, e, d); @@ -448,7 +448,7 @@ _compactIndexToCoords(P* const p, // appropriate variable. template <class P, class HC> inline void -compactIndexToCoords( +compact_index_to_coords( P* const p, // [out] point const size_t* ms, // [in ] precision of each dimension in bits const size_t n, // [in ] number of dimensions @@ -459,12 +459,12 @@ compactIndexToCoords( if (n <= FBV_BITS) { // Intermediate variables will fit in fixed width CFixBitVec scratch(n); - _compactIndexToCoords<P, HC, CFixBitVec>( + _compact_index_to_coords<P, HC, CFixBitVec>( p, ms, n, hc, std::move(scratch), M, m); } else { // Otherwise, they must be BigBitVecs CBigBitVec scratch(n); - _compactIndexToCoords<P, HC, CBigBitVec>( + _compact_index_to_coords<P, HC, CBigBitVec>( p, ms, n, hc, std::move(scratch), M, m); } } |