Update to shared_ptr-less parser interface.

This commit is contained in:
Jørgen Kvalsvik 2016-10-13 16:03:35 +02:00
parent 518c9849ff
commit 1057e6d3d0
58 changed files with 442 additions and 455 deletions

View File

@ -88,11 +88,11 @@ try
std::cout << "--------------- Reading parameters ---------------" << std::endl;
const std::string deck_filename = param.get<std::string>("deck_filename");
Opm::ParseContext parseContext;
Opm::ParserPtr parser(new Opm::Parser() );
Opm::DeckConstPtr deck = parser->parseFile(deck_filename , parseContext);
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext));
Opm::Parser parser;
const Opm::Deck& deck = parser.parseFile(deck_filename , parseContext);
const Opm::EclipseState eclipseState(deck, parseContext);
const double grav = param.getDefault("gravity", unit::gravity);
GridManager gm(*eclipseState->getInputGrid());
GridManager gm(eclipseState.getInputGrid());
const UnstructuredGrid& grid = *gm.c_grid();
BlackoilPropertiesFromDeck props(deck, eclipseState, grid, param);
warnIfUnusedParams(param);

View File

@ -173,11 +173,11 @@ try
std::string deck_filename = param.get<std::string>("deck_filename");
Parser parser;
ParseContext parseContext;
DeckConstPtr deck = parser.parseFile(deck_filename , parseContext);
EclipseStateConstPtr eclipseState = std::make_shared<EclipseState>(*deck , parseContext);
const Deck& deck = parser.parseFile(deck_filename , parseContext);
EclipseState eclipseState(deck , parseContext);
// Grid init
GridManager grid_manager(*eclipseState->getInputGrid());
GridManager grid_manager(eclipseState.getInputGrid());
const UnstructuredGrid& grid = *grid_manager.c_grid();
// Rock and fluid init
IncompPropertiesSinglePhase props(deck, eclipseState, grid);

View File

@ -65,8 +65,7 @@ try
exit(1);
}
const char* eclipseFilename = argv[1];
EclipseStateConstPtr eclState;
ParserPtr parser(new Opm::Parser);
Parser parser;
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE },
{ ParseContext::PARSE_UNKNOWN_KEYWORD, InputError::IGNORE},
{ ParseContext::PARSE_RANDOM_TEXT, InputError::IGNORE},
@ -75,10 +74,10 @@ try
{ ParseContext::UNSUPPORTED_INITIAL_THPRES, InputError::IGNORE},
{ ParseContext::INTERNAL_ERROR_UNINITIALIZED_THPRES, InputError::IGNORE}
});
Opm::DeckConstPtr deck(parser->parseFile(eclipseFilename, parseContext));
eclState.reset(new EclipseState(*deck, parseContext));
Opm::Deck deck = parser.parseFile(eclipseFilename, parseContext);
Opm::EclipseState eclState( deck, parseContext );
GridManager gm(*eclState->getInputGrid());
GridManager gm(eclState.getInputGrid());
const UnstructuredGrid& grid = *gm.c_grid();
using boost::filesystem::path;
path fpath(eclipseFilename);

View File

@ -86,13 +86,13 @@ void printKeywordValues(std::ofstream& out, std::string keyword, std::vector<T>
}
// forward declaration
std::vector<double> getMapaxesValues(Opm::DeckConstPtr deck);
std::vector<double> getMapaxesValues(const Opm::Deck& deck);
/// Mirror keyword MAPAXES in deck
void mirror_mapaxes( std::shared_ptr< const Opm::Deck > deck, std::string direction, std::ofstream& out) {
void mirror_mapaxes( const Opm::Deck& deck, std::string direction, std::ofstream& out) {
// Assumes axis aligned with x/y-direction
std::cout << "Warning: Keyword MAPAXES not fully understood. Result should be verified manually." << std::endl;
if (deck->hasKeyword("MAPAXES")) {
if (deck.hasKeyword("MAPAXES")) {
std::vector<double> mapaxes = getMapaxesValues(deck);
std::vector<double> mapaxes_mirrored = mapaxes;
// Double the length of the coordinate axis
@ -107,9 +107,9 @@ void mirror_mapaxes( std::shared_ptr< const Opm::Deck > deck, std::string direct
}
/// Mirror keyword SPECGRID in deck
void mirror_specgrid(std::shared_ptr< const Opm::Deck > deck, std::string direction, std::ofstream& out) {
void mirror_specgrid( const Opm::Deck& deck, std::string direction, std::ofstream& out) {
// We only need to multiply the dimension by 2 in the correct direction.
const auto& specgridRecord = deck->getKeyword("SPECGRID").getRecord(0);
const auto& specgridRecord = deck.getKeyword("SPECGRID").getRecord(0);
std::vector<int> dimensions(3);
dimensions[0] = specgridRecord.getItem("NX").get< int >(0);
dimensions[1] = specgridRecord.getItem("NY").get< int >(0);
@ -124,14 +124,14 @@ void mirror_specgrid(std::shared_ptr< const Opm::Deck > deck, std::string direct
}
/// Mirror keyword COORD in deck
void mirror_coord(std::shared_ptr< const Opm::Deck > deck, std::string direction, std::ofstream& out) {
void mirror_coord(const Opm::Deck& deck, std::string direction, std::ofstream& out) {
// We assume uniform spacing in x and y directions and parallel top and bottom faces
const auto& specgridRecord = deck->getKeyword("SPECGRID").getRecord(0);
const auto& specgridRecord = deck.getKeyword("SPECGRID").getRecord(0);
std::vector<int> dimensions(3);
dimensions[0] = specgridRecord.getItem("NX").get< int >(0);
dimensions[1] = specgridRecord.getItem("NY").get< int >(0);
dimensions[2] = specgridRecord.getItem("NZ").get< int >(0);
std::vector<double> coord = deck->getKeyword("COORD").getRawDoubleData();
std::vector<double> coord = deck.getKeyword("COORD").getRawDoubleData();
const int entries_per_pillar = 6;
std::vector<double> coord_mirrored;
// Handle the two directions differently due to ordering of the pillars.
@ -190,13 +190,13 @@ void mirror_coord(std::shared_ptr< const Opm::Deck > deck, std::string direction
}
/// Mirror keyword ZCORN in deck
void mirror_zcorn(std::shared_ptr< const Opm::Deck > deck, std::string direction, std::ofstream& out) {
const auto& specgridRecord = deck->getKeyword("SPECGRID").getRecord(0);
void mirror_zcorn(const Opm::Deck& deck, std::string direction, std::ofstream& out) {
const auto& specgridRecord = deck.getKeyword("SPECGRID").getRecord(0);
std::vector<int> dimensions(3);
dimensions[0] = specgridRecord.getItem("NX").get< int >(0);
dimensions[1] = specgridRecord.getItem("NY").get< int >(0);
dimensions[2] = specgridRecord.getItem("NZ").get< int >(0);
std::vector<double> zcorn = deck->getKeyword("ZCORN").getRawDoubleData();
std::vector<double> zcorn = deck.getKeyword("ZCORN").getRawDoubleData();
std::vector<double> zcorn_mirrored;
// Handle the two directions differently due to ordering of the pillars.
if (direction == "x") {
@ -257,17 +257,17 @@ void mirror_zcorn(std::shared_ptr< const Opm::Deck > deck, std::string direction
printKeywordValues(out, "ZCORN", zcorn_mirrored, 8);
}
std::vector<int> getKeywordValues(std::string keyword, std::shared_ptr< const Opm::Deck > deck, int /*dummy*/) {
return deck->getKeyword(keyword).getIntData();
std::vector<int> getKeywordValues(std::string keyword, const Opm::Deck& deck, int /*dummy*/) {
return deck.getKeyword(keyword).getIntData();
}
std::vector<double> getKeywordValues(std::string keyword, std::shared_ptr< const Opm::Deck > deck, double /*dummy*/) {
return deck->getKeyword(keyword).getRawDoubleData();
std::vector<double> getKeywordValues(std::string keyword, const Opm::Deck& deck, double /*dummy*/) {
return deck.getKeyword(keyword).getRawDoubleData();
}
std::vector<double> getMapaxesValues(Opm::DeckConstPtr deck)
std::vector<double> getMapaxesValues(const Opm::Deck& deck)
{
const auto& mapaxesRecord = deck->getKeyword("MAPAXES").getRecord(0);
const auto& mapaxesRecord = deck.getKeyword("MAPAXES").getRecord(0);
std::vector<double> result;
for (size_t itemIdx = 0; itemIdx < mapaxesRecord.size(); ++itemIdx) {
const auto& curItem = mapaxesRecord.getItem(itemIdx);
@ -281,13 +281,13 @@ std::vector<double> getMapaxesValues(Opm::DeckConstPtr deck)
/// Mirror keywords that have one value for each cell
template <class T>
void mirror_celldata(std::string keyword, Opm::DeckConstPtr deck, std::string direction, std::ofstream& out) {
if ( ! deck->hasKeyword(keyword)) {
void mirror_celldata(std::string keyword, const Opm::Deck& deck, std::string direction, std::ofstream& out) {
if ( ! deck.hasKeyword(keyword)) {
std::cout << "Ignoring keyword " << keyword << " as it was not found." << std::endl;
return;
}
// Get data from eclipse deck
const auto& specgridRecord = deck->getKeyword("SPECGRID").getRecord(0);
const auto& specgridRecord = deck.getKeyword("SPECGRID").getRecord(0);
std::vector<int> dimensions(3);
dimensions[0] = specgridRecord.getItem("NX").get< int >(0);
dimensions[1] = specgridRecord.getItem("NY").get< int >(0);
@ -365,10 +365,10 @@ int main(int argc, char** argv)
// Parse grdecl file
std::cout << "Parsing grid file '" << eclipsefilename << "' ..." << std::endl;
Opm::ParserPtr parser(new Opm::Parser);
Opm::Parser parser;
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck(parser->parseFile(eclipsefilename , parseContext));
if ( ! (deck->hasKeyword("SPECGRID") && deck->hasKeyword("COORD") && deck->hasKeyword("ZCORN")) ) {
const Opm::Deck deck(parser.parseFile(eclipsefilename , parseContext));
if ( ! (deck.hasKeyword("SPECGRID") && deck.hasKeyword("COORD") && deck.hasKeyword("ZCORN")) ) {
std::cerr << "Grid file " << eclipsefilename << "are missing keywords SPECGRID, COORD or ZCORN!" << std::endl;
exit(1);
}

View File

@ -36,13 +36,13 @@ try
// Read input file
ParseContext parseContext;
Opm::ParserPtr parser(new Opm::Parser());
Opm::DeckConstPtr deck = parser->parseFile(file_name , parseContext);
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
Opm::Parser parser;
Opm::Deck deck = parser.parseFile(file_name , parseContext);
Opm::EclipseState eclipseState(deck , parseContext);
std::cout << "Done!" << std::endl;
// Setup grid
GridManager grid(*eclipseState->getInputGrid());
GridManager grid(eclipseState.getInputGrid());
// Define rock and fluid properties
IncompPropertiesFromDeck incomp_properties(deck, eclipseState, *grid.c_grid());

View File

@ -48,7 +48,7 @@ creation and destruction of an UnstructuredGrid. The method
Opm::GridManager::c_grid() provides access to the underlying
UnstructuredGrid structure. This class also provides an easy way
to initialize a grid from an ECLIPSE-format input deck, via the
constructor taking an Opm::DeckConstPtr.
constructor taking an const Opm::Deck.
<h3>Well handling</h3>

View File

@ -174,24 +174,24 @@ namespace Opm
}
void GridManager::createGrdecl(Opm::DeckConstPtr deck, struct grdecl &grdecl)
void GridManager::createGrdecl(const Opm::Deck& deck, struct grdecl &grdecl)
{
// Extract data from deck.
const std::vector<double>& zcorn = deck->getKeyword("ZCORN").getSIDoubleData();
const std::vector<double>& coord = deck->getKeyword("COORD").getSIDoubleData();
const std::vector<double>& zcorn = deck.getKeyword("ZCORN").getSIDoubleData();
const std::vector<double>& coord = deck.getKeyword("COORD").getSIDoubleData();
const int* actnum = NULL;
if (deck->hasKeyword("ACTNUM")) {
actnum = &(deck->getKeyword("ACTNUM").getIntData()[0]);
if (deck.hasKeyword("ACTNUM")) {
actnum = &(deck.getKeyword("ACTNUM").getIntData()[0]);
}
std::array<int, 3> dims;
if (deck->hasKeyword("DIMENS")) {
const auto& dimensKeyword = deck->getKeyword("DIMENS");
if (deck.hasKeyword("DIMENS")) {
const auto& dimensKeyword = deck.getKeyword("DIMENS");
dims[0] = dimensKeyword.getRecord(0).getItem(0).get< int >(0);
dims[1] = dimensKeyword.getRecord(0).getItem(1).get< int >(0);
dims[2] = dimensKeyword.getRecord(0).getItem(2).get< int >(0);
} else if (deck->hasKeyword("SPECGRID")) {
const auto& specgridKeyword = deck->getKeyword("SPECGRID");
} else if (deck.hasKeyword("SPECGRID")) {
const auto& specgridKeyword = deck.getKeyword("SPECGRID");
dims[0] = specgridKeyword.getRecord(0).getItem(0).get< int >(0);
dims[1] = specgridKeyword.getRecord(0).getItem(1).get< int >(0);
dims[2] = specgridKeyword.getRecord(0).getItem(2).get< int >(0);
@ -208,8 +208,8 @@ namespace Opm
grdecl.dims[1] = dims[1];
grdecl.dims[2] = dims[2];
if (deck->hasKeyword("MAPAXES")) {
const auto& mapaxesKeyword = deck->getKeyword("MAPAXES");
if (deck.hasKeyword("MAPAXES")) {
const auto& mapaxesKeyword = deck.getKeyword("MAPAXES");
const auto& mapaxesRecord = mapaxesKeyword.getRecord(0);
// memleak alert: here we need to make sure that C code

View File

@ -78,7 +78,7 @@ namespace Opm
/// to make it clear that we are returning a C-compatible struct.
const UnstructuredGrid* c_grid() const;
static void createGrdecl(Opm::DeckConstPtr deck, struct grdecl &grdecl);
static void createGrdecl(const Opm::Deck& deck, struct grdecl &grdecl);
private:
// Disable copying and assignment.

View File

@ -29,8 +29,8 @@
namespace Opm
{
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
const UnstructuredGrid& grid,
bool init_rock)
{
@ -44,8 +44,8 @@ namespace Opm
init_rock);
}
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
const UnstructuredGrid& grid,
const parameter::ParameterGroup& param,
bool init_rock)
@ -59,8 +59,8 @@ namespace Opm
init(deck, eclState, materialLawManager, grid.number_of_cells, grid.global_cell, grid.cartdims, param, init_rock);
}
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
int number_of_cells,
const int* global_cell,
const int* cart_dims,
@ -76,8 +76,8 @@ namespace Opm
init_rock);
}
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
int number_of_cells,
const int* global_cell,
const int* cart_dims,
@ -100,8 +100,8 @@ namespace Opm
init_rock);
}
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
std::shared_ptr<MaterialLawManager> materialLawManager,
int number_of_cells,
const int* global_cell,
@ -119,8 +119,8 @@ namespace Opm
init_rock);
}
inline void BlackoilPropertiesFromDeck::init(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
inline void BlackoilPropertiesFromDeck::init(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
std::shared_ptr<MaterialLawManager> materialLawManager,
int number_of_cells,
const int* global_cell,
@ -145,8 +145,8 @@ namespace Opm
satprops_.reset(ptr);
}
inline void BlackoilPropertiesFromDeck::init(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
inline void BlackoilPropertiesFromDeck::init(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
std::shared_ptr<MaterialLawManager> materialLawManager,
int number_of_cells,
const int* global_cell,
@ -170,7 +170,7 @@ namespace Opm
// Unfortunate lack of pointer smartness here...
std::string threephase_model = param.getDefault<std::string>("threephase_model", "gwseg");
if (deck->hasKeyword("ENDSCALE") && threephase_model != "gwseg") {
if (deck.hasKeyword("ENDSCALE") && threephase_model != "gwseg") {
OPM_THROW(std::runtime_error, "Sorry, end point scaling currently available for the 'gwseg' model only.");
}
@ -690,17 +690,17 @@ namespace Opm
return &surfaceDensities_[pvtRegionIdx*pu.num_phases];
}
void BlackoilPropertiesFromDeck::initSurfaceDensities_(Opm::DeckConstPtr deck)
void BlackoilPropertiesFromDeck::initSurfaceDensities_(const Opm::Deck& deck)
{
const auto& pu = phaseUsage();
int np = pu.num_phases;
int numPvtRegions = 1;
if (deck->hasKeyword("TABDIMS")) {
const auto& tabdimsKeyword = deck->getKeyword("TABDIMS");
if (deck.hasKeyword("TABDIMS")) {
const auto& tabdimsKeyword = deck.getKeyword("TABDIMS");
numPvtRegions = tabdimsKeyword.getRecord(0).getItem("NTPVT").template get<int>(0);
}
const auto& densityKeyword = deck->getKeyword("DENSITY");
const auto& densityKeyword = deck.getKeyword("DENSITY");
surfaceDensities_.resize(np*numPvtRegions);
for (int pvtRegionIdx = 0; pvtRegionIdx < numPvtRegions; ++pvtRegionIdx) {

View File

@ -50,8 +50,8 @@ namespace Opm
/// \param[in] grid Grid to which property object applies, needed for the
/// mapping from cell indices (typically from a processed grid)
/// to logical cartesian indices consistent with the deck.
BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropertiesFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
const UnstructuredGrid& grid, bool init_rock=true );
/// Initialize from deck, grid and parameters.
@ -65,29 +65,29 @@ namespace Opm
/// threephase_model("simple") three-phase relperm model (accepts "simple" and "stone2").
/// For both size parameters, a 0 or negative value indicates that no spline fitting is to
/// be done, and the input fluid data used directly for linear interpolation.
BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropertiesFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
const UnstructuredGrid& grid,
const parameter::ParameterGroup& param,
bool init_rock=true);
BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropertiesFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
int number_of_cells,
const int* global_cell,
const int* cart_dims,
bool init_rock=true);
BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropertiesFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
int number_of_cells,
const int* global_cell,
const int* cart_dims,
const parameter::ParameterGroup& param,
bool init_rock=true);
BlackoilPropertiesFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropertiesFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
std::shared_ptr<MaterialLawManager> materialLawManager,
int number_of_cells,
const int* global_cell,
@ -258,7 +258,7 @@ namespace Opm
return pvtTableIdx[cellIdx];
}
void initSurfaceDensities_(Opm::DeckConstPtr deck);
void initSurfaceDensities_(const Opm::Deck& deck);
void compute_B_(const int n,
const double* p,
@ -290,16 +290,16 @@ namespace Opm
double* R,
double* dRdp) const;
void init(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
void init(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
std::shared_ptr<MaterialLawManager> materialLawManager,
int number_of_cells,
const int* global_cell,
const int* cart_dims,
bool init_rock);
void init(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
void init(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
std::shared_ptr<MaterialLawManager> materialLawManager,
int number_of_cells,
const int* global_cell,

View File

@ -27,8 +27,8 @@
namespace Opm
{
IncompPropertiesFromDeck::IncompPropertiesFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
IncompPropertiesFromDeck::IncompPropertiesFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
const UnstructuredGrid& grid)
{
rock_.init(eclState, grid.number_of_cells, grid.global_cell, grid.cartdims);

View File

@ -52,8 +52,8 @@ namespace Opm
/// \param grid Grid to which property object applies, needed for the
/// mapping from cell indices (typically from a processed grid)
/// to logical cartesian indices consistent with the deck.
IncompPropertiesFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
IncompPropertiesFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
const UnstructuredGrid& grid);
/// Destructor.

View File

@ -31,14 +31,14 @@
namespace Opm
{
IncompPropertiesSinglePhase::IncompPropertiesSinglePhase(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
IncompPropertiesSinglePhase::IncompPropertiesSinglePhase(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
const UnstructuredGrid& grid)
{
rock_.init(eclState, grid.number_of_cells, grid.global_cell, grid.cartdims);
if (deck->hasKeyword("DENSITY")) {
const auto& densityRecord = deck->getKeyword("DENSITY").getRecord(0);
if (deck.hasKeyword("DENSITY")) {
const auto& densityRecord = deck.getKeyword("DENSITY").getRecord(0);
surface_density_ = densityRecord.getItem("OIL").getSIDouble(0);
} else {
surface_density_ = 1000.0;
@ -49,8 +49,8 @@ namespace Opm
// This will be modified if we have a PVCDO specification.
reservoir_density_ = surface_density_;
if (deck->hasKeyword("PVCDO")) {
const auto& pvcdoRecord = deck->getKeyword("PVCDO").getRecord(0);
if (deck.hasKeyword("PVCDO")) {
const auto& pvcdoRecord = deck.getKeyword("PVCDO").getRecord(0);
if (pvcdoRecord.getItem("OIL_COMPRESSIBILITY").getSIDouble(0) != 0.0 ||
pvcdoRecord.getItem("OIL_VISCOSIBILITY").getSIDouble(0) != 0.0) {
OPM_MESSAGE("Compressibility effects in PVCDO are ignored.");

View File

@ -53,8 +53,8 @@ namespace Opm
/// \param grid Grid to which property object applies, needed for the
/// mapping from cell indices (typically from a processed grid)
/// to logical cartesian indices consistent with the deck.
IncompPropertiesSinglePhase(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
IncompPropertiesSinglePhase(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
const UnstructuredGrid& grid);
/// Destructor.

View File

@ -33,12 +33,12 @@ namespace Opm
/// Looks at presence of WATER, OIL and GAS keywords in state object
/// to determine active phases.
inline PhaseUsage phaseUsageFromDeck(Opm::EclipseStateConstPtr eclipseState)
inline PhaseUsage phaseUsageFromDeck(const Opm::EclipseState& eclipseState)
{
PhaseUsage pu;
std::fill(pu.phase_used, pu.phase_used + BlackoilPhases::MaxNumPhases, 0);
const auto& tm = eclipseState->getTableManager();
const auto& tm = eclipseState.getTableManager();
// Discover phase usage.
if (tm.hasPhase(Phase::PhaseEnum::WATER)) {
pu.phase_used[BlackoilPhases::Aqua] = 1;
@ -71,19 +71,19 @@ namespace Opm
/// Looks at presence of WATER, OIL and GAS keywords in deck
/// to determine active phases.
inline PhaseUsage phaseUsageFromDeck(Opm::DeckConstPtr deck)
inline PhaseUsage phaseUsageFromDeck(const Opm::Deck& deck)
{
PhaseUsage pu;
std::fill(pu.phase_used, pu.phase_used + BlackoilPhases::MaxNumPhases, 0);
// Discover phase usage.
if (deck->hasKeyword("WATER")) {
if (deck.hasKeyword("WATER")) {
pu.phase_used[BlackoilPhases::Aqua] = 1;
}
if (deck->hasKeyword("OIL")) {
if (deck.hasKeyword("OIL")) {
pu.phase_used[BlackoilPhases::Liquid] = 1;
}
if (deck->hasKeyword("GAS")) {
if (deck.hasKeyword("GAS")) {
pu.phase_used[BlackoilPhases::Vapour] = 1;
}
pu.num_phases = 0;

View File

@ -36,7 +36,7 @@ namespace Opm
{
}
void PvtPropertiesIncompFromDeck::init(Opm::DeckConstPtr deck)
void PvtPropertiesIncompFromDeck::init(const Opm::Deck& deck)
{
// So far, this class only supports a single PVT region. TODO?
int region_number = 0;
@ -49,8 +49,8 @@ namespace Opm
}
// Surface densities. Accounting for different orders in eclipse and our code.
if (deck->hasKeyword("DENSITY")) {
const auto& densityRecord = deck->getKeyword("DENSITY").getRecord(region_number);
if (deck.hasKeyword("DENSITY")) {
const auto& densityRecord = deck.getKeyword("DENSITY").getRecord(region_number);
surface_density_[phase_usage.phase_pos[PhaseUsage::Aqua]] = densityRecord.getItem("OIL").getSIDouble(0);
surface_density_[phase_usage.phase_pos[PhaseUsage::Liquid]] = densityRecord.getItem("WATER").getSIDouble(0);
} else {
@ -62,8 +62,8 @@ namespace Opm
reservoir_density_ = surface_density_;
// Water viscosity.
if (deck->hasKeyword("PVTW")) {
const auto& pvtwRecord = deck->getKeyword("PVTW").getRecord(region_number);
if (deck.hasKeyword("PVTW")) {
const auto& pvtwRecord = deck.getKeyword("PVTW").getRecord(region_number);
if (pvtwRecord.getItem("WATER_COMPRESSIBILITY").getSIDouble(0) != 0.0 ||
pvtwRecord.getItem("WATER_VISCOSIBILITY").getSIDouble(0) != 0.0) {
OPM_MESSAGE("Compressibility effects in PVTW are ignored.");
@ -77,8 +77,8 @@ namespace Opm
}
// Oil viscosity.
if (deck->hasKeyword("PVCDO")) {
const auto& pvcdoRecord = deck->getKeyword("PVCDO").getRecord(region_number);
if (deck.hasKeyword("PVCDO")) {
const auto& pvcdoRecord = deck.getKeyword("PVCDO").getRecord(region_number);
if (pvcdoRecord.getItem("OIL_COMPRESSIBILITY").getSIDouble(0) != 0.0 ||
pvcdoRecord.getItem("OIL_VISCOSIBILITY").getSIDouble(0) != 0.0) {

View File

@ -38,7 +38,7 @@ namespace Opm
PvtPropertiesIncompFromDeck();
/// Initialize from deck.
void init(Opm::DeckConstPtr deck);
void init(const Opm::Deck& deck);
/// Number of active phases.
int numPhases() const;

View File

@ -41,8 +41,8 @@ namespace Opm
/// extract the quantities needed specify the temperature dependence of the gas
/// viscosity and density from the deck
void initFromDeck(std::shared_ptr<const PvtInterface> isothermalPvt,
Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclipseState)
const Opm::Deck& deck,
const Opm::EclipseState& eclipseState)
{
isothermalPvt_ = isothermalPvt;
auto tables = eclipseState->getTableManager();

View File

@ -41,8 +41,8 @@ namespace Opm
/// set the tables which specify the temperature dependence of the oil viscosity
void initFromDeck(std::shared_ptr<const PvtInterface> isothermalPvt,
Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclipseState)
const Opm::Deck& deck,
const Opm::EclipseState& eclipseState)
{
isothermalPvt_ = isothermalPvt;

View File

@ -41,8 +41,8 @@ namespace Opm
/// set the tables which specify the temperature dependence of the water viscosity
void initFromDeck(std::shared_ptr<const PvtInterface> isothermalPvt,
Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclipseState)
const Opm::Deck& deck,
const Opm::EclipseState& eclipseState)
{
isothermalPvt_ = isothermalPvt;
watvisctTables_ = 0;

View File

@ -41,12 +41,12 @@ namespace Opm
rock_comp_ = param.getDefault("rock_compressibility", 0.0)/unit::barsa;
}
RockCompressibility::RockCompressibility(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclipseState)
RockCompressibility::RockCompressibility(const Opm::Deck& deck,
const Opm::EclipseState& eclipseState)
: pref_(0.0),
rock_comp_(0.0)
{
const auto& tables = eclipseState->getTableManager();
const auto& tables = eclipseState.getTableManager();
const auto& rocktabTables = tables.getRocktabTables();
if (rocktabTables.size() > 0) {
const auto& rocktabTable = rocktabTables.getTable<RocktabTable>(0);
@ -60,8 +60,8 @@ namespace Opm
} else {
transmult_ = rocktabTable.getColumn("PV_MULT_TRANX").vectorCopy();
}
} else if (deck->hasKeyword("ROCK")) {
const auto& rockKeyword = deck->getKeyword("ROCK");
} else if (deck.hasKeyword("ROCK")) {
const auto& rockKeyword = deck.getKeyword("ROCK");
if (rockKeyword.size() != 1) {
// here it would be better not to use std::cout directly but to add the
// warning to some "warning list"...

View File

@ -35,8 +35,8 @@ namespace Opm
public:
/// Construct from input deck.
/// Looks for the keywords ROCK and ROCKTAB.
RockCompressibility(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclipseState);
RockCompressibility(const Opm::Deck& deck,
const Opm::EclipseState& eclipseState);
/// Construct from parameters.
/// Accepts the following parameters (with defaults).

View File

@ -50,12 +50,12 @@ namespace Opm
typedef GridPropertyAccess::Compressed<PermArray, PermTag> PermComponent;
PermComponent
extractPermComponent(EclipseStateConstPtr ecl,
extractPermComponent(const EclipseState& ecl,
const std::string& kw,
const int* global_cell);
PermeabilityKind
fillTensor(EclipseStateConstPtr eclState,
fillTensor(const EclipseState& eclState,
const int* global_cell,
std::vector<PermComponent>& tensor,
std::array<int,9>& kmap);
@ -80,7 +80,7 @@ namespace Opm
{
}
void RockFromDeck::init(Opm::EclipseStateConstPtr eclState,
void RockFromDeck::init(const Opm::EclipseState& eclState,
int number_of_cells, const int* global_cell,
const int* cart_dims)
{
@ -91,7 +91,7 @@ namespace Opm
perm_threshold);
}
void RockFromDeck::assignPorosity(Opm::EclipseStateConstPtr eclState,
void RockFromDeck::assignPorosity(const Opm::EclipseState& eclState,
int number_of_cells, const int* global_cell)
{
typedef GridPropertyAccess::ArrayPolicy
@ -106,7 +106,7 @@ namespace Opm
}
}
void RockFromDeck::assignPermeability(Opm::EclipseStateConstPtr eclState,
void RockFromDeck::assignPermeability(const Opm::EclipseState& eclState,
int number_of_cells,
const int* global_cell,
const int* cartdims,
@ -181,9 +181,9 @@ namespace Opm
/// TensorPerm at least one cross-component given.
/// None no components given.
/// Invalid invalid set of components given.
PermeabilityKind classifyPermeability(Opm::EclipseStateConstPtr eclState)
PermeabilityKind classifyPermeability(const Opm::EclipseState& eclState)
{
auto& props = eclState->get3DProperties();
auto& props = eclState.get3DProperties();
const bool xx = props.hasDeckDoubleGridProperty("PERMX" );
const bool xy = props.hasDeckDoubleGridProperty("PERMXY");
const bool yx = xy;
@ -290,7 +290,7 @@ namespace Opm
/// @param [out] tensor
/// @param [out] kmap
PermeabilityKind
fillTensor(EclipseStateConstPtr eclState,
fillTensor(const EclipseState& eclState,
const int* global_cell,
std::vector<PermComponent>& tensor,
std::array<int,9>& kmap)
@ -310,7 +310,7 @@ namespace Opm
// -----------------------------------------------------------
// 1st row: [ kxx, kxy ], kxz handled in kzx
if (eclState->get3DProperties().hasDeckDoubleGridProperty("PERMX" )) {
if (eclState.get3DProperties().hasDeckDoubleGridProperty("PERMX" )) {
kmap[xx] = tensor.size();
tensor.push_back(extractPermComponent(eclState, "PERMX", global_cell));
@ -323,7 +323,7 @@ namespace Opm
// -----------------------------------------------------------
// 2nd row: [ kyy, kyz ], kyx handled in kxy
if (eclState->get3DProperties().hasDeckDoubleGridProperty("PERMY" )) {
if (eclState.get3DProperties().hasDeckDoubleGridProperty("PERMY" )) {
kmap[yy] = tensor.size();
tensor.push_back(extractPermComponent(eclState, "PERMY", global_cell));
@ -340,7 +340,7 @@ namespace Opm
kmap[zx] = kmap[xz] = tensor.size(); // Enforce symmetry.
tensor.push_back(extractPermComponent(eclState, "PERMZX", global_cell));
}
if (eclState->get3DProperties().hasDeckDoubleGridProperty("PERMZ" )) {
if (eclState.get3DProperties().hasDeckDoubleGridProperty("PERMZ" )) {
kmap[zz] = tensor.size();
tensor.push_back(extractPermComponent(eclState, "PERMZ", global_cell));
@ -351,7 +351,7 @@ namespace Opm
}
PermComponent
extractPermComponent(EclipseStateConstPtr ecl,
extractPermComponent(const EclipseState& ecl,
const std::string& kw,
const int* global_cell)
{

View File

@ -47,7 +47,7 @@ namespace Opm
/// \param global_cell The mapping fom local to global cell indices.
/// global_cell[i] is the corresponding global index of i.
/// \param cart_dims The size of the underlying cartesian grid.
void init(Opm::EclipseStateConstPtr eclState,
void init(const Opm::EclipseState& eclState,
int number_of_cells, const int* global_cell,
const int* cart_dims);
@ -78,10 +78,10 @@ namespace Opm
}
private:
void assignPorosity(Opm::EclipseStateConstPtr eclState,
void assignPorosity(const Opm::EclipseState& eclState,
int number_of_cells,
const int* global_cell);
void assignPermeability(Opm::EclipseStateConstPtr eclState,
void assignPermeability(const Opm::EclipseState& eclState,
int number_of_cells,
const int* global_cell,
const int* cart_dims,

View File

@ -24,12 +24,12 @@
namespace Opm{
void RelpermDiagnostics::phaseCheck_(DeckConstPtr deck)
void RelpermDiagnostics::phaseCheck_(const Deck& deck)
{
bool hasWater = deck->hasKeyword("WATER");
bool hasGas = deck->hasKeyword("GAS");
bool hasOil = deck->hasKeyword("OIL");
bool hasSolvent = deck->hasKeyword("SOLVENT");
bool hasWater = deck.hasKeyword("WATER");
bool hasGas = deck.hasKeyword("GAS");
bool hasOil = deck.hasKeyword("OIL");
bool hasSolvent = deck.hasKeyword("SOLVENT");
if (hasWater && hasGas && !hasOil && !hasSolvent) {
const std::string msg = "System: Water-Gas system.";
@ -62,9 +62,9 @@ namespace Opm{
void RelpermDiagnostics::satFamilyCheck_(Opm::EclipseStateConstPtr eclState)
void RelpermDiagnostics::satFamilyCheck_(const Opm::EclipseState& eclState)
{
const auto& tableManager = eclState->getTableManager();
const auto& tableManager = eclState.getTableManager();
const TableContainer& swofTables = tableManager.getSwofTables();
const TableContainer& slgofTables= tableManager.getSlgofTables();
const TableContainer& sgofTables = tableManager.getSgofTables();
@ -105,15 +105,15 @@ namespace Opm{
void RelpermDiagnostics::tableCheck_(EclipseStateConstPtr eclState,
std::shared_ptr< const Deck > deck)
void RelpermDiagnostics::tableCheck_(const EclipseState& eclState,
const Deck& deck)
{
const int numSatRegions = deck->getKeyword("TABDIMS").getRecord(0).getItem("NTSFUN").get< int >(0);
const int numSatRegions = deck.getKeyword("TABDIMS").getRecord(0).getItem("NTSFUN").get< int >(0);
{
const std::string msg = "Number of saturation regions: " + std::to_string(numSatRegions) + "\n";
OpmLog::info(msg);
}
const auto& tableManager = eclState->getTableManager();
const auto& tableManager = eclState.getTableManager();
const TableContainer& swofTables = tableManager.getSwofTables();
const TableContainer& slgofTables = tableManager.getSlgofTables();
const TableContainer& sgofTables = tableManager.getSgofTables();
@ -129,46 +129,46 @@ namespace Opm{
const TableContainer& msfnTables = tableManager.getMsfnTables();
for (int satnumIdx = 0; satnumIdx < numSatRegions; ++satnumIdx) {
if (deck->hasKeyword("SWOF")) {
if (deck.hasKeyword("SWOF")) {
swofTableCheck_(swofTables.getTable<SwofTable>(satnumIdx), satnumIdx+1);
}
if (deck->hasKeyword("SGOF")) {
if (deck.hasKeyword("SGOF")) {
sgofTableCheck_(sgofTables.getTable<SgofTable>(satnumIdx), satnumIdx+1);
}
if (deck->hasKeyword("SLGOF")) {
if (deck.hasKeyword("SLGOF")) {
slgofTableCheck_(slgofTables.getTable<SlgofTable>(satnumIdx), satnumIdx+1);
}
if (deck->hasKeyword("SWFN")) {
if (deck.hasKeyword("SWFN")) {
swfnTableCheck_(swfnTables.getTable<SwfnTable>(satnumIdx), satnumIdx+1);
}
if (deck->hasKeyword("SGFN")) {
if (deck.hasKeyword("SGFN")) {
sgfnTableCheck_(sgfnTables.getTable<SgfnTable>(satnumIdx), satnumIdx+1);
}
if (deck->hasKeyword("SOF3")) {
if (deck.hasKeyword("SOF3")) {
sof3TableCheck_(sof3Tables.getTable<Sof3Table>(satnumIdx), satnumIdx+1);
}
if (deck->hasKeyword("SOF2")) {
if (deck.hasKeyword("SOF2")) {
sof2TableCheck_(sof2Tables.getTable<Sof2Table>(satnumIdx), satnumIdx+1);
}
if (deck->hasKeyword("SGWFN")) {
if (deck.hasKeyword("SGWFN")) {
sgwfnTableCheck_(sgwfnTables.getTable<SgwfnTable>(satnumIdx), satnumIdx+1);
}
if (deck->hasKeyword("SGCWMIS")) {
if (deck.hasKeyword("SGCWMIS")) {
sgcwmisTableCheck_(sgcwmisTables.getTable<SgcwmisTable>(satnumIdx), satnumIdx+1);
}
if (deck->hasKeyword("SORWMIS")) {
if (deck.hasKeyword("SORWMIS")) {
sorwmisTableCheck_(sorwmisTables.getTable<SorwmisTable>(satnumIdx), satnumIdx+1);
}
if (deck->hasKeyword("SSFN")) {
if (deck.hasKeyword("SSFN")) {
ssfnTableCheck_(ssfnTables.getTable<SsfnTable>(satnumIdx), satnumIdx+1);
}
if (deck->hasKeyword("MSFN")) {
if (deck.hasKeyword("MSFN")) {
msfnTableCheck_(msfnTables.getTable<MsfnTable>(satnumIdx), satnumIdx+1);
}
}
if (deck->hasKeyword("MISCIBLE")) {
if (deck.hasKeyword("MISCIBLE")) {
const int numMiscNumIdx = miscTables.size();
const std::string msg = "Number of misc regions: " + std::to_string(numMiscNumIdx) + "\n";
OpmLog::info(msg);
@ -586,14 +586,14 @@ namespace Opm{
void RelpermDiagnostics::unscaledEndPointsCheck_(DeckConstPtr deck,
EclipseStateConstPtr eclState)
void RelpermDiagnostics::unscaledEndPointsCheck_(const Deck& deck,
const EclipseState& eclState)
{
// get the number of saturation regions and the number of cells in the deck
const int numSatRegions = deck->getKeyword("TABDIMS").getRecord(0).getItem("NTSFUN").get< int >(0);
const int numSatRegions = deck.getKeyword("TABDIMS").getRecord(0).getItem("NTSFUN").get< int >(0);
unscaledEpsInfo_.resize(numSatRegions);
const auto& tables = eclState->getTableManager();
const auto& tables = eclState.getTableManager();
const TableContainer& swofTables = tables.getSwofTables();
const TableContainer& sgofTables = tables.getSgofTables();
const TableContainer& slgofTables = tables.getSlgofTables();

View File

@ -58,8 +58,8 @@ namespace Opm {
///\param[in] deck ecliplise data file.
///\param[in] grid unstructured grid.
template <class GridT>
void diagnosis(EclipseStateConstPtr eclState,
DeckConstPtr deck,
void diagnosis(const EclipseState& eclState,
const Deck& deck,
const GridT& grid);
private:
@ -86,22 +86,22 @@ namespace Opm {
///Check the phase that used.
void phaseCheck_(DeckConstPtr deck);
void phaseCheck_(const Deck& deck);
///Check saturation family I and II.
void satFamilyCheck_(EclipseStateConstPtr eclState);
void satFamilyCheck_(const EclipseState& eclState);
///Check saturation tables.
void tableCheck_(EclipseStateConstPtr eclState,
DeckConstPtr deck);
void tableCheck_(const EclipseState& eclState,
const Deck& deck);
///Check endpoints in the saturation tables.
void unscaledEndPointsCheck_(DeckConstPtr deck,
EclipseStateConstPtr eclState);
void unscaledEndPointsCheck_(const Deck& deck,
const EclipseState& eclState);
template <class GridT>
void scaledEndPointsCheck_(DeckConstPtr deck,
EclipseStateConstPtr eclState,
void scaledEndPointsCheck_(const Deck& deck,
const EclipseState& eclState,
const GridT& grid);
///For every table, need to deal with case by case.

View File

@ -29,8 +29,8 @@
namespace Opm {
template <class GridT>
void RelpermDiagnostics::diagnosis(Opm::EclipseStateConstPtr eclState,
Opm::DeckConstPtr deck,
void RelpermDiagnostics::diagnosis(const Opm::EclipseState& eclState,
const Opm::Deck& deck,
const GridT& grid)
{
OpmLog::info("\n***************Saturation Functions Diagnostics***************");
@ -42,8 +42,8 @@ namespace Opm {
}
template <class GridT>
void RelpermDiagnostics::scaledEndPointsCheck_(DeckConstPtr deck,
EclipseStateConstPtr eclState,
void RelpermDiagnostics::scaledEndPointsCheck_(const Deck& deck,
const EclipseState& eclState,
const GridT& grid)
{
const int nc = Opm::UgGridHelpers::numCells(grid);
@ -53,7 +53,7 @@ namespace Opm {
scaledEpsInfo_.resize(nc);
EclEpsGridProperties epsGridProperties;
epsGridProperties.initFromDeck(deck, eclState, /*imbibition=*/false);
const auto& satnum = eclState->get3DProperties().getIntGridProperty("SATNUM");
const auto& satnum = eclState.get3DProperties().getIntGridProperty("SATNUM");
const std::string tag = "Scaled endpoints";
for (int c = 0; c < nc; ++c) {
@ -80,7 +80,7 @@ namespace Opm {
OpmLog::warning(tag, msg);
}
if (deck->hasKeyword("SCALECRS") && fluidSystem_ == FluidSystem::BlackOil) {
if (deck.hasKeyword("SCALECRS") && fluidSystem_ == FluidSystem::BlackOil) {
// Mobilility check.
if ((scaledEpsInfo_[c].Sowcr + scaledEpsInfo_[c].Swcr) >= 1.0) {
const std::string msg = "For scaled endpoints input, cell" + cellIdx + " SATNUM = " + satnumIdx + ", SOWCR + SWCR exceed 1.0";

View File

@ -66,7 +66,7 @@ namespace Opm
/// Initialize from deck and MaterialLawManager.
/// \param[in] deck Input deck
/// \param[in] materialLawManager An initialized MaterialLawManager object
void init(Opm::DeckConstPtr deck,
void init(const Opm::Deck& deck,
std::shared_ptr<MaterialLawManager> materialLawManager)
{
init(Opm::phaseUsageFromDeck(deck), materialLawManager);

View File

@ -49,17 +49,17 @@ namespace Opm
}
/// Use the SimulatorTimer as a shim around opm-parser's Opm::TimeMap
void SimulatorTimer::init(Opm::TimeMapConstPtr timeMap, size_t report_step)
void SimulatorTimer::init(const TimeMap& timeMap, size_t report_step)
{
total_time_ = timeMap->getTotalTime();
timesteps_.resize(timeMap->numTimesteps());
for ( size_t i = 0; i < timeMap->numTimesteps(); ++i ) {
timesteps_[i] = timeMap->getTimeStepLength(i);
total_time_ = timeMap.getTotalTime();
timesteps_.resize(timeMap.numTimesteps());
for ( size_t i = 0; i < timeMap.numTimesteps(); ++i ) {
timesteps_[i] = timeMap.getTimeStepLength(i);
}
setCurrentStepNum(report_step);
boost::posix_time::ptime start_time = timeMap->getStartTime(0);
boost::posix_time::ptime start_time = timeMap.getStartTime(0);
start_date_ = start_time.date();
}

View File

@ -47,7 +47,7 @@ namespace Opm
void init(const parameter::ParameterGroup& param);
/// Use the SimulatorTimer as a shim around opm-parser's Opm::TimeMap
void init(TimeMapConstPtr timeMap, size_t report_step = 0);
void init(const TimeMap& timeMap, size_t report_step = 0);
/// Whether the current step is the first step.
bool initialStep() const;

View File

@ -181,7 +181,7 @@ namespace Opm
template <class Props, class State>
void initStateFromDeck(const UnstructuredGrid& grid,
const Props& props,
Opm::DeckConstPtr deck,
const Opm::Deck& deck,
const double gravity,
State& state);
@ -196,7 +196,7 @@ namespace Opm
template <class Props, class State>
void initBlackoilStateFromDeck(const UnstructuredGrid& grid,
const Props& props,
Opm::DeckConstPtr deck,
const Opm::Deck& deck,
const double gravity,
State& state);
/// Initialize a blackoil state from input deck.
@ -209,7 +209,7 @@ namespace Opm
CCI begin_cell_centroids,
int dimensions,
const Props& props,
Opm::DeckConstPtr deck,
const Opm::Deck& deck,
const double gravity,
State& state);
} // namespace Opm

View File

@ -72,8 +72,8 @@ namespace Opm
template<class Grid>
void initStateEquil(const Grid& grid,
const BlackoilPropertiesInterface& props,
const Opm::DeckConstPtr deck,
const Opm::EclipseStateConstPtr eclipseState,
const Opm::Deck& deck,
const Opm::EclipseState& eclipseState,
const double gravity,
BlackoilState& state);
@ -213,16 +213,16 @@ namespace Opm
template<class Grid>
inline
std::vector<int>
equilnum(const Opm::DeckConstPtr deck,
const Opm::EclipseStateConstPtr eclipseState,
equilnum(const Opm::Deck& deck,
const Opm::EclipseState& eclipseState,
const Grid& G )
{
std::vector<int> eqlnum;
if (deck->hasKeyword("EQLNUM")) {
if (deck.hasKeyword("EQLNUM")) {
const int nc = UgGridHelpers::numCells(G);
eqlnum.resize(nc);
const std::vector<int>& e =
eclipseState->get3DProperties().getIntGridProperty("EQLNUM").getData();
eclipseState.get3DProperties().getIntGridProperty("EQLNUM").getData();
const int* gc = UgGridHelpers::globalCell(G);
for (int cell = 0; cell < nc; ++cell) {
const int deck_pos = (gc == NULL) ? cell : gc[cell];
@ -243,8 +243,8 @@ namespace Opm
public:
template<class Grid>
InitialStateComputer(BlackoilPropertiesInterface& props,
const Opm::DeckConstPtr deck,
const Opm::EclipseStateConstPtr eclipseState,
const Opm::Deck& deck,
const Opm::EclipseState& eclipseState,
const Grid& G ,
const double grav = unit::gravity)
: pp_(props.numPhases(),
@ -255,14 +255,14 @@ namespace Opm
rv_(UgGridHelpers::numCells(G))
{
// Get the equilibration records.
const std::vector<EquilRecord> rec = getEquil(*eclipseState);
const auto& tables = eclipseState->getTableManager();
const std::vector<EquilRecord> rec = getEquil(eclipseState);
const auto& tables = eclipseState.getTableManager();
// Create (inverse) region mapping.
const RegionMapping<> eqlmap(equilnum(deck, eclipseState, G));
// Create Rs functions.
rs_func_.reserve(rec.size());
if (deck->hasKeyword("DISGAS")) {
if (deck.hasKeyword("DISGAS")) {
const TableContainer& rsvdTables = tables.getRsvdTables();
for (size_t i = 0; i < rec.size(); ++i) {
if (eqlmap.cells(i).empty())
@ -300,7 +300,7 @@ namespace Opm
}
rv_func_.reserve(rec.size());
if (deck->hasKeyword("VAPOIL")) {
if (deck.hasKeyword("VAPOIL")) {
const TableContainer& rvvdTables = tables.getRvvdTables();
for (size_t i = 0; i < rec.size(); ++i) {
if (eqlmap.cells(i).empty())
@ -342,8 +342,8 @@ namespace Opm
// Check for presence of kw SWATINIT
if (deck->hasKeyword("SWATINIT")) {
const std::vector<double>& swat_init = eclipseState->
if (deck.hasKeyword("SWATINIT")) {
const std::vector<double>& swat_init = eclipseState.
get3DProperties().getDoubleGridProperty("SWATINIT").getData();
const int nc = UgGridHelpers::numCells(G);
swat_init_.resize(nc);

View File

@ -886,8 +886,8 @@ namespace Opm
template<class Grid>
void initStateEquil(const Grid& grid,
BlackoilPropertiesFromDeck& props,
const Opm::DeckConstPtr deck,
const Opm::EclipseStateConstPtr eclipseState,
const Opm::Deck& deck,
const Opm::EclipseState& eclipseState,
const double gravity,
BlackoilState& state)
{

View File

@ -621,7 +621,7 @@ namespace Opm
template <class Props, class State>
void initStateFromDeck(const UnstructuredGrid& grid,
const Props& props,
Opm::DeckConstPtr deck,
const Opm::Deck& deck,
const double gravity,
State& state)
{
@ -640,7 +640,7 @@ namespace Opm
CCI begin_cell_centroids,
int dimensions,
const Props& props,
Opm::DeckConstPtr deck,
const Opm::Deck& deck,
const double gravity,
State& state)
{
@ -650,12 +650,12 @@ namespace Opm
OPM_THROW(std::runtime_error, "initStateFromDeck(): user specified property object with " << num_phases << " phases, "
"found " << pu.num_phases << " phases in deck.");
}
if (deck->hasKeyword("EQUIL") && deck->hasKeyword("PRESSURE")) {
if (deck.hasKeyword("EQUIL") && deck.hasKeyword("PRESSURE")) {
OPM_THROW(std::runtime_error, "initStateFromDeck(): The deck must either specify the initial "
"condition using the PRESSURE _or_ the EQUIL keyword (currently it has both)");
}
if (deck->hasKeyword("EQUIL")) {
if (deck.hasKeyword("EQUIL")) {
if (num_phases != 2) {
OPM_THROW(std::runtime_error, "initStateFromDeck(): EQUIL-based init currently handling only two-phase scenarios.");
}
@ -663,7 +663,7 @@ namespace Opm
OPM_THROW(std::runtime_error, "initStateFromDeck(): EQUIL-based init currently handling only oil-water scenario (no gas).");
}
// Set saturations depending on oil-water contact.
Equil equil( deck->getKeyword( "EQUIL" ) );
Equil equil( deck.getKeyword( "EQUIL" ) );
if (equil.size() != 1) {
OPM_THROW(std::runtime_error, "initStateFromDeck(): No region support yet.");
}
@ -675,19 +675,19 @@ namespace Opm
const double datum_p = equil.getRecord( 0 ).datumDepthPressure();
initHydrostaticPressure(number_of_cells, begin_cell_centroids, dimensions,
props, woc, gravity, datum_z, datum_p, state);
} else if (deck->hasKeyword("PRESSURE")) {
} else if (deck.hasKeyword("PRESSURE")) {
// Set saturations from SWAT/SGAS, pressure from PRESSURE.
std::vector<double>& s = state.saturation();
std::vector<double>& p = state.pressure();
const std::vector<double>& p_deck = deck->getKeyword("PRESSURE").getSIDoubleData();
const std::vector<double>& p_deck = deck.getKeyword("PRESSURE").getSIDoubleData();
const int num_cells = number_of_cells;
if (num_phases == 2) {
if (!pu.phase_used[BlackoilPhases::Aqua]) {
// oil-gas: we require SGAS
if (!deck->hasKeyword("SGAS")) {
if (!deck.hasKeyword("SGAS")) {
OPM_THROW(std::runtime_error, "initStateFromDeck(): missing SGAS keyword in 2-phase init");
}
const std::vector<double>& sg_deck = deck->getKeyword("SGAS").getSIDoubleData();
const std::vector<double>& sg_deck = deck.getKeyword("SGAS").getSIDoubleData();
const int gpos = pu.phase_pos[BlackoilPhases::Vapour];
const int opos = pu.phase_pos[BlackoilPhases::Liquid];
for (int c = 0; c < num_cells; ++c) {
@ -698,10 +698,10 @@ namespace Opm
}
} else {
// water-oil or water-gas: we require SWAT
if (!deck->hasKeyword("SWAT")) {
if (!deck.hasKeyword("SWAT")) {
OPM_THROW(std::runtime_error, "initStateFromDeck(): missing SWAT keyword in 2-phase init");
}
const std::vector<double>& sw_deck = deck->getKeyword("SWAT").getSIDoubleData();
const std::vector<double>& sw_deck = deck.getKeyword("SWAT").getSIDoubleData();
const int wpos = pu.phase_pos[BlackoilPhases::Aqua];
const int nwpos = (wpos + 1) % 2;
for (int c = 0; c < num_cells; ++c) {
@ -712,15 +712,15 @@ namespace Opm
}
}
} else if (num_phases == 3) {
const bool has_swat_sgas = deck->hasKeyword("SWAT") && deck->hasKeyword("SGAS");
const bool has_swat_sgas = deck.hasKeyword("SWAT") && deck.hasKeyword("SGAS");
if (!has_swat_sgas) {
OPM_THROW(std::runtime_error, "initStateFromDeck(): missing SGAS or SWAT keyword in 3-phase init.");
}
const int wpos = pu.phase_pos[BlackoilPhases::Aqua];
const int gpos = pu.phase_pos[BlackoilPhases::Vapour];
const int opos = pu.phase_pos[BlackoilPhases::Liquid];
const std::vector<double>& sw_deck = deck->getKeyword("SWAT").getSIDoubleData();
const std::vector<double>& sg_deck = deck->getKeyword("SGAS").getSIDoubleData();
const std::vector<double>& sw_deck = deck.getKeyword("SWAT").getSIDoubleData();
const std::vector<double>& sg_deck = deck.getKeyword("SGAS").getSIDoubleData();
for (int c = 0; c < num_cells; ++c) {
int c_deck = (global_cell == NULL) ? c : global_cell[c];
s[3*c + wpos] = sw_deck[c_deck];
@ -910,7 +910,7 @@ namespace Opm
template <class Props, class State>
void initBlackoilStateFromDeck(const UnstructuredGrid& grid,
const Props& props,
Opm::DeckConstPtr deck,
const Opm::Deck& deck,
const double gravity,
State& state)
{
@ -930,15 +930,15 @@ namespace Opm
CCI begin_cell_centroids,
int dimensions,
const Props& props,
Opm::DeckConstPtr deck,
const Opm::Deck& deck,
const double gravity,
State& state)
{
initStateFromDeck(number_of_cells, global_cell, number_of_faces,
face_cells, begin_face_centroids, begin_cell_centroids,
dimensions, props, deck, gravity, state);
if (deck->hasKeyword("RS")) {
const std::vector<double>& rs_deck = deck->getKeyword("RS").getSIDoubleData();
if (deck.hasKeyword("RS")) {
const std::vector<double>& rs_deck = deck.getKeyword("RS").getSIDoubleData();
const int num_cells = number_of_cells;
for (int c = 0; c < num_cells; ++c) {
int c_deck = (global_cell == NULL) ? c : global_cell[c];
@ -946,8 +946,8 @@ namespace Opm
}
initBlackoilSurfvolUsingRSorRV(number_of_cells, props, state);
computeSaturation(props,state);
} else if (deck->hasKeyword("RV")){
const std::vector<double>& rv_deck = deck->getKeyword("RV").getSIDoubleData();
} else if (deck.hasKeyword("RV")){
const std::vector<double>& rv_deck = deck.getKeyword("RV").getSIDoubleData();
const int num_cells = number_of_cells;
for (int c = 0; c < num_cells; ++c) {
int c_deck = (global_cell == NULL) ? c : global_cell[c];

View File

@ -110,7 +110,7 @@ namespace Opm {
HasProperty<int>::p(PropertyContainer& ecl,
const std::string& kw)
{
return ecl->get3DProperties().hasDeckIntGridProperty(kw);
return ecl.get3DProperties().hasDeckIntGridProperty(kw);
}
/**
@ -145,7 +145,7 @@ namespace Opm {
HasProperty<double>::p(PropertyContainer& ecl,
const std::string& kw)
{
return ecl->get3DProperties().hasDeckDoubleGridProperty(kw);
return ecl.get3DProperties().hasDeckDoubleGridProperty(kw);
}
/**
@ -181,7 +181,7 @@ namespace Opm {
{
assert (HasProperty<int>::p(ecl, kw));
return &ecl->get3DProperties().getIntGridProperty(kw);
return &ecl.get3DProperties().getIntGridProperty(kw);
}
/**
@ -217,7 +217,7 @@ namespace Opm {
{
assert (HasProperty<double>::p(ecl, kw));
return &ecl->get3DProperties().getDoubleGridProperty(kw);
return &ecl.get3DProperties().getDoubleGridProperty(kw);
}
} // namespace EclPropImpl

View File

@ -27,12 +27,12 @@
namespace Opm {
void extractPvtTableIndex(std::vector<int> &pvtTableIdx,
Opm::EclipseStateConstPtr eclState,
const Opm::EclipseState& eclState,
size_t numCompressed,
const int *compressedToCartesianCellIdx)
{
//Get the PVTNUM data
const std::vector<int>& pvtnumData = eclState->get3DProperties().getIntGridProperty("PVTNUM").getData();
const std::vector<int>& pvtnumData = eclState.get3DProperties().getIntGridProperty("PVTNUM").getData();
// Convert this into an array of compressed cells
// Eclipse uses Fortran-style indices which start at 1
// instead of 0, we subtract 1.

View File

@ -24,7 +24,7 @@
namespace Opm {
void extractPvtTableIndex(std::vector<int> &pvtTableIdx,
Opm::EclipseStateConstPtr eclState,
const Opm::EclipseState& eclState,
size_t numCompressed,
const int *compressedToCartesianCellIdx);

View File

@ -326,7 +326,7 @@ namespace Opm
}
/// Construct wells from deck.
WellsManager::WellsManager(const Opm::EclipseStateConstPtr eclipseState,
WellsManager::WellsManager(const Opm::EclipseState& eclipseState,
const size_t timeStep,
const UnstructuredGrid& grid,
const double* permeability)
@ -729,11 +729,11 @@ namespace Opm
}
void WellsManager::addChildGroups(GroupTreeNodeConstPtr parentNode, ScheduleConstPtr schedule, size_t timeStep, const PhaseUsage& phaseUsage) {
for (auto childIter = parentNode->begin(); childIter != parentNode->end(); ++childIter) {
GroupTreeNodeConstPtr childNode = (*childIter).second;
well_collection_.addGroup(schedule->getGroup(childNode->name()), parentNode->name(), timeStep, phaseUsage);
addChildGroups(childNode, schedule, timeStep, phaseUsage);
void WellsManager::addChildGroups(const GroupTreeNode& parentNode, const Schedule& schedule, size_t timeStep, const PhaseUsage& phaseUsage) {
for (auto childIter = parentNode.begin(); childIter != parentNode.end(); ++childIter) {
const auto& childNode = (*childIter).second;
well_collection_.addGroup(schedule.getGroup(childNode->name()), parentNode.name(), timeStep, phaseUsage);
addChildGroups(*childNode, schedule, timeStep, phaseUsage);
}
}

View File

@ -83,7 +83,7 @@ namespace Opm
/// like shut wells. E.g. in a a parallel run these would be
/// the wells handeled by another process. Defaults to empty set.
template<class F2C, class FC>
WellsManager(const Opm::EclipseStateConstPtr eclipseState,
WellsManager(const Opm::EclipseState& eclipseState,
const size_t timeStep,
int num_cells,
const int* global_cell,
@ -97,7 +97,7 @@ namespace Opm
const std::vector<double>& well_potentials={},
const std::unordered_set<std::string>& deactivated_wells = {});
WellsManager(const Opm::EclipseStateConstPtr eclipseState,
WellsManager(const Opm::EclipseState& eclipseState,
const size_t timeStep,
const UnstructuredGrid& grid,
const double* permeability);
@ -154,7 +154,7 @@ namespace Opm
private:
template<class C2F, class FC>
void init(const Opm::EclipseStateConstPtr eclipseState,
void init(const Opm::EclipseState& eclipseState,
const size_t timeStep,
int num_cells,
const int* global_cell,
@ -193,7 +193,7 @@ namespace Opm
const std::unordered_set<std::string>& deactivated_wells,
const DynamicListEconLimited& list_econ_limited);
void addChildGroups(GroupTreeNodeConstPtr parentNode, std::shared_ptr< const Schedule > schedule, size_t timeStep, const PhaseUsage& phaseUsage);
void addChildGroups(const GroupTreeNode& parentNode, const Schedule& schedule, size_t timeStep, const PhaseUsage& phaseUsage);
void setupGuideRates(std::vector<const Well*>& wells, const size_t timeStep, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index,
const PhaseUsage& phaseUsage, const std::vector<double>& well_potentials);
// Data

View File

@ -161,15 +161,13 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
}
{ // COMPDAT handling
auto completionSet = well->getCompletions(timeStep);
// shut completions and open ones stored in this process will have 1 others 0.
for (size_t c=0; c<completionSet->size(); c++) {
CompletionConstPtr completion = completionSet->get(c);
if (completion->getState() == WellCompletion::OPEN) {
int i = completion->getI();
int j = completion->getJ();
int k = completion->getK();
for(const auto& completion : well->getCompletions(timeStep)) {
if (completion.getState() == WellCompletion::OPEN) {
int i = completion.getI();
int j = completion.getJ();
int k = completion.getK();
const int* cpgdim = cart_dims;
int cart_grid_indx = i + cpgdim[0]*(j + cpgdim[1]*k);
@ -195,12 +193,12 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
PerfData pd;
pd.cell = cell;
{
const Value<double>& transmissibilityFactor = completion->getConnectionTransmissibilityFactorAsValueObject();
const double wellPi = completion ->getWellPi();
const Value<double>& transmissibilityFactor = completion.getConnectionTransmissibilityFactorAsValueObject();
const double wellPi = completion.getWellPi();
if (transmissibilityFactor.hasValue()) {
pd.well_index = transmissibilityFactor.getValue();
} else {
double radius = 0.5*completion->getDiameter();
double radius = 0.5*completion.getDiameter();
if (radius <= 0.0) {
radius = 0.5*unit::feet;
OPM_MESSAGE("**** Warning: Well bore internal radius set to " << radius);
@ -217,8 +215,8 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
const double* cell_perm = &permeability[dimensions*dimensions*cell];
pd.well_index =
WellsManagerDetail::computeWellIndex(radius, cubical, cell_perm,
completion->getSkinFactor(),
completion->getDirection(),
completion.getSkinFactor(),
completion.getDirection(),
ntg[cell]);
}
pd.well_index *= wellPi;
@ -226,8 +224,8 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
wellperf_data[active_well_index].push_back(pd);
}
} else {
if (completion->getState() != WellCompletion::SHUT) {
OPM_THROW(std::runtime_error, "Completion state: " << WellCompletion::StateEnum2String( completion->getState() ) << " not handled");
if (completion.getState() != WellCompletion::SHUT) {
OPM_THROW(std::runtime_error, "Completion state: " << WellCompletion::StateEnum2String( completion.getState() ) << " not handled");
}
}
}
@ -305,7 +303,7 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
template <class C2F, class FC>
WellsManager::
WellsManager(const Opm::EclipseStateConstPtr eclipseState,
WellsManager(const Opm::EclipseState& eclipseState,
const size_t timeStep,
int number_of_cells,
const int* global_cell,
@ -328,7 +326,7 @@ WellsManager(const Opm::EclipseStateConstPtr eclipseState,
/// Construct wells from deck.
template <class C2F, class FC>
void
WellsManager::init(const Opm::EclipseStateConstPtr eclipseState,
WellsManager::init(const Opm::EclipseState& eclipseState,
const size_t timeStep,
int number_of_cells,
const int* global_cell,
@ -347,7 +345,7 @@ WellsManager::init(const Opm::EclipseStateConstPtr eclipseState,
"the corresponding grid is 3-dimensional.");
}
if (eclipseState->getSchedule()->numWells() == 0) {
if (eclipseState.getSchedule().numWells() == 0) {
OPM_MESSAGE("No wells specified in Schedule section, "
"initializing no wells");
return;
@ -369,8 +367,8 @@ WellsManager::init(const Opm::EclipseStateConstPtr eclipseState,
// For easy lookup:
std::map<std::string, int> well_names_to_index;
auto schedule = eclipseState->getSchedule();
auto wells = schedule->getWells(timeStep);
const auto& schedule = eclipseState.getSchedule();
auto wells = schedule.getWells(timeStep);
std::vector<int> wells_on_proc;
well_names.reserve(wells.size());
@ -382,7 +380,7 @@ WellsManager::init(const Opm::EclipseStateConstPtr eclipseState,
DoubleArray ntg_glob(eclipseState, "NTG", 1.0);
NTGArray ntg(ntg_glob, global_cell);
EclipseGridConstPtr eclGrid = eclipseState->getInputGrid();
const auto& eclGrid = eclipseState.getInputGrid();
// use cell thickness (dz) from eclGrid
// dz overwrites values calculated by WellDetails::getCubeDim
@ -390,7 +388,7 @@ WellsManager::init(const Opm::EclipseStateConstPtr eclipseState,
{
std::vector<int> gc = compressedToCartesian(number_of_cells, global_cell);
for (int cell = 0; cell < number_of_cells; ++cell) {
dz[cell] = eclGrid->getCellThicknes(gc[cell]);
dz[cell] = eclGrid.getCellThicknes(gc[cell]);
}
}
@ -406,13 +404,13 @@ WellsManager::init(const Opm::EclipseStateConstPtr eclipseState,
setupWellControls(wells, timeStep, well_names, pu, wells_on_proc, list_econ_limited);
{
GroupTreeNodeConstPtr fieldNode =
schedule->getGroupTree(timeStep).getNode("FIELD");
const auto& fieldNode =
schedule.getGroupTree(timeStep).getNode("FIELD");
const auto& fieldGroup = schedule->getGroup(fieldNode->name());
const auto& fieldGroup = schedule.getGroup(fieldNode->name());
well_collection_.addField(fieldGroup, timeStep, pu);
addChildGroups(fieldNode, schedule, timeStep, pu);
addChildGroups(*fieldNode, schedule, timeStep, pu);
}
for (auto w = wells.begin(), e = wells.end(); w != e; ++w) {

View File

@ -90,9 +90,9 @@ void verifyRFTFile(const std::string& rft_filename) {
Opm::DeckConstPtr createDeck(const std::string& input_str) {
const Opm::Deck createDeck(const std::string& input_str) {
Opm::ParserPtr parser = std::make_shared<Opm::Parser>();
Opm::DeckConstPtr deck = parser->parseString(input_str , Opm::ParseContext());
const Opm::Deck& deck = parser->parseString(input_str , Opm::ParseContext());
return deck;
}

View File

@ -41,17 +41,17 @@ BOOST_AUTO_TEST_CASE(EqualsDifferentDeckReturnFalse) {
const string filename2 = "testBlackoilState2.DATA";
const auto es1 = Opm::Parser::parse(filename1);
auto eg1 = es1.getInputGridCopy();
auto eg1 = es1.getInputGrid();
std::vector<int> actnum = get_testBlackoilStateActnum();
eg1->resetACTNUM(actnum.data());
eg1.resetACTNUM(actnum.data());
const auto es2 = Opm::Parser::parse(filename2);
auto eg2 = es2.getInputGrid();
const auto& eg2 = es2.getInputGrid();
GridManager gridManager1(*eg1);
GridManager gridManager1(eg1);
const UnstructuredGrid& grid1 = *gridManager1.c_grid();
GridManager gridManager2(*eg2);
GridManager gridManager2(eg2);
const UnstructuredGrid& grid2 = *gridManager2.c_grid();
BlackoilState state1( UgGridHelpers::numCells( grid1 ) , UgGridHelpers::numFaces( grid1 ) , 3);
@ -68,12 +68,12 @@ BOOST_AUTO_TEST_CASE(EqualsNumericalDifferenceReturnFalse) {
const string filename = "testBlackoilState1.DATA";
const auto es = Opm::Parser::parse(filename);
auto eg = es.getInputGridCopy();
auto eg = es.getInputGrid();
std::vector<int> actnum = get_testBlackoilStateActnum();
eg->resetACTNUM(actnum.data());
eg.resetACTNUM(actnum.data());
GridManager gridManager(*eg);
GridManager gridManager(eg);
const UnstructuredGrid& grid = *gridManager.c_grid();
BlackoilState state1( UgGridHelpers::numCells( grid ) , UgGridHelpers::numFaces( grid ) , 3);

View File

@ -132,14 +132,14 @@ BOOST_AUTO_TEST_CASE(DisjointColumn)
correct_answer[9].resize(1);
Opm::ParseContext parseContext;
Opm::ParserPtr parser(new Opm::Parser());
Opm::DeckConstPtr deck(parser->parseString(grdecl , parseContext));
Opm::EclipseGridPtr ep = std::make_shared<Opm::EclipseGrid>(deck);
Opm::Parser parser;
Opm::Deck deck = parser.parseString(grdecl , parseContext);
Opm::EclipseGrid ep = Opm::EclipseGrid(deck);
std::vector<int> actnum;
for (size_t i = 1; i <= (3 * 3 * 3); i++)
actnum.push_back(i != 14); // ACTNUM 13*1 0 13* 1
ep->resetACTNUM(actnum.data());
Opm::GridManager manager(*ep);
ep.resetACTNUM(actnum.data());
Opm::GridManager manager(ep);
VVI columns;
Opm::extractColumn(*manager.c_grid(), columns);

View File

@ -42,16 +42,13 @@
#include <opm/core/grid.h>
struct SetupSimple {
SetupSimple()
{
Opm::ParseContext parseContext;
Opm::ParserPtr parser(new Opm::Parser());
deck = parser->parseFile("compressed_gridproperty.data" , parseContext);
ecl.reset(new Opm::EclipseState(*deck , parseContext));
}
SetupSimple() :
deck( Opm::Parser{}.parseFile( "compressed_gridproperty.data", Opm::ParseContext{} ) ),
ecl( deck )
{}
Opm::DeckConstPtr deck;
Opm::EclipseStateConstPtr ecl;
Opm::Deck deck;
Opm::EclipseState ecl;
};
@ -60,7 +57,7 @@ struct TestFixture : public Setup
{
TestFixture()
: Setup ()
, grid (*ecl->getInputGrid())
, grid (ecl.getInputGrid())
, reltol(1.0e-10)
{
}

View File

@ -66,32 +66,32 @@ static Opm::EquilRecord mkEquilRecord( double datd, double datp,
auto dd = DeckItem::make< double >( "datdep" );
dd.push_back( datd );
auto dd_dim = std::make_shared< Opm::Dimension >( "dddim", 1 );
Opm::Dimension dd_dim( "dddim", 1 );
dd.push_backDimension( dd_dim, dd_dim );
auto dp = DeckItem::make< double >( "datps" );
dp.push_back( datp );
auto dp_dim = std::make_shared< Opm::Dimension >( "dpdim", 1 );
Opm::Dimension dp_dim( "dpdim", 1 );
dp.push_backDimension( dp_dim, dp_dim );
auto zw = DeckItem::make< double >( "zwoc" );
zw.push_back( zwoc );
auto zw_dim = std::make_shared< Opm::Dimension >( "zwdim", 1 );
Opm::Dimension zw_dim( "zwdim", 1 );
zw.push_backDimension( zw_dim, zw_dim );
auto pcow = DeckItem::make< double >( "pcow" );
pcow.push_back( pcow_woc );
auto pcow_dim = std::make_shared< Opm::Dimension >( "pcowdim", 1 );
Opm::Dimension pcow_dim( "pcowdim", 1 );
pcow.push_backDimension( pcow_dim, pcow_dim );
auto zg = DeckItem::make< double >( "zgoc" );
zg.push_back( zgoc );
auto zg_dim = std::make_shared< Opm::Dimension >( "zgdim", 1 );
Opm::Dimension zg_dim( "zgdim", 1 );
zg.push_backDimension( zg_dim, zg_dim );
auto pcgo = DeckItem::make< double >( "pcgo" );
pcgo.push_back( pcgo_goc );
auto pcgo_dim = std::make_shared< Opm::Dimension >( "pcgodim", 1 );
Opm::Dimension pcgo_dim( "pcgodim", 1 );
pcgo.push_backDimension( pcgo_dim, pcgo_dim );
auto i1 = DeckItem::make< int >( "i1" );
@ -364,9 +364,9 @@ BOOST_AUTO_TEST_CASE (DeckAllDead)
std::shared_ptr<UnstructuredGrid>
grid(create_grid_cart3d(1, 1, 10), destroy_grid);
Opm::ParseContext parseContext;
Opm::ParserPtr parser(new Opm::Parser() );
Opm::DeckConstPtr deck = parser->parseFile("deadfluids.DATA" , parseContext);
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext));
Opm::Parser parser;
Opm::Deck deck = parser.parseFile("deadfluids.DATA" , parseContext);
Opm::EclipseState eclipseState(deck, parseContext);
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, *grid, false);
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, *grid, 10.0);
const auto& pressures = comp.press();
@ -391,10 +391,10 @@ BOOST_AUTO_TEST_CASE (CapillaryInversion)
// Test setup.
Opm::GridManager gm(1, 1, 40, 1.0, 1.0, 2.5);
const UnstructuredGrid& grid = *(gm.c_grid());
Opm::ParserPtr parser(new Opm::Parser() );
Opm::Parser parser;
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck = parser->parseFile("capillary.DATA" , parseContext);
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
Opm::Deck deck = parser.parseFile("capillary.DATA" , parseContext);
Opm::EclipseState eclipseState(deck , parseContext);
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
// Test the capillary inversion for oil-water.
@ -445,10 +445,10 @@ BOOST_AUTO_TEST_CASE (DeckWithCapillary)
{
Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
const UnstructuredGrid& grid = *(gm.c_grid());
Opm::ParserPtr parser(new Opm::Parser() );
Opm::Parser parser;
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck = parser->parseFile("capillary.DATA" , parseContext);
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
Opm::Deck deck = parser.parseFile("capillary.DATA" , parseContext);
Opm::EclipseState eclipseState(deck , parseContext);
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 10.0);
@ -486,10 +486,10 @@ BOOST_AUTO_TEST_CASE (DeckWithCapillaryOverlap)
{
Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
const UnstructuredGrid& grid = *(gm.c_grid());
Opm::ParserPtr parser(new Opm::Parser() );
Opm::Parser parser;
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck = parser->parseFile("capillary_overlap.DATA" , parseContext);
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
Opm::Deck deck = parser.parseFile("capillary_overlap.DATA" , parseContext);
Opm::EclipseState eclipseState(deck , parseContext);
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665);
@ -549,10 +549,10 @@ BOOST_AUTO_TEST_CASE (DeckWithLiveOil)
{
Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
const UnstructuredGrid& grid = *(gm.c_grid());
Opm::ParserPtr parser(new Opm::Parser() );
Opm::Parser parser;
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck = parser->parseFile("equil_liveoil.DATA" , parseContext);
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
Opm::Deck deck = parser.parseFile("equil_liveoil.DATA" , parseContext);
Opm::EclipseState eclipseState(deck , parseContext);
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665);
@ -629,10 +629,10 @@ BOOST_AUTO_TEST_CASE (DeckWithLiveGas)
{
Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
const UnstructuredGrid& grid = *(gm.c_grid());
Opm::ParserPtr parser(new Opm::Parser() );
Opm::Parser parser;
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck = parser->parseFile("equil_livegas.DATA" , parseContext);
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
Opm::Deck deck = parser.parseFile("equil_livegas.DATA" , parseContext);
Opm::EclipseState eclipseState(deck , parseContext);
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665);
@ -712,10 +712,10 @@ BOOST_AUTO_TEST_CASE (DeckWithRSVDAndRVVD)
{
Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
const UnstructuredGrid& grid = *(gm.c_grid());
Opm::ParserPtr parser(new Opm::Parser() );
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck = parser->parseFile("equil_rsvd_and_rvvd.DATA", parseContext);
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
Opm::Parser parser;
Opm::Deck deck = parser.parseFile("equil_rsvd_and_rvvd.DATA", parseContext);
Opm::EclipseState eclipseState(deck , parseContext);
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665);

View File

@ -57,7 +57,7 @@ using namespace Opm;
further semantic meaning.
*/
void verify_norne_oil_pvt_region1(Opm::DeckConstPtr deck, Opm::EclipseStateConstPtr eclState) {
void verify_norne_oil_pvt_region1(const Opm::Deck& deck, const Opm::EclipseState& eclState) {
Opm::LiveOilPvt<double> oilPvt;
oilPvt.initFromDeck(deck, eclState);
@ -131,7 +131,7 @@ void verify_norne_oil_pvt_region1(Opm::DeckConstPtr deck, Opm::EclipseStateConst
}
void verify_norne_oil_pvt_region2(Opm::DeckConstPtr deck, Opm::EclipseStateConstPtr eclState) {
void verify_norne_oil_pvt_region2(const Opm::Deck& deck, const Opm::EclipseState& eclState) {
Opm::LiveOilPvt<double> oilPvt;
oilPvt.initFromDeck(deck, eclState);
@ -276,12 +276,11 @@ void verify_norne_oil_pvt_region2(Opm::DeckConstPtr deck, Opm::EclipseStateConst
BOOST_AUTO_TEST_CASE( Test_Norne_PVT) {
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }});
Opm::ParserPtr parser(new Parser());
Opm::Parser parser;
std::shared_ptr<const Deck> deck;
deck = parser->parseFile("norne_pvt.data", parseContext);
auto deck = parser.parseFile("norne_pvt.data", parseContext);
Opm::EclipseStateConstPtr eclState(new EclipseState(*deck, parseContext));
Opm::EclipseState eclState(deck, parseContext);
verify_norne_oil_pvt_region1( deck, eclState );
verify_norne_oil_pvt_region2( deck, eclState );

View File

@ -43,11 +43,11 @@ BOOST_AUTO_TEST_CASE(CreateParser)
{
const std::string filename1 = "testBlackoilState1.DATA";
Opm::ParseContext parseContext;
Opm::ParserPtr parser(new Opm::Parser() );
Opm::DeckConstPtr deck = parser->parseFile( filename1 , parseContext);
Opm::Parser parser;
Opm::Deck deck = parser.parseFile( filename1 , parseContext);
BOOST_CHECK_EQUAL( 6U , deck->size() );
const auto& actnum = deck->getKeyword("ACTNUM").getRecord(0).getItem(0);
BOOST_CHECK_EQUAL( 6U , deck.size() );
const auto& actnum = deck.getKeyword("ACTNUM").getRecord(0).getItem(0);
const std::vector<int>& actnum_data = actnum.getData< int >();
BOOST_CHECK_EQUAL( 1000U , actnum.size() );

View File

@ -51,18 +51,18 @@ using namespace Opm;
BOOST_AUTO_TEST_CASE(Processing)
{
const std::string filename="../tests/testPinch1.DATA";
Opm::ParserPtr parser(new Opm::Parser());
Opm::Parser parser;
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }});
Opm::DeckConstPtr deck = parser->parseFile(filename, parseContext);
std::shared_ptr<EclipseState> eclstate (new Opm::EclipseState(*deck, parseContext));
const auto& porv = eclstate->get3DProperties().getDoubleGridProperty("PORV").getData();
EclipseGridConstPtr eclgrid = eclstate->getInputGrid();
Opm::Deck deck = parser.parseFile(filename, parseContext);
EclipseState eclstate(deck, parseContext);
const auto& porv = eclstate.get3DProperties().getDoubleGridProperty("PORV").getData();
const auto& eclgrid = eclstate.getInputGrid();
BOOST_CHECK_EQUAL(eclgrid->getMinpvMode(), MinpvMode::EclSTD);
BOOST_CHECK_EQUAL(eclgrid.getMinpvMode(), MinpvMode::EclSTD);
const int nc_initial = eclgrid->getNumActive();
const int nc_initial = eclgrid.getNumActive();
Opm::GridManager gridM(*eclgrid, porv);
Opm::GridManager gridM(eclgrid, porv);
typedef UnstructuredGrid Grid;
const Grid& grid = *(gridM.c_grid());
const int* global_cell = Opm::UgGridHelpers::globalCell(grid);
@ -74,16 +74,16 @@ BOOST_AUTO_TEST_CASE(Processing)
Opm::RockFromDeck rock;
rock.init(eclstate, nc, global_cell, cart_dims);
const double minpv = eclgrid->getMinpvValue();
const double minpv = eclgrid.getMinpvValue();
BOOST_CHECK_EQUAL(minpv, 0.001);
const double thickness = eclgrid->getPinchThresholdThickness();
const double thickness = eclgrid.getPinchThresholdThickness();
BOOST_CHECK_EQUAL(thickness, 0.001);
auto transMode = eclgrid->getPinchOption();
auto transMode = eclgrid.getPinchOption();
BOOST_CHECK_EQUAL(transMode, PinchMode::ModeEnum::TOPBOT);
auto multzMode = eclgrid->getMultzOption();
auto multzMode = eclgrid.getMultzOption();
BOOST_CHECK_EQUAL(multzMode, PinchMode::ModeEnum::TOP);
PinchProcessor<Grid> pinch(minpv, thickness, transMode, multzMode);
@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(Processing)
std::vector<double> htrans(Opm::UgGridHelpers::numCellFaces(grid));
Grid* ug = const_cast<Grid*>(& grid);
tpfa_htrans_compute(ug, rock.permeability(), htrans.data());
const auto& transMult = eclstate->getTransMult();
const auto& transMult = eclstate.getTransMult();
std::vector<double> multz(nc, 0.0);
for (int i = 0; i < nc; ++i) {
multz[i] = transMult.getMultiplier(global_cell[i], Opm::FaceDir::ZPlus);

View File

@ -50,15 +50,14 @@ BOOST_AUTO_TEST_SUITE ()
BOOST_AUTO_TEST_CASE(diagnosis)
{
using namespace Opm;
EclipseStateConstPtr eclState;
ParserPtr parser(new Opm::Parser);
Parser parser;
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE },
{ ParseContext::PARSE_UNKNOWN_KEYWORD, InputError::IGNORE},
{ ParseContext::PARSE_RANDOM_TEXT, InputError::IGNORE}
});
Opm::DeckConstPtr deck(parser->parseFile("../tests/relpermDiagnostics.DATA", parseContext));
eclState.reset(new EclipseState(*deck, parseContext));
GridManager gm(*eclState->getInputGrid());
Opm::Deck deck = parser.parseFile("../tests/relpermDiagnostics.DATA", parseContext);
EclipseState eclState(deck, parseContext);
GridManager gm(eclState.getInputGrid());
const UnstructuredGrid& grid = *gm.c_grid();
std::shared_ptr<CounterLog> counterLog = std::make_shared<CounterLog>(Log::DefaultMessageTypes);
OpmLog::addBackend( "COUNTERLOG" , counterLog );

View File

@ -66,10 +66,10 @@ BOOST_AUTO_TEST_CASE (GwsegStandard)
Opm::GridManager gm(1, 1, 10, 1.0, 1.0, 5.0);
const UnstructuredGrid& grid = *(gm.c_grid());
Opm::ParserPtr parser(new Opm::Parser() );
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck = parser->parseFile("satfuncStandard.DATA", parseContext);
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
Opm::Parser parser;
Opm::Deck deck = parser.parseFile("satfuncStandard.DATA", parseContext);
Opm::EclipseState eclipseState(deck , parseContext);
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, param, false);
const int np = 3;
@ -152,10 +152,10 @@ BOOST_AUTO_TEST_CASE (GwsegEPSBase)
Opm::GridManager gm(1, 1, 10, 1.0, 1.0, 5.0);
const UnstructuredGrid& grid = *(gm.c_grid());
Opm::ParserPtr parser(new Opm::Parser() );
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck = parser->parseFile("satfuncEPSBase.DATA" , parseContext);
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
Opm::Parser parser;
Opm::Deck deck = parser.parseFile("satfuncEPSBase.DATA" , parseContext);
Opm::EclipseState eclipseState(deck , parseContext);
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, param, false);
const int np = 3;
@ -239,9 +239,9 @@ BOOST_AUTO_TEST_CASE (GwsegEPS_A)
Opm::GridManager gm(1, 1, 10, 1.0, 1.0, 5.0);
const UnstructuredGrid& grid = *(gm.c_grid());
Opm::ParseContext parseContext;
Opm::ParserPtr parser(new Opm::Parser() );
Opm::DeckConstPtr deck = parser->parseFile("satfuncEPS_A.DATA" , parseContext);
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
Opm::Parser parser;
Opm::Deck deck = parser.parseFile("satfuncEPS_A.DATA" , parseContext);
Opm::EclipseState eclipseState(deck , parseContext);
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, param, false);
const int np = 3;
@ -392,8 +392,8 @@ BOOST_AUTO_TEST_CASE (GwsegEPS_B)
Opm::GridManager gm(1, 1, 10, 1.0, 1.0, 5.0);
const UnstructuredGrid& grid = *(gm.c_grid());
Opm::ParserPtr parser(new Opm::Parser() );
Opm::DeckConstPtr deck = parser->parseFile("satfuncEPS_B.DATA");
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck));
const Opm::Deck& deck = parser->parseFile("satfuncEPS_B.DATA");
const Opm::EclipseState& eclipseState(new Opm::EclipseState(deck));
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, param, false);
const int np = props.numPhases();
@ -490,10 +490,10 @@ BOOST_AUTO_TEST_CASE (GwsegEPS_C)
Opm::GridManager gm(1, 1, 10, 1.0, 1.0, 5.0);
const UnstructuredGrid& grid = *(gm.c_grid());
Opm::ParserPtr parser(new Opm::Parser() );
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck = parser->parseFile("satfuncEPS_C.DATA", parseContext);
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
Opm::Parser parser;
Opm::Deck deck = parser.parseFile("satfuncEPS_C.DATA", parseContext);
Opm::EclipseState eclipseState(deck , parseContext);
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, param, false);
const int np = 3;
@ -593,10 +593,10 @@ BOOST_AUTO_TEST_CASE (GwsegEPS_D)
Opm::GridManager gm(1, 1, 10, 1.0, 1.0, 5.0);
const UnstructuredGrid& grid = *(gm.c_grid());
Opm::ParserPtr parser(new Opm::Parser() );
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck = parser->parseFile("satfuncEPS_D.DATA" , parseContext);
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
Opm::Parser parser;
Opm::Deck deck = parser.parseFile("satfuncEPS_D.DATA" , parseContext);
Opm::EclipseState eclipseState(deck , parseContext);
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, param, false);
const int np = 3;

View File

@ -43,12 +43,11 @@ using namespace Opm;
BOOST_AUTO_TEST_CASE(TestStoppedWells)
{
const std::string filename = "wells_stopped.data";
Opm::ParserPtr parser(new Opm::Parser());
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck(parser->parseFile(filename , parseContext));
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
Opm::GridManager gridManager(*eclipseState->getInputGrid());
Opm::Parser parser;
Opm::Deck deck(parser.parseFile(filename , parseContext));
Opm::EclipseState eclipseState(deck , parseContext);
Opm::GridManager gridManager(eclipseState.getInputGrid());
double target_surfacerate_inj;
double target_surfacerate_prod;

View File

@ -43,11 +43,11 @@
BOOST_AUTO_TEST_CASE(CreateTimer)
{
const std::string filename1 = "TESTTIMER.DATA";
Opm::ParserPtr parser(new Opm::Parser() );
Opm::ParseContext parseContext;
Opm::DeckConstPtr parserDeck = parser->parseFile( filename1 , parseContext);
Opm::Parser parser;
Opm::Deck parserDeck = parser.parseFile( filename1 , parseContext);
Opm::TimeMapPtr timeMap(new Opm::TimeMap(parserDeck));
Opm::TimeMap timeMap( parserDeck );
Opm::SimulatorTimer simtimer;
boost::gregorian::date defaultStartDate( 2012, 1, 1);

View File

@ -55,19 +55,19 @@ BOOST_AUTO_TEST_CASE(Equal) {
"EDIT\n"
"\n";
Opm::ParserPtr parser(new Opm::Parser() );
Opm::Parser parser;
Opm::DeckConstPtr deck1 = parser->parseFile( filename1 , parseContext);
Opm::EclipseState es1(*deck1, parseContext);
Opm::Deck deck1 = parser.parseFile( filename1 , parseContext);
Opm::EclipseState es1(deck1, parseContext);
Opm::DeckConstPtr deck2 = parser->parseString( deck2Data , parseContext);
Opm::EclipseState es2(*deck2, parseContext);
Opm::Deck deck2 = parser.parseString( deck2Data , parseContext);
Opm::EclipseState es2(deck2, parseContext);
BOOST_CHECK( deck1->hasKeyword("ZCORN") );
BOOST_CHECK( deck1->hasKeyword("COORD") );
BOOST_CHECK( deck1.hasKeyword("ZCORN") );
BOOST_CHECK( deck1.hasKeyword("COORD") );
Opm::GridManager grid1(*es1.getInputGrid());
Opm::GridManager grid2(*es2.getInputGrid());
Opm::GridManager grid1(es1.getInputGrid());
Opm::GridManager grid2(es2.getInputGrid());
const UnstructuredGrid* cgrid1 = grid1.c_grid();
const UnstructuredGrid* cgrid2 = grid2.c_grid();
@ -84,21 +84,21 @@ BOOST_AUTO_TEST_CASE(Equal) {
// TODO This method might be obsolete after using EclipseState to generate grid
BOOST_AUTO_TEST_CASE(EqualEclipseGrid) {
const std::string filename = "CORNERPOINT_ACTNUM.DATA";
Opm::ParserPtr parser(new Opm::Parser() );
Opm::Parser parser;
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck = parser->parseFile( filename , parseContext);
Opm::EclipseState es(*deck, parseContext);
Opm::Deck deck = parser.parseFile( filename , parseContext);
Opm::EclipseState es(deck, parseContext);
auto grid = es.getInputGrid();
Opm::GridManager gridM(*es.getInputGrid());
Opm::GridManager gridM(es.getInputGrid());
const UnstructuredGrid* cgrid1 = gridM.c_grid();
struct UnstructuredGrid * cgrid2;
{
struct grdecl g;
const auto& dimens = deck->getKeyword("DIMENS");
const auto& coord = deck->getKeyword("COORD");
const auto& zcorn = deck->getKeyword("ZCORN");
const auto& actnum = deck->getKeyword("ACTNUM");
const auto& dimens = deck.getKeyword("DIMENS");
const auto& coord = deck.getKeyword("COORD");
const auto& zcorn = deck.getKeyword("ZCORN");
const auto& actnum = deck.getKeyword("ACTNUM");
g.dims[0] = dimens.getRecord(0).getItem("NX").get< int >(0);
g.dims[1] = dimens.getRecord(0).getItem("NY").get< int >(0);
@ -157,21 +157,21 @@ BOOST_AUTO_TEST_CASE(TOPS_Fully_Specified) {
"EDIT\n"
"\n";
Opm::ParserPtr parser(new Opm::Parser());
Opm::Parser parser;
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck1 = parser->parseString(deck1Data, parseContext);
Opm::DeckConstPtr deck2 = parser->parseString(deck2Data, parseContext);
const Opm::Deck& deck1 = parser.parseString(deck1Data, parseContext);
const Opm::Deck& deck2 = parser.parseString(deck2Data, parseContext);
Opm::EclipseState es1(*deck1, parseContext);
Opm::EclipseState es2(*deck2, parseContext);
Opm::EclipseState es1(deck1, parseContext);
Opm::EclipseState es2(deck2, parseContext);
Opm::GridManager gridM1(*es1.getInputGrid());
Opm::GridManager gridM2(*es2.getInputGrid());
Opm::GridManager gridM1(es1.getInputGrid());
Opm::GridManager gridM2(es2.getInputGrid());
const UnstructuredGrid* cgrid1 = gridM1.c_grid();
const UnstructuredGrid* cgrid2 = gridM2.c_grid();
BOOST_CHECK(grid_equal(cgrid1, cgrid2));
Opm::EclipseGrid grid = Opm::UgGridHelpers::createEclipseGrid( *cgrid1 , *es1.getInputGrid( ) );
Opm::EclipseGrid grid = Opm::UgGridHelpers::createEclipseGrid( *cgrid1 , es1.getInputGrid( ) );
}

View File

@ -40,38 +40,38 @@
using namespace Opm;
BOOST_AUTO_TEST_CASE(AddWellsAndGroupToCollection) {
ParserPtr parser(new Parser());
Parser parser;
std::string scheduleFile("wells_group.data");
ParseContext parseContext;
DeckConstPtr deck = parser->parseFile(scheduleFile, parseContext);
EclipseStateConstPtr eclipseState(new EclipseState(*deck, parseContext));
Deck deck = parser.parseFile(scheduleFile, parseContext);
EclipseState eclipseState(deck, parseContext);
PhaseUsage pu = phaseUsageFromDeck(eclipseState);
GroupTreeNodePtr field=eclipseState->getSchedule()->getGroupTree(2).getNode("FIELD");
GroupTreeNodePtr g1=eclipseState->getSchedule()->getGroupTree(2).getNode("G1");
GroupTreeNodePtr g2=eclipseState->getSchedule()->getGroupTree(2).getNode("G2");
const auto& field=eclipseState.getSchedule().getGroupTree(2).getNode("FIELD");
const auto& g1=eclipseState.getSchedule().getGroupTree(2).getNode("G1");
const auto& g2=eclipseState.getSchedule().getGroupTree(2).getNode("G2");
WellCollection collection;
// Add groups to WellCollection
const auto& fieldGroup = eclipseState->getSchedule()->getGroup(field->name());
const auto& fieldGroup = eclipseState.getSchedule().getGroup(field->name());
collection.addField(fieldGroup, 2, pu);
for (auto iter = field->begin(); iter != field->end(); ++iter) {
const auto& childGroupNode = eclipseState->getSchedule()->getGroup((*iter).second->name());
const auto& childGroupNode = eclipseState.getSchedule().getGroup((*iter).second->name());
collection.addGroup(childGroupNode, fieldGroup.name(), 2, pu);
}
const auto& g1Group = eclipseState->getSchedule()->getGroup(g1->name());
const auto& g1Group = eclipseState.getSchedule().getGroup(g1->name());
for (auto iter = g1->begin(); iter != g1->end(); ++iter) {
const auto& childGroupNode = eclipseState->getSchedule()->getGroup((*iter).second->name());
const auto& childGroupNode = eclipseState.getSchedule().getGroup((*iter).second->name());
collection.addGroup(childGroupNode, g1Group.name(), 2, pu);
}
const auto& g2Group = eclipseState->getSchedule()->getGroup(g2->name());
const auto& g2Group = eclipseState.getSchedule().getGroup(g2->name());
for (auto iter = g2->begin(); iter != g2->end(); ++iter) {
auto childGroupNode = eclipseState->getSchedule()->getGroup((*iter).second->name());
const auto& childGroupNode = eclipseState.getSchedule().getGroup((*iter).second->name());
collection.addGroup(childGroupNode, g2Group.name(), 2, pu);
}
@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE(AddWellsAndGroupToCollection) {
// Add wells to WellCollection
WellCollection wellCollection;
auto wells = eclipseState->getSchedule()->getWells();
auto wells = eclipseState.getSchedule().getWells();
for (size_t i=0; i<wells.size(); i++) {
collection.addWell(wells[i], 2, pu);
}

View File

@ -48,14 +48,14 @@
using namespace Opm;
BOOST_AUTO_TEST_CASE(ConstructGroupFromWell) {
ParserPtr parser(new Parser());
std::string scheduleFile("wells_group.data");
ParseContext parseContext;
DeckConstPtr deck = parser->parseFile(scheduleFile, parseContext);
EclipseStateConstPtr eclipseState(new EclipseState(*deck , parseContext));
Parser parser;
Deck deck = parser.parseFile(scheduleFile, parseContext);
EclipseState eclipseState(deck , parseContext);
PhaseUsage pu = phaseUsageFromDeck(eclipseState);
auto wells = eclipseState->getSchedule()->getWells();
auto wells = eclipseState.getSchedule().getWells();
for (size_t i=0; i<wells.size(); i++) {
const auto* well = wells[i];
@ -81,17 +81,17 @@ BOOST_AUTO_TEST_CASE(ConstructGroupFromWell) {
BOOST_AUTO_TEST_CASE(ConstructGroupFromGroup) {
ParserPtr parser(new Parser());
Parser parser;
ParseContext parseContext;
std::string scheduleFile("wells_group.data");
DeckConstPtr deck = parser->parseFile(scheduleFile, parseContext);
EclipseStateConstPtr eclipseState(new EclipseState(*deck , parseContext));
Deck deck = parser.parseFile(scheduleFile, parseContext);
EclipseState eclipseState(deck , parseContext);
PhaseUsage pu = phaseUsageFromDeck(eclipseState);
auto nodes = eclipseState->getSchedule()->getGroupTree(2).getNodes();
auto nodes = eclipseState.getSchedule().getGroupTree(2).getNodes();
for (size_t i=0; i<nodes.size(); i++) {
const auto& group = eclipseState->getSchedule()->getGroup(nodes[i]->name());
const auto& group = eclipseState.getSchedule().getGroup(nodes[i]->name());
std::shared_ptr<WellsGroupInterface> wellsGroup = createGroupWellsGroup(group, 2, pu);
BOOST_CHECK_EQUAL(group.name(), wellsGroup->name());
if (group.isInjectionGroup(2)) {

View File

@ -177,12 +177,12 @@ void check_controls_epoch3(struct WellControls ** ctrls) {
BOOST_AUTO_TEST_CASE(New_Constructor_Works) {
const std::string filename = "wells_manager_data.data";
Opm::ParserPtr parser(new Opm::Parser());
Opm::Parser parser;
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck(parser->parseFile(filename, parseContext));
Opm::Deck deck = parser.parseFile(filename, parseContext);
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext));
Opm::GridManager gridManager(*eclipseState->getInputGrid());
Opm::EclipseState eclipseState(deck, parseContext);
Opm::GridManager gridManager(eclipseState.getInputGrid());
{
Opm::WellsManager wellsManager(eclipseState, 0, *gridManager.c_grid(), NULL);
@ -214,12 +214,11 @@ BOOST_AUTO_TEST_CASE(New_Constructor_Works) {
BOOST_AUTO_TEST_CASE(WellsEqual) {
const std::string filename = "wells_manager_data.data";
Opm::ParserPtr parser(new Opm::Parser());
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck(parser->parseFile(filename, parseContext));
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext));
Opm::GridManager gridManager(*eclipseState->getInputGrid());
Opm::Parser parser;
Opm::Deck deck(parser.parseFile(filename, parseContext));
Opm::EclipseState eclipseState(deck, parseContext);
Opm::GridManager gridManager(eclipseState.getInputGrid());
Opm::WellsManager wellsManager0(eclipseState, 0, *gridManager.c_grid(), NULL);
Opm::WellsManager wellsManager1(eclipseState, 1, *gridManager.c_grid(), NULL);
@ -231,11 +230,10 @@ BOOST_AUTO_TEST_CASE(WellsEqual) {
BOOST_AUTO_TEST_CASE(ControlsEqual) {
const std::string filename = "wells_manager_data.data";
Opm::ParseContext parseContext;
Opm::ParserPtr parser(new Opm::Parser());
Opm::DeckConstPtr deck(parser->parseFile(filename, parseContext));
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext));
Opm::GridManager gridManager(*eclipseState->getInputGrid());
Opm::Parser parser;
Opm::Deck deck(parser.parseFile(filename, parseContext));
Opm::EclipseState eclipseState(deck, parseContext);
Opm::GridManager gridManager(eclipseState.getInputGrid());
Opm::WellsManager wellsManager0(eclipseState, 0, *gridManager.c_grid(), NULL);
Opm::WellsManager wellsManager1(eclipseState, 1, *gridManager.c_grid(), NULL);
@ -253,12 +251,11 @@ BOOST_AUTO_TEST_CASE(ControlsEqual) {
BOOST_AUTO_TEST_CASE(WellShutOK) {
const std::string filename = "wells_manager_data.data";
Opm::ParserPtr parser(new Opm::Parser());
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck(parser->parseFile(filename, parseContext));
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext));
Opm::GridManager gridManager(*eclipseState->getInputGrid());
Opm::Parser parser;
Opm::Deck deck(parser.parseFile(filename, parseContext));
Opm::EclipseState eclipseState(deck, parseContext);
Opm::GridManager gridManager(eclipseState.getInputGrid());
Opm::WellsManager wellsManager2(eclipseState, 2, *gridManager.c_grid(), NULL);
@ -270,12 +267,11 @@ BOOST_AUTO_TEST_CASE(WellShutOK) {
BOOST_AUTO_TEST_CASE(WellSTOPOK) {
const std::string filename = "wells_manager_data_wellSTOP.data";
Opm::ParserPtr parser(new Opm::Parser());
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck(parser->parseFile(filename, parseContext));
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext));
Opm::GridManager gridManager(*eclipseState->getInputGrid());
Opm::Parser parser;
Opm::Deck deck(parser.parseFile(filename, parseContext));
Opm::EclipseState eclipseState(deck, parseContext);
Opm::GridManager gridManager(eclipseState.getInputGrid());
Opm::WellsManager wellsManager(eclipseState, 0, *gridManager.c_grid(), NULL);

View File

@ -196,7 +196,7 @@ std::shared_ptr<Opm::BlackoilState> createBlackOilState(Opm::EclipseGridConstPtr
return blackoilState;
}
Opm::EclipseWriterPtr createEclipseWriter(Opm::DeckConstPtr deck,
Opm::EclipseWriterPtr createEclipseWriter(const Opm::Deck& deck,
Opm::EclipseStatePtr eclipseState,
std::string& eclipse_data_filename) {
@ -255,7 +255,7 @@ BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData)
Opm::Parser parser;
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck = parser.parseString(input, parseContext);
const Opm::Deck& deck = parser.parseString(input, parseContext);
Opm::EclipseStatePtr eclipseState(new Opm::EclipseState(deck , parseContext));
Opm::EclipseWriterPtr eclipseWriter = createEclipseWriter(deck, eclipseState, eclipse_data_filename);

View File

@ -136,15 +136,15 @@ std::shared_ptr<Opm::BlackoilState> createBlackOilState(Opm::EclipseGridConstPtr
}
Opm::DeckConstPtr createDeck(const std::string& eclipse_data_filename) {
const Opm::Deck createDeck(const std::string& eclipse_data_filename) {
Opm::ParserPtr parser(new Opm::Parser());
Opm::DeckConstPtr deck = parser->parseFile(eclipse_data_filename , Opm::ParseContext());
const Opm::Deck& deck = parser->parseFile(eclipse_data_filename , Opm::ParseContext());
return deck;
}
Opm::EclipseWriterPtr createEclipseWriter(Opm::DeckConstPtr deck,
Opm::EclipseWriterPtr createEclipseWriter(const Opm::Deck& deck,
Opm::EclipseStatePtr eclipseState,
std::string& eclipse_data_filename) {
@ -172,7 +172,7 @@ BOOST_AUTO_TEST_CASE(EclipseWriteRestartWellInfo)
test_work_area_copy_file(test_area, eclipse_data_filename.c_str());
Opm::ParseContext parseContext;
Opm::DeckConstPtr deck = createDeck(eclipse_data_filename);
const Opm::Deck deck = createDeck(eclipse_data_filename);
Opm::EclipseStatePtr eclipseState(new Opm::EclipseState(deck , parseContext));
Opm::EclipseWriterPtr eclipseWriter = createEclipseWriter(deck, eclipseState, eclipse_data_filename);