From ec1f136f371c5fda7308f7c95ebc63c99b73a2b2 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Fri, 27 Jan 2017 13:20:02 +0100 Subject: [PATCH] fix the build and also, do not std::move a unique_ptr. (that's a quite strange thing, semantically.) --- opm/autodiff/FlowMainEbos.hpp | 4 +++- .../SimulatorFullyImplicitBlackoilOutputEbos.cpp | 12 ++++++------ .../SimulatorFullyImplicitBlackoilOutputEbos.hpp | 11 +++++------ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/opm/autodiff/FlowMainEbos.hpp b/opm/autodiff/FlowMainEbos.hpp index e4e1e3af8..1837d2c70 100644 --- a/opm/autodiff/FlowMainEbos.hpp +++ b/opm/autodiff/FlowMainEbos.hpp @@ -556,10 +556,12 @@ namespace Opm // output_writer_ void setupOutputWriter() { + const PhaseUsage pu = Opm::phaseUsageFromDeck(deck()); output_writer_.reset(new OutputWriter(grid(), param_, eclState(), - std::move(eclIO_)); + *eclIO_, + pu)); } // Run the simulator. diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoilOutputEbos.cpp b/opm/autodiff/SimulatorFullyImplicitBlackoilOutputEbos.cpp index 6c8405ec3..8e55e6fb1 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoilOutputEbos.cpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoilOutputEbos.cpp @@ -156,7 +156,7 @@ namespace Opm bool substep) { // ECL output - if ( eclIO_ ) + if (output()) { const auto& initConfig = eclipseState_.getInitConfig(); if (initConfig.restartRequested() && ((initConfig.getRestartStep()) == (timer.currentStepNum()))) { @@ -164,11 +164,11 @@ namespace Opm } else { data::Solution combined_sol = simToSolution(state, phaseUsage_); // Get "normal" data (SWAT, PRESSURE, ...) combined_sol.insert(sol.begin(), sol.end()); // ... insert "extra" data (KR, VISC, ...) - eclIO_->writeTimeStep(timer.reportStepNum(), - substep, - timer.simulationTimeElapsed(), - combined_sol, - wellState.report(phaseUsage_)); + eclIO_.writeTimeStep(timer.reportStepNum(), + substep, + timer.simulationTimeElapsed(), + combined_sol, + wellState.report(phaseUsage_)); } } diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoilOutputEbos.hpp b/opm/autodiff/SimulatorFullyImplicitBlackoilOutputEbos.hpp index 95a8ad7df..bffcc06cb 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoilOutputEbos.hpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoilOutputEbos.hpp @@ -69,7 +69,7 @@ namespace Opm BlackoilOutputWriterEbos(const Grid& grid, const parameter::ParameterGroup& param, const EclipseState& eclipseState, - std::unique_ptr&& eclIO, + EclipseIO& eclIO, const Opm::PhaseUsage &phaseUsage); /*! @@ -159,7 +159,7 @@ namespace Opm std::ofstream backupfile_; Opm::PhaseUsage phaseUsage_; - std::unique_ptr eclIO_; + EclipseIO& eclIO_; const EclipseState& eclipseState_; std::unique_ptr< ThreadHandle > asyncOutput_; @@ -177,7 +177,7 @@ namespace Opm BlackoilOutputWriterEbos(const Grid& grid, const parameter::ParameterGroup& param, const Opm::EclipseState& eclipseState, - std::unique_ptr&& eclIO, + EclipseIO& eclIO, const Opm::PhaseUsage &phaseUsage) : output_( param.getDefault("output", true) ), parallelOutput_( output_ ? new ParallelDebugOutput< Grid >( grid, eclipseState, phaseUsage.num_phases, phaseUsage ) : 0 ), @@ -185,13 +185,12 @@ namespace Opm output_interval_( output_ ? param.getDefault("output_interval", 1): 0 ), lastBackupReportStep_( -1 ), phaseUsage_( phaseUsage ), + eclIO_(eclIO), eclipseState_(eclipseState), asyncOutput_() { // For output. if (output_ && parallelOutput_->isIORank() ) { - eclIO_ = std::move(eclIO); - // Ensure that output dir exists boost::filesystem::path fpath(outputDir_); try { @@ -262,7 +261,7 @@ namespace Opm const Wells* wells = wellsmanager.c_wells(); wellstate.resize(wells, simulatorstate, phaseusage ); //Resize for restart step - auto state = eclIO_->loadRestart(solution_keys); + auto state = eclIO_.loadRestart(solution_keys); solutionToSim( state.first, phaseusage, simulatorstate ); wellsToState( state.second, phaseusage, wellstate ); }