#3096 Implemented ensemble calulations

This commit is contained in:
Bjørn Erik Jensen
2018-06-25 15:14:47 +02:00
parent 2ea84bdb63
commit 898df5b68a
44 changed files with 1378 additions and 99 deletions

View File

@@ -35,6 +35,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCrossPlotCurveFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryEnsembleCurveSetFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicPasteEnsembleCurveSetFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewEnsembleCurveFilterFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedEnsembleFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
@@ -73,6 +74,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCrossPlotCurveFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryEnsembleCurveSetFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicPasteEnsembleCurveSetFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewEnsembleCurveFilterFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedEnsembleFeature.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@@ -0,0 +1,86 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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 "RicNewDerivedEnsembleFeature.h"
#include "RiaApplication.h"
#include "RimDerivedEnsembleCaseCollection.h"
#include "RimProject.h"
#include "RimSummaryCaseMainCollection.h"
#include "RiuPlotMainWindowTools.h"
#include "cafSelectionManagerTools.h"
#include <QAction>
#include <memory>
CAF_CMD_SOURCE_INIT(RicNewDerivedEnsembleFeature, "RicNewDerivedEnsembleFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewDerivedEnsembleFeature::isCommandEnabled()
{
std::vector<RimSummaryCaseMainCollection*> mainColls = caf::selectedObjectsByTypeStrict<RimSummaryCaseMainCollection*>();
std::vector<RimSummaryCaseCollection*> ensembles = caf::selectedObjectsByTypeStrict<RimSummaryCaseCollection*>();
return mainColls.size() == 1 || ensembles.size() == 1 || ensembles.size() == 2;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewDerivedEnsembleFeature::onActionTriggered(bool isChecked)
{
if (isCommandEnabled())
{
auto project = RiaApplication::instance()->project();
auto mainColl = project->firstSummaryCaseMainCollection();
auto newColl = mainColl->addCaseCollection({}, "", true, []() {return new RimDerivedEnsembleCaseCollection(); });
auto newEnsemble = dynamic_cast<RimDerivedEnsembleCaseCollection*>(newColl);
{
std::vector<RimSummaryCaseCollection*> ensembles = caf::selectedObjectsByType<RimSummaryCaseCollection*>();
if (ensembles.size() >= 1) newEnsemble->setEnsemble1(ensembles[0]);
if (ensembles.size() == 2)
{
newEnsemble->setEnsemble2(ensembles[1]);
newEnsemble->updateDerivedEnsembleCases();
}
}
mainColl->updateConnectedEditors();
RiuPlotMainWindowTools::selectAsCurrentItem(newEnsemble);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewDerivedEnsembleFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("New Derived Ensemble");
actionToSetup->setIcon(QIcon(":/SummaryEnsemble16x16.png"));
}

View File

@@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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 "cafCmdFeature.h"
class RimSummaryPlotCollection;
class RimSummaryCase;
class RimSummaryPlot;
//==================================================================================================
///
//==================================================================================================
class RicNewDerivedEnsembleFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook(QAction* actionToSetup);
};

View File

@@ -27,6 +27,7 @@
#include "RifReaderEclipseSummary.h"
#include "RimDerivedEnsembleCaseCollection.h"
#include "RimEnsembleCurveSet.h"
#include "RimEnsembleCurveSetCollection.h"
#include "RimEnsembleCurveSetColorManager.h"
@@ -509,13 +510,13 @@ std::set<std::string> RicSummaryCurveCreator::getAllSummaryWellNames()
if (reader)
{
const std::vector<RifEclipseSummaryAddress> allAddresses = reader->allResultAddresses();
const std::set<RifEclipseSummaryAddress> allAddresses = reader->allResultAddresses();
for (size_t i = 0; i < allAddresses.size(); i++)
for(auto& address : allAddresses)
{
if (allAddresses[i].category() == RifEclipseSummaryAddress::SUMMARY_WELL)
if (address.category() == RifEclipseSummaryAddress::SUMMARY_WELL)
{
summaryWellNames.insert(allAddresses[i].wellName());
summaryWellNames.insert(address.wellName());
}
}
}