#739 Added summary case classes. Use those from the summary curves. Made save/restore work again for the summary plots. File format for Summary stuff are changed.

This commit is contained in:
Jacob Støren 2016-05-31 13:42:27 +02:00
parent 5732b5008f
commit 40388b308b
23 changed files with 864 additions and 20 deletions

View File

@ -100,6 +100,9 @@
#endif
#include "RimSummaryPlotCollection.h"
#include "RimSummaryPlot.h"
#include "RimSummaryCaseCollection.h"
#include "RimSummaryCase.h"
#include "RimGridSummaryCase.h"
namespace caf
{
@ -387,6 +390,17 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
if (oilField->wellPathCollection) oilField->wellPathCollection->readWellPathFiles();
}
for (RimOilField* oilField: m_project->oilFields)
{
if (oilField == NULL) continue;
// Temporary
if(!oilField->summaryCaseCollection())
{
oilField->summaryCaseCollection = new RimSummaryCaseCollection();
}
oilField->summaryCaseCollection()->createSummaryCasesFromRelevantEclipseResultCases();
oilField->summaryCaseCollection()->loadAllSummaryCaseData();
}
// If load action is specified to recalculate statistics, do it now.
// Apparently this needs to be done before the views are loaded, lest the number of time steps for statistics will be clamped
@ -776,11 +790,21 @@ bool RiaApplication::openEclipseCase(const QString& caseName, const QString& cas
riv->loadDataAndUpdate();
// Add a corresponding summary case if it exists
{
RimSummaryCaseCollection* sumCaseColl = m_project->activeOilField() ? m_project->activeOilField()->summaryCaseCollection() : NULL;
if(sumCaseColl)
{
RimGridSummaryCase* newSumCase = sumCaseColl->createAndAddSummaryCaseFromEclipseResultCase(rimResultReservoir);
if(newSumCase) newSumCase->loadCase();
}
}
if (!riv->cellResult()->hasResult())
{
riv->cellResult()->setResultVariable(RimDefines::undefinedResultName());
}
analysisModels->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(riv->cellResult());

View File

@ -31,6 +31,9 @@
#include "RimSummaryCurve.h"
#include "RiuMainWindow.h"
#include "cafSelectionManager.h"
#include "WellLogCommands\RicWellLogPlotCurveFeatureImpl.h"
#include "RimOilField.h"
#include "RimSummaryCaseCollection.h"
CAF_CMD_SOURCE_INIT(RicNewSummaryCurveFeature, "RicNewSummaryCurveFeature");
@ -62,10 +65,22 @@ void RicNewSummaryCurveFeature::onActionTriggered(bool isChecked)
{
RimSummaryCurve* newCurve = new RimSummaryCurve();
plot->addCurve(newCurve);
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable();
newCurve->setColor(curveColor);
RimSummaryCase* defaultCase = nullptr;
if (project->activeOilField()->summaryCaseCollection()->summaryCaseCount() > 0)
{
defaultCase = project->activeOilField()->summaryCaseCollection()->summaryCase(0);
newCurve->setSummaryCase(defaultCase);
newCurve->setVariable("FOPT");
newCurve->loadDataAndUpdate();
}
plot->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(newCurve);
}
}

View File

@ -28,6 +28,7 @@
#include "cvfAssert.h"
#include "RimSummaryPlotCollection.h"
#include "RimMainPlotCollection.h"
#include "RiuMainWindow.h"
CAF_CMD_SOURCE_INIT(RicNewSummaryPlotFeature, "RicNewSummaryPlotFeature");
@ -58,8 +59,11 @@ void RicNewSummaryPlotFeature::onActionTriggered(bool isChecked)
summaryPlotColl->m_summaryPlots().push_back(plot);
plot->setDescription(QString("Well Log Plot %1").arg(summaryPlotColl->m_summaryPlots.size()));
summaryPlotColl->updateConnectedEditors();
plot->loadDataAndUpdate();
RiuMainWindow::instance()->selectAsCurrentItem(plot);
}
//--------------------------------------------------------------------------------------------------

View File

@ -34,6 +34,62 @@ void RifEclipseSummaryTools::findSummaryHeaderFile(const std::string& inputFile,
findSummaryHeaderFileInfo(inputFile, headerFile, NULL, NULL, isFormatted);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifEclipseSummaryTools::findSummaryFiles(const std::string& inputFile,
std::string* headerFile,
std::vector<std::string>* dataFiles)
{
dataFiles->clear();
headerFile->clear();
char* myPath = NULL;
char* myBase = NULL;
char* myExtention = NULL;
util_alloc_file_components(inputFile.data(), &myPath, &myBase, &myExtention);
std::string path; if(myPath) path = myPath;
std::string base; if(myBase) base = myBase;
std::string extention; if(myExtention) extention = myExtention;
if(path.empty() || base.empty()) return ;
char* myHeaderFile = NULL;
stringlist_type* summary_file_list = stringlist_alloc_new();
ecl_util_alloc_summary_files(path.data(), base.data(), extention.data(), &myHeaderFile, summary_file_list);
(*headerFile) = myHeaderFile;
util_safe_free(myHeaderFile);
if(stringlist_get_size(summary_file_list) > 0)
{
for(int i = 0; i < stringlist_get_size(summary_file_list); i++)
{
dataFiles->push_back(stringlist_iget(summary_file_list,i));
}
}
stringlist_free(summary_file_list);
return;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifEclipseSummaryTools::hasSummaryFiles(const std::string& gridFileName)
{
std::string headerFileName;
std::vector<std::string> dataFileNames;
RifEclipseSummaryTools::findSummaryFiles(gridFileName, &headerFileName, &dataFileNames);
if (!headerFileName.empty() && dataFileNames.size()) return true;
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -36,6 +36,8 @@ public:
static void findSummaryHeaderFile(const std::string& inputFile, std::string* headerFile, bool* isFormatted);
static std::vector<std::string> findSummaryDataFiles(const std::string& caseFile);
static void findSummaryFiles(const std::string& inputFile, std::string* headerFile, std::vector<std::string>* dataFiles);
static bool hasSummaryFiles(const std::string& gridFileName);
static void dumpMetaData(RifReaderEclipseSummary* readerEclipseSummary);
private:

View File

@ -80,6 +80,10 @@ ${CEE_CURRENT_LIST_DIR}RimGridCollection.h
${CEE_CURRENT_LIST_DIR}RimSummaryPlotCollection.h
${CEE_CURRENT_LIST_DIR}RimSummaryPlot.h
${CEE_CURRENT_LIST_DIR}RimSummaryCurve.h
${CEE_CURRENT_LIST_DIR}RimSummaryCase.h
${CEE_CURRENT_LIST_DIR}RimGridSummaryCase.cpp
${CEE_CURRENT_LIST_DIR}RimFileSummaryCase.cpp
${CEE_CURRENT_LIST_DIR}RimSummaryCaseCollection.h
${CEE_CURRENT_LIST_DIR}RimPlotCurve.h
)
@ -160,6 +164,10 @@ ${CEE_CURRENT_LIST_DIR}RimGridCollection.cpp
${CEE_CURRENT_LIST_DIR}RimSummaryPlotCollection.cpp
${CEE_CURRENT_LIST_DIR}RimSummaryPlot.cpp
${CEE_CURRENT_LIST_DIR}RimSummaryCurve.cpp
${CEE_CURRENT_LIST_DIR}RimSummaryCase.cpp
${CEE_CURRENT_LIST_DIR}RimGridSummaryCase.cpp
${CEE_CURRENT_LIST_DIR}RimFileSummaryCase.cpp
${CEE_CURRENT_LIST_DIR}RimSummaryCaseCollection.cpp
${CEE_CURRENT_LIST_DIR}RimPlotCurve.cpp
)

View File

@ -0,0 +1,61 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimFileSummaryCase.h"
//==================================================================================================
//
//
//
//==================================================================================================
CAF_PDM_SOURCE_INIT(RimFileSummaryCase,"FileSummaryCase");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFileSummaryCase::RimFileSummaryCase()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFileSummaryCase::~RimFileSummaryCase()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFileSummaryCase::setSummaryHeaderFilename(const QString& fileName)
{
m_summaryHeaderFilename = fileName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFileSummaryCase::summaryHeaderFilename() const
{
return m_summaryHeaderFilename();
}

View File

@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimSummaryCase.h"
//==================================================================================================
//
//
//
//==================================================================================================
class RimFileSummaryCase: public RimSummaryCase
{
CAF_PDM_HEADER_INIT;
public:
RimFileSummaryCase();
virtual ~RimFileSummaryCase();
void setSummaryHeaderFilename(const QString& fileName);
virtual QString summaryHeaderFilename() const override;
private:
caf::PdmField<QString> m_summaryHeaderFilename;
};

View File

@ -0,0 +1,71 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimGridSummaryCase.h"
#include "RimEclipseCase.h"
#include <QFileInfo>
#include "RigSummaryCaseData.h"
//==================================================================================================
//
//
//
//==================================================================================================
CAF_PDM_SOURCE_INIT(RimGridSummaryCase,"GridSummaryCase");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridSummaryCase::RimGridSummaryCase()
{
CAF_PDM_InitFieldNoDefault(&m_eclipseCase, "Associated3DCase", "Main View", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridSummaryCase::~RimGridSummaryCase()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridSummaryCase::setAssociatedEclipseCase(RimEclipseCase* eclipseCase)
{
m_eclipseCase = eclipseCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGridSummaryCase::summaryHeaderFilename() const
{
if (!m_eclipseCase()) return QString();
QFileInfo gridFileInfo(m_eclipseCase()->gridFileName());
QString possibleSumHeaderFileName = gridFileInfo.path() +"/"+ gridFileInfo.completeBaseName() + ".SMSPEC";
return possibleSumHeaderFileName;
}

View File

@ -0,0 +1,44 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimSummaryCase.h"
//==================================================================================================
//
//
//
//==================================================================================================
class RimGridSummaryCase: public RimSummaryCase
{
CAF_PDM_HEADER_INIT;
public:
RimGridSummaryCase();
virtual ~RimGridSummaryCase();
void setAssociatedEclipseCase(RimEclipseCase* eclipseCase);
RimEclipseCase* associatedEclipseCase() { return m_eclipseCase(); }
virtual QString summaryHeaderFilename() const override;
private:
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
};

View File

@ -23,6 +23,7 @@
#include "RimEclipseCaseCollection.h"
#include "RimWellPathCollection.h"
#include "RimGeoMechModels.h"
#include "RimSummaryCaseCollection.h"
CAF_PDM_SOURCE_INIT(RimOilField, "ResInsightOilField");
//--------------------------------------------------------------------------------------------------
@ -35,9 +36,11 @@ RimOilField::RimOilField(void)
CAF_PDM_InitFieldNoDefault(&analysisModels, "AnalysisModels", "Grid Models", ":/GridModels.png", "", "");
CAF_PDM_InitFieldNoDefault(&geoMechModels, "GeoMechModels", "Geo Mech Models", ":/GridModels.png", "", "");
CAF_PDM_InitFieldNoDefault(&wellPathCollection, "WellPathCollection", "Well Paths", ":/WellCollection.png", "", "");
CAF_PDM_InitFieldNoDefault(&summaryCaseCollection,"SummaryCaseCollection","Summary Cases",":/GridModels.png","","");
analysisModels = new RimEclipseCaseCollection();
wellPathCollection = new RimWellPathCollection();
summaryCaseCollection = new RimSummaryCaseCollection();
}
//--------------------------------------------------------------------------------------------------
@ -48,5 +51,6 @@ RimOilField::~RimOilField(void)
if (wellPathCollection()) delete wellPathCollection();
if (geoMechModels()) delete geoMechModels();
if (analysisModels()) delete analysisModels();
if (summaryCaseCollection()) delete summaryCaseCollection();
}

View File

@ -28,7 +28,7 @@
class RimEclipseCaseCollection;
class RimGeoMechModels;
class RimWellPathCollection;
class RimSummaryCaseCollection;
//==================================================================================================
///
///
@ -44,4 +44,5 @@ public:
caf::PdmChildField<RimEclipseCaseCollection*> analysisModels;
caf::PdmChildField<RimGeoMechModels*> geoMechModels;
caf::PdmChildField<RimWellPathCollection*> wellPathCollection;
caf::PdmChildField<RimSummaryCaseCollection*> summaryCaseCollection;
};

View File

@ -56,6 +56,8 @@
#include <QDir>
#include <QMenu>
#include "RimGridSummaryCase.h"
#include "RimSummaryCaseCollection.h"
CAF_PDM_SOURCE_INIT(RimProject, "ResInsightProject");
@ -471,6 +473,25 @@ void RimProject::allCases(std::vector<RimCase*>& cases)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimProject::allSummaryCases(std::vector<RimSummaryCase*>& sumCases)
{
for (RimOilField* oilField: oilFields)
{
if(!oilField) continue;
RimSummaryCaseCollection* sumCaseColl = oilField->summaryCaseCollection();
if(sumCaseColl)
{
for (size_t scIdx = 0; scIdx < sumCaseColl->summaryCaseCount(); ++scIdx)
{
sumCases.push_back(sumCaseColl->summaryCase(scIdx));
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -38,6 +38,7 @@ class RimViewLinkerCollection;
class RimMainPlotCollection;
class RimOilField;
class RimScriptCollection;
class RimSummaryCase;
class RimView;
class RimWellPathImport;
@ -82,6 +83,7 @@ public:
void assignIdToCaseGroup(RimIdenticalGridCaseGroup* caseGroup);
void allCases(std::vector<RimCase*>& cases);
void allSummaryCases(std::vector<RimSummaryCase*>& sumCases);
void allNotLinkedViews(std::vector<RimView*>& views);
void allVisibleViews(std::vector<RimView*>& views);

View File

@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimSummaryCase.h"
#include "RimEclipseCase.h"
#include "RigSummaryCaseData.h"
#include <QFileInfo>
CAF_PDM_ABSTRACT_SOURCE_INIT(RimSummaryCase,"SummaryCase");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCase::RimSummaryCase()
{
CAF_PDM_InitObject("Summary Case",":/Cases16x16.png","","");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCase::~RimSummaryCase()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCase::loadCase()
{
if (m_summaryCaseData.isNull()) m_summaryCaseData = new RigSummaryCaseData(this->summaryHeaderFilename());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimSummaryCase::caseName()
{
QFileInfo caseFileName(this->summaryHeaderFilename());
return caseFileName.completeBaseName();
}

View File

@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafPdmChildArrayField.h"
#include "cafPdmObject.h"
#include "cafPdmField.h"
#include "cvfObject.h"
#include "cafPdmPtrField.h"
class RimEclipseCase;
class RigSummaryCaseData;
//==================================================================================================
//
//
//
//==================================================================================================
class RimSummaryCase : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimSummaryCase();
virtual ~RimSummaryCase();
QString caseName();
virtual QString summaryHeaderFilename() const = 0;
void loadCase();
RigSummaryCaseData* caseData() { return m_summaryCaseData.p(); }
protected:
cvf::ref<RigSummaryCaseData> m_summaryCaseData;
};

View File

@ -0,0 +1,136 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimSummaryCaseCollection.h"
#include "RimSummaryCase.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimEclipseResultCase.h"
#include "RimGridSummaryCase.h"
#include "RifEclipseSummaryTools.h"
#include <QDir>
CAF_PDM_SOURCE_INIT(RimSummaryCaseCollection,"SummaryCaseCollection");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCaseCollection::RimSummaryCaseCollection()
{
CAF_PDM_InitObject("Summary Cases",":/Cases16x16.png","","");
CAF_PDM_InitFieldNoDefault(&m_cases,"SummaryCases","","","","");
m_cases.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCaseCollection::~RimSummaryCaseCollection()
{
m_cases.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCaseCollection::createSummaryCasesFromRelevantEclipseResultCases()
{
RimProject* proj = nullptr;
firstAnchestorOrThisOfType(proj);
if (proj)
{
std::vector<RimCase*> all3DCases;
proj->allCases(all3DCases);
for (RimCase* aCase: all3DCases)
{
RimEclipseResultCase* eclResCase = dynamic_cast<RimEclipseResultCase*>(aCase);
if (eclResCase)
{
// If we have no summary case corresponding to this eclipse case,
// try to create one.
bool isFound = false;
for (size_t scIdx = 0; scIdx < m_cases.size(); ++scIdx)
{
RimGridSummaryCase* grdSumCase = dynamic_cast<RimGridSummaryCase*>(m_cases[scIdx]);
if (grdSumCase)
{
if (grdSumCase->associatedEclipseCase() == eclResCase)
{
isFound = true;
break;
}
}
}
if (!isFound)
{
// Create new GridSummaryCase
createAndAddSummaryCaseFromEclipseResultCase(eclResCase);
}
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCase* RimSummaryCaseCollection::summaryCase(size_t idx)
{
return m_cases[idx];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimSummaryCaseCollection::summaryCaseCount()
{
return m_cases.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCaseCollection::loadAllSummaryCaseData()
{
for (RimSummaryCase* sumCase: m_cases)
{
if (sumCase) sumCase->loadCase();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridSummaryCase* RimSummaryCaseCollection::createAndAddSummaryCaseFromEclipseResultCase(RimEclipseResultCase* eclResCase)
{
QString gridFileName = eclResCase->gridFileName();
if(RifEclipseSummaryTools::hasSummaryFiles(QDir::toNativeSeparators(gridFileName).toStdString()))
{
RimGridSummaryCase* newSumCase = new RimGridSummaryCase();
newSumCase->setAssociatedEclipseCase(eclResCase);
this->m_cases.push_back(newSumCase);
return newSumCase;
}
return nullptr;
}

View File

@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafPdmChildArrayField.h"
#include "cafPdmObject.h"
class RimSummaryCase;
class RimGridSummaryCase;
class RimEclipseResultCase;
class RimSummaryCaseCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimSummaryCaseCollection();
virtual ~RimSummaryCaseCollection();
RimSummaryCase* summaryCase(size_t idx);
size_t summaryCaseCount();
void createSummaryCasesFromRelevantEclipseResultCases();
RimGridSummaryCase* createAndAddSummaryCaseFromEclipseResultCase(RimEclipseResultCase* eclResCase);
void loadAllSummaryCaseData();
private:
caf::PdmChildArrayField<RimSummaryCase*> m_cases;
};

View File

@ -32,6 +32,30 @@
#include "cafPdmUiTreeOrdering.h"
#include "RiuLineSegmentQwtPlotCurve.h"
#include "qwt_date.h"
#include "RimSummaryCase.h"
#include "RigSummaryCaseData.h"
namespace caf
{
template<>
void caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>::setUp()
{
addItem(RifEclipseSummaryAddress::SUMMARY_WELL, "SUMMARY_WELL", "Well");
addItem(RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION, "SUMMARY_WELL_COMPLETION","Completion");
addItem(RifEclipseSummaryAddress::SUMMARY_GROUP, "SUMMARY_GROUP", "Group");
addItem(RifEclipseSummaryAddress::SUMMARY_FIELD, "SUMMARY_FIELD", "Field");
addItem(RifEclipseSummaryAddress::SUMMARY_REGION, "SUMMARY_REGION", "Region");
addItem(RifEclipseSummaryAddress::SUMMARY_MISC, "SUMMARY_MISC", "Misc");
addItem(RifEclipseSummaryAddress::SUMMARY_BLOCK, "SUMMARY_BLOCK", "Block");
addItem(RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR, "SUMMARY_BLOCK_LGR", "LGR Block");
addItem(RifEclipseSummaryAddress::SUMMARY_AQUIFIER, "SUMMARY_AQUIFIER", "Aquifier");
addItem(RifEclipseSummaryAddress::SUMMARY_SEGMENT, "SUMMARY_SEGMENT", "Segment");
addItem(RifEclipseSummaryAddress::SUMMARY_SEGMENT_RIVER, "SUMMARY_SEGMENT_RIVER", "Segment River");
setDefault(RifEclipseSummaryAddress::SUMMARY_FIELD);
}
}
CAF_PDM_SOURCE_INIT(RimSummaryCurve, "SummaryCurve");
@ -42,15 +66,28 @@ RimSummaryCurve::RimSummaryCurve()
{
CAF_PDM_InitObject("Summary Curve", ":/WellLogCurve16x16.png", "", "");
CAF_PDM_InitFieldNoDefault(&m_eclipseCase, "ReferencedEclipseCase", "Eclipse Case", "", "", "");
m_eclipseCase.uiCapability()->setUiChildrenHidden(true);
CAF_PDM_InitFieldNoDefault(&m_summaryCase, "SummaryCase", "Summary Case", "", "", "");
m_summaryCase.uiCapability()->setUiChildrenHidden(true);
// TODO: Implement setUiTreeHidden
//m_eclipseCase.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_variableName, "SummaryVariableName", "Variable Name", "", "", "");
m_variableName.uiCapability()->setUiEditorTypeName(caf::PdmUiComboBoxEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&m_category,"SummaryVarCategory","Category","","","");
m_category.xmlCapability()->setIOWritable(false);
m_category.xmlCapability()->setIOReadable(false);
CAF_PDM_InitFieldNoDefault(&m_simulationItemName,"SummaryVarItem","Item","","","");
m_simulationItemName.xmlCapability()->setIOWritable(false);
m_simulationItemName.xmlCapability()->setIOReadable(false);
CAF_PDM_InitFieldNoDefault(&m_quantityName,"SummaryVarQuantity","Quantity","","","");
m_quantityName.xmlCapability()->setIOWritable(false);
m_quantityName.xmlCapability()->setIOReadable(false);
updateOptionSensitivity();
}
//--------------------------------------------------------------------------------------------------
@ -60,17 +97,33 @@ RimSummaryCurve::~RimSummaryCurve()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCurve::setSummaryCase(RimSummaryCase* sumCase)
{
m_summaryCase = sumCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCurve::setVariable(QString varName)
{
m_variableName = varName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
{
this->RimPlotCurve::calculateValueOptions(fieldNeedingOptions,useOptionsOnly);
QList<caf::PdmOptionItemInfo> optionList = this->RimPlotCurve::calculateValueOptions(fieldNeedingOptions,useOptionsOnly);
if (!optionList.isEmpty()) return optionList;
QList<caf::PdmOptionItemInfo> optionList;
if (fieldNeedingOptions == &m_variableName)
{
if (m_eclipseCase)
if (m_summaryCase)
{
RifReaderEclipseSummary* reader = summaryReader();
if (reader)
@ -91,18 +144,18 @@ QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions(const caf::
if (useOptionsOnly) *useOptionsOnly = true;
}
}
else if (fieldNeedingOptions == &m_eclipseCase)
else if (fieldNeedingOptions == &m_summaryCase)
{
RimProject* proj = RiaApplication::instance()->project();
std::vector<RimCase*> cases;
std::vector<RimSummaryCase*> cases;
proj->allCases(cases);
proj->allSummaryCases(cases);
for (size_t i = 0; i < cases.size(); i++)
{
RimCase* rimCase = cases[i];
RimSummaryCase* rimCase = cases[i];
optionList.push_back(caf::PdmOptionItemInfo(rimCase->caseUserDescription(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(rimCase))));
optionList.push_back(caf::PdmOptionItemInfo(rimCase->caseName(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(rimCase))));
}
if (optionList.size() > 0)
@ -110,6 +163,14 @@ QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions(const caf::
optionList.push_front(caf::PdmOptionItemInfo("None", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(NULL))));
}
}
else if (fieldNeedingOptions == &m_simulationItemName)
{
RifReaderEclipseSummary* reader = summaryReader();
if(reader)
{
const std::vector<RifEclipseSummaryAddress>& addrs = reader->allResultAddresses();
}
}
return optionList;
@ -154,6 +215,29 @@ void RimSummaryCurve::onLoadDataAndUpdate()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data");
curveDataGroup->add(&m_summaryCase);
curveDataGroup->add(&m_variableName);
//curveDataGroup->add(&m_category);
//curveDataGroup->add(&m_simulationItemName);
//curveDataGroup->add(&m_quantityName);
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance");
appearanceGroup->add(&m_curveColor);
appearanceGroup->add(&m_curveThickness);
appearanceGroup->add(&m_pointSymbol);
appearanceGroup->add(&m_lineStyle);
appearanceGroup->add(&m_curveName);
appearanceGroup->add(&m_isUsingAutoName);
uiOrdering.setForgetRemainingFields(true); // For now.
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -165,7 +249,7 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
{
this->loadDataAndUpdate();
}
else if (changedField = &m_eclipseCase)
else if (changedField = &m_summaryCase)
{
this->loadDataAndUpdate();
}
@ -176,10 +260,11 @@ void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
//--------------------------------------------------------------------------------------------------
RifReaderEclipseSummary* RimSummaryCurve::summaryReader()
{
RimSummaryPlotCollection* plotCollection = NULL;
this->firstAnchestorOrThisOfType(plotCollection);
if (!m_summaryCase()) return nullptr;
return plotCollection->getOrCreateSummaryFileReader(m_eclipseCase);
if (!m_summaryCase->caseData()) return nullptr;
return m_summaryCase()->caseData()->summaryReader();
}
//--------------------------------------------------------------------------------------------------

View File

@ -25,8 +25,10 @@
#include "cafPdmPtrField.h"
#include "RimPlotCurve.h"
#include "RifEclipseSummaryAddress.h"
#include "cafAppEnum.h"
class RimEclipseResultCase;
class RimSummaryCase;
class RifReaderEclipseSummary;
class RiuLineSegmentQwtPlotCurve;
@ -41,6 +43,9 @@ public:
RimSummaryCurve();
virtual ~RimSummaryCurve();
void setSummaryCase(RimSummaryCase* sumCase);
void setVariable(QString varName);
protected:
// RimPlotCurve overrides
@ -56,8 +61,16 @@ private:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "");
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
// Fields
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseCase;
caf::PdmPtrField<RimSummaryCase*> m_summaryCase;
caf::PdmField<QString> m_variableName;
// Ui Fields
caf::PdmField<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory> >
m_category;
caf::PdmField<QString> m_simulationItemName;
caf::PdmField<QString> m_quantityName;
};

View File

@ -39,6 +39,7 @@ ${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.h
${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.h
${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.h
${CEE_CURRENT_LIST_DIR}RigCurveDataTools.h
${CEE_CURRENT_LIST_DIR}RigSummaryCaseData.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -73,6 +74,7 @@ ${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.cpp
${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.cpp
${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigCurveDataTools.cpp
${CEE_CURRENT_LIST_DIR}RigSummaryCaseData.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -0,0 +1,58 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RigSummaryCaseData.h"
#include "RifReaderEclipseSummary.h"
#include "RifEclipseSummaryTools.h"
#include <qstring>
#include <QDir>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigSummaryCaseData::RigSummaryCaseData(const QString& summaryHeaderFileName)
{
std::string headerFileName;
std::vector<std::string> dataFileNames;
std::string nativeSumHeadFileName = QDir::toNativeSeparators(summaryHeaderFileName).toStdString();
RifEclipseSummaryTools::findSummaryFiles(nativeSumHeadFileName, &headerFileName, &dataFileNames);
m_summaryFileReader = new RifReaderEclipseSummary();
if (!m_summaryFileReader->open(headerFileName, dataFileNames))
{
m_summaryFileReader = nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigSummaryCaseData::~RigSummaryCaseData()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifReaderEclipseSummary* RigSummaryCaseData::summaryReader()
{
return m_summaryFileReader.p();
}

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cvfObject.h"
class QString;
class RifReaderEclipseSummary;
class RigSummaryCaseData: public cvf::Object
{
public:
RigSummaryCaseData(const QString& summaryHeaderFileName );
~RigSummaryCaseData();
RifReaderEclipseSummary* summaryReader();
private:
cvf::ref<RifReaderEclipseSummary> m_summaryFileReader;
};