mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Fixing PR comments
- Use std::vector<HydroCarbonState> instead of std::vector<int> - Use the initializer list to initialize members in constructors - Fix indent - Return OilOnly for cases without gas to avoid potential trouble further down the line
This commit is contained in:
parent
2a40563c7b
commit
79fd23700e
@ -21,10 +21,11 @@ BlackoilState::BlackoilState( size_t num_cells , size_t num_faces , size_t num_p
|
|||||||
}
|
}
|
||||||
|
|
||||||
BlackoilState::BlackoilState( const BlackoilState& other )
|
BlackoilState::BlackoilState( const BlackoilState& other )
|
||||||
: SimulationDataContainer(other)
|
: SimulationDataContainer(other),
|
||||||
|
hydrocarbonstate_(other.hydroCarbonState())
|
||||||
{
|
{
|
||||||
setBlackoilStateReferencePointers();
|
setBlackoilStateReferencePointers();
|
||||||
hydrocarbonstate_ = other.hydroCarbonState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BlackoilState& BlackoilState::operator=( const BlackoilState& other )
|
BlackoilState& BlackoilState::operator=( const BlackoilState& other )
|
||||||
|
@ -68,12 +68,12 @@ enum HydroCarbonState {
|
|||||||
std::vector<double>& surfacevol () { return *surfacevol_ref_; }
|
std::vector<double>& surfacevol () { return *surfacevol_ref_; }
|
||||||
std::vector<double>& gasoilratio () { return *gasoilratio_ref_; }
|
std::vector<double>& gasoilratio () { return *gasoilratio_ref_; }
|
||||||
std::vector<double>& rv () { return *rv_ref_; }
|
std::vector<double>& rv () { return *rv_ref_; }
|
||||||
std::vector<int>& hydroCarbonState() { return hydrocarbonstate_; }
|
std::vector<HydroCarbonState>& hydroCarbonState() { return hydrocarbonstate_; }
|
||||||
|
|
||||||
const std::vector<double>& surfacevol () const { return *surfacevol_ref_; }
|
const std::vector<double>& surfacevol () const { return *surfacevol_ref_; }
|
||||||
const std::vector<double>& gasoilratio () const { return *gasoilratio_ref_; }
|
const std::vector<double>& gasoilratio () const { return *gasoilratio_ref_; }
|
||||||
const std::vector<double>& rv () const { return *rv_ref_; }
|
const std::vector<double>& rv () const { return *rv_ref_; }
|
||||||
const std::vector<int>& hydroCarbonState() const { return hydrocarbonstate_; }
|
const std::vector<HydroCarbonState>& hydroCarbonState() const { return hydrocarbonstate_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setBlackoilStateReferencePointers();
|
void setBlackoilStateReferencePointers();
|
||||||
@ -82,7 +82,7 @@ enum HydroCarbonState {
|
|||||||
std::vector<double>* rv_ref_;
|
std::vector<double>* rv_ref_;
|
||||||
|
|
||||||
// A vector storing the hydro carbon state.
|
// A vector storing the hydro carbon state.
|
||||||
std::vector<int> hydrocarbonstate_;
|
std::vector<HydroCarbonState> hydrocarbonstate_;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -10,12 +10,14 @@ void initHydroCarbonState(BlackoilState& state, const PhaseUsage& pu, const int
|
|||||||
enum { Oil = BlackoilPhases::Liquid, Gas = BlackoilPhases::Vapour, Water = BlackoilPhases::Aqua };
|
enum { Oil = BlackoilPhases::Liquid, Gas = BlackoilPhases::Vapour, Water = BlackoilPhases::Aqua };
|
||||||
// hydrocarbonstate is only used when gas and oil is present
|
// hydrocarbonstate is only used when gas and oil is present
|
||||||
assert(pu.phase_used[Oil]);
|
assert(pu.phase_used[Oil]);
|
||||||
if (!pu.phase_used[Gas]) {
|
std::vector<HydroCarbonState>& hydroCarbonState = state.hydroCarbonState();
|
||||||
return; // do nothing
|
|
||||||
}
|
|
||||||
std::vector<int>& hydroCarbonState = state.hydroCarbonState();
|
|
||||||
const int np = pu.num_phases;
|
|
||||||
hydroCarbonState.resize(num_cells);
|
hydroCarbonState.resize(num_cells);
|
||||||
|
if (!pu.phase_used[Gas]) {
|
||||||
|
// hydroCarbonState should only be used when oil and gas is present. Return OilOnly to avoid potential trouble.
|
||||||
|
std::fill(hydroCarbonState.begin(), hydroCarbonState.end(), HydroCarbonState::OilOnly);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const int np = pu.num_phases;
|
||||||
std::fill(hydroCarbonState.begin(), hydroCarbonState.end(), HydroCarbonState::GasAndOil);
|
std::fill(hydroCarbonState.begin(), hydroCarbonState.end(), HydroCarbonState::GasAndOil);
|
||||||
|
|
||||||
// set hydrocarbon state
|
// set hydrocarbon state
|
||||||
|
Loading…
Reference in New Issue
Block a user