mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #1541 from akva2/avoid_deck_assignment
changed: avoid use of the assignment operator for the Deck class
This commit is contained in:
commit
63e6e88f50
@ -95,7 +95,7 @@ try
|
|||||||
boost::scoped_ptr<RockCompressibility> rock_comp;
|
boost::scoped_ptr<RockCompressibility> rock_comp;
|
||||||
std::unique_ptr<PolymerBlackoilState> state;
|
std::unique_ptr<PolymerBlackoilState> state;
|
||||||
Opm::PolymerProperties poly_props;
|
Opm::PolymerProperties poly_props;
|
||||||
Opm::Deck deck;
|
std::unique_ptr<Opm::Deck> deck;
|
||||||
std::unique_ptr< EclipseState > eclipseState;
|
std::unique_ptr< EclipseState > eclipseState;
|
||||||
std::unique_ptr< Schedule> schedule;
|
std::unique_ptr< Schedule> schedule;
|
||||||
// bool check_well_controls = false;
|
// bool check_well_controls = false;
|
||||||
@ -105,16 +105,16 @@ try
|
|||||||
std::string deck_filename = param.get<std::string>("deck_filename");
|
std::string deck_filename = param.get<std::string>("deck_filename");
|
||||||
Parser parser;
|
Parser parser;
|
||||||
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }});
|
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }});
|
||||||
deck = parser.parseFile(deck_filename , parseContext);
|
deck.reset(new Deck(parser.parseFile(deck_filename , parseContext)));
|
||||||
eclipseState.reset( new EclipseState(deck , parseContext) );
|
eclipseState.reset( new EclipseState(*deck , parseContext) );
|
||||||
schedule.reset( new Schedule(deck, eclipseState->getInputGrid(), eclipseState->get3DProperties(), eclipseState->runspec().phases(), parseContext ));
|
schedule.reset( new Schedule(*deck, eclipseState->getInputGrid(), eclipseState->get3DProperties(), eclipseState->runspec().phases(), parseContext ));
|
||||||
// Grid init
|
// Grid init
|
||||||
grid.reset(new GridManager(eclipseState->getInputGrid()));
|
grid.reset(new GridManager(eclipseState->getInputGrid()));
|
||||||
{
|
{
|
||||||
const UnstructuredGrid& ug_grid = *(grid->c_grid());
|
const UnstructuredGrid& ug_grid = *(grid->c_grid());
|
||||||
|
|
||||||
// Rock and fluid init
|
// Rock and fluid init
|
||||||
props.reset(new BlackoilPropertiesFromDeck(deck, *eclipseState, ug_grid));
|
props.reset(new BlackoilPropertiesFromDeck(*deck, *eclipseState, ug_grid));
|
||||||
// check_well_controls = param.getDefault("check_well_controls", false);
|
// check_well_controls = param.getDefault("check_well_controls", false);
|
||||||
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
|
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
|
||||||
|
|
||||||
@ -122,16 +122,16 @@ try
|
|||||||
// Rock compressibility.
|
// Rock compressibility.
|
||||||
rock_comp.reset(new RockCompressibility(*eclipseState));
|
rock_comp.reset(new RockCompressibility(*eclipseState));
|
||||||
// Gravity.
|
// Gravity.
|
||||||
gravity[2] = deck.hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
|
gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
|
||||||
// Init state variables (saturation and pressure).
|
// Init state variables (saturation and pressure).
|
||||||
if (param.has("init_saturation")) {
|
if (param.has("init_saturation")) {
|
||||||
initStateBasic(ug_grid, *props, param, gravity[2], *state);
|
initStateBasic(ug_grid, *props, param, gravity[2], *state);
|
||||||
} else {
|
} else {
|
||||||
initStateFromDeck(ug_grid, *props, deck, gravity[2], *state);
|
initStateFromDeck(ug_grid, *props, *deck, gravity[2], *state);
|
||||||
}
|
}
|
||||||
initBlackoilSurfvol(ug_grid, *props, *state);
|
initBlackoilSurfvol(ug_grid, *props, *state);
|
||||||
// Init polymer properties.
|
// Init polymer properties.
|
||||||
poly_props.readFromDeck(deck, *eclipseState);
|
poly_props.readFromDeck(*deck, *eclipseState);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Grid init.
|
// Grid init.
|
||||||
@ -262,12 +262,12 @@ try
|
|||||||
// With a deck, we may have more epochs etc.
|
// With a deck, we may have more epochs etc.
|
||||||
WellState well_state;
|
WellState well_state;
|
||||||
int step = 0;
|
int step = 0;
|
||||||
Opm::TimeMap timeMap(deck);
|
Opm::TimeMap timeMap(*deck);
|
||||||
SimulatorTimer simtimer;
|
SimulatorTimer simtimer;
|
||||||
simtimer.init(timeMap);
|
simtimer.init(timeMap);
|
||||||
// Check for WPOLYMER presence in last report step to decide
|
// Check for WPOLYMER presence in last report step to decide
|
||||||
// polymer injection control type.
|
// polymer injection control type.
|
||||||
const bool use_wpolymer = deck.hasKeyword("WPOLYMER");
|
const bool use_wpolymer = deck->hasKeyword("WPOLYMER");
|
||||||
if (use_wpolymer) {
|
if (use_wpolymer) {
|
||||||
if (param.has("poly_start_days")) {
|
if (param.has("poly_start_days")) {
|
||||||
OPM_MESSAGE("Warning: Using WPOLYMER to control injection since it was found in deck. "
|
OPM_MESSAGE("Warning: Using WPOLYMER to control injection since it was found in deck. "
|
||||||
@ -283,7 +283,7 @@ try
|
|||||||
<< simtimer.numSteps() - step << ")\n\n" << std::flush;
|
<< simtimer.numSteps() - step << ")\n\n" << std::flush;
|
||||||
|
|
||||||
// Create new wells, polymer inflow controls.
|
// Create new wells, polymer inflow controls.
|
||||||
eclipseState.reset( new EclipseState( deck ) );
|
eclipseState.reset( new EclipseState( *deck ) );
|
||||||
WellsManager wells(*eclipseState , *schedule, reportStepIdx , *grid->c_grid());
|
WellsManager wells(*eclipseState , *schedule, reportStepIdx , *grid->c_grid());
|
||||||
boost::scoped_ptr<PolymerInflowInterface> polymer_inflow;
|
boost::scoped_ptr<PolymerInflowInterface> polymer_inflow;
|
||||||
if (use_wpolymer) {
|
if (use_wpolymer) {
|
||||||
|
@ -90,7 +90,7 @@ try
|
|||||||
|
|
||||||
// If we have a "deck_filename", grid and props will be read from that.
|
// If we have a "deck_filename", grid and props will be read from that.
|
||||||
bool use_deck = param.has("deck_filename");
|
bool use_deck = param.has("deck_filename");
|
||||||
Deck deck;
|
std::unique_ptr<Deck> deck;
|
||||||
boost::scoped_ptr<GridManager> grid;
|
boost::scoped_ptr<GridManager> grid;
|
||||||
boost::scoped_ptr<IncompPropertiesInterface> props;
|
boost::scoped_ptr<IncompPropertiesInterface> props;
|
||||||
boost::scoped_ptr<RockCompressibility> rock_comp;
|
boost::scoped_ptr<RockCompressibility> rock_comp;
|
||||||
@ -105,16 +105,16 @@ try
|
|||||||
std::string deck_filename = param.get<std::string>("deck_filename");
|
std::string deck_filename = param.get<std::string>("deck_filename");
|
||||||
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }});
|
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }});
|
||||||
Parser parser;
|
Parser parser;
|
||||||
deck = parser.parseFile(deck_filename , parseContext);
|
deck.reset(new Deck(parser.parseFile(deck_filename , parseContext)));
|
||||||
|
|
||||||
eclipseState.reset(new Opm::EclipseState(deck , parseContext));
|
eclipseState.reset(new Opm::EclipseState(*deck , parseContext));
|
||||||
schedule.reset( new Opm::Schedule(deck, eclipseState->getInputGrid(), eclipseState->get3DProperties(), eclipseState->runspec().phases(), parseContext));
|
schedule.reset( new Opm::Schedule(*deck, eclipseState->getInputGrid(), eclipseState->get3DProperties(), eclipseState->runspec().phases(), parseContext));
|
||||||
// Grid init
|
// Grid init
|
||||||
grid.reset(new GridManager(eclipseState->getInputGrid()));
|
grid.reset(new GridManager(eclipseState->getInputGrid()));
|
||||||
{
|
{
|
||||||
const UnstructuredGrid& ug_grid = *(grid->c_grid());
|
const UnstructuredGrid& ug_grid = *(grid->c_grid());
|
||||||
// Rock and fluid init
|
// Rock and fluid init
|
||||||
props.reset(new IncompPropertiesFromDeck(deck, *eclipseState, ug_grid ));
|
props.reset(new IncompPropertiesFromDeck(*deck, *eclipseState, ug_grid ));
|
||||||
// check_well_controls = param.getDefault("check_well_controls", false);
|
// check_well_controls = param.getDefault("check_well_controls", false);
|
||||||
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
|
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
|
||||||
state.reset( new PolymerState( UgGridHelpers::numCells( ug_grid ) , UgGridHelpers::numFaces( ug_grid ), 2));
|
state.reset( new PolymerState( UgGridHelpers::numCells( ug_grid ) , UgGridHelpers::numFaces( ug_grid ), 2));
|
||||||
@ -122,15 +122,15 @@ try
|
|||||||
// Rock compressibility.
|
// Rock compressibility.
|
||||||
rock_comp.reset(new RockCompressibility(*eclipseState));
|
rock_comp.reset(new RockCompressibility(*eclipseState));
|
||||||
// Gravity.
|
// Gravity.
|
||||||
gravity[2] = deck.hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
|
gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
|
||||||
// Init state variables (saturation and pressure).
|
// Init state variables (saturation and pressure).
|
||||||
if (param.has("init_saturation")) {
|
if (param.has("init_saturation")) {
|
||||||
initStateBasic(ug_grid, *props, param, gravity[2], *state);
|
initStateBasic(ug_grid, *props, param, gravity[2], *state);
|
||||||
} else {
|
} else {
|
||||||
initStateFromDeck(ug_grid, *props, deck, gravity[2], *state);
|
initStateFromDeck(ug_grid, *props, *deck, gravity[2], *state);
|
||||||
}
|
}
|
||||||
// Init polymer properties.
|
// Init polymer properties.
|
||||||
poly_props.readFromDeck(deck, *eclipseState);
|
poly_props.readFromDeck(*deck, *eclipseState);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Grid init.
|
// Grid init.
|
||||||
@ -302,7 +302,7 @@ try
|
|||||||
simtimer.init(timeMap);
|
simtimer.init(timeMap);
|
||||||
// Check for WPOLYMER presence in last epoch to decide
|
// Check for WPOLYMER presence in last epoch to decide
|
||||||
// polymer injection control type.
|
// polymer injection control type.
|
||||||
const bool use_wpolymer = deck.hasKeyword("WPOLYMER");
|
const bool use_wpolymer = deck->hasKeyword("WPOLYMER");
|
||||||
if (use_wpolymer) {
|
if (use_wpolymer) {
|
||||||
if (param.has("poly_start_days")) {
|
if (param.has("poly_start_days")) {
|
||||||
OPM_MESSAGE("Warning: Using WPOLYMER to control injection since it was found in deck. "
|
OPM_MESSAGE("Warning: Using WPOLYMER to control injection since it was found in deck. "
|
||||||
|
Loading…
Reference in New Issue
Block a user