mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4835 Python Cell Results : Not possible to write data if no dynamic data is present
This commit is contained in:
@@ -112,13 +112,13 @@ bool RigCaseCellResultCalculator::computeDifference( RigEclipseCaseData*
|
||||
// Initialize difference result with infinity for correct number of time steps and values per time step
|
||||
{
|
||||
const std::vector<std::vector<double>>& srcFrames = sourceCaseResults->cellScalarResults( nativeAddress );
|
||||
std::vector<std::vector<double>>& diffResultFrames = sourceCaseResults->modifiableCellScalarResultTimesteps(
|
||||
std::vector<std::vector<double>>* diffResultFrames = sourceCaseResults->modifiableCellScalarResultTimesteps(
|
||||
address );
|
||||
diffResultFrames.resize( srcFrames.size() );
|
||||
diffResultFrames->resize( srcFrames.size() );
|
||||
for ( size_t fIdx = 0; fIdx < srcFrames.size(); ++fIdx )
|
||||
{
|
||||
const std::vector<double>& srcVals = srcFrames[fIdx];
|
||||
std::vector<double>& dstVals = diffResultFrames[fIdx];
|
||||
std::vector<double>& dstVals = diffResultFrames->at( fIdx );
|
||||
|
||||
dstVals.resize( srcVals.size(), std::numeric_limits<double>::infinity() );
|
||||
}
|
||||
|
||||
@@ -249,20 +249,20 @@ const std::vector<std::vector<double>>&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::vector<double>>&
|
||||
std::vector<std::vector<double>>*
|
||||
RigCaseCellResultsData::modifiableCellScalarResultTimesteps( const RigEclipseResultAddress& resVarAddr )
|
||||
{
|
||||
size_t scalarResultIndex = findScalarResultIndexFromAddress( resVarAddr );
|
||||
|
||||
CVF_TIGHT_ASSERT( scalarResultIndex < resultCount() );
|
||||
|
||||
return m_cellScalarResults[scalarResultIndex];
|
||||
return &( m_cellScalarResults[scalarResultIndex] );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double>& RigCaseCellResultsData::modifiableCellScalarResult( const RigEclipseResultAddress& resVarAddr,
|
||||
std::vector<double>* RigCaseCellResultsData::modifiableCellScalarResult( const RigEclipseResultAddress& resVarAddr,
|
||||
size_t timeStepIndex )
|
||||
{
|
||||
size_t scalarResultIndex = findScalarResultIndexFromAddress( resVarAddr );
|
||||
@@ -270,7 +270,7 @@ std::vector<double>& RigCaseCellResultsData::modifiableCellScalarResult( const R
|
||||
CVF_TIGHT_ASSERT( scalarResultIndex < resultCount() );
|
||||
CVF_TIGHT_ASSERT( timeStepIndex < m_cellScalarResults[scalarResultIndex].size() );
|
||||
|
||||
return m_cellScalarResults[scalarResultIndex][timeStepIndex];
|
||||
return &( m_cellScalarResults[scalarResultIndex][timeStepIndex] );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -609,8 +609,8 @@ void RigCaseCellResultsData::setTimeStepInfos( const RigEclipseResultAddress&
|
||||
|
||||
m_resultInfos[findScalarResultIndexFromAddress( resVarAddr )].setTimeStepInfos( timeStepInfos );
|
||||
|
||||
std::vector<std::vector<double>>& dataValues = this->modifiableCellScalarResultTimesteps( resVarAddr );
|
||||
dataValues.resize( timeStepInfos.size() );
|
||||
std::vector<std::vector<double>>* dataValues = this->modifiableCellScalarResultTimesteps( resVarAddr );
|
||||
dataValues->resize( timeStepInfos.size() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1605,7 +1605,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep( size_t timeStepIndex )
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<double>& soilForTimeStep = this->modifiableCellScalarResult( SOILAddr, timeStepIndex );
|
||||
std::vector<double>* soilForTimeStep = this->modifiableCellScalarResult( SOILAddr, timeStepIndex );
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int idx = 0; idx < static_cast<int>( soilResultValueCount ); idx++ )
|
||||
@@ -1626,7 +1626,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep( size_t timeStepIndex )
|
||||
soilValue -= ssolForTimeStep->at( idx );
|
||||
}
|
||||
|
||||
soilForTimeStep[idx] = soilValue;
|
||||
soilForTimeStep->at( idx ) = soilValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2802,7 +2802,7 @@ void RigCaseCellResultsData::setActiveFormationNames( RigFormationNames* activeF
|
||||
false,
|
||||
totalGlobCellCount );
|
||||
|
||||
std::vector<double>& fnData =
|
||||
std::vector<double>* fnData =
|
||||
this->modifiableCellScalarResult( RigEclipseResultAddress( RiaDefines::FORMATION_NAMES,
|
||||
RiaDefines::activeFormationNamesResultName() ),
|
||||
0 );
|
||||
@@ -2811,7 +2811,7 @@ void RigCaseCellResultsData::setActiveFormationNames( RigFormationNames* activeF
|
||||
{
|
||||
for ( size_t cIdx = 0; cIdx < totalGlobCellCount; ++cIdx )
|
||||
{
|
||||
fnData[cIdx] = HUGE_VAL;
|
||||
fnData->at( cIdx ) = HUGE_VAL;
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -2827,11 +2827,11 @@ void RigCaseCellResultsData::setActiveFormationNames( RigFormationNames* activeF
|
||||
int formNameIdx = activeFormationNames->formationIndexFromKLayerIdx( k );
|
||||
if ( formNameIdx != -1 )
|
||||
{
|
||||
fnData[cIdx] = formNameIdx;
|
||||
fnData->at( cIdx ) = formNameIdx;
|
||||
}
|
||||
else
|
||||
{
|
||||
fnData[cIdx] = HUGE_VAL;
|
||||
fnData->at( cIdx ) = HUGE_VAL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2846,11 +2846,11 @@ void RigCaseCellResultsData::setActiveFormationNames( RigFormationNames* activeF
|
||||
int formNameIdx = activeFormationNames->formationIndexFromKLayerIdx( k );
|
||||
if ( formNameIdx != -1 )
|
||||
{
|
||||
fnData[cIdx] = formNameIdx;
|
||||
fnData->at( cIdx ) = formNameIdx;
|
||||
}
|
||||
else
|
||||
{
|
||||
fnData[cIdx] = HUGE_VAL;
|
||||
fnData->at( cIdx ) = HUGE_VAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3064,9 +3064,9 @@ void RigCaseCellResultsData::copyResultsMetaDataFromMainCase( RigEclipseCaseData
|
||||
|
||||
cellResultsStorage->setTimeStepInfos( resVarAddr, timeStepInfos );
|
||||
|
||||
std::vector<std::vector<double>>& dataValues = cellResultsStorage->modifiableCellScalarResultTimesteps(
|
||||
std::vector<std::vector<double>>* dataValues = cellResultsStorage->modifiableCellScalarResultTimesteps(
|
||||
resVarAddr );
|
||||
dataValues.resize( timeStepInfos.size() );
|
||||
dataValues->resize( timeStepInfos.size() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@ public:
|
||||
|
||||
const std::vector<std::vector<double>>& cellScalarResults( const RigEclipseResultAddress& resVarAddr ) const;
|
||||
const std::vector<double>& cellScalarResults( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex ) const;
|
||||
std::vector<std::vector<double>>& modifiableCellScalarResultTimesteps( const RigEclipseResultAddress& resVarAddr );
|
||||
std::vector<double>& modifiableCellScalarResult( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex );
|
||||
std::vector<std::vector<double>>* modifiableCellScalarResultTimesteps( const RigEclipseResultAddress& resVarAddr );
|
||||
std::vector<double>* modifiableCellScalarResult( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex );
|
||||
|
||||
bool isUsingGlobalActiveIndex( const RigEclipseResultAddress& resVarAddr ) const;
|
||||
|
||||
|
||||
@@ -52,18 +52,17 @@ cvf::ref<RigResultModifier> RigResultModifierFactory::createResultModifier( RigE
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<std::vector<double>>& scalarSetResults = eclipseCase->results( porosityModel )
|
||||
->modifiableCellScalarResultTimesteps( resVarAddr );
|
||||
auto scalarSetResults = eclipseCase->results( porosityModel )->modifiableCellScalarResultTimesteps( resVarAddr );
|
||||
|
||||
if ( timeStepIndex >= scalarSetResults.size() )
|
||||
if ( timeStepIndex >= scalarSetResults->size() )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<double>* resultValues = nullptr;
|
||||
if ( timeStepIndex < scalarSetResults.size() )
|
||||
if ( timeStepIndex < scalarSetResults->size() )
|
||||
{
|
||||
resultValues = &( scalarSetResults[timeStepIndex] );
|
||||
resultValues = &( scalarSetResults->at( timeStepIndex ) );
|
||||
}
|
||||
|
||||
bool useGlobalActiveIndex = eclipseCase->results( porosityModel )->isUsingGlobalActiveIndex( resVarAddr );
|
||||
|
||||
Reference in New Issue
Block a user