mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
- instead of dict.lookup(name) >> val;
can use dict.readEntry(name, val);
for checking of input token sizes.
This helps catch certain types of input errors:
{
key1 ; // <- Missing value
key2 1234 // <- Missing ';' terminator
key3 val;
}
STYLE: readIfPresent() instead of 'if found ...' in a few more places.
This commit is contained in:
@ -362,7 +362,7 @@ int main(int argc, char *argv[])
|
||||
/"processor" + Foam::name(Pstream::myProcNo());
|
||||
}
|
||||
wordList sourcePatches;
|
||||
dict.lookup("sourcePatches") >> sourcePatches;
|
||||
dict.readEntry("sourcePatches", sourcePatches);
|
||||
|
||||
if (sourcePatches.size() == 1)
|
||||
{
|
||||
@ -581,7 +581,7 @@ int main(int argc, char *argv[])
|
||||
labelList exposedPatchID;
|
||||
if (mode == PATCH)
|
||||
{
|
||||
dict.lookup("exposedPatchName") >> backPatchName;
|
||||
dict.readEntry("exposedPatchName", backPatchName);
|
||||
exposedPatchID.setSize
|
||||
(
|
||||
extrudePatch.size(),
|
||||
|
||||
@ -1514,7 +1514,7 @@ int main(int argc, char *argv[])
|
||||
const bool hasZones = dict.found("faceZones");
|
||||
if (hasZones)
|
||||
{
|
||||
dict.lookup("faceZones") >> zoneNames;
|
||||
dict.readEntry("faceZones", zoneNames);
|
||||
dict.readIfPresent("faceZonesShadow", zoneShadowNames);
|
||||
|
||||
// Check
|
||||
@ -1528,7 +1528,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
dict.lookup("faceSets") >> zoneNames;
|
||||
dict.readEntry("faceSets", zoneNames);
|
||||
dict.readIfPresent("faceSetsShadow", zoneShadowNames);
|
||||
}
|
||||
|
||||
|
||||
@ -71,10 +71,9 @@ Foam::surfaceOffsetLinearDistance::surfaceOffsetLinearDistance
|
||||
totalDistance_(),
|
||||
totalDistanceSqr_()
|
||||
{
|
||||
if (coeffsDict().found("totalDistanceCoeff"))
|
||||
if (coeffsDict().readIfPresent("totalDistanceCoeff", totalDistance_))
|
||||
{
|
||||
totalDistance_ =
|
||||
coeffsDict().get<scalar>("totalDistanceCoeff") * defaultCellSize;
|
||||
totalDistance_ *= defaultCellSize;
|
||||
|
||||
if (coeffsDict().found("linearDistanceCoeff"))
|
||||
{
|
||||
@ -84,11 +83,10 @@ Foam::surfaceOffsetLinearDistance::surfaceOffsetLinearDistance
|
||||
<< nl << exit(FatalError) << endl;
|
||||
}
|
||||
}
|
||||
else if (coeffsDict().found("linearDistanceCoeff"))
|
||||
else if (coeffsDict().readIfPresent("linearDistanceCoeff", totalDistance_))
|
||||
{
|
||||
totalDistance_ =
|
||||
coeffsDict().get<scalar>("linearDistanceCoeff") * defaultCellSize
|
||||
+ surfaceOffset_;
|
||||
totalDistance_ *= defaultCellSize;
|
||||
totalDistance_ += surfaceOffset_;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -749,7 +749,7 @@ int main(int argc, char *argv[])
|
||||
<< endl;
|
||||
}
|
||||
|
||||
renumberDict.lookup("writeMaps") >> writeMaps;
|
||||
renumberDict.readEntry("writeMaps", writeMaps);
|
||||
if (writeMaps)
|
||||
{
|
||||
Info<< "Writing renumber maps (new to old) to polyMesh." << nl
|
||||
|
||||
Reference in New Issue
Block a user