Use std::array<> in PhaseUsage

This commit is contained in:
Joakim Hove 2021-04-26 18:16:16 +02:00
parent 708645a2c0
commit 29673a168d
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);