Merge branch 'master' into dev

This commit is contained in:
Magne Sjaastad
2017-06-21 17:42:28 +02:00
9 changed files with 95 additions and 23 deletions

View File

@@ -146,7 +146,7 @@ void RicSnapshotViewToFileFeature::onActionTriggered(bool isChecked)
startPath += "/image.png"; startPath += "/image.png";
QString fileName = QFileDialog::getSaveFileName(NULL, tr("Export to File"), startPath, tr("Image files (*.bmp *.png * *.jpg)")); QString fileName = QFileDialog::getSaveFileName(NULL, tr("Export to File"), startPath);
if (fileName.isEmpty()) if (fileName.isEmpty())
{ {
return; return;

View File

@@ -76,14 +76,20 @@ RimEclipseCase::RimEclipseCase()
CAF_PDM_InitField(&flipXAxis, "FlipXAxis", false, "Flip X Axis", "", "", ""); CAF_PDM_InitField(&flipXAxis, "FlipXAxis", false, "Flip X Axis", "", "", "");
CAF_PDM_InitField(&flipYAxis, "FlipYAxis", false, "Flip Y Axis", "", "", ""); CAF_PDM_InitField(&flipYAxis, "FlipYAxis", false, "Flip Y Axis", "", "", "");
CAF_PDM_InitFieldNoDefault(&filesContainingFaults, "FilesContainingFaults", "", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_filesContainingFaultsSemColSeparated, "CachedFileNamesContainingFaults", "", "", "", "");
filesContainingFaults.uiCapability()->setUiHidden(true); m_filesContainingFaultsSemColSeparated.uiCapability()->setUiHidden(true);
// Obsolete fields
CAF_PDM_InitFieldNoDefault(&m_filesContainingFaults_OBSOLETE, "FilesContainingFaults", "", "", "", "");
m_filesContainingFaults_OBSOLETE.xmlCapability()->setIOWritable(false);
m_filesContainingFaults_OBSOLETE.uiCapability()->setUiHidden(true);
// Obsolete field
CAF_PDM_InitField(&caseName, "CaseName", QString(), "Obsolete", "", "" ,""); CAF_PDM_InitField(&caseName, "CaseName", QString(), "Obsolete", "", "" ,"");
caseName.xmlCapability()->setIOWritable(false); caseName.xmlCapability()->setIOWritable(false);
caseName.uiCapability()->setUiHidden(true); caseName.uiCapability()->setUiHidden(true);
// Init
m_matrixModelResults = new RimReservoirCellResultsStorage; m_matrixModelResults = new RimReservoirCellResultsStorage;
m_matrixModelResults.uiCapability()->setUiHidden(true); m_matrixModelResults.uiCapability()->setUiHidden(true);
m_matrixModelResults.uiCapability()->setUiTreeChildrenHidden(true); m_matrixModelResults.uiCapability()->setUiTreeChildrenHidden(true);
@@ -538,6 +544,39 @@ const RimReservoirCellResultsStorage* RimEclipseCase::results(RifReaderInterface
return m_fractureModelResults(); return m_fractureModelResults();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RimEclipseCase::filesContainingFaults() const
{
QString separatedPaths = m_filesContainingFaultsSemColSeparated;
QStringList pathList = separatedPaths.split(";", QString::SkipEmptyParts);
std::vector<QString> stdPathList;
for (auto& path: pathList) stdPathList.push_back(path);
return stdPathList;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseCase::setFilesContainingFaults(const std::vector<QString>& val)
{
QString separatedPaths;
for (size_t i = 0; i < val.size(); ++i)
{
const auto& path = val[i];
separatedPaths += path;
if (!(i+1 >= val.size()) )
{
separatedPaths += ";";
}
}
m_filesContainingFaultsSemColSeparated = separatedPaths;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -645,6 +684,7 @@ void RimEclipseCase::reloadDataAndUpdate()
RimEclipseView* reservoirView = reservoirViews()[i]; RimEclipseView* reservoirView = reservoirViews()[i];
CVF_ASSERT(reservoirView); CVF_ASSERT(reservoirView);
reservoirView->loadDataAndUpdate(); reservoirView->loadDataAndUpdate();
reservoirView->updateGridBoxData();
} }
RimProject* project = RiaApplication::instance()->project(); RimProject* project = RiaApplication::instance()->project();

View File

@@ -63,8 +63,8 @@ public:
caf::PdmField<bool> flipXAxis; caf::PdmField<bool> flipXAxis;
caf::PdmField<bool> flipYAxis; caf::PdmField<bool> flipYAxis;
caf::PdmField<std::vector<QString> > filesContainingFaults; std::vector<QString> filesContainingFaults() const;
void setFilesContainingFaults(const std::vector<QString>& val);
bool openReserviorCase(); bool openReserviorCase();
virtual bool openEclipseGridFile() = 0; virtual bool openEclipseGridFile() = 0;
@@ -121,6 +121,8 @@ private:
cvf::ref<RigEclipseCaseData> m_rigEclipseCase; cvf::ref<RigEclipseCaseData> m_rigEclipseCase;
QString m_timeStepFormatString; QString m_timeStepFormatString;
std::map<QString , cvf::Color3f> m_wellToColorMap; std::map<QString , cvf::Color3f> m_wellToColorMap;
caf::PdmField<QString > m_filesContainingFaultsSemColSeparated;
caf::PdmChildField<RimReservoirCellResultsStorage*> m_matrixModelResults; caf::PdmChildField<RimReservoirCellResultsStorage*> m_matrixModelResults;
caf::PdmChildField<RimReservoirCellResultsStorage*> m_fractureModelResults; caf::PdmChildField<RimReservoirCellResultsStorage*> m_fractureModelResults;
@@ -128,4 +130,7 @@ private:
// Obsolete fields // Obsolete fields
protected: protected:
caf::PdmField<QString> caseName; caf::PdmField<QString> caseName;
private:
caf::PdmField<std::vector<QString> > m_filesContainingFaults_OBSOLETE;
}; };

View File

@@ -117,7 +117,7 @@ bool RimEclipseResultCase::openEclipseGridFile()
return false; return false;
} }
this->filesContainingFaults = readerInterface->filenamesWithFaults(); this->setFilesContainingFaults(readerInterface->filenamesWithFaults());
this->setReservoirData( eclipseCase.p() ); this->setReservoirData( eclipseCase.p() );
} }
@@ -359,13 +359,14 @@ void RimEclipseResultCase::updateFilePathsFromProjectPath(const QString& newProj
caseFileName = RimTools::relocateFile(caseFileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths); caseFileName = RimTools::relocateFile(caseFileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths);
std::vector<QString> relocatedFaultFiles; std::vector<QString> relocatedFaultFiles;
for (auto faultFileName : filesContainingFaults()) const std::vector<QString>& orgFilesContainingFaults = filesContainingFaults();
for (auto faultFileName : orgFilesContainingFaults)
{ {
QString relocatedFaultFile = RimTools::relocateFile(faultFileName, newProjectPath, oldProjectPath, &foundFile, &searchedPaths); QString relocatedFaultFile = RimTools::relocateFile(faultFileName, newProjectPath, oldProjectPath, &foundFile, &searchedPaths);
relocatedFaultFiles.push_back(relocatedFaultFile); relocatedFaultFiles.push_back(relocatedFaultFile);
} }
filesContainingFaults = relocatedFaultFiles; setFilesContainingFaults(relocatedFaultFiles);
#if 0 // Output the search path for debugging #if 0 // Output the search path for debugging
for (size_t i = 0; i < searchedPaths.size(); ++i) for (size_t i = 0; i < searchedPaths.size(); ++i)

View File

@@ -170,6 +170,7 @@ public:
public: public:
virtual void loadDataAndUpdate() = 0; virtual void loadDataAndUpdate() = 0;
void updateGridBoxData();
virtual RimCase* ownerCase() = 0; virtual RimCase* ownerCase() = 0;
virtual caf::PdmFieldHandle* userDescriptionField() { return &name; } virtual caf::PdmFieldHandle* userDescriptionField() { return &name; }
@@ -188,7 +189,6 @@ protected:
virtual void createDisplayModel() = 0; virtual void createDisplayModel() = 0;
void createHighlightAndGridBoxDisplayModel(); void createHighlightAndGridBoxDisplayModel();
void updateGridBoxData();
virtual void createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts) = 0; virtual void createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts) = 0;

View File

@@ -426,7 +426,14 @@ QString RimWellLogPlot::asciiDataForPlotExport() const
if (curveNames.size() == 1) if (curveNames.size() == 1)
{ {
curveDepths = curveData->measuredDepthPlotValues(RiaDefines::UNIT_NONE); if (depthType() == TRUE_VERTICAL_DEPTH)
{
curveDepths = curveData->trueDepthPlotValues(depthUnit());
}
else
{
curveDepths = curveData->measuredDepthPlotValues(depthUnit());
}
} }
std::vector<double> xPlotValues = curveData->xPlotValues(); std::vector<double> xPlotValues = curveData->xPlotValues();
@@ -435,9 +442,9 @@ QString RimWellLogPlot::asciiDataForPlotExport() const
} }
for (int i = static_cast<int>(curveDepths.size()) - 1; i >= 0; i--) for (size_t i = 0; i < curveDepths.size(); ++i)
{ {
if (i == static_cast<int>(curveDepths.size()) - 1) if (i == 0)
{ {
if (depthType() == CONNECTION_NUMBER) out += "Connection"; if (depthType() == CONNECTION_NUMBER) out += "Connection";
else if (depthType() == MEASURED_DEPTH) out += "MD "; else if (depthType() == MEASURED_DEPTH) out += "MD ";
@@ -446,7 +453,7 @@ QString RimWellLogPlot::asciiDataForPlotExport() const
for (QString name : curveNames) out += " \t" + name; for (QString name : curveNames) out += " \t" + name;
out += "\n"; out += "\n";
} }
else if (curveDepths[i] == curveDepths[i+1]) else if (curveDepths[i] == curveDepths[i-1])
{ {
continue; continue;
} }

View File

@@ -14,7 +14,7 @@ set(ERT_GITHUB_SHA "06a39878636af0bc52582430ad0431450e51139c")
set(OPM_FLOWDIAGNOSTICS_SHA "b6e59ddcd2feba450c8612a7402c9239e442c0d4") set(OPM_FLOWDIAGNOSTICS_SHA "b6e59ddcd2feba450c8612a7402c9239e442c0d4")
# https://github.com/OPM/opm-flowdiagnostics-applications # https://github.com/OPM/opm-flowdiagnostics-applications
set(OPM_FLOWDIAGNOSTICS_APPLICATIONS_SHA "ccaaa4dd1b553e131a3051687fd615fe728b76ee") set(OPM_FLOWDIAGNOSTICS_APPLICATIONS_SHA "c78f50897cea10ed56c7eadd1a1b23aa5ffbc56e")
# https://github.com/OPM/opm-parser/blob/master/opm/parser/eclipse/Units/Units.hpp # https://github.com/OPM/opm-parser/blob/master/opm/parser/eclipse/Units/Units.hpp
# This file was moved from opm-core to opm-parser october 2016 # This file was moved from opm-core to opm-parser october 2016

View File

@@ -992,6 +992,10 @@ private:
/// of main grid's section within a view. /// of main grid's section within a view.
std::string firstKeyword_; std::string firstKeyword_;
/// True if path (or pointer) to unified restart file was passed
/// as constructor argument.
bool isUnified_;
/// Map LGR names to integral grid IDs. /// Map LGR names to integral grid IDs.
std::unique_ptr<ECLImpl::GridIDCache> gridIDCache_; std::unique_ptr<ECLImpl::GridIDCache> gridIDCache_;
@@ -1021,35 +1025,41 @@ Opm::ECLRestartData::Impl::Impl(Path prefix)
: prefix_ (std::move(prefix)) : prefix_ (std::move(prefix))
, result_ (openResultSet(deriveRestartPath(prefix_))) , result_ (openResultSet(deriveRestartPath(prefix_)))
, firstKeyword_(firstFileKeyword(result_.get())) , firstKeyword_(firstFileKeyword(result_.get()))
, isUnified_ (firstKeyword_ == "SEQNUM")
{} {}
Opm::ECLRestartData::Impl::Impl(std::shared_ptr<ecl_file_type> rstrt) Opm::ECLRestartData::Impl::Impl(std::shared_ptr<ecl_file_type> rstrt)
: prefix_ (ecl_file_get_src_file(rstrt.get())) : prefix_ (ecl_file_get_src_file(rstrt.get()))
, result_ (std::move(rstrt)) , result_ (std::move(rstrt))
, firstKeyword_(firstFileKeyword(result_.get())) , firstKeyword_(firstFileKeyword(result_.get()))
, isUnified_ (firstKeyword_ == "SEQNUM")
{} {}
Opm::ECLRestartData::Impl::Impl(const Impl& rhs) Opm::ECLRestartData::Impl::Impl(const Impl& rhs)
: prefix_ (rhs.prefix_) : prefix_ (rhs.prefix_)
, result_ (openResultSet(deriveRestartPath(prefix_))) , result_ (openResultSet(deriveRestartPath(prefix_)))
, firstKeyword_(firstFileKeyword(result_.get())) , firstKeyword_(firstFileKeyword(result_.get()))
, isUnified_ (rhs.isUnified_)
{} {}
Opm::ECLRestartData::Impl::Impl(Impl&& rhs) Opm::ECLRestartData::Impl::Impl(Impl&& rhs)
: prefix_ (std::move(rhs.prefix_)) : prefix_ (std::move(rhs.prefix_))
, result_ (std::move(rhs.result_)) , result_ (std::move(rhs.result_))
, firstKeyword_(std::move(rhs.firstKeyword_)) , firstKeyword_(std::move(rhs.firstKeyword_))
, isUnified_ (rhs.isUnified_)
{} {}
bool Opm::ECLRestartData::Impl::selectReportStep(const int step) bool Opm::ECLRestartData::Impl::selectReportStep(const int step)
{ {
if (! ecl_file_has_report_step(*this, step)) { if (isUnified_ && ! ecl_file_has_report_step(*this, step)) {
return false; return false;
} }
this->gridIDCache_.reset(); this->gridIDCache_.reset();
if (auto* globView = ecl_file_get_global_view(*this)) { if (auto* globView = ecl_file_get_global_view(*this)) {
if (isUnified_) {
// Set active block view to particular report step.
// Ignore sequence numbers, dates, and simulation time. // Ignore sequence numbers, dates, and simulation time.
const auto seqnum = -1; const auto seqnum = -1;
const auto dates = static_cast<std::size_t>(-1); const auto dates = static_cast<std::size_t>(-1);
@@ -1058,7 +1068,12 @@ bool Opm::ECLRestartData::Impl::selectReportStep(const int step)
this->activeBlock_ = this->activeBlock_ =
ecl_file_view_add_restart_view(globView, seqnum, ecl_file_view_add_restart_view(globView, seqnum,
step, dates, simdays); step, dates, simdays);
} else {
// Set active block view to global.
this->activeBlock_ = globView;
}
// Update grid id cache from active view.
if (this->activeBlock_ != nullptr) { if (this->activeBlock_ != nullptr) {
this->gridIDCache_ this->gridIDCache_
.reset(new ECLImpl::GridIDCache(this->activeBlock_)); .reset(new ECLImpl::GridIDCache(this->activeBlock_));

View File

@@ -109,6 +109,10 @@ namespace Opm {
/// step. /// step.
/// ///
/// This is needed when working with dynamic restart data. /// This is needed when working with dynamic restart data.
/// If constructed from a unified restart file, this function
/// will check that the requested step is available in the
/// file. If constructed from a non-unified restart file, no
/// such check is performed.
/// ///
/// \param[in] step Report step number. /// \param[in] step Report step number.
/// ///