Writing output should not change the state

Therefore we take const parameters across the board. (This is a
follow-up to the patch which declared the UnstructuredGrid const).
This commit is contained in:
Roland Kaufmann committed 2013-11-25 14:14:50 +01:00
1 parent eb276f79e1
commit d83d7d829c
6 files changed
+26 -26

No files matched your search

+3 -3
View File
@@ -46,7 +46,7 @@ private:
/// Psuedo-constructor, can appear in template
template <typename Format> unique_ptr <OutputWriter>
create (const ParameterGroup& params,
std::shared_ptr <EclipseGridParser> parser,
std::shared_ptr <const EclipseGridParser> parser,
std::shared_ptr <const UnstructuredGrid> grid) {
return unique_ptr <OutputWriter> (new Format (params, parser, grid));
}
@@ -59,7 +59,7 @@ create (const ParameterGroup& params,
/// to the list below!
typedef map <const char*, unique_ptr <OutputWriter> (*)(
const ParameterGroup&,
std::shared_ptr <EclipseGridParser>,
std::shared_ptr <const EclipseGridParser>,
std::shared_ptr <const UnstructuredGrid>)> map_t;
map_t FORMATS = {
{ "output_ecl", &create <EclipseWriter> },
@@ -69,7 +69,7 @@ map_t FORMATS = {
unique_ptr <OutputWriter>
OutputWriter::create (const ParameterGroup& params,
std::shared_ptr <EclipseGridParser> parser,
std::shared_ptr <const EclipseGridParser> parser,
std::shared_ptr <const UnstructuredGrid> grid) {
// allocate a list which will be filled with writers. this list
// is initially empty (no output).
+1 -1
View File
@@ -92,7 +92,7 @@ public:
*/
static std::unique_ptr <OutputWriter>
create (const parameter::ParameterGroup& params,
std::shared_ptr <EclipseGridParser> parser,
std::shared_ptr <const EclipseGridParser> parser,
std::shared_ptr <const UnstructuredGrid> grid);
};
+1 -1
View File
@@ -903,7 +903,7 @@ void EclipseWriter::writeTimeStep(
EclipseWriter::EclipseWriter (
const ParameterGroup& params,
std::shared_ptr <EclipseGridParser> parser,
std::shared_ptr <const EclipseGridParser> parser,
std::shared_ptr <const UnstructuredGrid> grid)
: parser_ (parser)
, grid_ (grid)
+2 -2
View File
@@ -61,7 +61,7 @@ public:
* binary files using ERT.
*/
EclipseWriter(const parameter::ParameterGroup& params,
std::shared_ptr <EclipseGridParser> parser,
std::shared_ptr <const EclipseGridParser> parser,
std::shared_ptr <const UnstructuredGrid> grid);
/*!
@@ -81,7 +81,7 @@ public:
const WellState& wellState);
private:
std::shared_ptr <EclipseGridParser> parser_;
std::shared_ptr <const EclipseGridParser> parser_;
std::shared_ptr <const UnstructuredGrid> grid_;
std::string outputDir_;
std::string baseName_;
+4 -4
View File
@@ -30,11 +30,11 @@ using namespace Opm;
SimulatorOutputBase::SimulatorOutputBase (
const parameter::ParameterGroup& params,
std::shared_ptr <EclipseGridParser> parser,
std::shared_ptr <const EclipseGridParser> parser,
std::shared_ptr <const UnstructuredGrid> grid,
std::shared_ptr <SimulatorTimer> timer,
std::shared_ptr <BlackoilState> state,
std::shared_ptr <WellState> wellState)
std::shared_ptr <const SimulatorTimer> timer,
std::shared_ptr <const BlackoilState> state,
std::shared_ptr <const WellState> wellState)
// store all parameters passed into the object, making them curried
// parameters to the writeOutput function.
+15 -15
View File
@@ -53,11 +53,11 @@ protected:
* need to pick them up from the object members.
*/
SimulatorOutputBase (const parameter::ParameterGroup& p,
std::shared_ptr <EclipseGridParser> parser,
std::shared_ptr <const EclipseGridParser> parser,
std::shared_ptr <const UnstructuredGrid> grid,
std::shared_ptr <SimulatorTimer> timer,
std::shared_ptr <BlackoilState> state,
std::shared_ptr <WellState> wellState);
std::shared_ptr <const SimulatorTimer> timer,
std::shared_ptr <const BlackoilState> state,
std::shared_ptr <const WellState> wellState);
/**
* We need a destructor in the compilation unit to avoid the
@@ -74,9 +74,9 @@ protected:
operator std::function <void ()> ();
/// Just hold a reference to these objects that are owned elsewhere.
std::shared_ptr <SimulatorTimer> timer_;
std::shared_ptr <BlackoilState> reservoirState_;
std::shared_ptr <WellState> wellState_;
std::shared_ptr <const SimulatorTimer> timer_;
std::shared_ptr <const BlackoilState> reservoirState_;
std::shared_ptr <const WellState> wellState_;
/// Created locally and destructed together with us
std::unique_ptr <OutputWriter> writer_;
@@ -139,11 +139,11 @@ private:
template <typename Simulator>
struct SimulatorOutput : public SimulatorOutputBase {
SimulatorOutput (const parameter::ParameterGroup& params,
std::shared_ptr <EclipseGridParser> parser,
std::shared_ptr <const EclipseGridParser> parser,
std::shared_ptr <const UnstructuredGrid> grid,
std::shared_ptr <SimulatorTimer> timer,
std::shared_ptr <BlackoilState> state,
std::shared_ptr <WellState> wellState,
std::shared_ptr <const SimulatorTimer> timer,
std::shared_ptr <const BlackoilState> state,
std::shared_ptr <const WellState> wellState,
std::shared_ptr <Simulator> sim)
// send all other parameters to base class
: SimulatorOutputBase (params, parser, grid, timer, state, wellState)
@@ -161,11 +161,11 @@ struct SimulatorOutput : public SimulatorOutputBase {
* the arguments passed exceeds the lifetime of this object.
*/
SimulatorOutput (const parameter::ParameterGroup& params,
EclipseGridParser& parser,
const EclipseGridParser& parser,
const UnstructuredGrid& grid,
SimulatorTimer& timer,
BlackoilState& state,
WellState& wellState,
const SimulatorTimer& timer,
const BlackoilState& state,
const WellState& wellState,
Simulator& sim)
// send all other parameters to base class
: SimulatorOutputBase (params,