Merge pull request #3185 from joakim-hove/phaseusage-std-array

Use std::array<> in PhaseUsage
This commit is contained in:
Bård Skaflestad 2021-04-26 23:43:01 +02:00 committed by GitHub
commit e258e69802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -20,6 +20,7 @@
#ifndef OPM_BLACKOILPHASES_HEADER_INCLUDED
#define OPM_BLACKOILPHASES_HEADER_INCLUDED
#include <array>
namespace Opm
{
@ -42,9 +43,10 @@ namespace Opm
struct PhaseUsage : public BlackoilPhases
{
std::array<int, MaxNumPhases + NumCryptoPhases> phase_used;
std::array<int, MaxNumPhases + NumCryptoPhases> phase_pos;
int num_phases;
int phase_used[MaxNumPhases + NumCryptoPhases];
int phase_pos[MaxNumPhases + NumCryptoPhases];
bool has_solvent;
bool has_polymer;
bool has_energy;

View File

@ -34,7 +34,7 @@ namespace Opm
/// Determine the active phases
inline PhaseUsage phaseUsage(const Phases& phases) {
PhaseUsage pu;
std::fill(pu.phase_used, pu.phase_used + BlackoilPhases::MaxNumPhases + BlackoilPhases::NumCryptoPhases, 0);
pu.phase_used.fill(0);
// Discover phase usage.
pu.phase_used[BlackoilPhases::Aqua] = phases.active(Phase::WATER);