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++ )
|
for ( size_t i = 0; i < m_variables.size(); i++ )
|
||||||
{
|
{
|
||||||
RimGridCalculationVariable* v = dynamic_cast<RimGridCalculationVariable*>( m_variables[i] );
|
RimGridCalculationVariable* v = dynamic_cast<RimGridCalculationVariable*>( m_variables[i] );
|
||||||
|
CAF_ASSERT( v != nullptr );
|
||||||
|
|
||||||
if ( !v->eclipseCase() )
|
if ( !v->eclipseCase() )
|
||||||
{
|
{
|
||||||
@ -147,6 +148,7 @@ bool RimGridCalculation::calculate()
|
|||||||
for ( size_t i = 0; i < m_variables.size(); i++ )
|
for ( size_t i = 0; i < m_variables.size(); i++ )
|
||||||
{
|
{
|
||||||
RimGridCalculationVariable* v = dynamic_cast<RimGridCalculationVariable*>( m_variables[i] );
|
RimGridCalculationVariable* v = dynamic_cast<RimGridCalculationVariable*>( m_variables[i] );
|
||||||
|
CAF_ASSERT( v != nullptr );
|
||||||
parser.assignVector( v->name(), values[i][tsId] );
|
parser.assignVector( v->name(), values[i][tsId] );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,6 +186,8 @@ RimEclipseCase* RimGridCalculation::findEclipseCaseFromVariables()
|
|||||||
for ( auto variable : m_variables )
|
for ( auto variable : m_variables )
|
||||||
{
|
{
|
||||||
RimGridCalculationVariable* v = dynamic_cast<RimGridCalculationVariable*>( variable.p() );
|
RimGridCalculationVariable* v = dynamic_cast<RimGridCalculationVariable*>( variable.p() );
|
||||||
|
CAF_ASSERT( v != nullptr );
|
||||||
|
|
||||||
if ( v->eclipseCase() ) return v->eclipseCase();
|
if ( v->eclipseCase() ) return v->eclipseCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,19 +220,19 @@ void RimGridCalculation::removeDependentObjects()
|
|||||||
RimEclipseCase* eclipseCase = findEclipseCaseFromVariables();
|
RimEclipseCase* eclipseCase = findEclipseCaseFromVariables();
|
||||||
if ( eclipseCase )
|
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() )
|
for ( auto v : eclipseCase->reservoirViews() )
|
||||||
{
|
{
|
||||||
if ( v->cellResult()->resultType() == resAddr.resultCatType() &&
|
if ( v->cellResult()->resultType() == resAddr.resultCatType() &&
|
||||||
v->cellResult()->resultVariable() == resAddr.resultName() )
|
v->cellResult()->resultVariable() == resAddr.resultName() )
|
||||||
{
|
{
|
||||||
v->cellResult()->setResultType( RiaDefines::ResultCatType::DYNAMIC_NATIVE );
|
v->cellResult()->setResultType( RiaDefines::ResultCatType::GENERATED );
|
||||||
v->cellResult()->setResultVariable( "SOIL" );
|
v->cellResult()->setResultVariable( "None" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eclipseCase->results( porosityModel )->clearScalarResult( resAddr );
|
eclipseCase->results( porosityModel )->clearScalarResult( resAddr );
|
||||||
eclipseCase->results( porosityModel )->eraseGeneratedResult( resAddr );
|
eclipseCase->results( porosityModel )->setRemovedTagOnGeneratedResult( resAddr );
|
||||||
|
|
||||||
RimReloadCaseTools::updateAll3dViews( eclipseCase );
|
RimReloadCaseTools::updateAll3dViews( eclipseCase );
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ RimGridCalculation* RimGridCalculationCollection::createCalculation() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimGridCalculationCollection::rebuildCaseMetaData()
|
void RimGridCalculationCollection::rebuildCaseMetaData()
|
||||||
{
|
{
|
||||||
ensureCalculationIds();
|
ensureValidCalculationIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -21,13 +21,6 @@
|
|||||||
#include "RimGridCalculation.h"
|
#include "RimGridCalculation.h"
|
||||||
#include "RimUserDefinedCalculationCollection.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++ )
|
for ( size_t i = 0; i < m_variables.size(); i++ )
|
||||||
{
|
{
|
||||||
RimSummaryCalculationVariable* v = dynamic_cast<RimSummaryCalculationVariable*>( m_variables[i] );
|
RimSummaryCalculationVariable* v = dynamic_cast<RimSummaryCalculationVariable*>( m_variables[i] );
|
||||||
|
CAF_ASSERT( v != nullptr );
|
||||||
|
|
||||||
if ( !v->summaryCase() )
|
if ( !v->summaryCase() )
|
||||||
{
|
{
|
||||||
@ -109,6 +110,7 @@ bool RimSummaryCalculation::calculate()
|
|||||||
for ( size_t i = 0; i < m_variables.size(); i++ )
|
for ( size_t i = 0; i < m_variables.size(); i++ )
|
||||||
{
|
{
|
||||||
RimSummaryCalculationVariable* v = dynamic_cast<RimSummaryCalculationVariable*>( m_variables[i] );
|
RimSummaryCalculationVariable* v = dynamic_cast<RimSummaryCalculationVariable*>( m_variables[i] );
|
||||||
|
CAF_ASSERT( v != nullptr );
|
||||||
|
|
||||||
parser.assignVector( v->name(), timeHistoryCurveMerger.interpolatedYValuesForAllXValues( i ) );
|
parser.assignVector( v->name(), timeHistoryCurveMerger.interpolatedYValuesForAllXValues( i ) );
|
||||||
}
|
}
|
||||||
|
@ -21,18 +21,6 @@
|
|||||||
#include "RimSummaryCalculationVariable.h"
|
#include "RimSummaryCalculationVariable.h"
|
||||||
#include "RimUserDefinedCalculation.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()
|
void RimSummaryCalculationCollection::rebuildCaseMetaData()
|
||||||
{
|
{
|
||||||
ensureCalculationIds();
|
ensureValidCalculationIds();
|
||||||
m_calcuationSummaryCase->buildMetaData();
|
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
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// 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 )
|
if ( field == &m_expression )
|
||||||
{
|
{
|
||||||
caf::PdmUiTextEditorAttribute* myAttr = dynamic_cast<caf::PdmUiTextEditorAttribute*>( attribute );
|
auto* myAttr = dynamic_cast<caf::PdmUiTextEditorAttribute*>( attribute );
|
||||||
if ( myAttr )
|
if ( myAttr )
|
||||||
{
|
{
|
||||||
myAttr->heightHint = -1;
|
myAttr->heightHint = -1;
|
||||||
@ -374,9 +374,5 @@ void RimUserDefinedCalculation::defineEditorAttribute( const caf::PdmFieldHandle
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<RimUserDefinedCalculationVariable*> RimUserDefinedCalculation::allVariables() const
|
std::vector<RimUserDefinedCalculationVariable*> RimUserDefinedCalculation::allVariables() const
|
||||||
{
|
{
|
||||||
std::vector<RimUserDefinedCalculationVariable*> outVariables;
|
return m_variables.childObjects();
|
||||||
for ( RimUserDefinedCalculationVariable* v : m_variables )
|
|
||||||
outVariables.push_back( v );
|
|
||||||
|
|
||||||
return outVariables;
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
@ -24,12 +24,9 @@
|
|||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
|
|
||||||
#include <QPointer>
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class RimUserDefinedCalculationVariable;
|
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
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// 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 )
|
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
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
@ -48,7 +48,7 @@ public:
|
|||||||
virtual RimUserDefinedCalculation* createCalculation() const = 0;
|
virtual RimUserDefinedCalculation* createCalculation() const = 0;
|
||||||
virtual void rebuildCaseMetaData() = 0;
|
virtual void rebuildCaseMetaData() = 0;
|
||||||
|
|
||||||
void ensureCalculationIds();
|
void ensureValidCalculationIds();
|
||||||
void assignCalculationIdToCalculation( RimUserDefinedCalculation* calculation ) const;
|
void assignCalculationIdToCalculation( RimUserDefinedCalculation* calculation ) const;
|
||||||
|
|
||||||
private:
|
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 );
|
CAF_ASSERT( resultAddress.resultCatType() == RiaDefines::ResultCatType::GENERATED );
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ public:
|
|||||||
void clearAllResults();
|
void clearAllResults();
|
||||||
void freeAllocatedResultsData();
|
void freeAllocatedResultsData();
|
||||||
void eraseAllSourSimData();
|
void eraseAllSourSimData();
|
||||||
void eraseGeneratedResult( const RigEclipseResultAddress& resultAddress );
|
void setRemovedTagOnGeneratedResult( const RigEclipseResultAddress& resultAddress );
|
||||||
|
|
||||||
QStringList resultNames( RiaDefines::ResultCatType type ) const;
|
QStringList resultNames( RiaDefines::ResultCatType type ) const;
|
||||||
std::vector<RigEclipseResultAddress> existingResults() const;
|
std::vector<RigEclipseResultAddress> existingResults() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user