From 03f39c8be08d632d1f982f5ba5f2e95256be1122 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 19 Aug 2018 16:47:38 +0200 Subject: Use consistent naming scheme --- chilbert/Hilbert.ipp | 116 +++++++++++++++++++++++++-------------------------- 1 file changed, 58 insertions(+), 58 deletions(-) (limited to 'chilbert/Hilbert.ipp') 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 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 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, n, static_cast(i), l); + get_location(p, n, static_cast(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, n, ho, w); + set_bits(h, n, ho, w); // Update the entry point and direction. update2(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 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, m, n, h, CFixBitVec(n)); + _coords_to_index(p, m, n, h, CFixBitVec(n)); } else { // Otherwise, they must be BigBitVecs - _coordsToIndex(p, m, n, h, CBigBitVec(n)); + _coords_to_index(p, m, n, h, CBigBitVec(n)); } } template 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(m - 1); i >= 0; i--) { // Get the Hilbert index bits ho -= n; - getBits(h, n, ho, w); + get_bits(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(e, d, n, l); + transform_inv(e, d, n, l); // Distribute these bits // to the coordinates. - setLocation(p, n, static_cast(i), l); + set_location(p, n, static_cast(i), l); // Update the entry point and direction. update1(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 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, m, n, h, CFixBitVec(n)); + _index_to_coords(p, m, n, h, CFixBitVec(n)); } else { // Otherwise, they must be BigBitVecs - _indexToCoords(p, m, n, h, CBigBitVec(n)); + _index_to_coords(p, m, n, h, CBigBitVec(n)); } } template 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, m, n, h, std::move(scratch), ds); - compactIndex(ms, ds, n, m, h, hc); + _coords_to_index(p, m, n, h, std::move(scratch), ds); + compact_index(ms, ds, n, m, h, hc); } else { CFixBitVec h(mn); - _coordsToIndex(p, m, n, h, std::move(scratch), ds); - compactIndex(ms, ds, n, m, h, hc); + _coords_to_index(p, m, n, h, std::move(scratch), ds); + compact_index(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 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( + _coords_to_compact_index( p, ms, n, hc, CFixBitVec(n), M, m); } else { // Otherwise, they must be BigBitVecs. - _coordsToCompactIndex( + _coords_to_compact_index( p, ms, n, hc, CBigBitVec(n), M, m); } } template 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(m - 1); i >= 0; i--) { // Get the mask and ptrn size_t b = 0; - extractMask(ms, n, d, static_cast(i), mask, b); + extract_mask(ms, n, d, static_cast(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, b, M, r); + get_bits(hc, b, M, r); // w = GrayCodeRankInv(r) // t = GrayCode(w) - grayCodeRankInv(mask, ptrn, r, n, b, t, w); + gray_code_rank_inv(mask, ptrn, r, n, b, t, w); // Reverse the transform // l = T^{-1}_{(e,d)}(t) l = t; - transformInv(e, d, n, l); + transform_inv(e, d, n, l); // Distribute these bits // to the coordinates. - setLocation(p, n, static_cast(i), l); + set_location(p, n, static_cast(i), l); // Update the entry point and direction. update1(l, t, w, n, e, d); @@ -448,7 +448,7 @@ _compactIndexToCoords(P* const p, // appropriate variable. template 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( + _compact_index_to_coords( p, ms, n, hc, std::move(scratch), M, m); } else { // Otherwise, they must be BigBitVecs CBigBitVec scratch(n); - _compactIndexToCoords( + _compact_index_to_coords( p, ms, n, hc, std::move(scratch), M, m); } } -- cgit v1.2.1