From 390d683fd4fe4c97cda2a0d1c38a6be6e448abe9 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 24 Nov 2020 13:10:47 +0100 Subject: [PATCH] #7014 Python: Resize the result container before assigning data --- .../GrpcInterface/RiaGrpcPropertiesService.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/GrpcInterface/RiaGrpcPropertiesService.cpp b/ApplicationCode/GrpcInterface/RiaGrpcPropertiesService.cpp index e41562dc0d..84fb304db3 100644 --- a/ApplicationCode/GrpcInterface/RiaGrpcPropertiesService.cpp +++ b/ApplicationCode/GrpcInterface/RiaGrpcPropertiesService.cpp @@ -119,6 +119,7 @@ public: if ( timeStep < resultData->timeStepCount( m_resultAddress ) ) { initResultAccess( caseData, request->grid_index(), m_porosityModel, timeStep, m_resultAddress ); + return grpc::Status::OK; } return grpc::Status( grpc::NOT_FOUND, "No such time step" ); @@ -348,11 +349,17 @@ protected: size_t timeStepIndex, RigEclipseResultAddress resVarAddr ) override { + m_cellCount = caseData->grid( gridIndex )->cellCount(); + auto resultValues = caseData->results( porosityModel )->modifiableCellScalarResult( resVarAddr, timeStepIndex ); + if ( resultValues && m_cellCount > 0 ) + { + resultValues->resize( m_cellCount ); + } + m_resultAccessor = RigResultAccessorFactory::createFromResultAddress( caseData, gridIndex, porosityModel, timeStepIndex, resVarAddr ); m_resultModifier = RigResultModifierFactory::createResultModifier( caseData, gridIndex, porosityModel, timeStepIndex, resVarAddr ); - m_cellCount = caseData->grid( gridIndex )->cellCount(); } double cellResult( size_t currentCellIndex ) const override