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:
@ -297,7 +297,7 @@ int main(int argc, char *argv[])
|
||||
autoPtr<extrudeModel> model(extrudeModel::New(dict));
|
||||
|
||||
// Whether to flip normals
|
||||
const Switch flipNormals(dict.lookup("flipNormals"));
|
||||
const bool flipNormals(dict.get<bool>("flipNormals"));
|
||||
|
||||
// What to extrude
|
||||
const ExtrudeMode mode = ExtrudeModeNames.lookup
|
||||
@ -983,8 +983,7 @@ int main(int argc, char *argv[])
|
||||
// Merging front and back patch faces
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Switch mergeFaces(dict.lookup("mergeFaces"));
|
||||
if (mergeFaces)
|
||||
if (dict.get<bool>("mergeFaces"))
|
||||
{
|
||||
if (mode == MESH)
|
||||
{
|
||||
@ -1009,7 +1008,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
|
||||
polyTopoChanger stitcher(mesh);
|
||||
stitcher.setSize(1);
|
||||
|
||||
|
||||
@ -1536,8 +1536,8 @@ int main(int argc, char *argv[])
|
||||
mappedPatchBase::sampleMode sampleMode =
|
||||
mappedPatchBase::sampleModeNames_[dict.lookup("sampleMode")];
|
||||
|
||||
const Switch oneD(dict.lookup("oneD"));
|
||||
Switch oneDNonManifoldEdges(false);
|
||||
const bool oneD(dict.get<bool>("oneD"));
|
||||
bool oneDNonManifoldEdges(false);
|
||||
word oneDPatchType(emptyPolyPatch::typeName);
|
||||
if (oneD)
|
||||
{
|
||||
@ -1545,7 +1545,7 @@ int main(int argc, char *argv[])
|
||||
dict.lookup("oneDPolyPatchType") >> oneDPatchType;
|
||||
}
|
||||
|
||||
const Switch adaptMesh(dict.lookup("adaptMesh"));
|
||||
const bool adaptMesh(dict.get<bool>("adaptMesh"));
|
||||
|
||||
if (hasZones)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user