From 2fa5b929182468abb96e237a604eea802a1f9f02 Mon Sep 17 00:00:00 2001 From: Chiara Salvoni <chiara.salvoni@cgi.com> Date: Fri, 4 Nov 2022 16:50:29 +0000 Subject: [PATCH] AST-1074 Remove fetch functions from SolutionInterval --- base/SolutionInterval.cc | 8 +------- base/SolutionInterval.h | 5 ++--- base/test/unit/tSolutionInterval.cc | 12 ++++-------- steps/DDECal.cc | 3 +-- steps/DDECal.h | 3 ++- 5 files changed, 10 insertions(+), 21 deletions(-) diff --git a/base/SolutionInterval.cc b/base/SolutionInterval.cc index e16940dd5..91e3aa718 100644 --- a/base/SolutionInterval.cc +++ b/base/SolutionInterval.cc @@ -10,14 +10,12 @@ using dp3::steps::InputStep; namespace dp3 { namespace base { -SolutionInterval::SolutionInterval(InputStep& input, - const std::size_t n_solution, +SolutionInterval::SolutionInterval(const std::size_t n_solution, const std::size_t buffer_size, common::NSTimer timer) : buffer_size_(buffer_size), n_solution_(n_solution), timer_(timer), - input_(input), buffer_index_(0), buffers_(buffer_size), original_flags_(buffer_size), @@ -32,10 +30,6 @@ void SolutionInterval::PushBack(const DPBuffer& buffer) { buffers_[buffer_index_].copy(buffer); - input_.fetchUVW(buffer, buffers_[buffer_index_], timer_); - input_.fetchWeights(buffer, buffers_[buffer_index_], timer_); - input_.fetchFullResFlags(buffer, buffers_[buffer_index_], timer_); - original_flags_[buffer_index_].assign(buffer.getFlags()); original_weights_[buffer_index_].assign(buffer.getWeights()); // Ensure that the copies are independent of the data in 'buffer'.. diff --git a/base/SolutionInterval.h b/base/SolutionInterval.h index 815395c9c..046570106 100644 --- a/base/SolutionInterval.h +++ b/base/SolutionInterval.h @@ -23,8 +23,8 @@ class DPBuffer; class SolutionInterval { public: - SolutionInterval(steps::InputStep& input, std::size_t n_solution, - std::size_t buffer_size, common::NSTimer timer); + SolutionInterval(std::size_t n_solution, std::size_t buffer_size, + common::NSTimer timer); ~SolutionInterval(); // Copy a buffer and append it to the Solution Interval. @@ -57,7 +57,6 @@ class SolutionInterval { const std::size_t n_solution_; common::NSTimer timer_; ///< Timer from the step that is using it for metrics - steps::InputStep& input_; ///< Input of DP3 std::size_t buffer_index_; ///< Current index where to insert the next buffer std::vector<DPBuffer> buffers_; ///< Vector of DPBuffer copies diff --git a/base/test/unit/tSolutionInterval.cc b/base/test/unit/tSolutionInterval.cc index 4f7e4f75f..0b986a4e4 100644 --- a/base/test/unit/tSolutionInterval.cc +++ b/base/test/unit/tSolutionInterval.cc @@ -61,13 +61,12 @@ BOOST_AUTO_TEST_SUITE(solutioninterval) /// Test if buffer inserted is the same BOOST_AUTO_TEST_CASE(insertion) { - MockInput input; NSTimer timer; size_t n_solution = 0; size_t buffer_size = 1; DPBuffer buffer = InitBuffer(); - SolutionInterval solInt(input, n_solution, buffer_size, timer); + SolutionInterval solInt(n_solution, buffer_size, timer); BOOST_TEST(solInt.Size() == 0U); solInt.PushBack(buffer); @@ -86,13 +85,12 @@ BOOST_AUTO_TEST_CASE(insertion) { /// Test that the limit cannot be exceeded BOOST_AUTO_TEST_CASE(limit) { - MockInput input; NSTimer timer; size_t n_solution = 0; size_t buffer_size = 1; DPBuffer buffer = InitBuffer(); - SolutionInterval solInt(input, n_solution, buffer_size, timer); + SolutionInterval solInt(n_solution, buffer_size, timer); solInt.PushBack(buffer); BOOST_CHECK_THROW(solInt.PushBack(buffer), std::runtime_error); @@ -100,13 +98,12 @@ BOOST_AUTO_TEST_CASE(limit) { /// Test if buffer is a copy and can be changed BOOST_AUTO_TEST_CASE(copy) { - MockInput input; NSTimer timer; size_t n_solution = 0; size_t buffer_size = 1; DPBuffer buffer = InitBuffer(); - SolutionInterval solInt(input, n_solution, buffer_size, timer); + SolutionInterval solInt(n_solution, buffer_size, timer); solInt.PushBack(buffer); BOOST_TEST(&solInt[0] != &buffer); @@ -121,13 +118,12 @@ BOOST_AUTO_TEST_CASE(copy) { /// Copy a buffer, change a weight and test if it is restored BOOST_AUTO_TEST_CASE(restore) { - MockInput input; NSTimer timer; size_t n_solution = 0; size_t buffer_size = 1; DPBuffer buffer = InitBuffer(); - SolutionInterval solInt(input, n_solution, buffer_size, timer); + SolutionInterval solInt(n_solution, buffer_size, timer); solInt.PushBack(buffer); // Overwrite the values in the buffer diff --git a/steps/DDECal.cc b/steps/DDECal.cc index d7cbfa4e6..bf39ec6d2 100644 --- a/steps/DDECal.cc +++ b/steps/DDECal.cc @@ -656,8 +656,7 @@ bool DDECal::process(const DPBuffer& bufin) { // Create a new solution interval if needed if (itsSolIntBuffers.empty() || itsSolIntBuffers.back().Size() == itsRequestedSolInt) { - itsSolIntBuffers.emplace_back(itsInput, itsNSolInts, itsRequestedSolInt, - itsTimer); + itsSolIntBuffers.emplace_back(itsNSolInts, itsRequestedSolInt, itsTimer); } const size_t currentIntervalIndex = itsSolIntBuffers.back().Size(); diff --git a/steps/DDECal.h b/steps/DDECal.h index 2cc7cfc97..a701de89b 100644 --- a/steps/DDECal.h +++ b/steps/DDECal.h @@ -41,7 +41,8 @@ class DDECal : public Step { const std::string& prefix); common::Fields getRequiredFields() const override { - return kDataField | kFlagsField | kWeightsField | kUvwField; + return kDataField | kFlagsField | kWeightsField | kUvwField | + kFullResFlagsField; } common::Fields getProvidedFields() const override { -- GitLab