mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-14 01:13:52 -06:00
Merge pull request #4771 from OPM/feature-ensemble-sources
Ensemble RFT: Keep matching sources when switching well plus lots of other changes
This commit is contained in:
commit
1e75c3aff6
@ -1,43 +1,42 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||
|
||||
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template<typename XValueType>
|
||||
bool XValueComparator<XValueType>::operator()(const XValueType& lhs, const XValueType& rhs) const
|
||||
template <typename XValueType>
|
||||
bool XValueComparator<XValueType>::operator()( const XValueType& lhs, const XValueType& rhs ) const
|
||||
{
|
||||
if (XValueComparator<XValueType>::equals(lhs, rhs))
|
||||
{
|
||||
if ( XValueComparator<XValueType>::equals( lhs, rhs ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return lhs < rhs;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template<typename XValueType>
|
||||
double XValueComparator<XValueType>::diff(const XValueType& lhs, const XValueType& rhs)
|
||||
template <typename XValueType>
|
||||
double XValueComparator<XValueType>::diff( const XValueType& lhs, const XValueType& rhs )
|
||||
{
|
||||
return lhs - rhs;
|
||||
}
|
||||
@ -45,118 +44,119 @@ double XValueComparator<XValueType>::diff(const XValueType& lhs, const XValueTyp
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template<typename XValueType>
|
||||
bool XValueComparator<XValueType>::equals(const XValueType& lhs, const XValueType& rhs)
|
||||
template <typename XValueType>
|
||||
bool XValueComparator<XValueType>::equals( const XValueType& lhs, const XValueType& rhs )
|
||||
{
|
||||
return lhs == rhs;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template<typename XValueType>
|
||||
RiaCurveMerger<XValueType>::RiaCurveMerger()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template<typename XValueType>
|
||||
void RiaCurveMerger<XValueType>::addCurveData(const std::vector<XValueType>& xValues, const std::vector<double>& yValues)
|
||||
{
|
||||
CVF_ASSERT(xValues.size() == yValues.size());
|
||||
|
||||
m_originalValues.push_back(std::make_pair(xValues, yValues));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template<typename XValueType>
|
||||
template <typename XValueType>
|
||||
RiaCurveMerger<XValueType>::RiaCurveMerger()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template <typename XValueType>
|
||||
void RiaCurveMerger<XValueType>::addCurveData( const std::vector<XValueType>& xValues, const std::vector<double>& yValues )
|
||||
{
|
||||
CVF_ASSERT( xValues.size() == yValues.size() );
|
||||
|
||||
m_originalValues.push_back( std::make_pair( xValues, yValues ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template <typename XValueType>
|
||||
size_t RiaCurveMerger<XValueType>::curveCount() const
|
||||
{
|
||||
return m_interpolatedValuesForAllCurves.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template<typename XValueType>
|
||||
template <typename XValueType>
|
||||
RiaCurveDataTools::CurveIntervals RiaCurveMerger<XValueType>::validIntervalsForAllXValues() const
|
||||
{
|
||||
return m_validIntervalsForAllXValues;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template<typename XValueType>
|
||||
template <typename XValueType>
|
||||
const std::vector<XValueType>& RiaCurveMerger<XValueType>::allXValues() const
|
||||
{
|
||||
return m_allXValues;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template<typename XValueType>
|
||||
const std::vector<double>& RiaCurveMerger<XValueType>::interpolatedYValuesForAllXValues(size_t curveIdx) const
|
||||
template <typename XValueType>
|
||||
const std::vector<double>& RiaCurveMerger<XValueType>::interpolatedYValuesForAllXValues( size_t curveIdx ) const
|
||||
{
|
||||
CVF_ASSERT(curveIdx < m_interpolatedValuesForAllCurves.size());
|
||||
CVF_ASSERT( curveIdx < m_interpolatedValuesForAllCurves.size() );
|
||||
|
||||
return m_interpolatedValuesForAllCurves[curveIdx];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template<typename XValueType>
|
||||
std::vector<double>& RiaCurveMerger<XValueType>::interpolatedYValuesForAllXValues(size_t curveIdx)
|
||||
template <typename XValueType>
|
||||
std::vector<double>& RiaCurveMerger<XValueType>::interpolatedYValuesForAllXValues( size_t curveIdx )
|
||||
{
|
||||
CVF_ASSERT(curveIdx < m_interpolatedValuesForAllCurves.size());
|
||||
CVF_ASSERT( curveIdx < m_interpolatedValuesForAllCurves.size() );
|
||||
|
||||
return m_interpolatedValuesForAllCurves[curveIdx];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template<typename XValueType>
|
||||
void RiaCurveMerger<XValueType>::computeInterpolatedValues(bool includeValuesFromPartialCurves)
|
||||
template <typename XValueType>
|
||||
void RiaCurveMerger<XValueType>::computeInterpolatedValues( bool includeValuesFromPartialCurves )
|
||||
{
|
||||
m_validIntervalsForAllXValues.clear();
|
||||
m_allXValues.clear();
|
||||
m_interpolatedValuesForAllCurves.clear();
|
||||
|
||||
computeUnionOfXValues(includeValuesFromPartialCurves);
|
||||
computeUnionOfXValues( includeValuesFromPartialCurves );
|
||||
|
||||
const size_t curveCount = m_originalValues.size();
|
||||
if (curveCount == 0)
|
||||
if ( curveCount == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const size_t dataValueCount = m_allXValues.size();
|
||||
if (dataValueCount == 0)
|
||||
if ( dataValueCount == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_interpolatedValuesForAllCurves.resize(curveCount);
|
||||
m_interpolatedValuesForAllCurves.resize( curveCount );
|
||||
|
||||
std::vector<double> accumulatedValidValues(dataValueCount, 1.0);
|
||||
std::vector<double> accumulatedValidValues( dataValueCount, 1.0 );
|
||||
|
||||
for (size_t curveIdx = 0; curveIdx < curveCount; curveIdx++)
|
||||
for ( size_t curveIdx = 0; curveIdx < curveCount; curveIdx++ )
|
||||
{
|
||||
std::vector<double>& curveValues = m_interpolatedValuesForAllCurves[curveIdx];
|
||||
curveValues.resize(dataValueCount);
|
||||
curveValues.resize( dataValueCount );
|
||||
|
||||
for (size_t valueIndex = 0; valueIndex < dataValueCount; valueIndex++)
|
||||
for ( size_t valueIndex = 0; valueIndex < dataValueCount; valueIndex++ )
|
||||
{
|
||||
double interpolValue = interpolatedYValue(m_allXValues[valueIndex], m_originalValues[curveIdx].first, m_originalValues[curveIdx].second);
|
||||
if (!RiaCurveDataTools::isValidValue(interpolValue, false))
|
||||
double interpolValue = interpolatedYValue( m_allXValues[valueIndex],
|
||||
m_originalValues[curveIdx].first,
|
||||
m_originalValues[curveIdx].second );
|
||||
if ( !RiaCurveDataTools::isValidValue( interpolValue, false ) )
|
||||
{
|
||||
accumulatedValidValues[valueIndex] = HUGE_VAL;
|
||||
}
|
||||
@ -165,45 +165,46 @@ void RiaCurveMerger<XValueType>::computeInterpolatedValues(bool includeValuesFro
|
||||
}
|
||||
}
|
||||
|
||||
m_validIntervalsForAllXValues = RiaCurveDataTools::calculateIntervalsOfValidValues(accumulatedValidValues, false);
|
||||
m_validIntervalsForAllXValues = RiaCurveDataTools::calculateIntervalsOfValidValues( accumulatedValidValues, false );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template<typename XValueType>
|
||||
void RiaCurveMerger<XValueType>::computeUnionOfXValues(bool includeValuesForPartialCurves)
|
||||
template <typename XValueType>
|
||||
void RiaCurveMerger<XValueType>::computeUnionOfXValues( bool includeValuesForPartialCurves )
|
||||
{
|
||||
m_allXValues.clear();
|
||||
|
||||
std::set<XValueType, XComparator> unionOfXValues;
|
||||
std::set<XValueType, XComparator> unionOfXValues;
|
||||
|
||||
for (const auto& curveData : m_originalValues)
|
||||
std::vector<std::pair<XValueType, XValueType>> originalXBounds;
|
||||
for ( const auto& curveData : m_originalValues )
|
||||
{
|
||||
for (const auto& x : curveData.first)
|
||||
for ( const auto& x : curveData.first )
|
||||
{
|
||||
unionOfXValues.insert(x);
|
||||
unionOfXValues.insert( x );
|
||||
}
|
||||
auto minmax_it = std::minmax_element( curveData.first.begin(), curveData.first.end() );
|
||||
originalXBounds.push_back( std::make_pair( *( minmax_it.first ), *( minmax_it.second ) ) );
|
||||
}
|
||||
|
||||
if (!includeValuesForPartialCurves)
|
||||
if ( !includeValuesForPartialCurves )
|
||||
{
|
||||
for (auto it = unionOfXValues.begin(); it != unionOfXValues.end();)
|
||||
for ( auto it = unionOfXValues.begin(); it != unionOfXValues.end(); )
|
||||
{
|
||||
bool outsideBounds = false;
|
||||
for (const auto& curveData : m_originalValues)
|
||||
for ( const auto& curveXBounds : originalXBounds )
|
||||
{
|
||||
if (curveData.first.empty()) continue;
|
||||
|
||||
if (*it < curveData.first.front() || *it > curveData.first.back())
|
||||
if ( *it < curveXBounds.first || *it > curveXBounds.second )
|
||||
{
|
||||
outsideBounds = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (outsideBounds)
|
||||
if ( outsideBounds )
|
||||
{
|
||||
it = unionOfXValues.erase(it);
|
||||
it = unionOfXValues.erase( it );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -212,27 +213,27 @@ void RiaCurveMerger<XValueType>::computeUnionOfXValues(bool includeValuesForPart
|
||||
}
|
||||
}
|
||||
|
||||
m_allXValues = std::vector<XValueType>(unionOfXValues.begin(), unionOfXValues.end());
|
||||
m_allXValues = std::vector<XValueType>( unionOfXValues.begin(), unionOfXValues.end() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template<typename XValueType>
|
||||
double RiaCurveMerger<XValueType>::interpolatedYValue(const XValueType& interpolationXValue,
|
||||
const std::vector<XValueType>& xValues,
|
||||
const std::vector<double>& yValues)
|
||||
template <typename XValueType>
|
||||
double RiaCurveMerger<XValueType>::interpolatedYValue( const XValueType& interpolationXValue,
|
||||
const std::vector<XValueType>& xValues,
|
||||
const std::vector<double>& yValues )
|
||||
{
|
||||
if (yValues.size() != xValues.size()) return HUGE_VAL;
|
||||
if ( yValues.size() != xValues.size() ) return HUGE_VAL;
|
||||
|
||||
const bool removeInterpolatedValues = false;
|
||||
|
||||
for (size_t firstI = 0; firstI < xValues.size(); firstI++)
|
||||
for ( size_t firstI = 0; firstI < xValues.size(); firstI++ )
|
||||
{
|
||||
if (XComparator::equals(xValues.at(firstI), interpolationXValue))
|
||||
if ( XComparator::equals( xValues.at( firstI ), interpolationXValue ) )
|
||||
{
|
||||
const double& firstValue = yValues.at(firstI);
|
||||
if (!RiaCurveDataTools::isValidValue(firstValue, removeInterpolatedValues))
|
||||
const double& firstValue = yValues.at( firstI );
|
||||
if ( !RiaCurveDataTools::isValidValue( firstValue, removeInterpolatedValues ) )
|
||||
{
|
||||
return HUGE_VAL;
|
||||
}
|
||||
@ -242,12 +243,12 @@ double RiaCurveMerger<XValueType>::interpolatedYValue(const XValueType&
|
||||
|
||||
size_t secondI = firstI + 1;
|
||||
|
||||
if (secondI < xValues.size())
|
||||
{
|
||||
if (XComparator::equals(xValues.at(secondI), interpolationXValue))
|
||||
if ( secondI < xValues.size() )
|
||||
{
|
||||
if ( XComparator::equals( xValues.at( secondI ), interpolationXValue ) )
|
||||
{
|
||||
const double& secondValue = yValues.at(secondI);
|
||||
if (!RiaCurveDataTools::isValidValue(secondValue, removeInterpolatedValues))
|
||||
const double& secondValue = yValues.at( secondI );
|
||||
if ( !RiaCurveDataTools::isValidValue( secondValue, removeInterpolatedValues ) )
|
||||
{
|
||||
return HUGE_VAL;
|
||||
}
|
||||
@ -255,32 +256,31 @@ double RiaCurveMerger<XValueType>::interpolatedYValue(const XValueType&
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
if (xValues.at(firstI) < interpolationXValue && xValues.at(secondI) > interpolationXValue)
|
||||
if ( xValues.at( firstI ) < interpolationXValue && xValues.at( secondI ) > interpolationXValue )
|
||||
{
|
||||
const double& firstValue = yValues.at(firstI);
|
||||
const double& secondValue = yValues.at(secondI);
|
||||
const double& firstValue = yValues.at( firstI );
|
||||
const double& secondValue = yValues.at( secondI );
|
||||
|
||||
bool isFirstValid = RiaCurveDataTools::isValidValue(firstValue, removeInterpolatedValues);
|
||||
if (!isFirstValid) return HUGE_VAL;
|
||||
bool isFirstValid = RiaCurveDataTools::isValidValue( firstValue, removeInterpolatedValues );
|
||||
if ( !isFirstValid ) return HUGE_VAL;
|
||||
|
||||
bool isSecondValid = RiaCurveDataTools::isValidValue(secondValue, removeInterpolatedValues);
|
||||
if (!isSecondValid) return HUGE_VAL;
|
||||
bool isSecondValid = RiaCurveDataTools::isValidValue( secondValue, removeInterpolatedValues );
|
||||
if ( !isSecondValid ) return HUGE_VAL;
|
||||
|
||||
double firstDiff = fabs(XComparator::diff(interpolationXValue, xValues.at(firstI)));
|
||||
double secondDiff = fabs(XComparator::diff(xValues.at(secondI), interpolationXValue));
|
||||
double firstDiff = fabs( XComparator::diff( interpolationXValue, xValues.at( firstI ) ) );
|
||||
double secondDiff = fabs( XComparator::diff( xValues.at( secondI ), interpolationXValue ) );
|
||||
|
||||
double firstWeight = secondDiff / (firstDiff + secondDiff);
|
||||
double secondWeight = firstDiff / (firstDiff + secondDiff);
|
||||
double firstWeight = secondDiff / ( firstDiff + secondDiff );
|
||||
double secondWeight = firstDiff / ( firstDiff + secondDiff );
|
||||
|
||||
double val = (firstValue * firstWeight) + (secondValue * secondWeight);
|
||||
double val = ( firstValue * firstWeight ) + ( secondValue * secondWeight );
|
||||
|
||||
CVF_ASSERT(RiaCurveDataTools::isValidValue(val, removeInterpolatedValues));
|
||||
CVF_ASSERT( RiaCurveDataTools::isValidValue( val, removeInterpolatedValues ) );
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return HUGE_VAL;
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "RimSummaryCurveFilter.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimWellLogRftCurve.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
#include "RiuMainWindow.h"
|
||||
@ -125,6 +126,17 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile( const QStringList& fil
|
||||
{
|
||||
existingFileSummaryCase->firstAncestorOrThisOfType( existingCollection );
|
||||
|
||||
// Replace file summary case pointers in Rft Curves
|
||||
std::vector<RimWellLogRftCurve*> rftCurves;
|
||||
existingFileSummaryCase->objectsWithReferringPtrFieldsOfType( rftCurves );
|
||||
for ( RimWellLogRftCurve* curve : rftCurves )
|
||||
{
|
||||
if ( curve->summaryCase() == existingSummaryCase )
|
||||
{
|
||||
curve->setSummaryCase( newSumCase );
|
||||
}
|
||||
}
|
||||
|
||||
// Replace all occurrences of file sum with ecl sum
|
||||
|
||||
std::vector<RimSummaryCurve*> objects;
|
||||
|
@ -40,6 +40,26 @@
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicImportFormationNamesFeature, "RicImportFormationNamesFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFormationNames* RicImportFormationNamesFeature::importFormationFiles( const QStringList& fileNames )
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RimFormationNamesCollection* fomNameColl = proj->activeOilField()->formationNamesCollection();
|
||||
if ( !fomNameColl )
|
||||
{
|
||||
fomNameColl = new RimFormationNamesCollection;
|
||||
proj->activeOilField()->formationNamesCollection = fomNameColl;
|
||||
}
|
||||
|
||||
// For each file, find existing Formation names item, or create new
|
||||
RimFormationNames* formationNames = fomNameColl->importFiles( fileNames );
|
||||
fomNameColl->updateConnectedEditors();
|
||||
|
||||
return formationNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -67,42 +87,35 @@ void RicImportFormationNamesFeature::onActionTriggered( bool isChecked )
|
||||
app->setLastUsedDialogDirectory( "BINARY_GRID", QFileInfo( fileNames.last() ).absolutePath() );
|
||||
|
||||
// Find or create the FomationNamesCollection
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
RimFormationNamesCollection* fomNameColl = proj->activeOilField()->formationNamesCollection();
|
||||
if ( !fomNameColl )
|
||||
{
|
||||
fomNameColl = new RimFormationNamesCollection;
|
||||
proj->activeOilField()->formationNamesCollection = fomNameColl;
|
||||
}
|
||||
|
||||
// For each file, find existing Formation names item, or create new
|
||||
RimFormationNames* formationName = fomNameColl->importFiles( fileNames );
|
||||
RimFormationNames* formationName = importFormationFiles( fileNames );
|
||||
|
||||
if ( fileNames.size() > 1 ) return;
|
||||
|
||||
std::vector<RimCase*> cases;
|
||||
proj->allCases( cases );
|
||||
|
||||
if ( !cases.empty() )
|
||||
{
|
||||
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if ( activeView )
|
||||
{
|
||||
RimCase* ownerCase = activeView->ownerCase();
|
||||
if ( ownerCase )
|
||||
{
|
||||
ownerCase->setFormationNames( formationName );
|
||||
ownerCase->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fomNameColl->updateConnectedEditors();
|
||||
|
||||
if ( formationName )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( formationName );
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
|
||||
std::vector<RimCase*> cases;
|
||||
proj->allCases( cases );
|
||||
|
||||
if ( !cases.empty() )
|
||||
{
|
||||
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if ( activeView )
|
||||
{
|
||||
RimCase* ownerCase = activeView->ownerCase();
|
||||
if ( ownerCase )
|
||||
{
|
||||
ownerCase->setFormationNames( formationName );
|
||||
ownerCase->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( formationName )
|
||||
{
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( formationName );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
class RimFormationNames;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -27,6 +28,8 @@ class RicImportFormationNamesFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
static RimFormationNames* importFormationFiles( const QStringList& fileNames );
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "RicImportObservedFmuDataFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RicImportFormationNamesFeature.h"
|
||||
#include "RifReaderFmuRft.h"
|
||||
|
||||
#include "RimObservedDataCollection.h"
|
||||
@ -32,7 +33,9 @@
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicImportObservedFmuDataFeature, "RicImportObservedFmuDataFeature" );
|
||||
@ -62,6 +65,14 @@ void RicImportObservedFmuDataFeature::selectObservedDataPathInDialog()
|
||||
for ( const QString& subDir : subDirsWithFmuData )
|
||||
{
|
||||
importedData = observedDataCollection->createAndAddFmuRftDataFromPath( subDir );
|
||||
QDir dir( subDir );
|
||||
QString layerZoneFile = dir.absoluteFilePath( "layer_zone_table.txt" );
|
||||
if ( QFileInfo::exists( layerZoneFile ) )
|
||||
{
|
||||
QStringList fileNames;
|
||||
fileNames << layerZoneFile;
|
||||
RicImportFormationNamesFeature::importFormationFiles( fileNames );
|
||||
}
|
||||
}
|
||||
if ( importedData != nullptr )
|
||||
{
|
||||
|
@ -68,7 +68,12 @@ public:
|
||||
|
||||
static std::set<RftWellLogChannelType> rftPlotChannelTypes()
|
||||
{
|
||||
return {RifEclipseRftAddress::PRESSURE};
|
||||
return {RifEclipseRftAddress::PRESSURE,
|
||||
RifEclipseRftAddress::PRESSURE_ERROR,
|
||||
RifEclipseRftAddress::PRESSURE_MEAN,
|
||||
RifEclipseRftAddress::PRESSURE_P10,
|
||||
RifEclipseRftAddress::PRESSURE_P50,
|
||||
RifEclipseRftAddress::PRESSURE_P90};
|
||||
}
|
||||
|
||||
static std::set<RftWellLogChannelType> pltPlotChannelTypes()
|
||||
|
@ -150,9 +150,12 @@ void RimWellRftPlot::applyCurveAppearance( RimWellLogCurve* newCurve )
|
||||
currentColor = m_dataSourceColors[sourceAddress];
|
||||
if ( m_showStatisticsCurves )
|
||||
{
|
||||
cvf::Color3f backgroundColor = RiaColorTools::fromQColorTo3f(
|
||||
trackByIndex( 0 )->viewer()->canvasBackground().color() );
|
||||
currentColor = RiaColorTools::blendCvfColors( backgroundColor, currentColor, 2, 1 );
|
||||
if ( trackByIndex( 0 ) && trackByIndex( 0 )->viewer() )
|
||||
{
|
||||
cvf::Color3f backgroundColor = RiaColorTools::fromQColorTo3f(
|
||||
trackByIndex( 0 )->viewer()->canvasBackground().color() );
|
||||
currentColor = RiaColorTools::blendCvfColors( backgroundColor, currentColor, 2, 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -247,7 +250,7 @@ void RimWellRftPlot::applyInitialSelections()
|
||||
sourcesToSelect.push_back( RifDataSourceForRftPlt( RifDataSourceForRftPlt::GRID, gridCase ) );
|
||||
}
|
||||
|
||||
for ( RimSummaryCaseCollection* const ensemble : RimWellPlotTools::rftEnsemblesForWell( m_wellPathNameOrSimWellName ) )
|
||||
for ( RimSummaryCaseCollection* const ensemble : RimWellPlotTools::rftEnsemblesForWell( simWellName ) )
|
||||
{
|
||||
sourcesToSelect.push_back( RifDataSourceForRftPlt( RifDataSourceForRftPlt::ENSEMBLE_RFT, ensemble ) );
|
||||
}
|
||||
@ -262,7 +265,8 @@ void RimWellRftPlot::applyInitialSelections()
|
||||
}
|
||||
}
|
||||
|
||||
for ( RimObservedFmuRftData* const observedFmuRftData : RimWellPlotTools::observedFmuRftData() )
|
||||
for ( RimObservedFmuRftData* const observedFmuRftData :
|
||||
RimWellPlotTools::observedFmuRftDataForWell( m_wellPathNameOrSimWellName ) )
|
||||
{
|
||||
sourcesToSelect.push_back(
|
||||
RifDataSourceForRftPlt( RifDataSourceForRftPlt::OBSERVED_FMU_RFT, observedFmuRftData ) );
|
||||
@ -287,6 +291,44 @@ void RimWellRftPlot::applyInitialSelections()
|
||||
syncCurvesFromUiSelection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftPlot::updateEditorsFromPreviousSelection()
|
||||
{
|
||||
std::set<RifDataSourceForRftPlt> previousSources( m_selectedSources().begin(), m_selectedSources().end() );
|
||||
std::set<QDateTime> previousTimeSteps( m_selectedTimeSteps().begin(), m_selectedTimeSteps().end() );
|
||||
|
||||
m_selectedSources.v().clear();
|
||||
m_selectedTimeSteps.v().clear();
|
||||
|
||||
bool dummy = false;
|
||||
auto dataSourceOptions = calculateValueOptions( &m_selectedSources, &dummy );
|
||||
for ( auto dataSourceOption : dataSourceOptions )
|
||||
{
|
||||
if ( dataSourceOption.level() == 1 )
|
||||
{
|
||||
RifDataSourceForRftPlt dataSource = dataSourceOption.value().value<RifDataSourceForRftPlt>();
|
||||
if ( previousSources.count( dataSource ) )
|
||||
{
|
||||
m_selectedSources.v().push_back( dataSource );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This has to happen after the m_selectedSources is filled
|
||||
// because the available time steps is dependent on the selected sources.
|
||||
auto timeStepOptions = calculateValueOptions( &m_selectedTimeSteps, &dummy );
|
||||
for ( auto timeStepOption : timeStepOptions )
|
||||
{
|
||||
QDateTime timeStep = timeStepOption.value().toDateTime();
|
||||
if ( previousTimeSteps.count( timeStep ) )
|
||||
{
|
||||
m_selectedTimeSteps.v().push_back( timeStep );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -785,8 +827,9 @@ void RimWellRftPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
plotTrack->deleteAllCurves();
|
||||
}
|
||||
|
||||
updateEditorsFromCurves();
|
||||
updateEditorsFromPreviousSelection();
|
||||
updateFormationsOnPlot();
|
||||
syncCurvesFromUiSelection();
|
||||
}
|
||||
else if ( changedField == &m_branchIndex || changedField == &m_branchDetection )
|
||||
{
|
||||
|
@ -102,6 +102,7 @@ protected:
|
||||
|
||||
private:
|
||||
std::map<QString, QStringList> findWellSources();
|
||||
void updateEditorsFromPreviousSelection();
|
||||
void updateEditorsFromCurves();
|
||||
void syncCurvesFromUiSelection();
|
||||
void assignWellPathToExtractionCurves();
|
||||
@ -140,8 +141,7 @@ private:
|
||||
caf::PdmField<bool> m_showErrorInObservedData;
|
||||
|
||||
caf::PdmField<std::vector<RifDataSourceForRftPlt>> m_selectedSources;
|
||||
|
||||
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
|
||||
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
|
||||
|
||||
caf::PdmPtrField<RimWellPathCollection*> m_wellPathCollection;
|
||||
|
||||
|
@ -214,7 +214,8 @@ void RimWellLogExtractionCurve::setPropertiesFromView( Rim3dView* view )
|
||||
}
|
||||
else if ( eclipseCase )
|
||||
{
|
||||
m_eclipseResultDefinition->setResultVariable( "SOIL" );
|
||||
m_eclipseResultDefinition->setResultType( RiaDefines::STATIC_NATIVE );
|
||||
m_eclipseResultDefinition->setResultVariable( "PORO" );
|
||||
}
|
||||
|
||||
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view );
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "RimWellAllocationPlot.h"
|
||||
#include "RimWellLogCurveCommonDataSource.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellRftPlot.h"
|
||||
|
||||
#include "RiuDockWidgetTools.h"
|
||||
#include "RiuDragDrop.h"
|
||||
@ -512,7 +513,9 @@ void RiuPlotMainWindow::addToTemporaryWidgets( QWidget* widget )
|
||||
void RiuPlotMainWindow::updateWellLogPlotToolBar()
|
||||
{
|
||||
RimWellLogPlot* wellLogPlot = dynamic_cast<RimWellLogPlot*>( m_activePlotViewWindow.p() );
|
||||
if ( wellLogPlot )
|
||||
RimWellRftPlot* wellRftPlot = dynamic_cast<RimWellRftPlot*>( wellLogPlot );
|
||||
|
||||
if ( wellLogPlot && !wellRftPlot )
|
||||
{
|
||||
std::vector<caf::PdmFieldHandle*> toolBarFields;
|
||||
toolBarFields = wellLogPlot->commonDataSource()->fieldsToShowInToolbar();
|
||||
@ -758,9 +761,9 @@ void RiuPlotMainWindow::selectedObjectsChanged()
|
||||
{
|
||||
if ( selectedWindow->viewWidget() )
|
||||
{
|
||||
setBlockSlotSubWindowActivated(true);
|
||||
setActiveViewer(selectedWindow->viewWidget());
|
||||
setBlockSlotSubWindowActivated(false);
|
||||
setBlockSlotSubWindowActivated( true );
|
||||
setActiveViewer( selectedWindow->viewWidget() );
|
||||
setBlockSlotSubWindowActivated( false );
|
||||
}
|
||||
// The only way to get to this code is by selection change initiated from the project tree view
|
||||
// As we are activating an MDI-window, the focus is given to this MDI-window
|
||||
|
@ -379,6 +379,8 @@ void RiuWellLogPlot::alignCanvasTops()
|
||||
}
|
||||
}
|
||||
|
||||
int legendHeight = 0;
|
||||
|
||||
for ( int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx )
|
||||
{
|
||||
if ( m_trackPlots[tIdx]->isVisible() )
|
||||
@ -395,13 +397,18 @@ void RiuWellLogPlot::alignCanvasTops()
|
||||
QMargins margins = m_trackPlots[tIdx]->contentsMargins();
|
||||
margins.setTop( margins.top() + canvasShift );
|
||||
m_trackPlots[tIdx]->setContentsMargins( margins );
|
||||
|
||||
if ( m_legends[tIdx]->isVisible() )
|
||||
{
|
||||
legendHeight = std::max( legendHeight, m_legends[tIdx]->heightForWidth( canvasRect.width() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_trackLayout->columnCount() > 0 && m_trackLayout->rowCount() > 0 )
|
||||
if ( m_plotDefinition->areTrackLegendsVisible() && m_trackLayout->columnCount() > 0 && m_trackLayout->rowCount() > 0 )
|
||||
{
|
||||
int legendHeight = m_trackLayout->cellRect( 0, 0 ).height();
|
||||
m_scrollBarLayout->setContentsMargins( 0, legendHeight, 0, 0 );
|
||||
m_trackLayout->setRowMinimumHeight( 0, legendHeight );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user