mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: use range-for when looping dictionary entries.
- as part of the cleanup of dictionary access methods (c6520033c9)
made the dictionary class single inheritance from IDLList<entry>.
This eliminates any ambiguities for iterators and allows
for simple use of range-for looping.
Eg,
for (const entry& e : topDict))
{
Info<< "entry:" << e.keyword() << " is dict:" << e.isDict() << nl;
}
vs
forAllConstIter(dictionary, topDict, iter))
{
Info<< "entry:" << iter().keyword()
<< " is dict:" << iter().isDict() << nl;
}
This commit is contained in:
@ -136,18 +136,19 @@ Foam::rigidBodyMeshMotion::rigidBodyMeshMotion
|
||||
|
||||
const dictionary& bodiesDict = coeffDict().subDict("bodies");
|
||||
|
||||
forAllConstIter(IDLList<entry>, bodiesDict, iter)
|
||||
for (const entry& dEntry : bodiesDict)
|
||||
{
|
||||
const dictionary& bodyDict = iter().dict();
|
||||
const keyType& bodyName = dEntry.keyword();
|
||||
const dictionary& bodyDict = dEntry.dict();
|
||||
|
||||
if (bodyDict.found("patches"))
|
||||
{
|
||||
const label bodyID = model_.bodyID(iter().keyword());
|
||||
const label bodyID = model_.bodyID(bodyName);
|
||||
|
||||
if (bodyID == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Body " << iter().keyword()
|
||||
<< "Body " << bodyName
|
||||
<< " has been merged with another body"
|
||||
" and cannot be assigned a set of patches"
|
||||
<< exit(FatalError);
|
||||
@ -158,7 +159,7 @@ Foam::rigidBodyMeshMotion::rigidBodyMeshMotion
|
||||
new bodyMesh
|
||||
(
|
||||
mesh,
|
||||
iter().keyword(),
|
||||
bodyName,
|
||||
bodyID,
|
||||
bodyDict
|
||||
)
|
||||
|
||||
@ -127,18 +127,19 @@ Foam::rigidBodyMeshMotionSolver::rigidBodyMeshMotionSolver
|
||||
|
||||
const dictionary& bodiesDict = coeffDict().subDict("bodies");
|
||||
|
||||
forAllConstIter(IDLList<entry>, bodiesDict, iter)
|
||||
for (const entry& dEntry : bodiesDict)
|
||||
{
|
||||
const dictionary& bodyDict = iter().dict();
|
||||
const keyType& bodyName = dEntry.keyword();
|
||||
const dictionary& bodyDict = dEntry.dict();
|
||||
|
||||
if (bodyDict.found("patches"))
|
||||
{
|
||||
const label bodyID = model_.bodyID(iter().keyword());
|
||||
const label bodyID = model_.bodyID(bodyName);
|
||||
|
||||
if (bodyID == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Body " << iter().keyword()
|
||||
<< "Body " << bodyName
|
||||
<< " has been merged with another body"
|
||||
" and cannot be assigned a set of patches"
|
||||
<< exit(FatalError);
|
||||
@ -149,7 +150,7 @@ Foam::rigidBodyMeshMotionSolver::rigidBodyMeshMotionSolver
|
||||
new bodyMesh
|
||||
(
|
||||
mesh,
|
||||
iter().keyword(),
|
||||
bodyName,
|
||||
bodyID,
|
||||
bodyDict
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user