From 4d467447837906451e5be17c81ec9653f435649e Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 8 Nov 2013 14:27:21 +0100 Subject: [PATCH] Performance: Reduce memory use for riGetPropertyData --- .../SocketInterface/RiaPropertyDataCommands.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp b/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp index 40dc5d2efd..f31218d7e3 100644 --- a/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp @@ -304,10 +304,10 @@ public: quint64 timestepCount = (quint64)requestedTimesteps.size(); socketStream << timestepCount; - size_t doubleValueCount = cellCountI * cellCountJ * cellCountK * timestepCount * sizeof(double); - std::vector values(doubleValueCount); size_t valueIdx = 0; + std::vector values(rigGrid->cellCount()); + for (size_t tsIdx = 0; tsIdx < timestepCount; tsIdx++) { cvf::ref cellCenterDataAccessObject = rimCase->reservoirData()->dataAccessObject(rigGrid, porosityModelEnum, requestedTimesteps[tsIdx], scalarResultIndex); @@ -323,11 +323,11 @@ public: { cellValue = 0.0; } - values[valueIdx++] = cellValue; + values[cellIdx] = cellValue; } - } - server->currentClient()->write((const char *)values.data(), doubleValueCount); + server->currentClient()->write((const char *)values.data(), rigGrid->cellCount() * sizeof(double)); + } return true; }