Use new parser for reading time map and generating output

This commit is contained in:
Roland Kaufmann
2014-04-01 14:32:30 +02:00
parent 5371e19d19
commit a4c168e58e
2 changed files with 16 additions and 10 deletions

View File

@@ -20,7 +20,8 @@
#include "SimulatorOutput.hpp"
// we need complete definitions for these types
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/core/io/OutputWriter.hpp>
#include <opm/core/simulator/SimulatorTimer.hpp>
@@ -30,7 +31,7 @@ using namespace Opm;
SimulatorOutputBase::SimulatorOutputBase (
const parameter::ParameterGroup& params,
std::shared_ptr <EclipseGridParser> parser,
std::shared_ptr <const Deck> parser,
std::shared_ptr <const UnstructuredGrid> grid,
std::shared_ptr <const SimulatorTimer> timer,
std::shared_ptr <const SimulatorState> state,
@@ -53,9 +54,14 @@ SimulatorOutputBase::SimulatorOutputBase (
// timesteps, we make a list of accumulated such to compare with
// current time. add an extra zero at the beginning so that the
// initial state is also written
const std::vector <double>& tstep = parser->getTSTEP ().tstep_;
times_.resize (tstep.size (), 0.);
std::partial_sum (tstep.begin(), tstep.end(), times_.begin());
TimeMap tmap(parser);
times_.resize (tmap.size () + 1, 0.);
double sum = 0.;
times_[0] = sum;
for (size_t step = 0; step < tmap.numTimesteps(); ++step) {
sum += tmap.getTimePassedUntil (step);
times_[step + 1] = sum;
}
// write the static initialization files, even before simulation starts
writer_->writeInit (*timer, *state, *wellState);

View File

@@ -32,7 +32,7 @@ struct UnstructuredGrid;
namespace Opm {
// forward definitions
class EclipseGridParser;
class Deck;
class OutputWriter;
namespace parameter { class ParameterGroup; }
class SimulatorState;
@@ -53,7 +53,7 @@ protected:
* need to pick them up from the object members.
*/
SimulatorOutputBase (const parameter::ParameterGroup& p,
std::shared_ptr <EclipseGridParser> parser,
std::shared_ptr <const Deck> parser,
std::shared_ptr <const UnstructuredGrid> grid,
std::shared_ptr <const SimulatorTimer> timer,
std::shared_ptr <const SimulatorState> state,
@@ -110,7 +110,7 @@ private:
* ParameterGroup params (argc, argv, false);
*
* // input file
* auto deck = make_shared <EclipseGridParser> ( ... );
* auto deck = make_shared <const Deck> ( ... );
* const GridManager manager (*parser);
* auto grid = share_obj (*manager.c_grid ());
*
@@ -139,7 +139,7 @@ private:
template <typename Simulator>
struct SimulatorOutput : public SimulatorOutputBase {
SimulatorOutput (const parameter::ParameterGroup& params,
std::shared_ptr <EclipseGridParser> parser,
std::shared_ptr <const Deck> parser,
std::shared_ptr <const UnstructuredGrid> grid,
std::shared_ptr <const SimulatorTimer> timer,
std::shared_ptr <const SimulatorState> state,
@@ -161,7 +161,7 @@ struct SimulatorOutput : public SimulatorOutputBase {
* the arguments passed exceeds the lifetime of this object.
*/
SimulatorOutput (const parameter::ParameterGroup& params,
EclipseGridParser& parser,
const Deck& parser,
const UnstructuredGrid& grid,
const SimulatorTimer& timer,
const SimulatorState& state,