mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Support ensemble cross plot curves
* Remove use of RifEnsembleStatisticsReader * Add RimSummaryAddressSelector and RimEnsembleCrossPlotStatisticsCase * Remove RifEnsembleStatisticsReader * Add support for cross plot x-axis selection * Support source stepping on ensemble cross plot curves * Add isXAxisSummaryVector
This commit is contained in:
@@ -45,7 +45,6 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifSummaryCaseRestartSelector.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifCaseRealizationParametersReader.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifFileParseTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifEnsembleStatisticsReader.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifReaderEnsembleStatisticsRft.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifDerivedEnsembleReader.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifActiveCellsReader.h
|
||||
@@ -136,7 +135,6 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifSummaryCaseRestartSelector.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifCaseRealizationParametersReader.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifFileParseTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifEnsembleStatisticsReader.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifDerivedEnsembleReader.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifActiveCellsReader.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifCsvDataTableFormatter.cpp
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RifEnsembleStatisticsReader.h"
|
||||
|
||||
#include "RimEnsembleCurveSet.h"
|
||||
#include "RimEnsembleStatisticsCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEnsembleStatisticsReader::RifEnsembleStatisticsReader( RimEnsembleStatisticsCase* ensStatCase )
|
||||
{
|
||||
CVF_ASSERT( ensStatCase );
|
||||
|
||||
m_ensembleStatCase = ensStatCase;
|
||||
|
||||
m_allResultAddresses =
|
||||
std::set<RifEclipseSummaryAddress>( { RifEclipseSummaryAddress::ensembleStatisticsAddress( ENSEMBLE_STAT_P10_QUANTITY_NAME, "" ),
|
||||
RifEclipseSummaryAddress::ensembleStatisticsAddress( ENSEMBLE_STAT_P50_QUANTITY_NAME, "" ),
|
||||
RifEclipseSummaryAddress::ensembleStatisticsAddress( ENSEMBLE_STAT_P90_QUANTITY_NAME, "" ),
|
||||
RifEclipseSummaryAddress::ensembleStatisticsAddress( ENSEMBLE_STAT_MEAN_QUANTITY_NAME, "" ) } );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<time_t> RifEnsembleStatisticsReader::timeSteps( const RifEclipseSummaryAddress& resultAddress ) const
|
||||
{
|
||||
if ( !validateAddress( resultAddress ) ) return {};
|
||||
return m_ensembleStatCase->timeSteps();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifEnsembleStatisticsReader::values( const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values ) const
|
||||
{
|
||||
if ( !validateAddress( resultAddress ) ) return false;
|
||||
|
||||
const std::vector<double>* sourceData = nullptr;
|
||||
auto quantityName = resultAddress.ensembleStatisticsVectorName();
|
||||
|
||||
if ( quantityName == ENSEMBLE_STAT_P10_QUANTITY_NAME )
|
||||
sourceData = &m_ensembleStatCase->p10();
|
||||
else if ( quantityName == ENSEMBLE_STAT_P50_QUANTITY_NAME )
|
||||
sourceData = &m_ensembleStatCase->p50();
|
||||
else if ( quantityName == ENSEMBLE_STAT_P90_QUANTITY_NAME )
|
||||
sourceData = &m_ensembleStatCase->p90();
|
||||
else if ( quantityName == ENSEMBLE_STAT_MEAN_QUANTITY_NAME )
|
||||
sourceData = &m_ensembleStatCase->mean();
|
||||
|
||||
if ( !sourceData ) return false;
|
||||
|
||||
values->clear();
|
||||
values->reserve( sourceData->size() );
|
||||
for ( auto val : *sourceData )
|
||||
values->push_back( val );
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RifEnsembleStatisticsReader::unitName( const RifEclipseSummaryAddress& resultAddress ) const
|
||||
{
|
||||
std::string retval;
|
||||
|
||||
// The stat case does not have a unit set, so pick up the unit from one of the input cases, if possible
|
||||
auto cases = m_ensembleStatCase->curveSet()->summaryCaseCollection()->allSummaryCases();
|
||||
if ( cases.size() > 0 )
|
||||
{
|
||||
QString qName = QString::fromStdString( resultAddress.vectorName() );
|
||||
std::string orgQName = qName.split( ":" )[1].toStdString();
|
||||
|
||||
RifEclipseSummaryAddress address = RifEclipseSummaryAddress( resultAddress );
|
||||
address.setVectorName( orgQName );
|
||||
|
||||
retval = cases[0]->summaryReader()->unitName( address );
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::EclipseUnitSystem RifEnsembleStatisticsReader::unitSystem() const
|
||||
{
|
||||
return m_ensembleStatCase->unitSystem();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifEnsembleStatisticsReader::validateAddress( const RifEclipseSummaryAddress& address ) const
|
||||
{
|
||||
return address.category() == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_ENSEMBLE_STATISTICS &&
|
||||
!address.vectorName().empty();
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
class RimEnsembleStatisticsCase;
|
||||
class RifEclipseSummaryAddress;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RifEnsembleStatisticsReader : public RifSummaryReaderInterface
|
||||
{
|
||||
public:
|
||||
RifEnsembleStatisticsReader( RimEnsembleStatisticsCase* ensStatCase );
|
||||
|
||||
std::vector<time_t> timeSteps( const RifEclipseSummaryAddress& resultAddress ) const override;
|
||||
bool values( const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values ) const override;
|
||||
std::string unitName( const RifEclipseSummaryAddress& resultAddress ) const override;
|
||||
|
||||
RiaDefines::EclipseUnitSystem unitSystem() const override;
|
||||
|
||||
private:
|
||||
bool validateAddress( const RifEclipseSummaryAddress& address ) const;
|
||||
|
||||
private:
|
||||
RimEnsembleStatisticsCase* m_ensembleStatCase;
|
||||
};
|
||||
Reference in New Issue
Block a user