diff --git a/opm/core/simulator/BlackoilState.cpp b/opm/core/simulator/BlackoilState.cpp index 1dd0c1edc..b210af6e5 100644 --- a/opm/core/simulator/BlackoilState.cpp +++ b/opm/core/simulator/BlackoilState.cpp @@ -4,11 +4,16 @@ using namespace Opm; void -BlackoilState::init(int number_of_cells, int number_of_phases, int num_phases) { - SimulatorState::init(number_of_cells, number_of_phases, num_phases); - gor_.resize(number_of_cells, 0.) ; - rv_.resize(number_of_cells,0.); +BlackoilState::init(int number_of_cells, int number_of_phases, int num_phases) +{ + SimulatorState::init(number_of_cells, number_of_phases, num_phases); + + // register cell data in base class + gorId_ = SimulatorState::registerCellData( "GASOILRATIO", 1 ); + rvId_ = SimulatorState::registerCellData( "RV", 1 ); + // surfvol_ intentionally empty, left to initBlackoilSurfvol + surfaceVolId_ = SimulatorState::registerCellData( "SURFACEVOL", 0 ); } void diff --git a/opm/core/simulator/BlackoilState.hpp b/opm/core/simulator/BlackoilState.hpp index ea9c968a4..c5c6bdab6 100644 --- a/opm/core/simulator/BlackoilState.hpp +++ b/opm/core/simulator/BlackoilState.hpp @@ -32,8 +32,10 @@ namespace Opm class BlackoilState : public SimulatorState { public: + using SimulatorState :: cellData ; + virtual void init(const UnstructuredGrid& grid, int num_phases); - + virtual void init(int number_of_cells, int number_of_faces, int num_phases); /// Set the first saturation to either its min or max value in @@ -47,18 +49,22 @@ namespace Opm virtual bool equals(const SimulatorState& other, double epsilon = 1e-8) const; - std::vector& surfacevol () { return surfvol_; } - std::vector& gasoilratio () { return gor_ ; } - std::vector& rv () {return rv_ ; } + std::vector& surfacevol () { return cellData()[ surfaceVolId_ ]; } + std::vector& gasoilratio () { return cellData()[ gorId_ ] ; } + std::vector& rv () {return cellData()[ rvId_ ] ; } - const std::vector& surfacevol () const { return surfvol_; } - const std::vector& gasoilratio () const { return gor_ ; } - const std::vector& rv () const {return rv_ ; } + const std::vector& surfacevol () const { return cellData()[ surfaceVolId_ ]; } + const std::vector& gasoilratio () const { return cellData()[ gorId_ ] ; } + const std::vector& rv () const { return cellData()[ rvId_ ] ; } private: - std::vector surfvol_; // no entries = no cells * no phases - std::vector gor_ ; // no entries = no cells - std::vector rv_ ; // no entries = no cells + int gorId_ ; // no entries = no cells (gas oil ratio id) + int rvId_ ; // no entries = no cells ( rv id ) + int surfaceVolId_ ; // no entries = no cells * no phases (surfaceVol id ) + + //std::vector surfvol_; // no entries = no cells * no phases + //std::vector gor_ ; // no entries = no cells + //std::vector rv_ ; // no entries = no cells }; } // namespace Opm