diff --git a/src/core/accumulators/Correlator.cpp b/src/core/accumulators/Correlator.cpp index 6960c0b8963..de56820ad23 100644 --- a/src/core/accumulators/Correlator.cpp +++ b/src/core/accumulators/Correlator.cpp @@ -159,7 +159,6 @@ std::vector fcs_acf(std::vector const &A, } void Correlator::initialize() { - hierarchy_depth = 0; // Class members are assigned via the initializer list if (m_tau_lin == 1) { // use the default @@ -181,9 +180,9 @@ void Correlator::initialize() { } // set hierarchy depth which can accommodate at least m_tau_max if ((m_tau_max / m_dt) < m_tau_lin) { - hierarchy_depth = 1; + m_hierarchy_depth = 1; } else { - hierarchy_depth = static_cast( + m_hierarchy_depth = static_cast( ceil(1 + log((m_tau_max / m_dt) / (m_tau_lin - 1)) / log(2.0))); } @@ -280,18 +279,18 @@ void Correlator::initialize() { "no proper function for compression of second observable given"); } - A.resize(std::array{{hierarchy_depth, m_tau_lin + 1}}); + A.resize(std::array{{m_hierarchy_depth, m_tau_lin + 1}}); std::fill_n(A.data(), A.num_elements(), std::vector(dim_A, 0)); - B.resize(std::array{{hierarchy_depth, m_tau_lin + 1}}); + B.resize(std::array{{m_hierarchy_depth, m_tau_lin + 1}}); std::fill_n(B.data(), B.num_elements(), std::vector(dim_B, 0)); n_data = 0; A_accumulated_average = std::vector(dim_A, 0); B_accumulated_average = std::vector(dim_B, 0); - m_n_result = m_tau_lin + 1 + (m_tau_lin + 1) / 2 * (hierarchy_depth - 1); + m_n_result = m_tau_lin + 1 + (m_tau_lin + 1) / 2 * (m_hierarchy_depth - 1); n_sweeps = std::vector(m_n_result, 0); - n_vals = std::vector(hierarchy_depth, 0); + n_vals = std::vector(m_hierarchy_depth, 0); result.resize(std::array{{m_n_result, m_dim_corr}}); @@ -302,14 +301,14 @@ void Correlator::initialize() { } } - newest = std::vector(hierarchy_depth, m_tau_lin); + newest = std::vector(m_hierarchy_depth, m_tau_lin); tau.resize(m_n_result); for (int i = 0; i < m_tau_lin + 1; i++) { tau[i] = i; } - for (int j = 1; j < hierarchy_depth; j++) { + for (int j = 1; j < m_hierarchy_depth; j++) { for (int k = 0; k < m_tau_lin / 2; k++) { tau[m_tau_lin + 1 + (j - 1) * m_tau_lin / 2 + k] = (k + (m_tau_lin / 2) + 1) * (1 << j); @@ -335,7 +334,7 @@ void Correlator::update() { while (true) { if (((t - ((m_tau_lin + 1) * ((1 << (i + 1)) - 1) + 1)) % (1 << (i + 1)) == 0)) { - if (i < (hierarchy_depth - 1) && n_vals[i] > m_tau_lin) { + if (i < (m_hierarchy_depth - 1) && n_vals[i] > m_tau_lin) { highest_level_to_compress += 1; i++; } else @@ -426,7 +425,7 @@ int Correlator::finalize() { // mark the correlation as finalized finalized = true; - for (int ll = 0; ll < hierarchy_depth - 1; ll++) { + for (int ll = 0; ll < m_hierarchy_depth - 1; ll++) { int vals_ll; // number of values remaining in the lowest level if (n_vals[ll] > m_tau_lin + 1) vals_ll = m_tau_lin + static_cast(n_vals[ll]) % 2; @@ -445,7 +444,7 @@ int Correlator::finalize() { // space for the new value while (highest_level_to_compress > -1) { if (n_vals[i] % 2) { - if (i < (hierarchy_depth - 1) && n_vals[i] > m_tau_lin) { + if (i < (m_hierarchy_depth - 1) && n_vals[i] > m_tau_lin) { highest_level_to_compress += 1; i++; } else { diff --git a/src/core/accumulators/Correlator.hpp b/src/core/accumulators/Correlator.hpp index 79908307c33..da4e28536c6 100644 --- a/src/core/accumulators/Correlator.hpp +++ b/src/core/accumulators/Correlator.hpp @@ -221,12 +221,12 @@ class Correlator : public AccumulatorBase { ///< correlation may need (currently ///< only used by fcs_acf) - int hierarchy_depth; ///< maximum level of data compression - int m_tau_lin; ///< number of frames in the linear correlation - size_t m_dim_corr; ///< number of columns for the correlation - double m_dt; ///< time interval at which samples arrive - double m_tau_max; ///< maximum time for which the correlation should be - ///< calculated + int m_hierarchy_depth; ///< maximum level of data compression + int m_tau_lin; ///< number of frames in the linear correlation + size_t m_dim_corr; ///< number of columns for the correlation + double m_dt; ///< time interval at which samples arrive + double m_tau_max; ///< maximum time for which the correlation should be + ///< calculated std::string compressA_name; std::string compressB_name;