mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: avoid unrestricted dictionary lookup in conversion, sampling, surfMesh
- aids with detection of excess tokens (issue #762) - deprecated dictionary::operator[] in favour of the lookup() method which offers more flexibilty and clarity of purpose. Additionally, the read<> and get<> forms should generally be used instead anyhow.
This commit is contained in:
@ -21,23 +21,8 @@
|
|||||||
|
|
||||||
if (io.typeHeaderOk<IOdictionary>(true))
|
if (io.typeHeaderOk<IOdictionary>(true))
|
||||||
{
|
{
|
||||||
IOdictionary timeObject
|
const label timeIndex = IOdictionary(io).get<label>("index");
|
||||||
(
|
timeName = Foam::name(timeIndex);
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"time",
|
|
||||||
runTime.timeName(),
|
|
||||||
"uniform",
|
|
||||||
runTime,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
label index;
|
|
||||||
timeObject.lookup("index") >> index;
|
|
||||||
timeName = Foam::name(index);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -46,4 +31,3 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Info<< "\nTime [" << timeName << "] = " << runTime.timeName() << nl;
|
Info<< "\nTime [" << timeName << "] = " << runTime.timeName() << nl;
|
||||||
|
|
||||||
|
|||||||
@ -21,23 +21,8 @@
|
|||||||
|
|
||||||
if (io.typeHeaderOk<IOdictionary>(true))
|
if (io.typeHeaderOk<IOdictionary>(true))
|
||||||
{
|
{
|
||||||
IOdictionary timeObject
|
const label timeIndex = IOdictionary(io).get<label>("index");
|
||||||
(
|
timeName = Foam::name(timeIndex);
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"time",
|
|
||||||
runTime.timeName(),
|
|
||||||
"uniform",
|
|
||||||
runTime,
|
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
label index;
|
|
||||||
timeObject.lookup("index") >> index;
|
|
||||||
timeName = Foam::name(index);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -48,4 +33,3 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Info<< "\nTime [" << timeName << "] = " << runTime.timeName() << nl;
|
Info<< "\nTime [" << timeName << "] = " << runTime.timeName() << nl;
|
||||||
|
|
||||||
|
|||||||
@ -21,23 +21,8 @@
|
|||||||
|
|
||||||
if (io.typeHeaderOk<IOdictionary>(true))
|
if (io.typeHeaderOk<IOdictionary>(true))
|
||||||
{
|
{
|
||||||
IOdictionary timeObject
|
const label timeIndex = IOdictionary(io).get<label>("index");
|
||||||
(
|
timeName = Foam::name(timeIndex);
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"time",
|
|
||||||
runTime.timeName(),
|
|
||||||
"uniform",
|
|
||||||
runTime,
|
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
label index;
|
|
||||||
timeObject.lookup("index") >> index;
|
|
||||||
timeName = Foam::name(index);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -21,23 +21,8 @@
|
|||||||
|
|
||||||
if (io.typeHeaderOk<IOdictionary>(true))
|
if (io.typeHeaderOk<IOdictionary>(true))
|
||||||
{
|
{
|
||||||
IOdictionary timeObject
|
const label timeIndex = IOdictionary(io).get<label>("index");
|
||||||
(
|
timeName = Foam::name(timeIndex);
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"time",
|
|
||||||
runTime.timeName(),
|
|
||||||
"uniform",
|
|
||||||
runTime,
|
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
label index;
|
|
||||||
timeObject.lookup("index") >> index;
|
|
||||||
timeName = Foam::name(index);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -641,7 +641,8 @@ int main(int argc, char *argv[])
|
|||||||
const dictionary& patchSources = dict.subDict("patches");
|
const dictionary& patchSources = dict.subDict("patches");
|
||||||
forAllConstIter(dictionary, patchSources, iter)
|
forAllConstIter(dictionary, patchSources, iter)
|
||||||
{
|
{
|
||||||
const word patchName(iter().dict()["name"]);
|
const word patchName(iter().dict().get<word>("name"));
|
||||||
|
|
||||||
bafflePatches.insert(patchName);
|
bafflePatches.insert(patchName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -649,6 +650,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
const word masterName = selectors[selectorI].name() + "_master";
|
const word masterName = selectors[selectorI].name() + "_master";
|
||||||
bafflePatches.insert(masterName);
|
bafflePatches.insert(masterName);
|
||||||
|
|
||||||
const word slaveName = selectors[selectorI].name() + "_slave";
|
const word slaveName = selectors[selectorI].name() + "_slave";
|
||||||
bafflePatches.insert(slaveName);
|
bafflePatches.insert(slaveName);
|
||||||
}
|
}
|
||||||
@ -685,7 +687,7 @@ int main(int argc, char *argv[])
|
|||||||
const dictionary& patchSources = dict.subDict("patches");
|
const dictionary& patchSources = dict.subDict("patches");
|
||||||
forAllConstIter(dictionary, patchSources, iter)
|
forAllConstIter(dictionary, patchSources, iter)
|
||||||
{
|
{
|
||||||
const word patchName(iter().dict()["name"]);
|
const word patchName(iter().dict().get<word>("name"));
|
||||||
|
|
||||||
if (pbm.findPatchID(patchName) == -1)
|
if (pbm.findPatchID(patchName) == -1)
|
||||||
{
|
{
|
||||||
@ -789,7 +791,7 @@ int main(int argc, char *argv[])
|
|||||||
bool master = true;
|
bool master = true;
|
||||||
forAllConstIter(dictionary, patchSources, iter)
|
forAllConstIter(dictionary, patchSources, iter)
|
||||||
{
|
{
|
||||||
const word patchName(iter().dict()["name"]);
|
const word patchName(iter().dict().get<word>("name"));
|
||||||
label patchi = pbm.findPatchID(patchName);
|
label patchi = pbm.findPatchID(patchName);
|
||||||
if (master)
|
if (master)
|
||||||
{
|
{
|
||||||
@ -884,7 +886,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
forAllConstIter(dictionary, patchSources, iter)
|
forAllConstIter(dictionary, patchSources, iter)
|
||||||
{
|
{
|
||||||
const word patchName(iter().dict()["name"]);
|
const word patchName(iter().dict().get<word>("name"));
|
||||||
label patchi = pbm.findPatchID(patchName);
|
label patchi = pbm.findPatchID(patchName);
|
||||||
|
|
||||||
if (iter().dict().found("patchFields"))
|
if (iter().dict().found("patchFields"))
|
||||||
|
|||||||
@ -55,7 +55,7 @@ Foam::label Foam::mergePolyMesh::patchIndex(const polyPatch& p)
|
|||||||
{
|
{
|
||||||
if (patchNames_[patchi] == pName)
|
if (patchNames_[patchi] == pName)
|
||||||
{
|
{
|
||||||
if (word(patchDicts_[patchi]["type"]) == pType)
|
if (patchDicts_[patchi].get<word>("type") == pType)
|
||||||
{
|
{
|
||||||
// Found name and types match
|
// Found name and types match
|
||||||
return patchi;
|
return patchi;
|
||||||
|
|||||||
@ -320,8 +320,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Patch names
|
// Patch names
|
||||||
const word masterPatchName(dict["master"]);
|
const word masterPatchName(dict.get<word>("master"));
|
||||||
const word slavePatchName(dict["slave"]);
|
const word slavePatchName(dict.get<word>("slave"));
|
||||||
|
|
||||||
// Patch names
|
// Patch names
|
||||||
Info<< " " << masterPatchName
|
Info<< " " << masterPatchName
|
||||||
@ -454,8 +454,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Patch names
|
// Patch names
|
||||||
const word masterPatchName(dict["master"]);
|
const word masterPatchName(dict.get<word>("master"));
|
||||||
const word slavePatchName(dict["slave"]);
|
const word slavePatchName(dict.get<word>("slave"));
|
||||||
|
|
||||||
// Zone names
|
// Zone names
|
||||||
const word mergePatchName(masterPatchName + slavePatchName);
|
const word mergePatchName(masterPatchName + slavePatchName);
|
||||||
|
|||||||
@ -95,7 +95,7 @@ void rewriteBoundary
|
|||||||
{
|
{
|
||||||
const dictionary& patchDict = patches[patchi].dict();
|
const dictionary& patchDict = patches[patchi].dict();
|
||||||
|
|
||||||
if (word(patchDict["type"]) == cyclicPolyPatch::typeName)
|
if (patchDict.get<word>("type") == cyclicPolyPatch::typeName)
|
||||||
{
|
{
|
||||||
if (!patchDict.found("neighbourPatch"))
|
if (!patchDict.found("neighbourPatch"))
|
||||||
{
|
{
|
||||||
@ -130,7 +130,7 @@ void rewriteBoundary
|
|||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
word(patchDict["type"]) == cyclicPolyPatch::typeName
|
patchDict.get<word>("type") == cyclicPolyPatch::typeName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word& name = oldPatches[patchi].keyword();
|
const word& name = oldPatches[patchi].keyword();
|
||||||
@ -167,10 +167,10 @@ void rewriteBoundary
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
label nFaces = readLabel(patchDict["nFaces"]);
|
label nFaces = patchDict.get<label>("nFaces");
|
||||||
label startFace = readLabel(patchDict["startFace"]);
|
label startFace = patchDict.get<label>("startFace");
|
||||||
|
|
||||||
Info<< "Detected old style " << word(patchDict["type"])
|
Info<< "Detected old style " << patchDict.get<word>("type")
|
||||||
<< " patch " << name << " with" << nl
|
<< " patch " << name << " with" << nl
|
||||||
<< " nFaces : " << nFaces << nl
|
<< " nFaces : " << nFaces << nl
|
||||||
<< " startFace : " << startFace << endl;
|
<< " startFace : " << startFace << endl;
|
||||||
@ -213,17 +213,15 @@ void rewriteBoundary
|
|||||||
Info<< "Replaced with patches" << nl
|
Info<< "Replaced with patches" << nl
|
||||||
<< patches[patchi].keyword() << " with" << nl
|
<< patches[patchi].keyword() << " with" << nl
|
||||||
<< " nFaces : "
|
<< " nFaces : "
|
||||||
<< readLabel(thisPatchDict.lookup("nFaces"))
|
<< thisPatchDict.get<label>("nFaces") << nl
|
||||||
<< nl
|
|
||||||
<< " startFace : "
|
<< " startFace : "
|
||||||
<< readLabel(thisPatchDict.lookup("startFace")) << nl
|
<< thisPatchDict.get<label>("startFace") << nl
|
||||||
<< patches[addedPatchi].keyword() << " with" << nl
|
<< patches[addedPatchi].keyword() << " with" << nl
|
||||||
<< " nFaces : "
|
<< " nFaces : "
|
||||||
<< readLabel(nbrPatchDict.lookup("nFaces"))
|
<< nbrPatchDict.get<label>("nFaces") << nl
|
||||||
<< nl
|
|
||||||
<< " startFace : "
|
<< " startFace : "
|
||||||
<< readLabel(nbrPatchDict.lookup("startFace"))
|
<< nbrPatchDict.get<label>("startFace") << nl
|
||||||
<< nl << endl;
|
<< endl;
|
||||||
|
|
||||||
addedPatchi++;
|
addedPatchi++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -292,7 +292,7 @@ int main(int argc, char *argv[])
|
|||||||
// message.
|
// message.
|
||||||
if (surfaceDict.found("surfaces") || !dictName.hasExt())
|
if (surfaceDict.found("surfaces") || !dictName.hasExt())
|
||||||
{
|
{
|
||||||
loader.select(wordReList(surfaceDict.lookup("surfaces")));
|
loader.select(surfaceDict.get<wordRes>("surfaces"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -508,7 +508,7 @@ int main(int argc, char *argv[])
|
|||||||
boolList surfBaffleRegions(surf.patches().size(), false);
|
boolList surfBaffleRegions(surf.patches().size(), false);
|
||||||
if (surfaceDict.found("baffles"))
|
if (surfaceDict.found("baffles"))
|
||||||
{
|
{
|
||||||
wordReList baffleSelect(surfaceDict.lookup("baffles"));
|
wordRes baffleSelect(surfaceDict.get<wordRes>("baffles"));
|
||||||
|
|
||||||
wordList patchNames(surf.patches().size());
|
wordList patchNames(surf.patches().size());
|
||||||
forAll(surf.patches(), patchi)
|
forAll(surf.patches(), patchi)
|
||||||
@ -549,7 +549,11 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (surfaceDict.isDict("addFeatures"))
|
if (surfaceDict.isDict("addFeatures"))
|
||||||
{
|
{
|
||||||
const word addFeName = surfaceDict.subDict("addFeatures")["name"];
|
const word addFeName
|
||||||
|
(
|
||||||
|
surfaceDict.subDict("addFeatures").get<word>("name")
|
||||||
|
);
|
||||||
|
|
||||||
Info<< "Adding (without merging) features from " << addFeName
|
Info<< "Adding (without merging) features from " << addFeName
|
||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
|
|
||||||
@ -736,7 +740,7 @@ int main(int argc, char *argv[])
|
|||||||
outputName,
|
outputName,
|
||||||
feMesh,
|
feMesh,
|
||||||
surf,
|
surf,
|
||||||
readScalar(surfaceDict.lookup("maxFeatureProximity"))
|
surfaceDict.get<scalar>("maxFeatureProximity")
|
||||||
);
|
);
|
||||||
|
|
||||||
if (writeVTK)
|
if (writeVTK)
|
||||||
|
|||||||
@ -64,7 +64,7 @@ Foam::ODESolver::ODESolver(const ODESystem& ode, const dictionary& dict)
|
|||||||
n_(ode.nEqns()),
|
n_(ode.nEqns()),
|
||||||
absTol_(n_, dict.lookupOrDefault<scalar>("absTol", SMALL)),
|
absTol_(n_, dict.lookupOrDefault<scalar>("absTol", SMALL)),
|
||||||
relTol_(n_, dict.lookupOrDefault<scalar>("relTol", 1e-4)),
|
relTol_(n_, dict.lookupOrDefault<scalar>("relTol", 1e-4)),
|
||||||
maxSteps_(dict.lookupOrDefault<scalar>("maxSteps", 10000))
|
maxSteps_(dict.lookupOrDefault<label>("maxSteps", 10000))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ void Foam::ODESolver::solve
|
|||||||
stepState step(dxTry);
|
stepState step(dxTry);
|
||||||
scalar x = xStart;
|
scalar x = xStart;
|
||||||
|
|
||||||
for (label nStep=0; nStep<maxSteps_; nStep++)
|
for (label nStep=0; nStep<maxSteps_; ++nStep)
|
||||||
{
|
{
|
||||||
// Store previous iteration dxTry
|
// Store previous iteration dxTry
|
||||||
scalar dxTry0 = step.dxTry;
|
scalar dxTry0 = step.dxTry;
|
||||||
|
|||||||
@ -33,7 +33,7 @@ Foam::autoPtr<Foam::ODESolver> Foam::ODESolver::New
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word solverType(dict.lookup("solver"));
|
const word solverType(dict.get<word>("solver"));
|
||||||
Info<< "Selecting ODE solver " << solverType << endl;
|
Info<< "Selecting ODE solver " << solverType << endl;
|
||||||
|
|
||||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(solverType);
|
auto cstrIter = dictionaryConstructorTablePtr_->cfind(solverType);
|
||||||
|
|||||||
@ -810,12 +810,6 @@ void Foam::dictionary::transfer(dictionary& dict)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::ITstream& Foam::dictionary::operator[](const word& keyword) const
|
|
||||||
{
|
|
||||||
return lookup(keyword);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::dictionary::operator=(const dictionary& rhs)
|
void Foam::dictionary::operator=(const dictionary& rhs)
|
||||||
{
|
{
|
||||||
if (this == &rhs)
|
if (this == &rhs)
|
||||||
|
|||||||
@ -1113,11 +1113,13 @@ public:
|
|||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
//- Find and return an entry data stream (identical to #lookup method).
|
//- Find and return an entry data stream (identical to #lookup method).
|
||||||
// Default search: non-recursive with patterns.
|
// Search: non-recursive with patterns.
|
||||||
//
|
//
|
||||||
// \param recursive search parent dictionaries
|
// \deprecated use lookup() method instead (deprecated JUL-2018)
|
||||||
// \param patternMatch use regular expressions
|
ITstream& operator[](const word& keyword) const
|
||||||
ITstream& operator[](const word& keyword) const;
|
{
|
||||||
|
return lookup(keyword);
|
||||||
|
}
|
||||||
|
|
||||||
//- Copy assignment
|
//- Copy assignment
|
||||||
void operator=(const dictionary& rhs);
|
void operator=(const dictionary& rhs);
|
||||||
|
|||||||
@ -544,7 +544,7 @@ Foam::Istream& Foam::dimensionSet::read
|
|||||||
scalar exponent = readScalar(exp);
|
scalar exponent = readScalar(exp);
|
||||||
|
|
||||||
dimensionedScalar s;
|
dimensionedScalar s;
|
||||||
s.read(readSet[symbol], readSet);
|
s.read(readSet.lookup(symbol), readSet);
|
||||||
|
|
||||||
symbolSet.reset(pow(s.dimensions(), exponent));
|
symbolSet.reset(pow(s.dimensions(), exponent));
|
||||||
// Round to nearest integer if close to it
|
// Round to nearest integer if close to it
|
||||||
@ -554,7 +554,7 @@ Foam::Istream& Foam::dimensionSet::read
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
dimensionedScalar s;
|
dimensionedScalar s;
|
||||||
s.read(readSet[symbolPow], readSet);
|
s.read(readSet.lookup(symbolPow), readSet);
|
||||||
|
|
||||||
symbolSet.reset(s.dimensions());
|
symbolSet.reset(s.dimensions());
|
||||||
multiplier *= s.value();
|
multiplier *= s.value();
|
||||||
|
|||||||
@ -966,24 +966,15 @@ void Foam::argList::parse
|
|||||||
// 5. '-fileHandler' commmand-line option
|
// 5. '-fileHandler' commmand-line option
|
||||||
|
|
||||||
{
|
{
|
||||||
word handlerType
|
word handlerType =
|
||||||
(
|
options_.lookup("fileHandler", getEnv("FOAM_FILEHANDLER"));
|
||||||
options_.lookup("fileHandler", getEnv("FOAM_FILEHANDLER"))
|
|
||||||
);
|
|
||||||
|
|
||||||
if (handlerType.empty())
|
if (handlerType.empty())
|
||||||
{
|
{
|
||||||
handlerType = fileOperation::defaultFileHandler;
|
handlerType = fileOperation::defaultFileHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
autoPtr<fileOperation> handler
|
auto handler = fileOperation::New(handlerType, bannerEnabled());
|
||||||
(
|
|
||||||
fileOperation::New
|
|
||||||
(
|
|
||||||
handlerType,
|
|
||||||
bannerEnabled()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
Foam::fileHandler(handler);
|
Foam::fileHandler(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1159,15 +1150,12 @@ void Foam::argList::parse
|
|||||||
|
|
||||||
dictionary decompDict(decompDictStream);
|
dictionary decompDict(decompDictStream);
|
||||||
|
|
||||||
dictNProcs = readLabel
|
dictNProcs = decompDict.get<label>("numberOfSubdomains");
|
||||||
(
|
|
||||||
decompDict.lookup("numberOfSubdomains")
|
|
||||||
);
|
|
||||||
|
|
||||||
if (decompDict.lookupOrDefault("distributed", false))
|
if (decompDict.lookupOrDefault("distributed", false))
|
||||||
{
|
{
|
||||||
distributed_ = true;
|
distributed_ = true;
|
||||||
decompDict.lookup("roots") >> roots;
|
decompDict.read("roots", roots);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1700,8 +1688,8 @@ void Foam::argList::printCompat() const
|
|||||||
void Foam::argList::displayDoc(bool source) const
|
void Foam::argList::displayDoc(bool source) const
|
||||||
{
|
{
|
||||||
const dictionary& docDict = debug::controlDict().subDict("Documentation");
|
const dictionary& docDict = debug::controlDict().subDict("Documentation");
|
||||||
List<fileName> docDirs(docDict.lookup("doxyDocDirs"));
|
fileNameList docDirs(docDict.get<fileNameList>("doxyDocDirs"));
|
||||||
fileName docExt(docDict.lookup("doxySourceFileExt"));
|
fileName docExt(docDict.get<fileName>("doxySourceFileExt"));
|
||||||
|
|
||||||
// For source code: change xxx_8C.html to xxx_8C_source.html
|
// For source code: change xxx_8C.html to xxx_8C_source.html
|
||||||
if (source)
|
if (source)
|
||||||
@ -1746,7 +1734,7 @@ void Foam::argList::displayDoc(bool source) const
|
|||||||
string docBrowser = getEnv("FOAM_DOC_BROWSER");
|
string docBrowser = getEnv("FOAM_DOC_BROWSER");
|
||||||
if (docBrowser.empty())
|
if (docBrowser.empty())
|
||||||
{
|
{
|
||||||
docDict.lookup("docBrowser") >> docBrowser;
|
docDict.read("docBrowser", docBrowser);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can use FOAM_DOC_BROWSER='application file://%f' if required
|
// Can use FOAM_DOC_BROWSER='application file://%f' if required
|
||||||
|
|||||||
@ -61,7 +61,7 @@ dimensionedScalar dimensionedConstant
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const word unitSetCoeffs(word(dict.lookup("unitSet")) + "Coeffs");
|
const word unitSetCoeffs(dict.get<word>("unitSet") + "Coeffs");
|
||||||
|
|
||||||
if (!dict.found(unitSetCoeffs))
|
if (!dict.found(unitSetCoeffs))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1179,7 +1179,7 @@ const Foam::fileOperation& Foam::fileHandler()
|
|||||||
{
|
{
|
||||||
word handler(getEnv("FOAM_FILEHANDLER"));
|
word handler(getEnv("FOAM_FILEHANDLER"));
|
||||||
|
|
||||||
if (!handler.size())
|
if (handler.empty())
|
||||||
{
|
{
|
||||||
handler = fileOperation::defaultFileHandler;
|
handler = fileOperation::defaultFileHandler;
|
||||||
}
|
}
|
||||||
@ -1191,14 +1191,14 @@ const Foam::fileOperation& Foam::fileHandler()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::fileHandler(autoPtr<fileOperation>& newHandlerPtr)
|
void Foam::fileHandler(autoPtr<fileOperation>& newHandler)
|
||||||
{
|
{
|
||||||
if (fileOperation::fileHandlerPtr_.valid())
|
if (fileOperation::fileHandlerPtr_.valid())
|
||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
newHandlerPtr.valid()
|
newHandler.valid()
|
||||||
&& newHandlerPtr->type() == fileOperation::fileHandlerPtr_->type()
|
&& newHandler->type() == fileOperation::fileHandlerPtr_->type()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -1206,9 +1206,9 @@ void Foam::fileHandler(autoPtr<fileOperation>& newHandlerPtr)
|
|||||||
}
|
}
|
||||||
fileOperation::fileHandlerPtr_.clear();
|
fileOperation::fileHandlerPtr_.clear();
|
||||||
|
|
||||||
if (newHandlerPtr.valid())
|
if (newHandler.valid())
|
||||||
{
|
{
|
||||||
fileOperation::fileHandlerPtr_ = std::move(newHandlerPtr);
|
fileOperation::fileHandlerPtr_ = std::move(newHandler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -563,7 +563,7 @@ public:
|
|||||||
const fileOperation& fileHandler();
|
const fileOperation& fileHandler();
|
||||||
|
|
||||||
//- Reset file handler
|
//- Reset file handler
|
||||||
void fileHandler(autoPtr<fileOperation>&);
|
void fileHandler(autoPtr<fileOperation>& newHandler);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -402,7 +402,7 @@ void Foam::ccm::reader::readProblemDescription_boundaryRegion
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Fallback
|
// Fallback
|
||||||
str = word(dict["BoundaryType"]) + "_" + ::Foam::name(Id);
|
str = dict.get<word>("BoundaryType") + "_" + ::Foam::name(Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!str.empty())
|
if (!str.empty())
|
||||||
|
|||||||
@ -480,8 +480,10 @@ void Foam::ccm::reader::readCells
|
|||||||
auto dictIter = boundaryRegion_.find(info.ccmIndex);
|
auto dictIter = boundaryRegion_.find(info.ccmIndex);
|
||||||
if (dictIter.found())
|
if (dictIter.found())
|
||||||
{
|
{
|
||||||
word patchName(dictIter()["Label"]);
|
dictionary& dict = dictIter.object();
|
||||||
word patchType(dictIter()["BoundaryType"]);
|
|
||||||
|
const word patchName(dict.get<word>("Label"));
|
||||||
|
const word patchType(dict.get<word>("BoundaryType"));
|
||||||
|
|
||||||
if (!patchName.empty())
|
if (!patchName.empty())
|
||||||
{
|
{
|
||||||
@ -494,8 +496,8 @@ void Foam::ccm::reader::readCells
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Optional, but potentially useful information:
|
// Optional, but potentially useful information:
|
||||||
dictIter().add("BoundaryIndex", info.ccmIndex);
|
dict.add("BoundaryIndex", info.ccmIndex);
|
||||||
dictIter().add("size", info.size);
|
dict.add("size", info.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bndInfo.append(info);
|
bndInfo.append(info);
|
||||||
@ -1039,7 +1041,7 @@ void Foam::ccm::reader::readMonitoring
|
|||||||
word zoneName;
|
word zoneName;
|
||||||
if (iter.found())
|
if (iter.found())
|
||||||
{
|
{
|
||||||
iter().lookup("Label") >> zoneName;
|
iter().read("Label", zoneName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2415,7 +2417,7 @@ void Foam::ccm::reader::addPatches
|
|||||||
// provide some fallback values
|
// provide some fallback values
|
||||||
forAll(newPatches, patchI)
|
forAll(newPatches, patchI)
|
||||||
{
|
{
|
||||||
word fallbackName("patch" + Foam::name(patchI));
|
const word fallbackName("patch" + Foam::name(patchI));
|
||||||
word patchName;
|
word patchName;
|
||||||
word patchType;
|
word patchType;
|
||||||
|
|
||||||
@ -2423,8 +2425,8 @@ void Foam::ccm::reader::addPatches
|
|||||||
|
|
||||||
if (citer.found())
|
if (citer.found())
|
||||||
{
|
{
|
||||||
citer().lookup("Label") >> patchName;
|
citer().read("Label", patchName);
|
||||||
citer().lookup("BoundaryType") >> patchType;
|
citer().read("BoundaryType", patchType);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -31,7 +31,7 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// name for the topology file reference
|
// Name for the topology file reference
|
||||||
Foam::string Foam::ccm::writer::defaultMeshName = "meshExport";
|
Foam::string Foam::ccm::writer::defaultMeshName = "meshExport";
|
||||||
|
|
||||||
|
|
||||||
@ -98,21 +98,17 @@ void Foam::ccm::writer::writeBoundaryRegion
|
|||||||
forAllConstIters(boundaryRegion_, iter)
|
forAllConstIters(boundaryRegion_, iter)
|
||||||
{
|
{
|
||||||
const dictionary& dict = iter();
|
const dictionary& dict = iter();
|
||||||
|
word nameEntry;
|
||||||
|
word typeEntry;
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
dict.found("Label")
|
dict.readIfPresent("Label", nameEntry)
|
||||||
&& dict.found("BoundaryType")
|
&& dict.readIfPresent("BoundaryType", typeEntry)
|
||||||
|
&& !typeDict.found(nameEntry)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
word nameEntry, typeEntry;
|
typeDict.add(nameEntry, typeEntry);
|
||||||
|
|
||||||
dict.lookup("Label") >> nameEntry;
|
|
||||||
dict.lookup("BoundaryType") >> typeEntry;
|
|
||||||
|
|
||||||
if (!typeDict.found(nameEntry))
|
|
||||||
{
|
|
||||||
typeDict.add(nameEntry, typeEntry);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +156,7 @@ void Foam::ccm::writer::writeBoundaryRegion
|
|||||||
}
|
}
|
||||||
else if (defaultId == -1 || regionId < defaultId)
|
else if (defaultId == -1 || regionId < defaultId)
|
||||||
{
|
{
|
||||||
regionId++;
|
++regionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use BoundaryType from constant/boundaryRegion
|
// Use BoundaryType from constant/boundaryRegion
|
||||||
@ -223,15 +219,15 @@ void Foam::ccm::writer::writeCellTable
|
|||||||
);
|
);
|
||||||
|
|
||||||
wordList toc = dict.toc();
|
wordList toc = dict.toc();
|
||||||
forAll(toc, i)
|
for (const word& keyword : toc)
|
||||||
{
|
{
|
||||||
word keyword = toc[i];
|
|
||||||
int pos = keyword.find("Id");
|
int pos = keyword.find("Id");
|
||||||
|
|
||||||
// Tags containing 'Id' are integers
|
// Tags containing 'Id' are integers
|
||||||
if (pos > 0)
|
if (pos > 0)
|
||||||
{
|
{
|
||||||
dict.lookup(keyword) >> intVal;
|
dict.read(keyword, intVal);
|
||||||
|
|
||||||
CCMIOWriteOpti
|
CCMIOWriteOpti
|
||||||
(
|
(
|
||||||
nullptr,
|
nullptr,
|
||||||
@ -242,8 +238,7 @@ void Foam::ccm::writer::writeCellTable
|
|||||||
}
|
}
|
||||||
else if (pos < 0)
|
else if (pos < 0)
|
||||||
{
|
{
|
||||||
word strVal;
|
const word strVal(dict.get<word>(keyword));
|
||||||
dict.lookup(keyword) >> strVal;
|
|
||||||
|
|
||||||
CCMIOWriteOptstr
|
CCMIOWriteOptstr
|
||||||
(
|
(
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -352,7 +352,6 @@ void Foam::ccm::writer::writeSolution
|
|||||||
// Get time information
|
// Get time information
|
||||||
const Time& runTime = mesh_.time();
|
const Time& runTime = mesh_.time();
|
||||||
label timeIndex = 0;
|
label timeIndex = 0;
|
||||||
// scalar timeValue = runTime.timeName();
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
runTime.timeName() != runTime.constant()
|
runTime.timeName() != runTime.constant()
|
||||||
@ -372,21 +371,7 @@ void Foam::ccm::writer::writeSolution
|
|||||||
|
|
||||||
if (io.typeHeaderOk<IOdictionary>(true))
|
if (io.typeHeaderOk<IOdictionary>(true))
|
||||||
{
|
{
|
||||||
IOdictionary timeObject
|
timeIndex = IOdictionary(io).get<label>("index");
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"time",
|
|
||||||
runTime.timeName(),
|
|
||||||
"uniform",
|
|
||||||
runTime,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
timeObject.lookup("index") >> timeIndex;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,7 +448,7 @@ void Foam::ccm::writer::writeSolution
|
|||||||
&phaseNode
|
&phaseNode
|
||||||
);
|
);
|
||||||
|
|
||||||
forAllConstIter(IOobjectList, objects, iter)
|
forAllConstIters(objects, iter)
|
||||||
{
|
{
|
||||||
word fieldName = (*iter()).name();
|
word fieldName = (*iter()).name();
|
||||||
bool variableGood =
|
bool variableGood =
|
||||||
|
|||||||
@ -272,7 +272,7 @@ void Foam::boundaryRegion::rename(const dictionary& mapDict)
|
|||||||
dictionary& dict = operator[](iter.key());
|
dictionary& dict = operator[](iter.key());
|
||||||
|
|
||||||
Info<< "rename patch: " << iter()
|
Info<< "rename patch: " << iter()
|
||||||
<< " <- " << word(dict.lookup("Label")) << nl;
|
<< " <- " << dict.get<word>("Label") << nl;
|
||||||
|
|
||||||
dict.set("Label", iter());
|
dict.set("Label", iter());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -186,13 +186,13 @@ void Foam::refinementFeatures::read
|
|||||||
|
|
||||||
if (dict.found("levels"))
|
if (dict.found("levels"))
|
||||||
{
|
{
|
||||||
List<Tuple2<scalar, label>> distLevels(dict["levels"]);
|
List<Tuple2<scalar, label>> distLevels(dict.lookup("levels"));
|
||||||
|
|
||||||
if (dict.size() < 1)
|
if (dict.size() < 1)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< " : levels should be at least size 1" << endl
|
<< " : levels should be at least size 1" << endl
|
||||||
<< "levels : " << dict["levels"]
|
<< "levels : " << dict.lookup("levels")
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -265,8 +265,8 @@ bool Foam::patchProbes::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (!dict.readIfPresent("patches", patchNames_))
|
if (!dict.readIfPresent("patches", patchNames_))
|
||||||
{
|
{
|
||||||
patchNames_.setSize(1);
|
patchNames_.resize(1);
|
||||||
patchNames_[0] = wordRe(word(dict.lookup("patch")));
|
patchNames_.first() = dict.get<word>("patch");
|
||||||
}
|
}
|
||||||
|
|
||||||
return probes::read(dict);
|
return probes::read(dict);
|
||||||
|
|||||||
@ -315,8 +315,8 @@ Foam::probes::probes
|
|||||||
|
|
||||||
bool Foam::probes::read(const dictionary& dict)
|
bool Foam::probes::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
dict.lookup("probeLocations") >> *this;
|
dict.read("probeLocations", static_cast<pointField&>(*this));
|
||||||
dict.lookup("fields") >> fieldSelection_;
|
dict.read("fields", fieldSelection_);
|
||||||
|
|
||||||
dict.readIfPresent("fixedLocations", fixedLocations_);
|
dict.readIfPresent("fixedLocations", fixedLocations_);
|
||||||
if (dict.readIfPresent("interpolationScheme", interpolationScheme_))
|
if (dict.readIfPresent("interpolationScheme", interpolationScheme_))
|
||||||
|
|||||||
@ -175,8 +175,8 @@ Foam::arraySet::arraySet
|
|||||||
:
|
:
|
||||||
sampledSet(name, mesh, searchEngine, dict),
|
sampledSet(name, mesh, searchEngine, dict),
|
||||||
coordSys_(dict),
|
coordSys_(dict),
|
||||||
pointsDensity_(dict.lookup("pointsDensity")),
|
pointsDensity_(dict.get<labelVector>("pointsDensity")),
|
||||||
spanBox_(dict.lookup("spanBox"))
|
spanBox_(dict.get<vector>("spanBox"))
|
||||||
{
|
{
|
||||||
genSamples();
|
genSamples();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,6 +47,7 @@ SourceFiles
|
|||||||
#define arraySet_H
|
#define arraySet_H
|
||||||
|
|
||||||
#include "sampledSet.H"
|
#include "sampledSet.H"
|
||||||
|
#include "labelVector.H"
|
||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
#include "coordinateSystem.H"
|
#include "coordinateSystem.H"
|
||||||
|
|
||||||
@ -73,10 +74,10 @@ class arraySet
|
|||||||
coordinateSystem coordSys_;
|
coordinateSystem coordSys_;
|
||||||
|
|
||||||
//- Point density vector
|
//- Point density vector
|
||||||
Vector<label> pointsDensity_;
|
labelVector pointsDensity_;
|
||||||
|
|
||||||
//- Span box
|
//- Span box
|
||||||
Vector<scalar> spanBox_;
|
vector spanBox_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|||||||
@ -198,14 +198,11 @@ Foam::circleSet::circleSet
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
sampledSet(name, mesh, searchEngine, dict),
|
sampledSet(name, mesh, searchEngine, dict),
|
||||||
origin_(dict.lookup("origin")),
|
origin_(dict.get<point>("origin")),
|
||||||
circleAxis_(dict.lookup("circleAxis")),
|
circleAxis_(normalised(dict.get<vector>("circleAxis"))),
|
||||||
startPoint_(dict.lookup("startPoint")),
|
startPoint_(dict.get<point>("startPoint")),
|
||||||
dTheta_(dict.get<scalar>("dTheta"))
|
dTheta_(dict.get<scalar>("dTheta"))
|
||||||
{
|
{
|
||||||
// Normalise circleAxis
|
|
||||||
circleAxis_ /= mag(circleAxis_);
|
|
||||||
|
|
||||||
genSamples();
|
genSamples();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -205,7 +205,7 @@ Foam::cloudSet::cloudSet
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
sampledSet(name, mesh, searchEngine, dict),
|
sampledSet(name, mesh, searchEngine, dict),
|
||||||
sampleCoords_(dict.lookup("points"))
|
sampleCoords_(dict.get<pointField>("points"))
|
||||||
{
|
{
|
||||||
genSamples();
|
genSamples();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,7 +66,7 @@ class cloudSet
|
|||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Sampling points
|
//- Sampling points
|
||||||
List<point> sampleCoords_;
|
pointField sampleCoords_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|||||||
@ -359,8 +359,8 @@ Foam::faceOnlySet::faceOnlySet
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
sampledSet(name, mesh, searchEngine, dict),
|
sampledSet(name, mesh, searchEngine, dict),
|
||||||
start_(dict.lookup("start")),
|
start_(dict.get<point>("start")),
|
||||||
end_(dict.lookup("end"))
|
end_(dict.get<point>("end"))
|
||||||
{
|
{
|
||||||
genSamples();
|
genSamples();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -295,13 +295,10 @@ Foam::patchCloudSet::patchCloudSet
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
sampledSet(name, mesh, searchEngine, dict),
|
sampledSet(name, mesh, searchEngine, dict),
|
||||||
sampleCoords_(dict.lookup("points")),
|
sampleCoords_(dict.get<pointField>("points")),
|
||||||
patchSet_
|
patchSet_
|
||||||
(
|
(
|
||||||
mesh.boundaryMesh().patchSet
|
mesh.boundaryMesh().patchSet(dict.get<wordRes>("patches"))
|
||||||
(
|
|
||||||
wordReList(dict.lookup("patches"))
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
searchDist_(dict.get<scalar>("maxDistance"))
|
searchDist_(dict.get<scalar>("maxDistance"))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -65,7 +65,7 @@ class patchCloudSet
|
|||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Sampling points
|
//- Sampling points
|
||||||
const List<point> sampleCoords_;
|
const pointField sampleCoords_;
|
||||||
|
|
||||||
//- Patches to sample
|
//- Patches to sample
|
||||||
const labelHashSet patchSet_;
|
const labelHashSet patchSet_;
|
||||||
|
|||||||
@ -346,10 +346,7 @@ Foam::patchSeedSet::patchSeedSet
|
|||||||
sampledSet(name, mesh, searchEngine, dict),
|
sampledSet(name, mesh, searchEngine, dict),
|
||||||
patchSet_
|
patchSet_
|
||||||
(
|
(
|
||||||
mesh.boundaryMesh().patchSet
|
mesh.boundaryMesh().patchSet(dict.get<wordRes>("patches"))
|
||||||
(
|
|
||||||
wordReList(dict.lookup("patches"))
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
maxPoints_(dict.get<label>("maxPoints")),
|
maxPoints_(dict.get<label>("maxPoints")),
|
||||||
selectedLocations_
|
selectedLocations_
|
||||||
|
|||||||
@ -368,7 +368,7 @@ Foam::polyLineSet::polyLineSet
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
sampledSet(name, mesh, searchEngine, dict),
|
sampledSet(name, mesh, searchEngine, dict),
|
||||||
sampleCoords_(dict.lookup("points"))
|
sampleCoords_(dict.get<pointField>("points"))
|
||||||
{
|
{
|
||||||
genSamples();
|
genSamples();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,7 @@ class polyLineSet
|
|||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Sampling points
|
//- Sampling points
|
||||||
List<point> sampleCoords_;
|
pointField sampleCoords_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|||||||
@ -224,14 +224,13 @@ bool Foam::sampledSets::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
dict_ = dict;
|
dict_ = dict;
|
||||||
|
|
||||||
bool setsFound = dict_.found("sets");
|
if (dict_.found("sets"))
|
||||||
if (setsFound)
|
|
||||||
{
|
{
|
||||||
dict_.lookup("fields") >> fieldSelection_;
|
dict_.read("fields", fieldSelection_);
|
||||||
clearFieldGroups();
|
clearFieldGroups();
|
||||||
|
|
||||||
dict.lookup("interpolationScheme") >> interpolationScheme_;
|
dict.read("interpolationScheme", interpolationScheme_);
|
||||||
dict.lookup("setFormat") >> writeFormat_;
|
dict.read("setFormat", writeFormat_);
|
||||||
|
|
||||||
PtrList<sampledSet> newList
|
PtrList<sampledSet> newList
|
||||||
(
|
(
|
||||||
@ -270,8 +269,7 @@ bool Foam::sampledSets::read(const dictionary& dict)
|
|||||||
|
|
||||||
void Foam::sampledSets::correct()
|
void Foam::sampledSets::correct()
|
||||||
{
|
{
|
||||||
bool setsFound = dict_.found("sets");
|
if (dict_.found("sets"))
|
||||||
if (setsFound)
|
|
||||||
{
|
{
|
||||||
searchEngine_.correct();
|
searchEngine_.correct();
|
||||||
|
|
||||||
|
|||||||
@ -325,8 +325,8 @@ Foam::shortestPathSet::shortestPathSet
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
sampledSet(name, mesh, searchEngine, dict),
|
sampledSet(name, mesh, searchEngine, dict),
|
||||||
insidePoints_(dict.lookup("insidePoints")),
|
insidePoints_(dict.get<pointField>("insidePoints")),
|
||||||
outsidePoints_(dict.lookup("outsidePoints"))
|
outsidePoints_(dict.get<pointField>("outsidePoints"))
|
||||||
{
|
{
|
||||||
genSamples(mesh);
|
genSamples(mesh);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -440,8 +440,8 @@ Foam::uniformSet::uniformSet
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
sampledSet(name, mesh, searchEngine, dict),
|
sampledSet(name, mesh, searchEngine, dict),
|
||||||
start_(dict.lookup("start")),
|
start_(dict.get<point>("start")),
|
||||||
end_(dict.lookup("end")),
|
end_(dict.get<point>("end")),
|
||||||
nPoints_(dict.get<label>("nPoints"))
|
nPoints_(dict.get<label>("nPoints"))
|
||||||
{
|
{
|
||||||
genSamples();
|
genSamples();
|
||||||
|
|||||||
@ -466,8 +466,8 @@ Foam::sampledIsoSurface::sampledIsoSurface
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
sampledSurface(name, mesh, dict),
|
sampledSurface(name, mesh, dict),
|
||||||
isoField_(dict.lookup("isoField")),
|
isoField_(dict.get<word>("isoField")),
|
||||||
isoVal_(readScalar(dict.lookup("isoValue"))),
|
isoVal_(dict.get<scalar>("isoValue")),
|
||||||
bounds_(dict.lookupOrDefault("bounds", boundBox::invertedBox)),
|
bounds_(dict.lookupOrDefault("bounds", boundBox::invertedBox)),
|
||||||
mergeTol_(dict.lookupOrDefault("mergeTol", 1e-6)),
|
mergeTol_(dict.lookupOrDefault("mergeTol", 1e-6)),
|
||||||
regularise_(dict.lookupOrDefault("regularise", true)),
|
regularise_(dict.lookupOrDefault("regularise", true)),
|
||||||
@ -491,7 +491,7 @@ Foam::sampledIsoSurface::sampledIsoSurface
|
|||||||
|
|
||||||
if (zoneID_.index() != -1)
|
if (zoneID_.index() != -1)
|
||||||
{
|
{
|
||||||
dict.lookup("exposedPatchName") >> exposedPatchName_;
|
dict.read("exposedPatchName", exposedPatchName_);
|
||||||
|
|
||||||
if (mesh.boundaryMesh().findPatchID(exposedPatchName_) == -1)
|
if (mesh.boundaryMesh().findPatchID(exposedPatchName_) == -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -196,8 +196,8 @@ Foam::sampledIsoSurfaceCell::sampledIsoSurfaceCell
|
|||||||
:
|
:
|
||||||
sampledSurface(name, mesh, dict),
|
sampledSurface(name, mesh, dict),
|
||||||
MeshStorage(),
|
MeshStorage(),
|
||||||
isoField_(dict.lookup("isoField")),
|
isoField_(dict.get<word>("isoField")),
|
||||||
isoVal_(readScalar(dict.lookup("isoValue"))),
|
isoVal_(dict.get<scalar>("isoValue")),
|
||||||
bounds_(dict.lookupOrDefault("bounds", boundBox::invertedBox)),
|
bounds_(dict.lookupOrDefault("bounds", boundBox::invertedBox)),
|
||||||
regularise_(dict.lookupOrDefault("regularise", true)),
|
regularise_(dict.lookupOrDefault("regularise", true)),
|
||||||
average_(dict.lookupOrDefault("average", true)),
|
average_(dict.lookupOrDefault("average", true)),
|
||||||
|
|||||||
@ -312,7 +312,7 @@ Foam::sampledCuttingPlane::sampledCuttingPlane
|
|||||||
{
|
{
|
||||||
if (zoneID_.index() != -1)
|
if (zoneID_.index() != -1)
|
||||||
{
|
{
|
||||||
dict.lookup("exposedPatchName") >> exposedPatchName_;
|
dict.read("exposedPatchName", exposedPatchName_);
|
||||||
|
|
||||||
if (mesh.boundaryMesh().findPatchID(exposedPatchName_) == -1)
|
if (mesh.boundaryMesh().findPatchID(exposedPatchName_) == -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -66,7 +66,7 @@ Foam::sampledPatch::sampledPatch
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
sampledSurface(name, mesh, dict),
|
sampledSurface(name, mesh, dict),
|
||||||
patchNames_(dict.lookup("patches")),
|
patchNames_(dict.get<wordRes>("patches")),
|
||||||
triangulate_(dict.lookupOrDefault("triangulate", false)),
|
triangulate_(dict.lookupOrDefault("triangulate", false)),
|
||||||
needsUpdate_(true)
|
needsUpdate_(true)
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -61,17 +61,14 @@ Foam::sampledPatchInternalField::sampledPatchInternalField
|
|||||||
mappedPatchBase::offsetMode mode = mappedPatchBase::NORMAL;
|
mappedPatchBase::offsetMode mode = mappedPatchBase::NORMAL;
|
||||||
if (dict.found("offsetMode"))
|
if (dict.found("offsetMode"))
|
||||||
{
|
{
|
||||||
mode = mappedPatchBase::offsetModeNames_.read
|
mode = mappedPatchBase::offsetModeNames_.lookup("offsetMode", dict);
|
||||||
(
|
|
||||||
dict.lookup("offsetMode")
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case mappedPatchBase::NORMAL:
|
case mappedPatchBase::NORMAL:
|
||||||
{
|
{
|
||||||
const scalar distance = readScalar(dict.lookup("distance"));
|
const scalar distance(dict.get<scalar>("distance"));
|
||||||
forAll(patchIDs(), i)
|
forAll(patchIDs(), i)
|
||||||
{
|
{
|
||||||
mappers_.set
|
mappers_.set
|
||||||
@ -92,7 +89,7 @@ Foam::sampledPatchInternalField::sampledPatchInternalField
|
|||||||
|
|
||||||
case mappedPatchBase::UNIFORM:
|
case mappedPatchBase::UNIFORM:
|
||||||
{
|
{
|
||||||
const point offset(dict.lookup("offset"));
|
const point offset(dict.get<point>("offset"));
|
||||||
forAll(patchIDs(), i)
|
forAll(patchIDs(), i)
|
||||||
{
|
{
|
||||||
mappers_.set
|
mappers_.set
|
||||||
@ -113,7 +110,7 @@ Foam::sampledPatchInternalField::sampledPatchInternalField
|
|||||||
|
|
||||||
case mappedPatchBase::NONUNIFORM:
|
case mappedPatchBase::NONUNIFORM:
|
||||||
{
|
{
|
||||||
const pointField offsets(dict.lookup("offsets"));
|
const pointField offsets(dict.get<pointField>("offsets"));
|
||||||
forAll(patchIDs(), i)
|
forAll(patchIDs(), i)
|
||||||
{
|
{
|
||||||
mappers_.set
|
mappers_.set
|
||||||
|
|||||||
@ -54,7 +54,7 @@ Foam::autoPtr<Foam::sampledSurface> Foam::sampledSurface::New
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word sampleType(dict.lookup("type"));
|
const word sampleType(dict.get<word>("type"));
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -259,11 +259,11 @@ bool Foam::sampledSurfaces::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
sampleFaceScheme_ = dict.lookupOrDefault<word>("sampleScheme", "cell");
|
sampleFaceScheme_ = dict.lookupOrDefault<word>("sampleScheme", "cell");
|
||||||
|
|
||||||
dict.lookup("interpolationScheme") >> sampleNodeScheme_;
|
dict.read("interpolationScheme", sampleNodeScheme_);
|
||||||
|
|
||||||
dict.lookup("fields") >> fieldSelection_;
|
dict.read("fields", fieldSelection_);
|
||||||
|
|
||||||
const word writeType(dict.lookup("surfaceFormat"));
|
const word writeType(dict.get<word>("surfaceFormat"));
|
||||||
|
|
||||||
// Define the surface formatter
|
// Define the surface formatter
|
||||||
// Optionally defined extra controls for the output formats
|
// Optionally defined extra controls for the output formats
|
||||||
|
|||||||
@ -668,7 +668,7 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
dict.lookup("surface"),
|
dict.get<word>("surface"),
|
||||||
mesh.time().constant(), // instance
|
mesh.time().constant(), // instance
|
||||||
"triSurface", // local
|
"triSurface", // local
|
||||||
mesh.time(), // registry
|
mesh.time(), // registry
|
||||||
|
|||||||
@ -147,7 +147,7 @@ Foam::sampledThresholdCellFaces::sampledThresholdCellFaces
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
sampledSurface(name, mesh, dict),
|
sampledSurface(name, mesh, dict),
|
||||||
fieldName_(dict.lookup("field")),
|
fieldName_(dict.get<word>("field")),
|
||||||
lowerThreshold_(dict.lookupOrDefault<scalar>("lowerLimit", -VGREAT)),
|
lowerThreshold_(dict.lookupOrDefault<scalar>("lowerLimit", -VGREAT)),
|
||||||
upperThreshold_(dict.lookupOrDefault<scalar>("upperLimit", VGREAT)),
|
upperThreshold_(dict.lookupOrDefault<scalar>("upperLimit", VGREAT)),
|
||||||
zoneKey_(keyType::null),
|
zoneKey_(keyType::null),
|
||||||
|
|||||||
@ -349,7 +349,7 @@ Foam::fileName Foam::ensightSurfaceWriter::writeCollated
|
|||||||
forAllConstIter(dictionary, fieldsDict, iter)
|
forAllConstIter(dictionary, fieldsDict, iter)
|
||||||
{
|
{
|
||||||
const dictionary& subDict = iter().dict();
|
const dictionary& subDict = iter().dict();
|
||||||
const word fieldType(subDict.lookup("type"));
|
const word fieldType(subDict.get<word>("type"));
|
||||||
const word varName = subDict.lookupOrDefault
|
const word varName = subDict.lookupOrDefault
|
||||||
(
|
(
|
||||||
"name",
|
"name",
|
||||||
|
|||||||
@ -342,7 +342,8 @@ Foam::nastranSurfaceWriter::nastranSurfaceWriter(const dictionary& options)
|
|||||||
separator_ = ",";
|
separator_ = ",";
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Pair<word>> fieldPairs(options.lookup("fields"));
|
List<Pair<word>> fieldPairs;
|
||||||
|
options.read("fields", fieldPairs);
|
||||||
|
|
||||||
for (const Pair<word>& item : fieldPairs)
|
for (const Pair<word>& item : fieldPairs)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -217,7 +217,7 @@ Foam::rawSurfaceWriter::rawSurfaceWriter(const dictionary& options)
|
|||||||
if (options.found("compression"))
|
if (options.found("compression"))
|
||||||
{
|
{
|
||||||
writeCompression_ =
|
writeCompression_ =
|
||||||
IOstream::compressionEnum(options.lookup("compression"));
|
IOstream::compressionEnum(options.get<word>("compression"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -75,7 +75,7 @@ Foam::surfMeshSample::New
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word sampleType(dict.lookup("type"));
|
const word sampleType(dict.get<word>("type"));
|
||||||
|
|
||||||
auto cstrIter = wordConstructorTablePtr_->cfind(sampleType);
|
auto cstrIter = wordConstructorTablePtr_->cfind(sampleType);
|
||||||
|
|
||||||
|
|||||||
@ -348,7 +348,7 @@ bool Foam::surfMeshSamplers::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
sampleScheme_ = dict.lookupOrDefault<word>("sampleScheme", "cell");
|
sampleScheme_ = dict.lookupOrDefault<word>("sampleScheme", "cell");
|
||||||
|
|
||||||
dict.lookup("fields") >> fieldSelection_;
|
dict.read("fields", fieldSelection_);
|
||||||
fieldSelection_.uniq();
|
fieldSelection_.uniq();
|
||||||
|
|
||||||
Info<< type() << " fields: " << flatOutput(fieldSelection_) << nl;
|
Info<< type() << " fields: " << flatOutput(fieldSelection_) << nl;
|
||||||
|
|||||||
@ -52,7 +52,7 @@ Foam::distanceSurface::distanceSurface
|
|||||||
(
|
(
|
||||||
searchableSurface::New
|
searchableSurface::New
|
||||||
(
|
(
|
||||||
dict.lookup("surfaceType"),
|
dict.get<word>("surfaceType"),
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
dict.lookupOrDefault("surfaceName", defaultSurfaceName),
|
dict.lookupOrDefault("surfaceName", defaultSurfaceName),
|
||||||
@ -65,7 +65,7 @@ Foam::distanceSurface::distanceSurface
|
|||||||
dict
|
dict
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
distance_(readScalar(dict.lookup("distance"))),
|
distance_(dict.get<scalar>("distance")),
|
||||||
signed_(dict.get<bool>("signed")),
|
signed_(dict.get<bool>("signed")),
|
||||||
cell_(dict.lookupOrDefault("cell", true)),
|
cell_(dict.lookupOrDefault("cell", true)),
|
||||||
regularise_(dict.lookupOrDefault("regularise", true)),
|
regularise_(dict.lookupOrDefault("regularise", true)),
|
||||||
|
|||||||
@ -675,7 +675,7 @@ Foam::discreteSurface::discreteSurface
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
dict.lookup("surface"),
|
dict.get<word>("surface"),
|
||||||
mesh.time().constant(), // instance
|
mesh.time().constant(), // instance
|
||||||
"triSurface", // local
|
"triSurface", // local
|
||||||
mesh.time(), // registry
|
mesh.time(), // registry
|
||||||
|
|||||||
@ -81,8 +81,8 @@ Foam::surfZone::surfZone
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
surfZoneIdentifier(name, dict, index),
|
surfZoneIdentifier(name, dict, index),
|
||||||
size_(readLabel(dict.lookup("nFaces"))),
|
size_(dict.get<label>("nFaces")),
|
||||||
start_(readLabel(dict.lookup("startFace")))
|
start_(dict.get<label>("startFace"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -61,8 +61,8 @@ Foam::surfZoneIOList::surfZoneIOList
|
|||||||
{
|
{
|
||||||
const dictionary& dict = dictEntries[zoneI].dict();
|
const dictionary& dict = dictEntries[zoneI].dict();
|
||||||
|
|
||||||
label zoneSize = readLabel(dict.lookup("nFaces"));
|
const label zoneSize = dict.get<label>("nFaces");
|
||||||
label startFacei = readLabel(dict.lookup("startFace"));
|
const label startFacei = dict.get<label>("startFace");
|
||||||
|
|
||||||
zones[zoneI] = surfZone
|
zones[zoneI] = surfZone
|
||||||
(
|
(
|
||||||
|
|||||||
@ -87,8 +87,8 @@ Foam::surfacePatch::surfacePatch
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
geometricSurfacePatch(name, dict, index),
|
geometricSurfacePatch(name, dict, index),
|
||||||
size_(readLabel(dict.lookup("nFaces"))),
|
size_(dict.get<label>("nFaces")),
|
||||||
start_(readLabel(dict.lookup("startFace")))
|
start_(dict.get<label>("startFace"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user