Move to more consistent ownership of ECL data in EclBaseVanguard

We resort to consistently use unique_ptrs in EclBaseVanguard for
the data read from ECL files or set externally. This means that
during the simulation EclBaseVanguard owns this data and not Main
or the ebos setup functions. This ownership transfer becomes
transparent due to std::move.

This came up when trying to fix the parallel runs of ebos and during
that removing some code duplication.
This commit is contained in:
Markus Blatt 2020-08-17 21:15:46 +02:00
parent 83bfd4edfc
commit 75104fd310
41 changed files with 315 additions and 227 deletions

View File

@ -89,18 +89,18 @@ std::unique_ptr<Opm::ParseContext> ebosBlackOilCreateParseContext(int argc, char
return result; return result;
} }
void ebosBlackOilSetDeck(Opm::Deck* deck, void ebosBlackOilSetDeck(std::unique_ptr<Opm::Deck> deck,
Opm::ParseContext* parseContext, std::unique_ptr<Opm::ParseContext> parseContext,
Opm::ErrorGuard* errorGuard, std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime) double externalSetupTime)
{ {
using ProblemTypeTag = Properties::TTag::EbosTypeTag; using ProblemTypeTag = Properties::TTag::EbosTypeTag;
using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>; using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(externalSetupTime); Vanguard::setExternalSetupTime(externalSetupTime);
Vanguard::setExternalParseContext(parseContext); Vanguard::setExternalParseContext(std::move(parseContext));
Vanguard::setExternalErrorGuard(errorGuard); Vanguard::setExternalErrorGuard(std::move(errorGuard));
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
} }
int ebosBlackOilMain(int argc, char **argv) int ebosBlackOilMain(int argc, char **argv)

View File

@ -40,9 +40,9 @@ bool ebosBlackOilDeckFileNameIsSet(int argc, char** argv);
std::string ebosBlackOilGetDeckFileName(int argc, char** argv); std::string ebosBlackOilGetDeckFileName(int argc, char** argv);
std::unique_ptr<Opm::ParseContext> ebosBlackOilCreateParseContext(int argc, char** argv); std::unique_ptr<Opm::ParseContext> ebosBlackOilCreateParseContext(int argc, char** argv);
void ebosBlackOilSetDeck(Opm::Deck* deck, void ebosBlackOilSetDeck(std::unique_ptr<Opm::Deck> deck,
Opm::ParseContext* parseContext, std::unique_ptr<Opm::ParseContext> parseContext,
Opm::ErrorGuard* errorGuard, std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime); double externalSetupTime);
int ebosBlackOilMain(int argc, char** argv); int ebosBlackOilMain(int argc, char** argv);

View File

@ -41,18 +41,18 @@ SET_BOOL_PROP(EbosBrineTypeTag, EnableBrine, true);
namespace Opm { namespace Opm {
void ebosBrineSetDeck(Opm::Deck* deck, void ebosBrineSetDeck(std::unique_ptr<Opm::Deck> deck,
Opm::ParseContext* parseContext, std::unique_ptr<Opm::ParseContext> parseContext,
Opm::ErrorGuard* errorGuard, std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime) double externalSetupTime)
{ {
using ProblemTypeTag = Properties::TTag::EbosBrineTypeTag; using ProblemTypeTag = Properties::TTag::EbosBrineTypeTag;
using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>; using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(externalSetupTime); Vanguard::setExternalSetupTime(externalSetupTime);
Vanguard::setExternalParseContext(parseContext); Vanguard::setExternalParseContext(std::move(parseContext));
Vanguard::setExternalErrorGuard(errorGuard); Vanguard::setExternalErrorGuard(std::move(errorGuard));
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
} }
int ebosBrineMain(int argc, char **argv) int ebosBrineMain(int argc, char **argv)

View File

@ -41,18 +41,18 @@ SET_BOOL_PROP(EbosFoamTypeTag, EnableFoam, true);
namespace Opm { namespace Opm {
void ebosFoamSetDeck(Opm::Deck* deck, void ebosFoamSetDeck(std::unique_ptr<Opm::Deck> deck,
Opm::ParseContext* parseContext, std::unique_ptr<Opm::ParseContext> parseContext,
Opm::ErrorGuard* errorGuard, std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime) double externalSetupTime)
{ {
using ProblemTypeTag = Properties::TTag::EbosFoamTypeTag; using ProblemTypeTag = Properties::TTag::EbosFoamTypeTag;
using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>; using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(externalSetupTime); Vanguard::setExternalSetupTime(externalSetupTime);
Vanguard::setExternalParseContext(parseContext); Vanguard::setExternalParseContext(std::move(parseContext));
Vanguard::setExternalErrorGuard(errorGuard); Vanguard::setExternalErrorGuard(std::move(errorGuard));
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
} }
int ebosFoamMain(int argc, char **argv) int ebosFoamMain(int argc, char **argv)

View File

@ -33,9 +33,9 @@
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp> #include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
namespace Opm { namespace Opm {
void ebosFoamSetDeck(Opm::Deck* deck, void ebosFoamSetDeck(std::unique_ptr<Opm::Deck> deck,
Opm::ParseContext* parseContext, std::unique_ptr<Opm::ParseContext> parseContext,
Opm::ErrorGuard* errorGuard, std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime); double externalSetupTime);
int ebosFoamMain(int argc, char** argv); int ebosFoamMain(int argc, char** argv);

View File

@ -57,18 +57,18 @@ public:
namespace Opm { namespace Opm {
void ebosGasOilSetDeck(Opm::Deck* deck, void ebosGasOilSetDeck(std::unique_ptr<Opm::Deck> deck,
Opm::ParseContext* parseContext, std::unique_ptr<Opm::ParseContext> parseContext,
Opm::ErrorGuard* errorGuard, std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime) double externalSetupTime)
{ {
using ProblemTypeTag = Properties::TTag::EbosGasOilTypeTag; using ProblemTypeTag = Properties::TTag::EbosGasOilTypeTag;
using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>; using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(externalSetupTime); Vanguard::setExternalSetupTime(externalSetupTime);
Vanguard::setExternalParseContext(parseContext); Vanguard::setExternalParseContext(std::move(parseContext));
Vanguard::setExternalErrorGuard(errorGuard); Vanguard::setExternalErrorGuard(std::move(errorGuard));
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
} }
int ebosGasOilMain(int argc, char **argv) int ebosGasOilMain(int argc, char **argv)

View File

@ -33,9 +33,9 @@
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp> #include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
namespace Opm { namespace Opm {
void ebosGasOilSetDeck(Opm::Deck* deck, void ebosGasOilSetDeck(std::unique_ptr<Opm::Deck> deck,
Opm::ParseContext* parseContext, std::unique_ptr<Opm::ParseContext> parseContext,
Opm::ErrorGuard* errorGuard, std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime); double externalSetupTime);
int ebosGasOilMain(int argc, char** argv); int ebosGasOilMain(int argc, char** argv);

View File

@ -57,18 +57,18 @@ public:
namespace Opm { namespace Opm {
void ebosOilWaterSetDeck(Opm::Deck* deck, void ebosOilWaterSetDeck(std::unique_ptr<Opm::Deck> deck,
Opm::ParseContext* parseContext, std::unique_ptr<Opm::ParseContext> parseContext,
Opm::ErrorGuard* errorGuard, std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime) double externalSetupTime)
{ {
using ProblemTypeTag = Properties::TTag::EbosOilWaterTypeTag; using ProblemTypeTag = Properties::TTag::EbosOilWaterTypeTag;
using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>; using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(externalSetupTime); Vanguard::setExternalSetupTime(externalSetupTime);
Vanguard::setExternalParseContext(parseContext); Vanguard::setExternalParseContext(std::move(parseContext));
Vanguard::setExternalErrorGuard(errorGuard); Vanguard::setExternalErrorGuard(std::move(errorGuard));
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
} }
int ebosOilWaterMain(int argc, char **argv) int ebosOilWaterMain(int argc, char **argv)

View File

@ -33,9 +33,9 @@
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp> #include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
namespace Opm { namespace Opm {
void ebosOilWaterSetDeck(Opm::Deck* deck, void ebosOilWaterSetDeck(std::unique_ptr<Opm::Deck> deck,
Opm::ParseContext* parseContext, std::unique_ptr<Opm::ParseContext> parseContext,
Opm::ErrorGuard* errorGuard, std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime); double externalSetupTime);
int ebosOilWaterMain(int argc, char** argv); int ebosOilWaterMain(int argc, char** argv);

View File

@ -59,18 +59,18 @@ public:
namespace Opm { namespace Opm {
void ebosOilWaterPolymerSetDeck(Opm::Deck* deck, void ebosOilWaterPolymerSetDeck(std::unique_ptr<Opm::Deck> deck,
Opm::ParseContext* parseContext, std::unique_ptr<Opm::ParseContext> parseContext,
Opm::ErrorGuard* errorGuard, std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime) double externalSetupTime)
{ {
using ProblemTypeTag = Properties::TTag::EbosOilWaterPolymerTypeTag; using ProblemTypeTag = Properties::TTag::EbosOilWaterPolymerTypeTag;
using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>; using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(externalSetupTime); Vanguard::setExternalSetupTime(externalSetupTime);
Vanguard::setExternalParseContext(parseContext); Vanguard::setExternalParseContext(std::move(parseContext));
Vanguard::setExternalErrorGuard(errorGuard); Vanguard::setExternalErrorGuard(std::move(errorGuard));
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
} }
int ebosOilWaterPolymerMain(int argc, char **argv) int ebosOilWaterPolymerMain(int argc, char **argv)

View File

@ -33,9 +33,9 @@
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp> #include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
namespace Opm { namespace Opm {
void ebosOilWaterPolymerSetDeck(Opm::Deck* deck, void ebosOilWaterPolymerSetDeck(std::unique_ptr<Opm::Deck> deck,
Opm::ParseContext* parseContext, std::unique_ptr<Opm::ParseContext> parseContext,
Opm::ErrorGuard* errorGuard, std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime); double externalSetupTime);
int ebosOilWaterPolymerMain(int argc, char** argv); int ebosOilWaterPolymerMain(int argc, char** argv);

View File

@ -41,18 +41,18 @@ SET_BOOL_PROP(EbosPolymerTypeTag, EnablePolymer, true);
namespace Opm { namespace Opm {
void ebosPolymerSetDeck(Opm::Deck* deck, void ebosPolymerSetDeck(std::unique_ptr<Opm::Deck> deck,
Opm::ParseContext* parseContext, std::unique_ptr<Opm::ParseContext> parseContext,
Opm::ErrorGuard* errorGuard, std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime) double externalSetupTime)
{ {
using ProblemTypeTag = Properties::TTag::EbosPolymerTypeTag; using ProblemTypeTag = Properties::TTag::EbosPolymerTypeTag;
using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>; using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(externalSetupTime); Vanguard::setExternalSetupTime(externalSetupTime);
Vanguard::setExternalParseContext(parseContext); Vanguard::setExternalParseContext(std::move(parseContext));
Vanguard::setExternalErrorGuard(errorGuard); Vanguard::setExternalErrorGuard(std::move(errorGuard));
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
} }
int ebosPolymerMain(int argc, char **argv) int ebosPolymerMain(int argc, char **argv)

View File

@ -33,9 +33,9 @@
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp> #include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
namespace Opm { namespace Opm {
void ebosPolymerSetDeck(Opm::Deck* deck, void ebosPolymerSetDeck(std::unique_ptr<Opm::Deck> deck,
Opm::ParseContext* parseContext, std::unique_ptr<Opm::ParseContext> parseContext,
Opm::ErrorGuard* errorGuard, std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime); double externalSetupTime);
int ebosPolymerMain(int argc, char** argv); int ebosPolymerMain(int argc, char** argv);

View File

@ -41,18 +41,18 @@ SET_BOOL_PROP(EbosSolventTypeTag, EnableSolvent, true);
namespace Opm { namespace Opm {
void ebosSolventSetDeck(Opm::Deck* deck, void ebosSolventSetDeck(std::unique_ptr<Opm::Deck> deck,
Opm::ParseContext* parseContext, std::unique_ptr<Opm::ParseContext> parseContext,
Opm::ErrorGuard* errorGuard, std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime) double externalSetupTime)
{ {
using ProblemTypeTag = Properties::TTag::EbosSolventTypeTag; using ProblemTypeTag = Properties::TTag::EbosSolventTypeTag;
using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>; using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(externalSetupTime); Vanguard::setExternalSetupTime(externalSetupTime);
Vanguard::setExternalParseContext(parseContext); Vanguard::setExternalParseContext(std::move(parseContext));
Vanguard::setExternalErrorGuard(errorGuard); Vanguard::setExternalErrorGuard(std::move(errorGuard));
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
} }
int ebosSolventMain(int argc, char **argv) int ebosSolventMain(int argc, char **argv)

View File

@ -33,9 +33,9 @@
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp> #include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
namespace Opm { namespace Opm {
void ebosSolventSetDeck(Opm::Deck* deck, void ebosSolventSetDeck(std::unique_ptr<Opm::Deck> deck,
Opm::ParseContext* parseContext, std::unique_ptr<Opm::ParseContext> parseContext,
Opm::ErrorGuard* errorGuard, std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime); double externalSetupTime);
int ebosSolventMain(int argc, char** argv); int ebosSolventMain(int argc, char** argv);

View File

@ -41,18 +41,18 @@ SET_BOOL_PROP(EbosThermalTypeTag, EnableEnergy, true);
namespace Opm { namespace Opm {
void ebosThermalSetDeck(Opm::Deck* deck, void ebosThermalSetDeck(std::unique_ptr<Opm::Deck> deck,
Opm::ParseContext* parseContext, std::unique_ptr<Opm::ParseContext> parseContext,
Opm::ErrorGuard* errorGuard, std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime) double externalSetupTime)
{ {
using ProblemTypeTag = Properties::TTag::EbosThermalTypeTag; using ProblemTypeTag = Properties::TTag::EbosThermalTypeTag;
using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>; using Vanguard = GetPropType<ProblemTypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(externalSetupTime); Vanguard::setExternalSetupTime(externalSetupTime);
Vanguard::setExternalParseContext(parseContext); Vanguard::setExternalParseContext(std::move(parseContext));
Vanguard::setExternalErrorGuard(errorGuard); Vanguard::setExternalErrorGuard(std::move(errorGuard));
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
} }
int ebosThermalMain(int argc, char **argv) int ebosThermalMain(int argc, char **argv)

View File

@ -33,9 +33,9 @@
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp> #include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
namespace Opm { namespace Opm {
void ebosThermalSetDeck(Opm::Deck* deck, void ebosThermalSetDeck(std::unique_ptr<Opm::Deck> deck,
Opm::ParseContext* parseContext, std::unique_ptr<Opm::ParseContext> parseContext,
Opm::ErrorGuard* errorGuard, std::unique_ptr<Opm::ErrorGuard> errorGuard,
double externalSetupTime); double externalSetupTime);
int ebosThermalMain(int argc, char** argv); int ebosThermalMain(int argc, char** argv);

View File

@ -223,14 +223,14 @@ public:
/*! /*!
* \brief Set the Opm::ParseContext object which ought to be used for parsing the deck and creating the Opm::EclipseState object. * \brief Set the Opm::ParseContext object which ought to be used for parsing the deck and creating the Opm::EclipseState object.
*/ */
static void setExternalParseContext(Opm::ParseContext* parseContext) static void setExternalParseContext(std::unique_ptr<Opm::ParseContext> parseContext)
{ externalParseContext_ = parseContext; } { externalParseContext_ = std::move(parseContext); }
/*! /*!
* \brief Set the Opm::ErrorGuard object which ought to be used for parsing the deck and creating the Opm::EclipseState object. * \brief Set the Opm::ErrorGuard object which ought to be used for parsing the deck and creating the Opm::EclipseState object.
*/ */
static void setExternalErrorGuard(Opm::ErrorGuard* errorGuard) static void setExternalErrorGuard(std::unique_ptr<Opm::ErrorGuard> errorGuard)
{ externalErrorGuard_ = errorGuard; } { externalErrorGuard_ = std::move(errorGuard); }
/*! /*!
* \brief Set the Opm::Deck object which ought to be used when the simulator vanguard * \brief Set the Opm::Deck object which ought to be used when the simulator vanguard
@ -242,14 +242,14 @@ public:
* management of these two objects, i.e., they are not allowed to be deleted as long * management of these two objects, i.e., they are not allowed to be deleted as long
* as the simulator vanguard object is alive. * as the simulator vanguard object is alive.
*/ */
static void setExternalDeck(Opm::Deck* deck) static void setExternalDeck(std::unique_ptr<Opm::Deck> deck)
{ externalDeck_ = deck; externalDeckSet_ = true; } { externalDeck_ = std::move(deck); externalDeckSet_ = true; }
/*! /*!
* \brief Set the Opm::EclipseState object which ought to be used when the simulator * \brief Set the Opm::EclipseState object which ought to be used when the simulator
* vanguard is instantiated. * vanguard is instantiated.
*/ */
static void setExternalEclState(Opm::EclipseState* eclState) static void setExternalEclState(std::unique_ptr<Opm::EclipseState> eclState)
{ externalEclState_ = eclState; } { externalEclState_ = std::move(eclState); }
/*! /*!
* \brief Create the grid for problem data files which use the ECL file format. * \brief Create the grid for problem data files which use the ECL file format.
@ -307,14 +307,14 @@ public:
parseContext_ = internalParseContext_.get(); parseContext_ = internalParseContext_.get();
} }
else else
parseContext_ = externalParseContext_; parseContext_ = externalParseContext_.get();
if (!externalParseContext_) { if (!externalParseContext_) {
internalErrorGuard_.reset(new Opm::ErrorGuard); internalErrorGuard_.reset(new Opm::ErrorGuard);
errorGuard_ = internalErrorGuard_.get(); errorGuard_ = internalErrorGuard_.get();
} }
else else
errorGuard_ = externalErrorGuard_; errorGuard_ = externalErrorGuard_.get();
if (!externalDeck_ && !externalDeckSet_) { if (!externalDeck_ && !externalDeckSet_) {
if (myRank == 0) if (myRank == 0)
@ -328,7 +328,7 @@ public:
Opm::checkDeck(*deck_, parser, *parseContext_, *errorGuard_); Opm::checkDeck(*deck_, parser, *parseContext_, *errorGuard_);
} }
else { else {
deck_ = externalDeck_; deck_ = externalDeck_.get();
} }
if (!externalEclState_) { if (!externalEclState_) {
@ -338,8 +338,8 @@ public:
else { else {
assert(externalEclState_); assert(externalEclState_);
deck_ = externalDeck_; deck_ = externalDeck_.get();
eclState_ = externalEclState_; eclState_ = externalEclState_.get();
} }
if (!externalEclSchedule_) { if (!externalEclSchedule_) {
@ -350,7 +350,7 @@ public:
eclSchedule_ = internalEclSchedule_.get(); eclSchedule_ = internalEclSchedule_.get();
} }
else else
eclSchedule_ = externalEclSchedule_; eclSchedule_ = externalEclSchedule_.get();
this->summaryState_.reset( new Opm::SummaryState( std::chrono::system_clock::from_time_t(this->eclSchedule_->getStartTime() ))); this->summaryState_.reset( new Opm::SummaryState( std::chrono::system_clock::from_time_t(this->eclSchedule_->getStartTime() )));
this->actionState_.reset( new Opm::Action::State() ); this->actionState_.reset( new Opm::Action::State() );
@ -367,7 +367,7 @@ public:
eclSummaryConfig_ = internalEclSummaryConfig_.get(); eclSummaryConfig_ = internalEclSummaryConfig_.get();
} }
else else
eclSummaryConfig_ = externalEclSummaryConfig_; eclSummaryConfig_ = externalEclSummaryConfig_.get();
if (*errorGuard_) { if (*errorGuard_) {
errorGuard_->dump(); errorGuard_->dump();
@ -416,8 +416,8 @@ public:
* The lifetime of this object is not managed by the vanguard, i.e., the object must * The lifetime of this object is not managed by the vanguard, i.e., the object must
* stay valid until after the vanguard gets destroyed. * stay valid until after the vanguard gets destroyed.
*/ */
static void setExternalSchedule(Opm::Schedule* schedule) static void setExternalSchedule(std::unique_ptr<Opm::Schedule> schedule)
{ externalEclSchedule_ = schedule; } { externalEclSchedule_ = std::move(schedule); }
/*! /*!
* \brief Return a reference to the object that determines which quantities ought to * \brief Return a reference to the object that determines which quantities ought to
@ -432,8 +432,8 @@ public:
* The lifetime of this object is not managed by the vanguard, i.e., the object must * The lifetime of this object is not managed by the vanguard, i.e., the object must
* stay valid until after the vanguard gets destroyed. * stay valid until after the vanguard gets destroyed.
*/ */
static void setExternalSummaryConfig(Opm::SummaryConfig* summaryConfig) static void setExternalSummaryConfig(std::unique_ptr<Opm::SummaryConfig> summaryConfig)
{ externalEclSummaryConfig_ = summaryConfig; } { externalEclSummaryConfig_ = std::move(summaryConfig); }
/*! /*!
@ -616,13 +616,13 @@ private:
static Scalar externalSetupTime_; static Scalar externalSetupTime_;
static Opm::ParseContext* externalParseContext_; static std::unique_ptr<Opm::ParseContext> externalParseContext_;
static Opm::ErrorGuard* externalErrorGuard_; static std::unique_ptr<Opm::ErrorGuard> externalErrorGuard_;
static Opm::Deck* externalDeck_; static std::unique_ptr<Opm::Deck> externalDeck_;
static bool externalDeckSet_; static bool externalDeckSet_;
static Opm::EclipseState* externalEclState_; static std::unique_ptr<Opm::EclipseState> externalEclState_;
static Opm::Schedule* externalEclSchedule_; static std::unique_ptr<Opm::Schedule> externalEclSchedule_;
static Opm::SummaryConfig* externalEclSummaryConfig_; static std::unique_ptr<Opm::SummaryConfig> externalEclSummaryConfig_;
std::unique_ptr<Opm::ParseContext> internalParseContext_; std::unique_ptr<Opm::ParseContext> internalParseContext_;
std::unique_ptr<Opm::ErrorGuard> internalErrorGuard_; std::unique_ptr<Opm::ErrorGuard> internalErrorGuard_;
@ -657,25 +657,25 @@ template <class TypeTag>
typename EclBaseVanguard<TypeTag>::Scalar EclBaseVanguard<TypeTag>::externalSetupTime_ = 0.0; typename EclBaseVanguard<TypeTag>::Scalar EclBaseVanguard<TypeTag>::externalSetupTime_ = 0.0;
template <class TypeTag> template <class TypeTag>
Opm::ParseContext* EclBaseVanguard<TypeTag>::externalParseContext_ = nullptr; std::unique_ptr<Opm::ParseContext> EclBaseVanguard<TypeTag>::externalParseContext_ = nullptr;
template <class TypeTag> template <class TypeTag>
Opm::ErrorGuard* EclBaseVanguard<TypeTag>::externalErrorGuard_ = nullptr; std::unique_ptr<Opm::ErrorGuard> EclBaseVanguard<TypeTag>::externalErrorGuard_ = nullptr;
template <class TypeTag> template <class TypeTag>
Opm::Deck* EclBaseVanguard<TypeTag>::externalDeck_ = nullptr; std::unique_ptr<Opm::Deck> EclBaseVanguard<TypeTag>::externalDeck_ = nullptr;
template <class TypeTag> template <class TypeTag>
bool EclBaseVanguard<TypeTag>::externalDeckSet_ = false; bool EclBaseVanguard<TypeTag>::externalDeckSet_ = false;
template <class TypeTag> template <class TypeTag>
Opm::EclipseState* EclBaseVanguard<TypeTag>::externalEclState_; std::unique_ptr<Opm::EclipseState> EclBaseVanguard<TypeTag>::externalEclState_;
template <class TypeTag> template <class TypeTag>
Opm::Schedule* EclBaseVanguard<TypeTag>::externalEclSchedule_ = nullptr; std::unique_ptr<Opm::Schedule> EclBaseVanguard<TypeTag>::externalEclSchedule_ = nullptr;
template <class TypeTag> template <class TypeTag>
Opm::SummaryConfig* EclBaseVanguard<TypeTag>::externalEclSummaryConfig_ = nullptr; std::unique_ptr<Opm::SummaryConfig> EclBaseVanguard<TypeTag>::externalEclSummaryConfig_ = nullptr;
} // namespace Opm } // namespace Opm

View File

@ -123,9 +123,9 @@ int main(int argc, char **argv)
if (polymerActive && oilActive && waterActive) { if (polymerActive && oilActive && waterActive) {
if (myRank == 0) if (myRank == 0)
std::cout << "Using oil-water-polymer mode" << std::endl; std::cout << "Using oil-water-polymer mode" << std::endl;
Opm::ebosOilWaterPolymerSetDeck(deck.get(), Opm::ebosOilWaterPolymerSetDeck(std::move(deck),
parseContext.get(), std::move(parseContext),
errorGuard.get(), std::move(errorGuard),
externalSetupTimer.elapsed()); externalSetupTimer.elapsed());
return Opm::ebosOilWaterPolymerMain(argc, argv); return Opm::ebosOilWaterPolymerMain(argc, argv);
} }
@ -154,9 +154,9 @@ int main(int argc, char **argv)
if (oilActive && waterActive) { if (oilActive && waterActive) {
if (myRank == 0) if (myRank == 0)
std::cout << "Using oil-water mode" << std::endl; std::cout << "Using oil-water mode" << std::endl;
Opm::ebosOilWaterSetDeck(deck.get(), Opm::ebosOilWaterSetDeck(std::move(deck),
parseContext.get(), std::move(parseContext),
errorGuard.get(), std::move(errorGuard),
externalSetupTimer.elapsed()); externalSetupTimer.elapsed());
return Opm::ebosOilWaterMain(argc, argv); return Opm::ebosOilWaterMain(argc, argv);
} }
@ -164,9 +164,9 @@ int main(int argc, char **argv)
// run ebos_gasoil // run ebos_gasoil
if (myRank == 0) if (myRank == 0)
std::cout << "Using gas-oil mode" << std::endl; std::cout << "Using gas-oil mode" << std::endl;
Opm::ebosGasOilSetDeck(deck.get(), Opm::ebosGasOilSetDeck(std::move(deck),
parseContext.get(), std::move(parseContext),
errorGuard.get(), std::move(errorGuard),
externalSetupTimer.elapsed()); externalSetupTimer.elapsed());
return Opm::ebosGasOilMain(argc, argv); return Opm::ebosGasOilMain(argc, argv);
} }
@ -202,9 +202,9 @@ int main(int argc, char **argv)
// run ebos_foam // run ebos_foam
if (myRank == 0) if (myRank == 0)
std::cout << "Using foam mode" << std::endl; std::cout << "Using foam mode" << std::endl;
Opm::ebosFoamSetDeck(deck.get(), Opm::ebosFoamSetDeck(std::move(deck),
parseContext.get(), std::move(parseContext),
errorGuard.get(), std::move(errorGuard),
externalSetupTimer.elapsed()); externalSetupTimer.elapsed());
return Opm::ebosFoamMain(argc, argv); return Opm::ebosFoamMain(argc, argv);
} }
@ -233,9 +233,9 @@ int main(int argc, char **argv)
// run ebos_polymer // run ebos_polymer
if (myRank == 0) if (myRank == 0)
std::cout << "Using polymer mode" << std::endl; std::cout << "Using polymer mode" << std::endl;
Opm::ebosPolymerSetDeck(deck.get(), Opm::ebosPolymerSetDeck(std::move(deck),
parseContext.get(), std::move(parseContext),
errorGuard.get(), std::move(errorGuard),
externalSetupTimer.elapsed()); externalSetupTimer.elapsed());
return Opm::ebosPolymerMain(argc, argv); return Opm::ebosPolymerMain(argc, argv);
} }
@ -264,9 +264,9 @@ int main(int argc, char **argv)
// run ebos_solvent // run ebos_solvent
if (myRank == 0) if (myRank == 0)
std::cout << "Using solvent mode" << std::endl; std::cout << "Using solvent mode" << std::endl;
Opm::ebosSolventSetDeck(deck.get(), Opm::ebosSolventSetDeck(std::move(deck),
parseContext.get(), std::move(parseContext),
errorGuard.get(), std::move(errorGuard),
externalSetupTimer.elapsed()); externalSetupTimer.elapsed());
return Opm::ebosSolventMain(argc, argv); return Opm::ebosSolventMain(argc, argv);
} }
@ -295,18 +295,18 @@ int main(int argc, char **argv)
// run ebos_thermal // run ebos_thermal
if (myRank == 0) if (myRank == 0)
std::cout << "Using thermal mode" << std::endl; std::cout << "Using thermal mode" << std::endl;
Opm::ebosThermalSetDeck(deck.get(), Opm::ebosThermalSetDeck(std::move(deck),
parseContext.get(), std::move(parseContext),
errorGuard.get(), std::move(errorGuard),
externalSetupTimer.elapsed()); externalSetupTimer.elapsed());
return Opm::ebosThermalMain(argc, argv); return Opm::ebosThermalMain(argc, argv);
} }
else { else {
if (myRank == 0) if (myRank == 0)
std::cout << "Using blackoil mode" << std::endl; std::cout << "Using blackoil mode" << std::endl;
Opm::ebosBlackOilSetDeck(deck.get(), Opm::ebosBlackOilSetDeck(std::move(deck),
parseContext.get(), std::move(parseContext),
errorGuard.get(), std::move(errorGuard),
externalSetupTimer.elapsed()); externalSetupTimer.elapsed());
return Opm::ebosBlackOilMain(argc, argv); return Opm::ebosBlackOilMain(argc, argv);
} }

View File

@ -34,16 +34,19 @@
namespace Opm { namespace Opm {
void flowEbosBlackoilSetDeck(double setupTime, Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig) void flowEbosBlackoilSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig)
{ {
using TypeTag = Properties::TTag::EclFlowProblem; using TypeTag = Properties::TTag::EclFlowProblem;
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>; using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(setupTime); Vanguard::setExternalSetupTime(setupTime);
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
Vanguard::setExternalEclState(&eclState); Vanguard::setExternalEclState(std::move(eclState));
Vanguard::setExternalSchedule(&schedule); Vanguard::setExternalSchedule(std::move(schedule));
Vanguard::setExternalSummaryConfig(&summaryConfig); Vanguard::setExternalSummaryConfig(std::move(summaryConfig));
} }
std::unique_ptr<Opm::FlowMainEbos<Properties::TTag::EclFlowProblem>> std::unique_ptr<Opm::FlowMainEbos<Properties::TTag::EclFlowProblem>>

View File

@ -24,7 +24,10 @@
#include <opm/simulators/flow/FlowMainEbos.hpp> #include <opm/simulators/flow/FlowMainEbos.hpp>
namespace Opm { namespace Opm {
void flowEbosBlackoilSetDeck(double setupTime, Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig); void flowEbosBlackoilSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig);
int flowEbosBlackoilMain(int argc, char** argv, bool outputCout, bool outputFiles); int flowEbosBlackoilMain(int argc, char** argv, bool outputCout, bool outputFiles);

View File

@ -36,16 +36,19 @@ SET_BOOL_PROP(EclFlowBrineProblem, EnableBrine, true);
}} }}
namespace Opm { namespace Opm {
void flowEbosBrineSetDeck(double setupTime, Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig) void flowEbosBrineSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig)
{ {
using TypeTag = Properties::TTag::EclFlowBrineProblem; using TypeTag = Properties::TTag::EclFlowBrineProblem;
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>; using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(setupTime); Vanguard::setExternalSetupTime(setupTime);
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
Vanguard::setExternalEclState(&eclState); Vanguard::setExternalEclState(std::move(eclState));
Vanguard::setExternalSchedule(&schedule); Vanguard::setExternalSchedule(std::move(schedule));
Vanguard::setExternalSummaryConfig(&summaryConfig); Vanguard::setExternalSummaryConfig(std::move(summaryConfig));
} }

View File

@ -24,7 +24,10 @@
namespace Opm { namespace Opm {
void flowEbosBrineSetDeck(double setupTime, Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig); void flowEbosBrineSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig);
int flowEbosBrineMain(int argc, char** argv, bool outputCout, bool outputFiles); int flowEbosBrineMain(int argc, char** argv, bool outputCout, bool outputFiles);
} }

View File

@ -36,16 +36,19 @@ SET_BOOL_PROP(EclFlowEnergyProblem, EnableEnergy, true);
}} }}
namespace Opm { namespace Opm {
void flowEbosEnergySetDeck(double setupTime, Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig) void flowEbosEnergySetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig)
{ {
using TypeTag = Properties::TTag::EclFlowEnergyProblem; using TypeTag = Properties::TTag::EclFlowEnergyProblem;
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>; using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(setupTime); Vanguard::setExternalSetupTime(setupTime);
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
Vanguard::setExternalEclState(&eclState); Vanguard::setExternalEclState(std::move(eclState));
Vanguard::setExternalSchedule(&schedule); Vanguard::setExternalSchedule(std::move(schedule));
Vanguard::setExternalSummaryConfig(&summaryConfig); Vanguard::setExternalSummaryConfig(std::move(summaryConfig));
} }
// ----------------- Main program ----------------- // ----------------- Main program -----------------

View File

@ -23,7 +23,10 @@
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp> #include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
namespace Opm { namespace Opm {
void flowEbosEnergySetDeck(double setupTime, Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig); void flowEbosEnergySetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig);
int flowEbosEnergyMain(int argc, char** argv, bool outputCout, bool outputFiles); int flowEbosEnergyMain(int argc, char** argv, bool outputCout, bool outputFiles);
} }

View File

@ -36,16 +36,19 @@ SET_BOOL_PROP(EclFlowFoamProblem, EnableFoam, true);
}} }}
namespace Opm { namespace Opm {
void flowEbosFoamSetDeck(double setupTime, Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig) void flowEbosFoamSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig)
{ {
using TypeTag = Properties::TTag::EclFlowFoamProblem; using TypeTag = Properties::TTag::EclFlowFoamProblem;
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>; using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(setupTime); Vanguard::setExternalSetupTime(setupTime);
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
Vanguard::setExternalEclState(&eclState); Vanguard::setExternalEclState(std::move(eclState));
Vanguard::setExternalSchedule(&schedule); Vanguard::setExternalSchedule(std::move(schedule));
Vanguard::setExternalSummaryConfig(&summaryConfig); Vanguard::setExternalSummaryConfig(std::move(summaryConfig));
} }

View File

@ -24,7 +24,10 @@
namespace Opm { namespace Opm {
void flowEbosFoamSetDeck(double setupTime, Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig); void flowEbosFoamSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig);
int flowEbosFoamMain(int argc, char** argv, bool outputCout, bool outputFiles); int flowEbosFoamMain(int argc, char** argv, bool outputCout, bool outputFiles);
} }

View File

@ -60,16 +60,19 @@ public:
}} }}
namespace Opm { namespace Opm {
void flowEbosGasOilSetDeck(double setupTime, Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig) void flowEbosGasOilSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig)
{ {
using TypeTag = Properties::TTag::EclFlowGasOilProblem; using TypeTag = Properties::TTag::EclFlowGasOilProblem;
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>; using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(setupTime); Vanguard::setExternalSetupTime(setupTime);
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
Vanguard::setExternalEclState(&eclState); Vanguard::setExternalEclState(std::move(eclState));
Vanguard::setExternalSchedule(&schedule); Vanguard::setExternalSchedule(std::move(schedule));
Vanguard::setExternalSummaryConfig(&summaryConfig); Vanguard::setExternalSummaryConfig(std::move(summaryConfig));
} }

View File

@ -23,7 +23,10 @@
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp> #include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
namespace Opm { namespace Opm {
void flowEbosGasOilSetDeck(double setupTime, Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig); void flowEbosGasOilSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig);
int flowEbosGasOilMain(int argc, char** argv, bool outputCout, bool outputFiles); int flowEbosGasOilMain(int argc, char** argv, bool outputCout, bool outputFiles);
} }

View File

@ -60,16 +60,19 @@ public:
}} }}
namespace Opm { namespace Opm {
void flowEbosOilWaterSetDeck(double setupTime, Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig) void flowEbosOilWaterSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig)
{ {
using TypeTag = Properties::TTag::EclFlowOilWaterProblem; using TypeTag = Properties::TTag::EclFlowOilWaterProblem;
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>; using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(setupTime); Vanguard::setExternalSetupTime(setupTime);
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
Vanguard::setExternalEclState(&eclState); Vanguard::setExternalEclState(std::move(eclState));
Vanguard::setExternalSchedule(&schedule); Vanguard::setExternalSchedule(std::move(schedule));
Vanguard::setExternalSummaryConfig(&summaryConfig); Vanguard::setExternalSummaryConfig(std::move(summaryConfig));
} }
// ----------------- Main program ----------------- // ----------------- Main program -----------------

View File

@ -23,7 +23,10 @@
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp> #include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
namespace Opm { namespace Opm {
void flowEbosOilWaterSetDeck(double setupTime, Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig); void flowEbosOilWaterSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig);
int flowEbosOilWaterMain(int argc, char** argv, bool outputCout, bool outputFiles); int flowEbosOilWaterMain(int argc, char** argv, bool outputCout, bool outputFiles);
} }

View File

@ -60,16 +60,19 @@ public:
}} }}
namespace Opm { namespace Opm {
void flowEbosOilWaterBrineSetDeck(double setupTime, Deck* deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig) void flowEbosOilWaterBrineSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig)
{ {
using TypeTag = Properties::TTag::EclFlowOilWaterBrineProblem; using TypeTag = Properties::TTag::EclFlowOilWaterBrineProblem;
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>; using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(setupTime); Vanguard::setExternalSetupTime(setupTime);
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
Vanguard::setExternalEclState(&eclState); Vanguard::setExternalEclState(std::move(eclState));
Vanguard::setExternalSchedule(&schedule); Vanguard::setExternalSchedule(std::move(schedule));
Vanguard::setExternalSummaryConfig(&summaryConfig); Vanguard::setExternalSummaryConfig(std::move(summaryConfig));
} }
// ----------------- Main program ----------------- // ----------------- Main program -----------------

View File

@ -23,7 +23,10 @@
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp> #include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
namespace Opm { namespace Opm {
void flowEbosOilWaterBrineSetDeck(double setupTime, Deck* deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig); void flowEbosOilWaterBrineSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig);
int flowEbosOilWaterBrineMain(int argc, char** argv, bool outputCout, bool outputFiles); int flowEbosOilWaterBrineMain(int argc, char** argv, bool outputCout, bool outputFiles);
} }

View File

@ -61,16 +61,19 @@ public:
}} }}
namespace Opm { namespace Opm {
void flowEbosOilWaterPolymerSetDeck(double setupTime, Deck* deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig) void flowEbosOilWaterPolymerSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig)
{ {
using TypeTag = Properties::TTag::EclFlowOilWaterPolymerProblem; using TypeTag = Properties::TTag::EclFlowOilWaterPolymerProblem;
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>; using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(setupTime); Vanguard::setExternalSetupTime(setupTime);
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
Vanguard::setExternalEclState(&eclState); Vanguard::setExternalEclState(std::move(eclState));
Vanguard::setExternalSchedule(&schedule); Vanguard::setExternalSchedule(std::move(schedule));
Vanguard::setExternalSummaryConfig(&summaryConfig); Vanguard::setExternalSummaryConfig(std::move(summaryConfig));
} }
// ----------------- Main program ----------------- // ----------------- Main program -----------------

View File

@ -23,7 +23,10 @@
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp> #include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
namespace Opm { namespace Opm {
void flowEbosOilWaterPolymerSetDeck(double setupTime, Deck* deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig); void flowEbosOilWaterPolymerSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig);
int flowEbosOilWaterPolymerMain(int argc, char** argv, bool outputCout, bool outputFiles); int flowEbosOilWaterPolymerMain(int argc, char** argv, bool outputCout, bool outputFiles);
} }

View File

@ -68,7 +68,7 @@ namespace Opm {
using TypeTag = Properties::TTag::EclFlowOilWaterPolymerInjectivityProblem; using TypeTag = Properties::TTag::EclFlowOilWaterPolymerInjectivityProblem;
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>; using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
Vanguard::setExternalDeck(&deck, &eclState); Vanguard::setExternalDeck(std::move(deck, &eclState));
} */ } */
// ----------------- Main program ----------------- // ----------------- Main program -----------------

View File

@ -36,16 +36,19 @@ SET_BOOL_PROP(EclFlowPolymerProblem, EnablePolymer, true);
}} }}
namespace Opm { namespace Opm {
void flowEbosPolymerSetDeck(double setupTime, Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig) void flowEbosPolymerSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig)
{ {
using TypeTag = Properties::TTag::EclFlowPolymerProblem; using TypeTag = Properties::TTag::EclFlowPolymerProblem;
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>; using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(setupTime); Vanguard::setExternalSetupTime(setupTime);
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
Vanguard::setExternalEclState(&eclState); Vanguard::setExternalEclState(std::move(eclState));
Vanguard::setExternalSchedule(&schedule); Vanguard::setExternalSchedule(std::move(schedule));
Vanguard::setExternalSummaryConfig(&summaryConfig); Vanguard::setExternalSummaryConfig(std::move(summaryConfig));
} }
// ----------------- Main program ----------------- // ----------------- Main program -----------------

View File

@ -23,7 +23,10 @@
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp> #include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
namespace Opm { namespace Opm {
void flowEbosPolymerSetDeck(double setupTime, Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig); void flowEbosPolymerSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig);
int flowEbosPolymerMain(int argc, char** argv, bool outputCout, bool outputFiles); int flowEbosPolymerMain(int argc, char** argv, bool outputCout, bool outputFiles);
} }

View File

@ -36,16 +36,19 @@ SET_BOOL_PROP(EclFlowSolventProblem, EnableSolvent, true);
}} }}
namespace Opm { namespace Opm {
void flowEbosSolventSetDeck(double setupTime, Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig) void flowEbosSolventSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig)
{ {
using TypeTag = Properties::TTag::EclFlowSolventProblem; using TypeTag = Properties::TTag::EclFlowSolventProblem;
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>; using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
Vanguard::setExternalSetupTime(setupTime); Vanguard::setExternalSetupTime(setupTime);
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
Vanguard::setExternalEclState(&eclState); Vanguard::setExternalEclState(std::move(eclState));
Vanguard::setExternalSchedule(&schedule); Vanguard::setExternalSchedule(std::move(schedule));
Vanguard::setExternalSummaryConfig(&summaryConfig); Vanguard::setExternalSummaryConfig(std::move(summaryConfig));
} }

View File

@ -24,7 +24,10 @@
namespace Opm { namespace Opm {
void flowEbosSolventSetDeck(double setupTime, Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig); void flowEbosSolventSetDeck(double setupTime, std::unique_ptr<Deck> deck,
std::unique_ptr<EclipseState> eclState,
std::unique_ptr<Schedule> schedule,
std::unique_ptr<SummaryConfig> summaryConfig);
int flowEbosSolventMain(int argc, char** argv, bool outoutCout, bool outputFiles); int flowEbosSolventMain(int argc, char** argv, bool outoutCout, bool outputFiles);
} }

View File

@ -78,13 +78,13 @@ NEW_TYPE_TAG(FlowEarlyBird, INHERITS_FROM(EclFlowProblem));
namespace Opm { namespace Opm {
template <class TypeTag> template <class TypeTag>
void flowEbosSetDeck(Deck *deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig) void flowEbosSetDeck(std::unique_ptr<Deck> deck, std::unique_ptr<EclipseState> eclState, std::unique_ptr<Schedule> schedule, std::unique_ptr<SummaryConfig> summaryConfig)
{ {
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>; using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
Vanguard::setExternalDeck(deck); Vanguard::setExternalDeck(std::move(deck));
Vanguard::setExternalEclState(&eclState); Vanguard::setExternalEclState(std::move(eclState));
Vanguard::setExternalSchedule(&schedule); Vanguard::setExternalSchedule(std::move(schedule));
Vanguard::setExternalSummaryConfig(&summaryConfig); Vanguard::setExternalSummaryConfig(std::move(summaryConfig));
} }
// ----------------- Main program ----------------- // ----------------- Main program -----------------
@ -143,16 +143,16 @@ namespace Opm
Main(int argc, Main(int argc,
char** argv, char** argv,
std::shared_ptr<Opm::Deck> deck, std::unique_ptr<Opm::Deck> deck,
std::shared_ptr<Opm::EclipseState> eclipseState, std::unique_ptr<Opm::EclipseState> eclipseState,
std::shared_ptr<Opm::Schedule> schedule, std::unique_ptr<Opm::Schedule> schedule,
std::shared_ptr<Opm::SummaryConfig> summaryConfig) std::unique_ptr<Opm::SummaryConfig> summaryConfig)
: argc_(argc) : argc_(argc)
, argv_(argv) , argv_(argv)
, deck_(deck) , deck_(std::move(deck))
, eclipseState_(eclipseState) , eclipseState_(std::move(eclipseState))
, schedule_(schedule) , schedule_(std::move(schedule))
, summaryConfig_(summaryConfig) , summaryConfig_(std::move(summaryConfig))
{ {
} }
@ -189,10 +189,10 @@ namespace Opm
// case. E.g. check that number of phases == 3 // case. E.g. check that number of phases == 3
Opm::flowEbosBlackoilSetDeck( Opm::flowEbosBlackoilSetDeck(
setupTime_, setupTime_,
deck_.get(), std::move(deck_),
*eclipseState_, std::move(eclipseState_),
*schedule_, std::move(schedule_),
*summaryConfig_); std::move(summaryConfig_));
return Opm::flowEbosBlackoilMainInit( return Opm::flowEbosBlackoilMainInit(
argc_, argv_, outputCout_, outputFiles_); argc_, argv_, outputCout_, outputFiles_);
} else { } else {
@ -216,12 +216,13 @@ namespace Opm
else if( phases.size() == 2 ) { else if( phases.size() == 2 ) {
// oil-gas // oil-gas
if (phases.active( Opm::Phase::GAS )) { if (phases.active( Opm::Phase::GAS )) {
Opm::flowEbosGasOilSetDeck(setupTime_, deck_.get(), *eclipseState_, *schedule_, *summaryConfig_); Opm::flowEbosGasOilSetDeck(setupTime_, std::move(deck_), std::move(eclipseState_),
std::move(schedule_), std::move(summaryConfig_));
return Opm::flowEbosGasOilMain(argc_, argv_, outputCout_, outputFiles_); return Opm::flowEbosGasOilMain(argc_, argv_, outputCout_, outputFiles_);
} }
// oil-water // oil-water
else if ( phases.active( Opm::Phase::WATER ) ) { else if ( phases.active( Opm::Phase::WATER ) ) {
Opm::flowEbosOilWaterSetDeck(setupTime_, deck_.get(), *eclipseState_, *schedule_, *summaryConfig_); Opm::flowEbosOilWaterSetDeck(setupTime_, std::move(deck_), std::move(eclipseState_), std::move(schedule_), std::move(summaryConfig_));
return Opm::flowEbosOilWaterMain(argc_, argv_, outputCout_, outputFiles_); return Opm::flowEbosOilWaterMain(argc_, argv_, outputCout_, outputFiles_);
} }
else { else {
@ -248,16 +249,25 @@ namespace Opm
} }
if ( phases.size() == 3 ) { // oil water polymer case if ( phases.size() == 3 ) { // oil water polymer case
Opm::flowEbosOilWaterPolymerSetDeck(setupTime_, deck_.get(), *eclipseState_, *schedule_, *summaryConfig_); Opm::flowEbosOilWaterPolymerSetDeck(setupTime_, std::move(deck_),
std::move(eclipseState_),
std::move(schedule_),
std::move(summaryConfig_));
return Opm::flowEbosOilWaterPolymerMain(argc_, argv_, outputCout_, outputFiles_); return Opm::flowEbosOilWaterPolymerMain(argc_, argv_, outputCout_, outputFiles_);
} else { } else {
Opm::flowEbosPolymerSetDeck(setupTime_, deck_.get(), *eclipseState_, *schedule_, *summaryConfig_); Opm::flowEbosPolymerSetDeck(setupTime_, std::move(deck_),
std::move(eclipseState_),
std::move(schedule_),
std::move(summaryConfig_));
return Opm::flowEbosPolymerMain(argc_, argv_, outputCout_, outputFiles_); return Opm::flowEbosPolymerMain(argc_, argv_, outputCout_, outputFiles_);
} }
} }
// Foam case // Foam case
else if ( phases.active( Opm::Phase::FOAM ) ) { else if ( phases.active( Opm::Phase::FOAM ) ) {
Opm::flowEbosFoamSetDeck(setupTime_, deck_.get(), *eclipseState_, *schedule_, *summaryConfig_); Opm::flowEbosFoamSetDeck(setupTime_, std::move(deck_),
std::move(eclipseState_),
std::move(schedule_),
std::move(summaryConfig_));
return Opm::flowEbosFoamMain(argc_, argv_, outputCout_, outputFiles_); return Opm::flowEbosFoamMain(argc_, argv_, outputCout_, outputFiles_);
} }
// Brine case // Brine case
@ -269,27 +279,42 @@ namespace Opm
return EXIT_FAILURE; return EXIT_FAILURE;
} }
if ( phases.size() == 3 ) { // oil water brine case if ( phases.size() == 3 ) { // oil water brine case
Opm::flowEbosOilWaterBrineSetDeck(setupTime_, deck_.get(), *eclipseState_, *schedule_, *summaryConfig_); Opm::flowEbosOilWaterBrineSetDeck(setupTime_, std::move(deck_),
std::move(eclipseState_),
std::move(schedule_),
std::move(summaryConfig_));
return Opm::flowEbosOilWaterBrineMain(argc_, argv_, outputCout_, outputFiles_); return Opm::flowEbosOilWaterBrineMain(argc_, argv_, outputCout_, outputFiles_);
} else { } else {
Opm::flowEbosBrineSetDeck(setupTime_, deck_.get(), *eclipseState_, *schedule_, *summaryConfig_); Opm::flowEbosBrineSetDeck(setupTime_, std::move(deck_),
std::move(eclipseState_),
std::move(schedule_),
std::move(summaryConfig_));
return Opm::flowEbosBrineMain(argc_, argv_, outputCout_, outputFiles_); return Opm::flowEbosBrineMain(argc_, argv_, outputCout_, outputFiles_);
} }
} }
// Solvent case // Solvent case
else if ( phases.active( Opm::Phase::SOLVENT ) ) { else if ( phases.active( Opm::Phase::SOLVENT ) ) {
Opm::flowEbosSolventSetDeck(setupTime_, deck_.get(), *eclipseState_, *schedule_, *summaryConfig_); Opm::flowEbosSolventSetDeck(setupTime_, std::move(deck_),
std::move(eclipseState_),
std::move(schedule_),
std::move(summaryConfig_));
return Opm::flowEbosSolventMain(argc_, argv_, outputCout_, outputFiles_); return Opm::flowEbosSolventMain(argc_, argv_, outputCout_, outputFiles_);
} }
// Energy case // Energy case
else if (eclipseState_->getSimulationConfig().isThermal()) { else if (eclipseState_->getSimulationConfig().isThermal()) {
Opm::flowEbosEnergySetDeck(setupTime_, deck_.get(), *eclipseState_, *schedule_, *summaryConfig_); Opm::flowEbosEnergySetDeck(setupTime_, std::move(deck_),
std::move(eclipseState_),
std::move(schedule_),
std::move(summaryConfig_));
return Opm::flowEbosEnergyMain(argc_, argv_, outputCout_, outputFiles_); return Opm::flowEbosEnergyMain(argc_, argv_, outputCout_, outputFiles_);
} }
#endif // FLOW_BLACKOIL_ONLY #endif // FLOW_BLACKOIL_ONLY
// Blackoil case // Blackoil case
else if( phases.size() == 3 ) { else if( phases.size() == 3 ) {
Opm::flowEbosBlackoilSetDeck(setupTime_, deck_.get(), *eclipseState_, *schedule_, *summaryConfig_); Opm::flowEbosBlackoilSetDeck(setupTime_, std::move(deck_),
std::move(eclipseState_),
std::move(schedule_),
std::move(summaryConfig_));
return Opm::flowEbosBlackoilMain(argc_, argv_, outputCout_, outputFiles_); return Opm::flowEbosBlackoilMain(argc_, argv_, outputCout_, outputFiles_);
} }
else { else {
@ -302,7 +327,10 @@ namespace Opm
template <class TypeTag> template <class TypeTag>
int dispatchStatic_() int dispatchStatic_()
{ {
Opm::flowEbosSetDeck<TypeTag>(deck_.get(), *eclipseState_, *schedule_, *summaryConfig_); Opm::flowEbosSetDeck<TypeTag>(std::move(deck_),
std::move(eclipseState_),
std::move(schedule_),
std::move(summaryConfig_));
return Opm::flowEbosMain<TypeTag>(argc_, argv_, outputCout_, outputFiles_); return Opm::flowEbosMain<TypeTag>(argc_, argv_, outputCout_, outputFiles_);
} }
@ -693,10 +721,10 @@ namespace Opm
std::string deckFilename_; std::string deckFilename_;
std::string flowProgName_; std::string flowProgName_;
char *saveArgs_[2]; char *saveArgs_[2];
std::shared_ptr<Opm::Deck> deck_; std::unique_ptr<Opm::Deck> deck_;
std::shared_ptr<Opm::EclipseState> eclipseState_; std::unique_ptr<Opm::EclipseState> eclipseState_;
std::shared_ptr<Opm::Schedule> schedule_; std::unique_ptr<Opm::Schedule> schedule_;
std::shared_ptr<Opm::SummaryConfig> summaryConfig_; std::unique_ptr<Opm::SummaryConfig> summaryConfig_;
}; };
} // namespace Opm } // namespace Opm