Simplify diagonal component thresholding

This commit switches the assignment

    diagonal = max(diagonal, minval)

to using a reference in the "diagonal" expression.  This guarantees
that the indexing is done once which eases maintainability.  While
here, replace the hard-coded dimension stride ('3') with the current
run-time dimension.  This is mostly for symmetry because the overall
code is only really supported in three space dimension.
This commit is contained in:
Bård Skaflestad 2014-08-22 15:12:12 +02:00
parent e63e28a4f2
commit e037142b01

View File

@ -121,8 +121,10 @@ namespace Opm
// K(i,j) = (*tensor[kmap[kix]])[glob];
permeability_[off + (i + dim*j)] = (*tensor[kmap[kix]])[glob];
}
// K(i,i) = std::max(K(i,i), perm_threshold);
permeability_[off + 3*i + i] = std::max(permeability_[off + 3*i + i], perm_threshold);
double& kii = permeability_[off + i*(dim + 1)];
kii = std::max(kii, perm_threshold);
}
permfield_valid_[c] = std::vector<unsigned char>::value_type(1);