From 2d0bd94f2293a4b0fe54abfcf43c1e2f4614f1c2 Mon Sep 17 00:00:00 2001 From: Steven Hahn <hahnse@ornl.gov> Date: Sun, 30 Apr 2017 11:58:04 -0400 Subject: [PATCH] further avoid memory allocations. --- Framework/MDAlgorithms/src/MDNormSCD.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Framework/MDAlgorithms/src/MDNormSCD.cpp b/Framework/MDAlgorithms/src/MDNormSCD.cpp index fb99051b5e1..5c7d7d90758 100644 --- a/Framework/MDAlgorithms/src/MDNormSCD.cpp +++ b/Framework/MDAlgorithms/src/MDNormSCD.cpp @@ -416,10 +416,10 @@ void MDNormSCD::calculateNormalization( std::vector<std::atomic<signal_t>> signalArray(m_normWS->getNPoints()); std::vector<std::array<double, 4>> intersections; std::vector<double> xValues, yValues; - std::vector<coord_t> posNew(vmdDims); + std::vector<coord_t> pos, posNew; auto prog = make_unique<API::Progress>(this, 0.3, 1.0, ndets); -#pragma omp parallel for private(intersections, xValues, yValues, \ - pos) if (Kernel::threadSafe(*integrFlux)) +#pragma omp parallel for private(intersections, xValues, yValues, pos, \ + posNew) if (Kernel::threadSafe(*integrFlux)) for (int64_t i = 0; i < ndets; i++) { PARALLEL_START_INTERUPT_REGION @@ -461,7 +461,7 @@ void MDNormSCD::calculateNormalization( // Compute final position in HKL // pre-allocate for efficiency and copy non-hkl dim values into place - std::vector<coord_t> pos(vmdDims + otherValues.size()); + pos.resize(vmdDims + otherValues.size()); std::copy(otherValues.begin(), otherValues.end(), pos.begin() + vmdDims - 1); pos.push_back(1.); -- GitLab