mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: adjustments to Switch
- align Switch more with Enum.
Now have find(), found() static methods.
Constructors with failsafe option.
The find() method makes for clearer coding:
OLD
Switch sw(some_string, true); // NB: true = allowBad
if (sw.valid()) ...
NOW
Switch sw = Switch::find(some_string);
if (sw.good()) ...
or
if (Switch::found(some_string)) ...
- improve construct from dictionary to handle all valid token types.
Previously just read in a word.
- Remove asText() method - replaced by c_str() and str() several
versions ago.
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -279,16 +279,9 @@ int main(int argc, char *argv[])
|
||||
surfaceIntersection::NONE
|
||||
);
|
||||
|
||||
const Switch writeObj = surfaceDict.lookupOrDefault<Switch>
|
||||
(
|
||||
"writeObj",
|
||||
Switch::OFF
|
||||
);
|
||||
const Switch writeVTK = surfaceDict.lookupOrDefault<Switch>
|
||||
(
|
||||
"writeVTK",
|
||||
Switch::OFF
|
||||
);
|
||||
const Switch writeObj("writeObj", surfaceDict, Switch::OFF);
|
||||
|
||||
const Switch writeVTK("writeVTK", surfaceDict, Switch::OFF);
|
||||
|
||||
// The "surfaces" entry is normally optional, but make it mandatory
|
||||
// if the dictionary name doesn't have an extension
|
||||
|
||||
Reference in New Issue
Block a user