STYLE: reduced usage of Switch

- Since 'bool' and 'Switch' use the _identical_ input mechanism
  (ie, both accept true/false, on/off, yes/no, none, 1/0), the main
  reason to prefer one or the other is the output.

  The output for Switch is as text (eg, "true"), whereas for bool
  it is label (0 or 1). If the output is required for a dictionary,
  Switch may be appropriate. If the output is not required, or is only
  used for Pstream exchange, bool can be more appropriate.
This commit is contained in:
Mark Olesen
2018-06-01 20:51:48 +02:00
parent 0f60cc9263
commit 84b109219a
72 changed files with 227 additions and 319 deletions

View File

@ -13,9 +13,11 @@ IOdictionary gravitationalProperties
);
const dimensionedVector g(gravitationalProperties.lookup("g"));
const Switch rotating(gravitationalProperties.lookup("rotating"));
const bool rotating(gravitationalProperties.get<bool>("rotating"));
const dimensionedVector Omega =
(
rotating ? gravitationalProperties.lookup("Omega")
: dimensionedVector("Omega", -dimTime, vector(0,0,0));
: dimensionedVector("Omega", -dimTime, vector(0,0,0))
);
const dimensionedScalar magg = mag(g);
const dimensionedVector gHat = g/magg;

View File

@ -1,5 +1,5 @@
IOporosityModelList pZones(mesh);
Switch pressureImplicitPorosity(false);
bool pressureImplicitPorosity(false);
// nUCorrectors used for pressureImplicitPorosity
int nUCorr = 0;