mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-27 17:50:59 -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 )
|
||||
: SimulationDataContainer(other)
|
||||
: SimulationDataContainer(other),
|
||||
hydrocarbonstate_(other.hydroCarbonState())
|
||||
{
|
||||
setBlackoilStateReferencePointers();
|
||||
hydrocarbonstate_ = other.hydroCarbonState();
|
||||
|
||||
}
|
||||
|
||||
BlackoilState& BlackoilState::operator=( const BlackoilState& other )
|
||||
|
@ -30,11 +30,11 @@
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
enum HydroCarbonState {
|
||||
GasOnly = 0,
|
||||
GasAndOil = 1,
|
||||
OilOnly = 2
|
||||
};
|
||||
enum HydroCarbonState {
|
||||
GasOnly = 0,
|
||||
GasAndOil = 1,
|
||||
OilOnly = 2
|
||||
};
|
||||
|
||||
/// Simulator state for a blackoil simulator.
|
||||
class BlackoilState : public SimulationDataContainer
|
||||
@ -68,12 +68,12 @@ enum HydroCarbonState {
|
||||
std::vector<double>& surfacevol () { return *surfacevol_ref_; }
|
||||
std::vector<double>& gasoilratio () { return *gasoilratio_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>& gasoilratio () const { return *gasoilratio_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:
|
||||
void setBlackoilStateReferencePointers();
|
||||
@ -82,7 +82,7 @@ enum HydroCarbonState {
|
||||
std::vector<double>* rv_ref_;
|
||||
|
||||
// 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 };
|
||||
// hydrocarbonstate is only used when gas and oil is present
|
||||
assert(pu.phase_used[Oil]);
|
||||
if (!pu.phase_used[Gas]) {
|
||||
return; // do nothing
|
||||
}
|
||||
std::vector<int>& hydroCarbonState = state.hydroCarbonState();
|
||||
const int np = pu.num_phases;
|
||||
std::vector<HydroCarbonState>& hydroCarbonState = state.hydroCarbonState();
|
||||
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);
|
||||
|
||||
// set hydrocarbon state
|
||||
|
Loading…
Reference in New Issue
Block a user