#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")
# 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
# 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.
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.
std::unique_ptr<ECLImpl::GridIDCache> gridIDCache_;
@ -1021,44 +1025,55 @@ Opm::ECLRestartData::Impl::Impl(Path prefix)
: prefix_ (std::move(prefix))
, result_ (openResultSet(deriveRestartPath(prefix_)))
, firstKeyword_(firstFileKeyword(result_.get()))
, isUnified_ (firstKeyword_ == "SEQNUM")
{}
Opm::ECLRestartData::Impl::Impl(std::shared_ptr<ecl_file_type> rstrt)
: prefix_ (ecl_file_get_src_file(rstrt.get()))
, result_ (std::move(rstrt))
, firstKeyword_(firstFileKeyword(result_.get()))
, isUnified_ (firstKeyword_ == "SEQNUM")
{}
Opm::ECLRestartData::Impl::Impl(const Impl& rhs)
: prefix_ (rhs.prefix_)
, result_ (openResultSet(deriveRestartPath(prefix_)))
, firstKeyword_(firstFileKeyword(result_.get()))
, isUnified_ (rhs.isUnified_)
{}
Opm::ECLRestartData::Impl::Impl(Impl&& rhs)
: prefix_ (std::move(rhs.prefix_))
, result_ (std::move(rhs.result_))
, firstKeyword_(std::move(rhs.firstKeyword_))
, isUnified_ (rhs.isUnified_)
{}
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;
}
this->gridIDCache_.reset();
if (auto* globView = ecl_file_get_global_view(*this)) {
// Ignore sequence numbers, dates, and simulation time.
const auto seqnum = -1;
const auto dates = static_cast<std::size_t>(-1);
const auto simdays = -1.0;
if (isUnified_) {
// Set active block view to particular report step.
// Ignore sequence numbers, dates, and simulation time.
const auto seqnum = -1;
const auto dates = static_cast<std::size_t>(-1);
const auto simdays = -1.0;
this->activeBlock_ =
ecl_file_view_add_restart_view(globView, seqnum,
step, dates, simdays);
this->activeBlock_ =
ecl_file_view_add_restart_view(globView, seqnum,
step, dates, simdays);
} else {
// Set active block view to global.
this->activeBlock_ = globView;
}
// Update grid id cache from active view.
if (this->activeBlock_ != nullptr) {
this->gridIDCache_
.reset(new ECLImpl::GridIDCache(this->activeBlock_));

View File

@ -109,6 +109,10 @@ namespace Opm {
/// step.
///
/// 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.
///