simulator.hpp
Go to the documentation of this file.
1#ifndef OPM_VERTEQ_SIMULATOR_HPP_INCLUDED
2#define OPM_VERTEQ_SIMULATOR_HPP_INCLUDED
3
4// Copyright (C) 2013 Uni Research AS
5// This file is licensed under the GNU General Public License v3.0
6
7#include <memory> // unique_ptr
8#include <vector>
9
10#ifndef OPM_VERTEQ_VISIBILITY_HPP_INCLUDED
12#endif /* OPM_VERTEQ_VISIBILITY_HPP_INCLUDED */
13
14#ifndef OPM_SIMULATORREPORT_HEADER_INCLUDED
15#include <opm/core/simulator/SimulatorReport.hpp>
16#endif /* OPM_SIMULATORREPORT_HEADER_INCLUDED */
17
18#ifndef OPM_VERTEQ_OPMFWD_HPP_INCLUDED
19#include <opm/verteq/opmfwd.hpp>
20#endif /* OPM_VERTEQ_OPMFWD_HPP_INCLUDED */
21
22namespace Opm {
23
45 virtual void init (
46 const parameter::ParameterGroup& param,
47 const UnstructuredGrid& grid,
48 const IncompPropertiesInterface& props,
49 const RockCompressibility* rock_comp_props,
50 WellsManager& wells_manager,
51 const std::vector<double>& src,
52 const FlowBoundaryConditions* bcs,
53 LinearSolverInterface& linsolver,
54 const double* gravity) = 0;
55
59 virtual ~Simulator () {}
60
72 virtual SimulatorReport run(
73 SimulatorTimer& timer,
74 TwophaseState& state,
75 WellState& well_state) = 0;
76
85 virtual Event& timestep_completed () = 0;
86
95 virtual void sync () = 0;
96};
97
106template <typename T>
113 virtual void init (
114 const parameter::ParameterGroup& param,
115 const UnstructuredGrid& grid,
116 const IncompPropertiesInterface& props,
117 const RockCompressibility* rock_comp_props,
118 WellsManager& wells_manager,
119 const std::vector<double>& src,
120 const FlowBoundaryConditions* bcs,
121 LinearSolverInterface& linsolver,
122 const double* gravity) {
123 t_ = std::unique_ptr <T> (new T (param, grid, props, rock_comp_props,
124 wells_manager, src, bcs, linsolver,
125 gravity));
126 }
127
128 // forward all method to the underlaying instance
129 virtual SimulatorReport run(
130 SimulatorTimer& timer,
131 TwophaseState& state,
132 WellState& well_state) {
133 return t_->run (timer, state, well_state);
134 }
135 virtual Event& timestep_completed () {
136 return t_->timestep_completed ();
137 }
138 virtual void sync () {
139 t_->sync ();
140 }
141
142private:
143 std::unique_ptr <T> t_;
144};
145
146} /* namespace Opm */
147
148#endif /* OPM_VERTEQ_SIMULATOR_HPP_INCLUDED */
#define OPM_VERTEQ_PUBLIC
Definition: exc.hpp:19
Definition: opmfwd.hpp:15
Definition: simulator.hpp:107
virtual void init(const parameter::ParameterGroup &param, const UnstructuredGrid &grid, const IncompPropertiesInterface &props, const RockCompressibility *rock_comp_props, WellsManager &wells_manager, const std::vector< double > &src, const FlowBoundaryConditions *bcs, LinearSolverInterface &linsolver, const double *gravity)
Definition: simulator.hpp:113
virtual Event & timestep_completed()
Definition: simulator.hpp:135
virtual void sync()
Definition: simulator.hpp:138
virtual SimulatorReport run(SimulatorTimer &timer, TwophaseState &state, WellState &well_state)
Definition: simulator.hpp:129
Definition: simulator.hpp:31
virtual void init(const parameter::ParameterGroup &param, const UnstructuredGrid &grid, const IncompPropertiesInterface &props, const RockCompressibility *rock_comp_props, WellsManager &wells_manager, const std::vector< double > &src, const FlowBoundaryConditions *bcs, LinearSolverInterface &linsolver, const double *gravity)=0
virtual Event & timestep_completed()=0
virtual SimulatorReport run(SimulatorTimer &timer, TwophaseState &state, WellState &well_state)=0
virtual ~Simulator()
Definition: simulator.hpp:59
virtual void sync()=0