From 3ff116d468649a68365bf35d1b1922b19ea86799 Mon Sep 17 00:00:00 2001 From: Evgueni Ovtchinnikov Date: Thu, 12 Dec 2024 16:47:36 +0000 Subject: [PATCH] adopted the reviewer's suggestions --- src/buildblock/ProjDataInMemory.cxx | 17 ++--------------- src/include/stir/Array.h | 2 +- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/buildblock/ProjDataInMemory.cxx b/src/buildblock/ProjDataInMemory.cxx index 033268e168..bebb7108e2 100644 --- a/src/buildblock/ProjDataInMemory.cxx +++ b/src/buildblock/ProjDataInMemory.cxx @@ -73,21 +73,8 @@ ProjDataInMemory::ProjDataInMemory(shared_ptr const& exam_info_s void ProjDataInMemory::create_buffer(const bool initialise_with_0) { - if (!initialise_with_0) - { - this->buffer.set_initialise_with_zeros(false); - this->buffer.grow(0, this->size_all() - 1); - return; - } -#if 0 - float *b = new float[this->size_all()]; - if (initialise_with_0) - memset(b, 0, this->size_all()*sizeof(float)); - return b; -#else - this->buffer.set_initialise_with_zeros(true); - this->buffer = Array<1, float>(static_cast(this->size_all())); -#endif + this->buffer.set_initialise_with_zeros(initialise_with_0); + this->buffer.grow(0, this->size_all() - 1); } ///////////////// /set functions diff --git a/src/include/stir/Array.h b/src/include/stir/Array.h index 6aa4098d10..ccb438a2fa 100644 --- a/src/include/stir/Array.h +++ b/src/include/stir/Array.h @@ -589,7 +589,7 @@ class Array<1, elemT> : public NumericVectorWithOffset */ inline void init(const IndexRange<1>& range, elemT* const data_ptr, bool copy_data); - bool init_with_zeros_ = 1; + bool init_with_zeros_ = true; }; END_NAMESPACE_STIR