2017-10-20 03:00:16 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017 Statoil ASA
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2017-10-20 03:00:16 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2017-10-20 03:00:16 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2017-10-20 03:00:16 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RiaSummaryTools.h"
|
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
|
|
|
#include "RifEclipseSummaryAddress.h"
|
|
|
|
|
|
|
|
#include "RimMainPlotCollection.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RimOilField.h"
|
2017-10-20 03:00:16 -05:00
|
|
|
#include "RimProject.h"
|
2018-05-23 06:33:10 -05:00
|
|
|
#include "RimSummaryCaseMainCollection.h"
|
2017-11-15 00:07:26 -06:00
|
|
|
#include "RimSummaryCrossPlot.h"
|
2017-10-20 03:00:16 -05:00
|
|
|
#include "RimSummaryCurve.h"
|
|
|
|
#include "RimSummaryPlot.h"
|
|
|
|
#include "RimSummaryPlotCollection.h"
|
|
|
|
|
2017-11-15 00:07:26 -06:00
|
|
|
#include "RimSummaryCrossPlotCollection.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "cafPdmObject.h"
|
2017-11-15 00:07:26 -06:00
|
|
|
|
2017-10-20 03:00:16 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-10-20 03:00:16 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimSummaryPlotCollection* RiaSummaryTools::summaryPlotCollection()
|
|
|
|
{
|
|
|
|
RimProject* project = RiaApplication::instance()->project();
|
|
|
|
|
|
|
|
return project->mainPlotCollection()->summaryPlotCollection();
|
|
|
|
}
|
|
|
|
|
2018-05-23 06:33:10 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimSummaryCaseMainCollection* RiaSummaryTools::summaryCaseMainCollection()
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RimProject* project = RiaApplication::instance()->project();
|
2018-05-23 06:33:10 -05:00
|
|
|
RimSummaryCaseMainCollection* summaryCaseMainCollection = project->activeOilField()->summaryCaseMainCollection();
|
2019-09-06 03:40:57 -05:00
|
|
|
CVF_ASSERT( summaryCaseMainCollection );
|
2018-05-23 06:33:10 -05:00
|
|
|
return summaryCaseMainCollection;
|
|
|
|
}
|
|
|
|
|
2017-10-20 03:00:16 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Update the summary curves referencing this curve, as the curve is identified by the name
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-12-09 02:21:06 -06:00
|
|
|
void RiaSummaryTools::notifyCalculatedCurveNameHasChanged( int calculationId, const QString& currentCurveName )
|
2017-10-20 03:00:16 -05:00
|
|
|
{
|
|
|
|
RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryPlot* plot : summaryPlotColl->summaryPlots() )
|
2017-10-20 03:00:16 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimSummaryCurve* curve : plot->summaryCurves() )
|
2017-10-20 03:00:16 -05:00
|
|
|
{
|
2017-11-15 04:36:33 -06:00
|
|
|
RifEclipseSummaryAddress adr = curve->summaryAddressY();
|
2019-12-09 02:21:06 -06:00
|
|
|
if ( adr.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED && adr.id() == calculationId )
|
2017-10-20 03:00:16 -05:00
|
|
|
{
|
2019-12-09 02:21:06 -06:00
|
|
|
RifEclipseSummaryAddress updatedAdr =
|
|
|
|
RifEclipseSummaryAddress::calculatedAddress( currentCurveName.toStdString(), calculationId );
|
|
|
|
curve->setSummaryAddressYAndApplyInterpolation( updatedAdr );
|
2017-10-20 03:00:16 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-11-15 00:07:26 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-11-15 00:07:26 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
RimSummaryPlot* RiaSummaryTools::parentSummaryPlot( caf::PdmObject* object )
|
2017-11-15 00:07:26 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( parentCrossPlot( object ) )
|
2017-11-15 00:07:26 -06:00
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
RimSummaryPlot* summaryPlot = nullptr;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( object )
|
2017-11-15 00:07:26 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
object->firstAncestorOrThisOfType( summaryPlot );
|
2017-11-15 00:07:26 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return summaryPlot;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-11-15 00:07:26 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
RimSummaryPlotCollection* RiaSummaryTools::parentSummaryPlotCollection( caf::PdmObject* object )
|
2017-11-15 00:07:26 -06:00
|
|
|
{
|
|
|
|
RimSummaryPlotCollection* summaryPlotColl = nullptr;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( object )
|
2017-11-15 00:07:26 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
object->firstAncestorOrThisOfType( summaryPlotColl );
|
2017-11-15 00:07:26 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return summaryPlotColl;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-11-15 00:07:26 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
RimSummaryCrossPlot* RiaSummaryTools::parentCrossPlot( caf::PdmObject* object )
|
2017-11-15 00:07:26 -06:00
|
|
|
{
|
|
|
|
RimSummaryCrossPlot* crossPlot = nullptr;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( object )
|
2017-11-15 00:07:26 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
object->firstAncestorOrThisOfType( crossPlot );
|
2017-11-15 00:07:26 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return crossPlot;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-11-15 00:07:26 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
RimSummaryCrossPlotCollection* RiaSummaryTools::parentCrossPlotCollection( caf::PdmObject* object )
|
2017-11-15 00:07:26 -06:00
|
|
|
{
|
|
|
|
RimSummaryCrossPlotCollection* crossPlotColl = nullptr;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( object )
|
2017-11-15 00:07:26 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
object->firstAncestorOrThisOfType( crossPlotColl );
|
2017-11-15 00:07:26 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return crossPlotColl;
|
|
|
|
}
|
2017-12-12 06:22:16 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-12-12 06:22:16 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
bool RiaSummaryTools::isSummaryCrossPlot( const RimSummaryPlot* plot )
|
2017-12-12 06:22:16 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
return dynamic_cast<const RimSummaryCrossPlot*>( plot );
|
2017-12-12 06:22:16 -06:00
|
|
|
}
|