#11024 Allow grid calculator expressions with no input cases

Will make it possible to use calc := 3
This commit is contained in:
Magne Sjaastad 2024-01-08 15:22:45 +01:00
parent fa94aa0bf9
commit f907c6bdff
3 changed files with 21 additions and 4 deletions

View File

@ -278,7 +278,16 @@ QList<caf::PdmOptionItemInfo> RimGridCalculation::calculateValueOptions( const c
RimProject::current()->allViews( views );
RimEclipseCase* firstEclipseCase = nullptr;
if ( !inputCases().empty() ) firstEclipseCase = inputCases().front();
if ( !inputCases().empty() )
{
firstEclipseCase = inputCases().front();
}
else
{
// If no input cases are defined, use the destination case to determine the grid size. This will enable use of expressions with
// no input cases like "calculation := 1.0"
firstEclipseCase = m_destinationCase();
}
if ( firstEclipseCase )
{
@ -727,7 +736,15 @@ bool RimGridCalculation::calculateForCases( const std::vector<RimEclipseCase*>&
}
std::vector<double> resultValues;
resultValues.resize( dataForAllVariables[0].size() );
if ( m_destinationCase && m_destinationCase->eclipseCaseData() )
{
// Find number of active cells in the destination case.
auto activeCellInfoDestination = m_destinationCase->eclipseCaseData()->activeCellInfo( porosityModel );
if ( activeCellInfoDestination )
{
resultValues.resize( activeCellInfoDestination->reservoirActiveCellCount() );
}
}
parser.assignVector( leftHandSideVariableName, resultValues );
QString errorText;

@ -1 +1 @@
Subproject commit 994162ff388bab1befd8bff7256d8daa9e686f97
Subproject commit f0c77de5d4a0b04b989c90f9750b7f507326341b

2
ThirdParty/openzgy vendored

@ -1 +1 @@
Subproject commit 6c82a005d5dee93cbfd55c41e836a40ad7d91028
Subproject commit 61126458c761f4fa4fffa817cb162f7912afef3c