#1624 Update opm-flowdiagnostics-applications to c78f50897cea10ed56c7eadd1a1b23aa5ffbc56e that handles none-unified restart files

This commit is contained in:
Jacob Støren 2017-06-20 09:07:57 +02:00
parent b2a3116e8f
commit 690d86b876
3 changed files with 28 additions and 9 deletions

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.
/// ///