mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Grid Calculator: Improvements after review.
This commit is contained in:
parent
8ea4e933aa
commit
85cd07c373
@ -74,6 +74,7 @@ bool RimGridCalculation::calculate()
|
||||
for ( size_t i = 0; i < m_variables.size(); i++ )
|
||||
{
|
||||
RimGridCalculationVariable* v = dynamic_cast<RimGridCalculationVariable*>( m_variables[i] );
|
||||
CAF_ASSERT( v != nullptr );
|
||||
|
||||
if ( !v->eclipseCase() )
|
||||
{
|
||||
@ -147,6 +148,7 @@ bool RimGridCalculation::calculate()
|
||||
for ( size_t i = 0; i < m_variables.size(); i++ )
|
||||
{
|
||||
RimGridCalculationVariable* v = dynamic_cast<RimGridCalculationVariable*>( m_variables[i] );
|
||||
CAF_ASSERT( v != nullptr );
|
||||
parser.assignVector( v->name(), values[i][tsId] );
|
||||
}
|
||||
|
||||
@ -184,6 +186,8 @@ RimEclipseCase* RimGridCalculation::findEclipseCaseFromVariables()
|
||||
for ( auto variable : m_variables )
|
||||
{
|
||||
RimGridCalculationVariable* v = dynamic_cast<RimGridCalculationVariable*>( variable.p() );
|
||||
CAF_ASSERT( v != nullptr );
|
||||
|
||||
if ( v->eclipseCase() ) return v->eclipseCase();
|
||||
}
|
||||
|
||||
@ -216,19 +220,19 @@ void RimGridCalculation::removeDependentObjects()
|
||||
RimEclipseCase* eclipseCase = findEclipseCaseFromVariables();
|
||||
if ( eclipseCase )
|
||||
{
|
||||
// Select default result if
|
||||
// Select "None" result if the result that is being removed were displayed in a view.
|
||||
for ( auto v : eclipseCase->reservoirViews() )
|
||||
{
|
||||
if ( v->cellResult()->resultType() == resAddr.resultCatType() &&
|
||||
v->cellResult()->resultVariable() == resAddr.resultName() )
|
||||
{
|
||||
v->cellResult()->setResultType( RiaDefines::ResultCatType::DYNAMIC_NATIVE );
|
||||
v->cellResult()->setResultVariable( "SOIL" );
|
||||
v->cellResult()->setResultType( RiaDefines::ResultCatType::GENERATED );
|
||||
v->cellResult()->setResultVariable( "None" );
|
||||
}
|
||||
}
|
||||
|
||||
eclipseCase->results( porosityModel )->clearScalarResult( resAddr );
|
||||
eclipseCase->results( porosityModel )->eraseGeneratedResult( resAddr );
|
||||
eclipseCase->results( porosityModel )->setRemovedTagOnGeneratedResult( resAddr );
|
||||
|
||||
RimReloadCaseTools::updateAll3dViews( eclipseCase );
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ RimGridCalculation* RimGridCalculationCollection::createCalculation() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCalculationCollection::rebuildCaseMetaData()
|
||||
{
|
||||
ensureCalculationIds();
|
||||
ensureValidCalculationIds();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -21,13 +21,6 @@
|
||||
#include "RimGridCalculation.h"
|
||||
#include "RimUserDefinedCalculationCollection.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimGridCase;
|
||||
class RimCalculatedGridCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
|
@ -71,6 +71,7 @@ bool RimSummaryCalculation::calculate()
|
||||
for ( size_t i = 0; i < m_variables.size(); i++ )
|
||||
{
|
||||
RimSummaryCalculationVariable* v = dynamic_cast<RimSummaryCalculationVariable*>( m_variables[i] );
|
||||
CAF_ASSERT( v != nullptr );
|
||||
|
||||
if ( !v->summaryCase() )
|
||||
{
|
||||
@ -109,6 +110,7 @@ bool RimSummaryCalculation::calculate()
|
||||
for ( size_t i = 0; i < m_variables.size(); i++ )
|
||||
{
|
||||
RimSummaryCalculationVariable* v = dynamic_cast<RimSummaryCalculationVariable*>( m_variables[i] );
|
||||
CAF_ASSERT( v != nullptr );
|
||||
|
||||
parser.assignVector( v->name(), timeHistoryCurveMerger.interpolatedYValuesForAllXValues( i ) );
|
||||
}
|
||||
|
@ -21,18 +21,6 @@
|
||||
#include "RimSummaryCalculationVariable.h"
|
||||
#include "RimUserDefinedCalculation.h"
|
||||
|
||||
#include "RiuExpressionContextMenuManager.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include <memory>
|
||||
|
||||
class QTextEdit;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
|
@ -59,7 +59,7 @@ RimSummaryCase* RimSummaryCalculationCollection::calculationSummaryCase()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCalculationCollection::rebuildCaseMetaData()
|
||||
{
|
||||
ensureCalculationIds();
|
||||
ensureValidCalculationIds();
|
||||
m_calcuationSummaryCase->buildMetaData();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
// Copyright (C) 2022 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -353,7 +353,7 @@ void RimUserDefinedCalculation::defineEditorAttribute( const caf::PdmFieldHandle
|
||||
{
|
||||
if ( field == &m_expression )
|
||||
{
|
||||
caf::PdmUiTextEditorAttribute* myAttr = dynamic_cast<caf::PdmUiTextEditorAttribute*>( attribute );
|
||||
auto* myAttr = dynamic_cast<caf::PdmUiTextEditorAttribute*>( attribute );
|
||||
if ( myAttr )
|
||||
{
|
||||
myAttr->heightHint = -1;
|
||||
@ -374,9 +374,5 @@ void RimUserDefinedCalculation::defineEditorAttribute( const caf::PdmFieldHandle
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimUserDefinedCalculationVariable*> RimUserDefinedCalculation::allVariables() const
|
||||
{
|
||||
std::vector<RimUserDefinedCalculationVariable*> outVariables;
|
||||
for ( RimUserDefinedCalculationVariable* v : m_variables )
|
||||
outVariables.push_back( v );
|
||||
|
||||
return outVariables;
|
||||
return m_variables.childObjects();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
// Copyright (C) 2022 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -24,12 +24,9 @@
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include <memory>
|
||||
|
||||
class RimUserDefinedCalculationVariable;
|
||||
class QTextEdit;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
// Copyright (C) 2022 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -147,7 +147,7 @@ void RimUserDefinedCalculationCollection::deleteAllContainedObjects()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUserDefinedCalculationCollection::ensureCalculationIds()
|
||||
void RimUserDefinedCalculationCollection::ensureValidCalculationIds()
|
||||
{
|
||||
for ( RimUserDefinedCalculation* calculation : m_calculations )
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
// Copyright (C) 2022 Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -48,7 +48,7 @@ public:
|
||||
virtual RimUserDefinedCalculation* createCalculation() const = 0;
|
||||
virtual void rebuildCaseMetaData() = 0;
|
||||
|
||||
void ensureCalculationIds();
|
||||
void ensureValidCalculationIds();
|
||||
void assignCalculationIdToCalculation( RimUserDefinedCalculation* calculation ) const;
|
||||
|
||||
private:
|
||||
|
@ -912,7 +912,7 @@ void RigCaseCellResultsData::eraseAllSourSimData()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigCaseCellResultsData::eraseGeneratedResult( const RigEclipseResultAddress& resultAddress )
|
||||
void RigCaseCellResultsData::setRemovedTagOnGeneratedResult( const RigEclipseResultAddress& resultAddress )
|
||||
{
|
||||
CAF_ASSERT( resultAddress.resultCatType() == RiaDefines::ResultCatType::GENERATED );
|
||||
|
||||
|
@ -120,7 +120,7 @@ public:
|
||||
void clearAllResults();
|
||||
void freeAllocatedResultsData();
|
||||
void eraseAllSourSimData();
|
||||
void eraseGeneratedResult( const RigEclipseResultAddress& resultAddress );
|
||||
void setRemovedTagOnGeneratedResult( const RigEclipseResultAddress& resultAddress );
|
||||
|
||||
QStringList resultNames( RiaDefines::ResultCatType type ) const;
|
||||
std::vector<RigEclipseResultAddress> existingResults() const;
|
||||
|
Loading…
Reference in New Issue
Block a user