Skip to content

Commit

Permalink
Create cross plot menu from list of addresses in preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Oct 9, 2023
1 parent d3069db commit 0ee8b08
Show file tree
Hide file tree
Showing 15 changed files with 466 additions and 71 deletions.
19 changes: 19 additions & 0 deletions ApplicationLibCode/Application/RiaPreferencesSummary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ RiaPreferencesSummary::RiaPreferencesSummary()
"" );
CAF_PDM_InitFieldNoDefault( &m_defaultSummaryPlot, "defaultSummaryPlot", "Create Plot On Summary Data Import" );

CAF_PDM_InitField( &m_crossPlotAddressCombinations,
"CrossPlotAddressCombinations",
QString( "FWIR FOPT;FGOR FOPT;FWCT FOPT;FGLIR FOPR" ),
"Cross Plot Addresses [Y-adr X-adr]",
"",
"Semicolon separated list used to create cross plot curves. Based on selection, the names will be changed to "
"corresponing well or group vector names",
"" );

CAF_PDM_InitField( &m_selectDefaultTemplates, "selectDefaultTemplate", false, "", "", "Select Default Templates" );
m_selectDefaultTemplates.xmlCapability()->disableIO();
m_selectDefaultTemplates.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
Expand Down Expand Up @@ -282,6 +291,8 @@ void RiaPreferencesSummary::appendItemsToPlottingGroup( caf::PdmUiOrdering& uiOr
break;
}

uiOrdering.add( &m_crossPlotAddressCombinations );

auto historyCurveGroup = uiOrdering.addNewGroup( "History Vectors" );

historyCurveGroup->add( &m_defaultSummaryHistoryCurveStyle );
Expand Down Expand Up @@ -369,6 +380,14 @@ bool RiaPreferencesSummary::appendHistoryVectors() const
return m_appendHistoryVectors();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferencesSummary::crossPlotAddressCombinations() const
{
return m_crossPlotAddressCombinations;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions ApplicationLibCode/Application/RiaPreferencesSummary.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ class RiaPreferencesSummary : public caf::PdmObject
bool colorCurvesByPhase() const;
bool appendHistoryVectors() const;

QString crossPlotAddressCombinations() const;

SummaryHistoryCurveStyleMode defaultSummaryHistoryCurveStyle() const;

RiaDefines::ColumnCount defaultMultiPlotColumnCount() const;
Expand All @@ -132,6 +134,7 @@ class RiaPreferencesSummary : public caf::PdmObject
caf::PdmField<SummaryRestartFilesImportModeType> m_summaryEnsembleImportMode;

caf::PdmField<QString> m_defaultSummaryCurvesTextFilter;
caf::PdmField<QString> m_crossPlotAddressCombinations;
caf::PdmField<SummaryHistoryCurveStyleModeType> m_defaultSummaryHistoryCurveStyle;
caf::PdmField<bool> m_curveColorByPhase;
caf::PdmField<bool> m_appendHistoryVectors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
#include "SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h"
#include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h"

#include "RiaPreferencesSummary.h"
#include "RiaSummaryAddressAnalyzer.h"
#include "RiaSummaryTools.h"

#include "RifEclipseSummaryAddress.h"
#include "RifReaderEclipseSummary.h"
#include "RifSummaryReaderInterface.h"

#include "RiaPreferencesSummary.h"
#include "RimEnsembleCurveSet.h"
#include "RimEnsembleCurveSetCollection.h"
#include "RimMainPlotCollection.h"
Expand All @@ -40,6 +40,7 @@
#include "RimSummaryCase.h"
#include "RimSummaryCaseCollection.h"
#include "RimSummaryCurve.h"
#include "RimSummaryCurveAppearanceCalculator.h"
#include "RimSummaryMultiPlot.h"
#include "RimSummaryMultiPlotCollection.h"
#include "RimSummaryPlot.h"
Expand Down Expand Up @@ -619,6 +620,41 @@ RimSummaryPlot* RicSummaryPlotBuilder::createPlot( const std::set<RifEclipseSumm
return plot;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryPlot* RicSummaryPlotBuilder::createCrossPlot( const std::vector<RiaSummaryCurveAddress>& addresses,
const std::vector<RimSummaryCase*>& summaryCases,
const std::vector<RimSummaryCaseCollection*>& ensembles )
{
auto* summaryPlot = new RimSummaryPlot();
summaryPlot->enableAutoPlotTitle( true );

for ( const auto& addr : addresses )
{
for ( const auto ensemble : ensembles )
{
if ( !ensemble ) continue;

auto curveSet = addNewEnsembleCurve( summaryPlot, addr, ensemble );
curveSet->findOrAssignBottomAxisX( RiuPlotAxis::defaultBottomForSummaryVectors() );
}

for ( const auto summaryCase : summaryCases )
{
if ( !summaryCase ) continue;

addNewSummaryCurve( summaryPlot, addr, summaryCase );
}
}

summaryPlot->applyDefaultCurveAppearances();
summaryPlot->loadDataAndUpdate();
summaryPlot->zoomAll();

return summaryPlot;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand All @@ -633,6 +669,7 @@ void RicSummaryPlotBuilder::appendCurvesToPlot( RimSummaryPlot*
{
auto curveSet = createCurveSet( ensemble, addr );
summaryPlot->ensembleCurveSetCollection()->addCurveSet( curveSet );
curveSet->setLeftOrRightAxisY( RiuPlotAxis::defaultLeft() );
}

for ( const auto summaryCase : summaryCases )
Expand All @@ -642,3 +679,64 @@ void RicSummaryPlotBuilder::appendCurvesToPlot( RimSummaryPlot*
}
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEnsembleCurveSet* RicSummaryPlotBuilder::addNewEnsembleCurve( RimSummaryPlot* summaryPlot,
const RiaSummaryCurveAddress& curveAddress,
RimSummaryCaseCollection* ensemble )
{
auto* curveSet = new RimEnsembleCurveSet();

curveSet->setSummaryCaseCollection( ensemble );
curveSet->setCurveAddress( curveAddress );

cvf::Color3f curveColor =
RimSummaryCurveAppearanceCalculator::computeTintedCurveColorForAddress( curveSet->summaryAddressY(),
static_cast<int>(
summaryPlot->ensembleCurveSetCollection()->curveSetCount() ) );

auto adr = curveSet->summaryAddressY();
if ( adr.isHistoryVector() ) curveColor = RiaPreferencesSummary::current()->historyCurveContrastColor();

curveSet->setColor( curveColor );

summaryPlot->ensembleCurveSetCollection()->addCurveSet( curveSet );

curveSet->setLeftOrRightAxisY( RiuPlotAxis::defaultLeft() );
curveSet->setBottomOrTopAxisX( RiuPlotAxis::defaultBottomForSummaryVectors() );

summaryPlot->curvesChanged.send();

return curveSet;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCurve* RicSummaryPlotBuilder::addNewSummaryCurve( RimSummaryPlot* summaryPlot,
const RiaSummaryCurveAddress& curveAddress,
RimSummaryCase* summaryCase )
{
auto curve = new RimSummaryCurve();

curve->setSummaryCaseY( summaryCase );
curve->setSummaryAddressY( curveAddress.summaryAddressY() );

curve->setSummaryCaseX( summaryCase );
curve->setSummaryAddressX( curveAddress.summaryAddressX() );
if ( curveAddress.summaryAddressX().category() != SummaryCategory::SUMMARY_TIME )
{
curve->setAxisTypeX( RiaDefines::HorizontalAxisType::SUMMARY_VECTOR );
}

summaryPlot->addCurveNoUpdate( curve );

if ( curveAddress.summaryAddressX().category() != SummaryCategory::SUMMARY_TIME )
{
summaryPlot->findOrAssignPlotAxisX( curve );
}

return curve;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class RimSummaryPlot;
class RimEnsembleCurveSet;
class RimSummaryCurve;
class RimSummaryMultiPlot;
class RiaSummaryCurveAddress;

namespace caf
{
Expand Down Expand Up @@ -90,11 +91,21 @@ class RicSummaryPlotBuilder
const std::vector<RimSummaryCase*>& summaryCases,
const std::vector<RimSummaryCaseCollection*>& ensembles );

static RimSummaryPlot* createCrossPlot( const std::vector<RiaSummaryCurveAddress>& addresses,
const std::vector<RimSummaryCase*>& summaryCases,
const std::vector<RimSummaryCaseCollection*>& ensembles );

static void appendCurvesToPlot( RimSummaryPlot* summaryPlot,
const std::set<RifEclipseSummaryAddress>& addresses,
const std::vector<RimSummaryCase*>& summaryCases,
const std::vector<RimSummaryCaseCollection*>& ensembles );

static RimEnsembleCurveSet*
addNewEnsembleCurve( RimSummaryPlot* summaryPlot, const RiaSummaryCurveAddress& curveAddress, RimSummaryCaseCollection* ensemble );

static RimSummaryCurve*
addNewSummaryCurve( RimSummaryPlot* summaryPlot, const RiaSummaryCurveAddress& curveAddress, RimSummaryCase* summaryCase );

private:
std::set<RifEclipseSummaryAddress> m_addresses;
std::vector<RimSummaryCase*> m_summaryCases;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicDuplicateSummaryTableFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateDeclineCurvesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateRegressionAnalysisCurveFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateCrossPlotFeature.h
)

set(SOURCE_GROUP_SOURCE_FILES
Expand Down Expand Up @@ -98,6 +99,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicDuplicateSummaryTableFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateDeclineCurvesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateRegressionAnalysisCurveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateCrossPlotFeature.cpp
)

list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
Expand Down
Loading

0 comments on commit 0ee8b08

Please sign in to comment.