Move grid size check to calculate()

This move will make it possible to use a calculator expression defined for a different grid size for grid case statistics.
This commit is contained in:
Magne Sjaastad 2023-11-10 08:06:46 +01:00
parent 5ecc43d49f
commit 917fd9b3b5

View File

@ -111,6 +111,22 @@ RimGridCalculationVariable* RimGridCalculation::createVariable()
//--------------------------------------------------------------------------------------------------
bool RimGridCalculation::calculate()
{
for ( auto calculationCase : outputEclipseCases() )
{
if ( !calculationCase ) continue;
for ( auto inputCase : inputCases() )
{
if ( !calculationCase->isGridSizeEqualTo( inputCase ) )
{
QString msg = "Detected IJK mismatch between input cases and destination case. All grid "
"cases must have identical IJK sizes.";
RiaLogging::errorInMessageBox( nullptr, "Grid Property Calculator", msg );
return false;
}
}
}
auto timeSteps = std::nullopt;
return calculateForCases( outputEclipseCases(), timeSteps );
@ -529,20 +545,6 @@ bool RimGridCalculation::calculateForCases( const std::vector<RimEclipseCase*>&
return false;
}
for ( auto calculationCase : calculationCases )
{
for ( auto inputCase : inputCases() )
{
if ( !calculationCase->isGridSizeEqualTo( inputCase ) )
{
QString msg = "Detected IJK mismatch between input cases and destination case. All grid "
"cases must have identical IJK sizes.";
RiaLogging::errorInMessageBox( nullptr, "Grid Property Calculator", msg );
return false;
}
}
}
const bool isMultipleCasesPresent = calculationCases.size() > 1;
if ( isMultipleCasesPresent )