variableState: Don't form objects when references suffice

There's no need to form new objects, especially for the 'xvar', when
there are existing objects to which read-only references can be
bound.
This commit is contained in:
Bård Skaflestad 2014-05-27 18:42:58 +02:00
parent eccc5c9694
commit 78b87b8857

View File

@ -530,10 +530,10 @@ namespace {
if (active_[ Gas]) {
// Define Sg Rs and Rv in terms of xvar.
ADB rsSat = fluidRsSat(state.pressure, cells_);
ADB rvSat = fluidRvSat(state.pressure, cells_);
ADB xvar = vars[ nextvar++ ];
ADB sg = isSg*xvar + isRv* so;
const ADB& rsSat = fluidRsSat(state.pressure, cells_);
const ADB& rvSat = fluidRvSat(state.pressure, cells_);
const ADB& xvar = vars[ nextvar++ ];
const ADB& sg = isSg*xvar + isRv* so;
state.saturation[ pu.phase_pos[ Gas ] ] = sg;
so = so - sg;