mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -37,7 +37,6 @@ Description
|
||||
#include "triSurfaceSearch.H"
|
||||
#include "argList.H"
|
||||
#include "Fstream.H"
|
||||
#include "Switch.H"
|
||||
#include "IOdictionary.H"
|
||||
#include "boundBox.H"
|
||||
#include "indexedOctree.H"
|
||||
@ -102,10 +101,8 @@ int main(int argc, char *argv[])
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
Switch addFaceNeighbours
|
||||
(
|
||||
meshSubsetDict.lookup("addFaceNeighbours")
|
||||
);
|
||||
const bool addFaceNeighbours =
|
||||
meshSubsetDict.get<bool>("addFaceNeighbours");
|
||||
|
||||
const bool invertSelection =
|
||||
meshSubsetDict.lookupOrDefault("invertSelection", false);
|
||||
@ -231,7 +228,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
fileName surfName(surfDict.lookup("name"));
|
||||
|
||||
Switch outside(surfDict.lookup("outside"));
|
||||
const bool outside(surfDict.get<bool>("outside"));
|
||||
|
||||
if (outside)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user