do not pass the deck to the output writers anymore
I'd prefer to pass it for consistency reasons (because basically every other class which takes an EclipseState object also requires a deck object), but some people seem to have a very strong option about this...
This commit is contained in:
@@ -47,12 +47,10 @@ private:
|
|||||||
/// Psuedo-constructor, can appear in template
|
/// Psuedo-constructor, can appear in template
|
||||||
template <typename Format> unique_ptr <OutputWriter>
|
template <typename Format> unique_ptr <OutputWriter>
|
||||||
create (const ParameterGroup& params,
|
create (const ParameterGroup& params,
|
||||||
std::shared_ptr <const Deck> deck,
|
|
||||||
std::shared_ptr <const EclipseState> eclipseState,
|
std::shared_ptr <const EclipseState> eclipseState,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
std::shared_ptr <const UnstructuredGrid> grid) {
|
std::shared_ptr <const UnstructuredGrid> grid) {
|
||||||
return unique_ptr <OutputWriter> (new Format (params,
|
return unique_ptr <OutputWriter> (new Format (params,
|
||||||
deck,
|
|
||||||
eclipseState,
|
eclipseState,
|
||||||
phaseUsage,
|
phaseUsage,
|
||||||
grid->number_of_cells,
|
grid->number_of_cells,
|
||||||
@@ -67,7 +65,6 @@ create (const ParameterGroup& params,
|
|||||||
/// to the list below!
|
/// to the list below!
|
||||||
typedef map <const char*, unique_ptr <OutputWriter> (*)(
|
typedef map <const char*, unique_ptr <OutputWriter> (*)(
|
||||||
const ParameterGroup&,
|
const ParameterGroup&,
|
||||||
std::shared_ptr <const Deck> deck,
|
|
||||||
std::shared_ptr <const EclipseState> eclipseState,
|
std::shared_ptr <const EclipseState> eclipseState,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
std::shared_ptr <const UnstructuredGrid>)> map_t;
|
std::shared_ptr <const UnstructuredGrid>)> map_t;
|
||||||
@@ -79,7 +76,6 @@ map_t FORMATS = {
|
|||||||
|
|
||||||
unique_ptr <OutputWriter>
|
unique_ptr <OutputWriter>
|
||||||
OutputWriter::create (const ParameterGroup& params,
|
OutputWriter::create (const ParameterGroup& params,
|
||||||
std::shared_ptr <const Deck> deck,
|
|
||||||
std::shared_ptr <const EclipseState> eclipseState,
|
std::shared_ptr <const EclipseState> eclipseState,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
std::shared_ptr <const UnstructuredGrid> grid) {
|
std::shared_ptr <const UnstructuredGrid> grid) {
|
||||||
@@ -97,7 +93,7 @@ OutputWriter::create (const ParameterGroup& params,
|
|||||||
// invoke the constructor for the type if we found the keyword
|
// invoke the constructor for the type if we found the keyword
|
||||||
// and put the pointer to this writer onto the list
|
// and put the pointer to this writer onto the list
|
||||||
if (params.getDefault <bool> (name, false)) {
|
if (params.getDefault <bool> (name, false)) {
|
||||||
list->push_front (it->second (params, deck, eclipseState, phaseUsage, grid));
|
list->push_front (it->second (params, eclipseState, phaseUsage, grid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
#define OPM_OUTPUT_WRITER_HPP
|
#define OPM_OUTPUT_WRITER_HPP
|
||||||
|
|
||||||
#include <memory> // unique_ptr, shared_ptr
|
#include <memory> // unique_ptr, shared_ptr
|
||||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
|
||||||
#include <opm/core/simulator/SimulatorTimerInterface.hpp>
|
#include <opm/core/simulator/SimulatorTimerInterface.hpp>
|
||||||
|
|
||||||
struct UnstructuredGrid;
|
struct UnstructuredGrid;
|
||||||
@@ -108,7 +107,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
static std::unique_ptr <OutputWriter>
|
static std::unique_ptr <OutputWriter>
|
||||||
create (const parameter::ParameterGroup& params,
|
create (const parameter::ParameterGroup& params,
|
||||||
std::shared_ptr <const Deck> deck,
|
|
||||||
std::shared_ptr <const EclipseState> eclipseState,
|
std::shared_ptr <const EclipseState> eclipseState,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
std::shared_ptr <const UnstructuredGrid> grid);
|
std::shared_ptr <const UnstructuredGrid> grid);
|
||||||
|
|||||||
@@ -449,8 +449,7 @@ public:
|
|||||||
// on the classes defined in the following.
|
// on the classes defined in the following.
|
||||||
|
|
||||||
// add rate variables for each of the well in the input file
|
// add rate variables for each of the well in the input file
|
||||||
void addAllWells(Opm::DeckConstPtr deck,
|
void addAllWells(Opm::EclipseStateConstPtr eclipseState,
|
||||||
Opm::EclipseStateConstPtr eclipseState,
|
|
||||||
const PhaseUsage& uses);
|
const PhaseUsage& uses);
|
||||||
void writeTimeStep(int writeStepIdx,
|
void writeTimeStep(int writeStepIdx,
|
||||||
const SimulatorTimerInterface& timer,
|
const SimulatorTimerInterface& timer,
|
||||||
@@ -994,8 +993,7 @@ void Summary::writeTimeStep(int writeStepIdx,
|
|||||||
ecl_sum_fwrite(ertHandle());
|
ecl_sum_fwrite(ertHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Summary::addAllWells(Opm::DeckConstPtr deck,
|
void Summary::addAllWells(Opm::EclipseStateConstPtr eclipseState,
|
||||||
Opm::EclipseStateConstPtr eclipseState,
|
|
||||||
const PhaseUsage& uses)
|
const PhaseUsage& uses)
|
||||||
{
|
{
|
||||||
eclipseState_ = eclipseState;
|
eclipseState_ = eclipseState;
|
||||||
@@ -1174,7 +1172,7 @@ void EclipseWriter::writeInit(const SimulatorTimerInterface &timer)
|
|||||||
eclGrid->getNX(),
|
eclGrid->getNX(),
|
||||||
eclGrid->getNY(),
|
eclGrid->getNY(),
|
||||||
eclGrid->getNZ()));
|
eclGrid->getNZ()));
|
||||||
summary_->addAllWells(deck_, eclipseState_, phaseUsage_);
|
summary_->addAllWells(eclipseState_, phaseUsage_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// implementation of the writeTimeStep method
|
// implementation of the writeTimeStep method
|
||||||
@@ -1341,13 +1339,11 @@ void EclipseWriter::writeTimeStep(const SimulatorTimerInterface& timer,
|
|||||||
|
|
||||||
|
|
||||||
EclipseWriter::EclipseWriter(const parameter::ParameterGroup& params,
|
EclipseWriter::EclipseWriter(const parameter::ParameterGroup& params,
|
||||||
Opm::DeckConstPtr deck,
|
|
||||||
Opm::EclipseStateConstPtr eclipseState,
|
Opm::EclipseStateConstPtr eclipseState,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
int numCells,
|
int numCells,
|
||||||
const int* compressedToCartesianCellIdx)
|
const int* compressedToCartesianCellIdx)
|
||||||
: deck_(deck)
|
: eclipseState_(eclipseState)
|
||||||
, eclipseState_(eclipseState)
|
|
||||||
, numCells_(numCells)
|
, numCells_(numCells)
|
||||||
, compressedToCartesianCellIdx_(compressedToCartesianCellIdx)
|
, compressedToCartesianCellIdx_(compressedToCartesianCellIdx)
|
||||||
, gridToEclipseIdx_(numCells, int(-1) )
|
, gridToEclipseIdx_(numCells, int(-1) )
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ public:
|
|||||||
* binary files using ERT.
|
* binary files using ERT.
|
||||||
*/
|
*/
|
||||||
EclipseWriter(const parameter::ParameterGroup& params,
|
EclipseWriter(const parameter::ParameterGroup& params,
|
||||||
Opm::DeckConstPtr deck,
|
|
||||||
Opm::EclipseStateConstPtr eclipseState,
|
Opm::EclipseStateConstPtr eclipseState,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
int numCells,
|
int numCells,
|
||||||
@@ -107,7 +106,6 @@ public:
|
|||||||
static ert_ecl_unit_enum convertUnitTypeErtEclUnitEnum(UnitSystem::UnitType unit);
|
static ert_ecl_unit_enum convertUnitTypeErtEclUnitEnum(UnitSystem::UnitType unit);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Opm::DeckConstPtr deck_;
|
|
||||||
Opm::EclipseStateConstPtr eclipseState_;
|
Opm::EclipseStateConstPtr eclipseState_;
|
||||||
int numCells_;
|
int numCells_;
|
||||||
std::array<int, 3> cartesianSize_;
|
std::array<int, 3> cartesianSize_;
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ using namespace Opm;
|
|||||||
|
|
||||||
SimulatorOutputBase::SimulatorOutputBase (
|
SimulatorOutputBase::SimulatorOutputBase (
|
||||||
const parameter::ParameterGroup& params,
|
const parameter::ParameterGroup& params,
|
||||||
std::shared_ptr <const Deck> deck,
|
|
||||||
std::shared_ptr <const EclipseState> eclipseState,
|
std::shared_ptr <const EclipseState> eclipseState,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
std::shared_ptr <const UnstructuredGrid> grid,
|
std::shared_ptr <const UnstructuredGrid> grid,
|
||||||
@@ -46,7 +45,7 @@ SimulatorOutputBase::SimulatorOutputBase (
|
|||||||
|
|
||||||
// process parameters into a writer. we don't setup a new chain in
|
// process parameters into a writer. we don't setup a new chain in
|
||||||
// every timestep!
|
// every timestep!
|
||||||
, writer_ (std::move (OutputWriter::create (params, deck, eclipseState, phaseUsage, grid)))
|
, writer_ (std::move (OutputWriter::create (params, eclipseState, phaseUsage, grid)))
|
||||||
|
|
||||||
// always start from the first timestep
|
// always start from the first timestep
|
||||||
, next_ (0) {
|
, next_ (0) {
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ protected:
|
|||||||
* need to pick them up from the object members.
|
* need to pick them up from the object members.
|
||||||
*/
|
*/
|
||||||
SimulatorOutputBase (const parameter::ParameterGroup& p,
|
SimulatorOutputBase (const parameter::ParameterGroup& p,
|
||||||
std::shared_ptr <const Deck> deck,
|
|
||||||
std::shared_ptr <const EclipseState> eclipseState,
|
std::shared_ptr <const EclipseState> eclipseState,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
std::shared_ptr <const UnstructuredGrid> grid,
|
std::shared_ptr <const UnstructuredGrid> grid,
|
||||||
@@ -146,7 +145,6 @@ private:
|
|||||||
template <typename Simulator>
|
template <typename Simulator>
|
||||||
struct SimulatorOutput : public SimulatorOutputBase {
|
struct SimulatorOutput : public SimulatorOutputBase {
|
||||||
SimulatorOutput (const parameter::ParameterGroup& params,
|
SimulatorOutput (const parameter::ParameterGroup& params,
|
||||||
std::shared_ptr <const Deck> deck,
|
|
||||||
std::shared_ptr <const EclipseState> eclipseState,
|
std::shared_ptr <const EclipseState> eclipseState,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
std::shared_ptr <const UnstructuredGrid> grid,
|
std::shared_ptr <const UnstructuredGrid> grid,
|
||||||
@@ -155,7 +153,7 @@ struct SimulatorOutput : public SimulatorOutputBase {
|
|||||||
std::shared_ptr <const WellState> wellState,
|
std::shared_ptr <const WellState> wellState,
|
||||||
std::shared_ptr <Simulator> sim)
|
std::shared_ptr <Simulator> sim)
|
||||||
// send all other parameters to base class
|
// send all other parameters to base class
|
||||||
: SimulatorOutputBase (params, deck, eclipseState, phaseUsage,
|
: SimulatorOutputBase (params, eclipseState, phaseUsage,
|
||||||
grid, timer, state, wellState)
|
grid, timer, state, wellState)
|
||||||
|
|
||||||
// store reference to simulator in derived class
|
// store reference to simulator in derived class
|
||||||
@@ -171,7 +169,6 @@ struct SimulatorOutput : public SimulatorOutputBase {
|
|||||||
* the arguments passed exceeds the lifetime of this object.
|
* the arguments passed exceeds the lifetime of this object.
|
||||||
*/
|
*/
|
||||||
SimulatorOutput (const parameter::ParameterGroup& params,
|
SimulatorOutput (const parameter::ParameterGroup& params,
|
||||||
const Deck& deck,
|
|
||||||
const EclipseState& eclipseState,
|
const EclipseState& eclipseState,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
const UnstructuredGrid& grid,
|
const UnstructuredGrid& grid,
|
||||||
@@ -181,7 +178,6 @@ struct SimulatorOutput : public SimulatorOutputBase {
|
|||||||
Simulator& sim)
|
Simulator& sim)
|
||||||
// send all other parameters to base class
|
// send all other parameters to base class
|
||||||
: SimulatorOutputBase (params,
|
: SimulatorOutputBase (params,
|
||||||
share_obj (deck),
|
|
||||||
share_obj (eclipseState),
|
share_obj (eclipseState),
|
||||||
phaseUsage,
|
phaseUsage,
|
||||||
share_obj (grid),
|
share_obj (grid),
|
||||||
|
|||||||
@@ -136,7 +136,6 @@ std::shared_ptr<Opm::EclipseWriter> createEclipseWriter(std::shared_ptr<const Op
|
|||||||
const UnstructuredGrid &ourFinerUnstructuredGrid = *ourFineGridManagerPtr->c_grid();
|
const UnstructuredGrid &ourFinerUnstructuredGrid = *ourFineGridManagerPtr->c_grid();
|
||||||
|
|
||||||
std::shared_ptr<Opm::EclipseWriter> eclipseWriter = std::make_shared<Opm::EclipseWriter>(params,
|
std::shared_ptr<Opm::EclipseWriter> eclipseWriter = std::make_shared<Opm::EclipseWriter>(params,
|
||||||
deck,
|
|
||||||
eclipseState,
|
eclipseState,
|
||||||
phaseUsage,
|
phaseUsage,
|
||||||
ourFinerUnstructuredGrid.number_of_cells,
|
ourFinerUnstructuredGrid.number_of_cells,
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ void createEclipseWriter(const char *deckString)
|
|||||||
|
|
||||||
Opm::PhaseUsage phaseUsage = Opm::phaseUsageFromDeck(deck);
|
Opm::PhaseUsage phaseUsage = Opm::phaseUsageFromDeck(deck);
|
||||||
eclWriter.reset(new Opm::EclipseWriter(params,
|
eclWriter.reset(new Opm::EclipseWriter(params,
|
||||||
deck,
|
|
||||||
eclipseState,
|
eclipseState,
|
||||||
phaseUsage,
|
phaseUsage,
|
||||||
ourFinerUnstructuredGrid.number_of_cells,
|
ourFinerUnstructuredGrid.number_of_cells,
|
||||||
|
|||||||
@@ -151,7 +151,6 @@ Opm::EclipseWriterPtr createEclipseWriter(Opm::DeckConstPtr deck,
|
|||||||
const Opm::PhaseUsage phaseUsage = Opm::phaseUsageFromDeck(deck);
|
const Opm::PhaseUsage phaseUsage = Opm::phaseUsageFromDeck(deck);
|
||||||
|
|
||||||
Opm::EclipseWriterPtr eclWriter(new Opm::EclipseWriter(params,
|
Opm::EclipseWriterPtr eclWriter(new Opm::EclipseWriter(params,
|
||||||
deck,
|
|
||||||
eclipseState,
|
eclipseState,
|
||||||
phaseUsage,
|
phaseUsage,
|
||||||
eclipseState->getEclipseGrid()->getCartesianSize(),
|
eclipseState->getEclipseGrid()->getCartesianSize(),
|
||||||
|
|||||||
Reference in New Issue
Block a user