Aesthetics: Turn if-else into switch()

This commit replaces an if-else-based query of the primaryVariable_
with the equivalent switch() statement for uniformity with the rest
of the implementation.
This commit is contained in:
Bård Skaflestad 2014-07-07 17:02:14 +02:00
parent 0f663dfe9f
commit a3bc595a91

View File

@ -417,14 +417,18 @@ namespace {
if (active_[ Gas ]){
for (int c = 0; c < nc ; c++ ) {
if ( primalVariable_[c] == PrimalVariables::RS ) {
switch (primalVariable_[c]) {
case PrimalVariables::RS:
isRs[c] = 1;
}
else if ( primalVariable_[c] == PrimalVariables::RV ) {
break;
case PrimalVariables::RV:
isRv[c] = 1;
}
else {
break;
default:
isSg[c] = 1;
break;
}
}
@ -1192,15 +1196,19 @@ namespace {
V isRv = V::Zero(nc,1);
V isSg = V::Zero(nc,1);
if (active_[Gas]) {
for (int c = 0; c < nc ; c++ ) {
if ( primalVariable_[c] == PrimalVariables::RS ) {
for (int c = 0; c < nc; ++c) {
switch (primalVariable_[c]) {
case PrimalVariables::RS:
isRs[c] = 1;
}
else if ( primalVariable_[c] == PrimalVariables::RV ) {
break;
case PrimalVariables::RV:
isRv[c] = 1;
}
else {
break;
default:
isSg[c] = 1;
break;
}
}
}