Added phaseName() method.

This commit is contained in:
Atgeirr Flø Rasmussen 2015-09-30 12:48:16 +02:00
parent aac34009e1
commit 4f72bfdbcf
2 changed files with 19 additions and 0 deletions

View File

@ -208,6 +208,9 @@ namespace Opm {
/// The number of active phases in the model.
int numPhases() const;
/// The name of an active phase in the model.
const std::string& phaseName(int phase_index) const;
/// Update the scaling factors for mass balance equations
void updateEquationsScaling();
@ -274,6 +277,7 @@ namespace Opm {
std::vector<int> primalVariable_;
V pvdt_;
std::vector<std::string> phase_name_;
// --------- Protected methods ---------

View File

@ -179,7 +179,9 @@ namespace detail {
ADB::null(),
{ 1.1169, 1.0031, 0.0031 }} ) // the default magic numbers
, terminal_output_ (terminal_output)
, phase_name_{ "Water", "Oil", "Gas" }
{
assert(numPhases() == 3); // Due to the phase_name_ init above.
#if HAVE_MPI
if ( linsolver_.parallelInformation().type() == typeid(ParallelISTLInformation) )
{
@ -284,6 +286,19 @@ namespace detail {
template <class Grid, class Implementation>
const std::string&
BlackoilModelBase<Grid, Implementation>::
phaseName(int phase_index) const
{
assert(phase_index < numPhases());
return phase_name_[phase_index];
}
template <class Grid, class Implementation>
void
BlackoilModelBase<Grid, Implementation>::