Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
4da4f40d
Commit
4da4f40d
authored
Jan 07, 2019
by
Mark OLESEN
Committed by
Andrew Heather
Jan 07, 2019
Browse files
ENH: for-range, forAllIters() ... in lagrangian/ basic
- reduced clutter when iterating over containers
parent
6cbe8972
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/lagrangian/basic/InteractionLists/InteractionLists.C
View file @
4da4f40d
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd |
Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
...
...
@@ -320,10 +320,8 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
// Determine the index of all of the wall faces on this processor
DynamicList
<
label
>
localWallFaces
;
for
All
(
mesh_
.
boundaryMesh
()
,
patchi
)
for
(
const
polyPatch
&
patch
:
mesh_
.
boundaryMesh
())
{
const
polyPatch
&
patch
=
mesh_
.
boundaryMesh
()[
patchi
];
if
(
isA
<
wallPolyPatch
>
(
patch
))
{
const
scalarField
areaFraction
(
patch
.
areaFraction
());
...
...
@@ -607,11 +605,9 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
// Reserve space to avoid multiple resizing
DynamicList
<
label
>
cellDIL
(
interactingElems
.
size
());
for
All
(
interactingElems
,
i
)
for
(
const
label
elemi
:
interactingElems
)
{
label
elemI
=
interactingElems
[
i
];
label
c
=
allCellsTree
.
shapes
().
cellLabels
()[
elemI
];
const
label
c
=
allCellsTree
.
shapes
().
cellLabels
()[
elemi
];
// Here, a more detailed geometric test could be applied,
// i.e. a more accurate bounding volume like a OBB or
...
...
@@ -634,9 +630,9 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
forAll
(
interactingElems
,
i
)
{
label
elem
I
=
interactingElems
[
i
];
const
label
elem
i
=
interactingElems
[
i
];
label
f
=
wallFacesTree
.
shapes
().
faceLabels
()[
elem
I
];
const
label
f
=
wallFacesTree
.
shapes
().
faceLabels
()[
elem
i
];
dwfil_
[
celli
][
i
]
=
f
;
}
...
...
@@ -849,10 +845,8 @@ void Foam::InteractionLists<ParticleType>::buildMap
// 1. Count
labelList
nSend
(
Pstream
::
nProcs
(),
Zero
);
for
All
(
toProc
,
i
)
for
(
const
label
proci
:
toProc
)
{
label
proci
=
toProc
[
i
];
nSend
[
proci
]
++
;
}
...
...
@@ -896,7 +890,7 @@ void Foam::InteractionLists<ParticleType>::buildMap
{
if
(
proci
!=
Pstream
::
myProcNo
())
{
label
nRecv
=
recvSizes
[
proci
];
const
label
nRecv
=
recvSizes
[
proci
];
constructMap
[
proci
].
setSize
(
nRecv
);
...
...
@@ -991,11 +985,11 @@ void Foam::InteractionLists<ParticleType>::fillReferredParticleCloud()
const
IDLList
<
ParticleType
>&
refCell
=
referredParticles_
[
refCelli
];
for
AllConstIter
(
typename
IDLList
<
ParticleType
>
,
refCell
,
iter
)
for
(
const
ParticleType
&
p
:
refCell
)
{
cloud_
.
addParticle
(
static_cast
<
ParticleType
*>
(
iter
()
.
clone
().
ptr
())
static_cast
<
ParticleType
*>
(
p
.
clone
().
ptr
())
);
}
}
...
...
@@ -1238,9 +1232,9 @@ void Foam::InteractionLists<ParticleType>::receiveReferredData
forAll
(
referredParticles_
,
refCelli
)
{
IDLList
<
ParticleType
>&
refCell
=
referredParticles_
[
refCelli
];
for
AllIter
(
typename
IDLList
<
ParticleType
>
,
refCell
,
iter
)
for
(
ParticleType
&
p
:
refCell
)
{
iter
()
.
correctAfterInteractionListReferral
(
ril_
[
refCelli
][
0
]);
p
.
correctAfterInteractionListReferral
(
ril_
[
refCelli
][
0
]);
}
}
...
...
src/lagrangian/solidParticle/solidParticleIO.C
View file @
4da4f40d
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd |
Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
...
...
@@ -78,13 +78,11 @@ void Foam::solidParticle::readFields(Cloud<solidParticle>& c)
c
.
checkFieldIOobject
(
c
,
U
);
label
i
=
0
;
for
AllIter
(
Cloud
<
solidParticle
>
,
c
,
iter
)
for
(
solidParticle
&
p
:
c
)
{
solidParticle
&
p
=
iter
();
p
.
d_
=
d
[
i
];
p
.
U_
=
U
[
i
];
i
++
;
++
i
;
}
}
...
...
@@ -93,19 +91,17 @@ void Foam::solidParticle::writeFields(const Cloud<solidParticle>& c)
{
particle
::
writeFields
(
c
);
label
np
=
c
.
size
();
const
label
np
=
c
.
size
();
IOField
<
scalar
>
d
(
c
.
fieldIOobject
(
"d"
,
IOobject
::
NO_READ
),
np
);
IOField
<
vector
>
U
(
c
.
fieldIOobject
(
"U"
,
IOobject
::
NO_READ
),
np
);
label
i
=
0
;
for
AllConstIter
(
Cloud
<
solidParticle
>
,
c
,
iter
)
for
(
const
solidParticle
&
p
:
c
)
{
const
solidParticle
&
p
=
iter
();
d
[
i
]
=
p
.
d_
;
U
[
i
]
=
p
.
U_
;
i
++
;
++
i
;
}
d
.
write
(
np
>
0
);
...
...
src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H
View file @
4da4f40d
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd |
Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation
...
...
@@ -110,9 +110,8 @@ inline Foam::scalar Foam::SprayCloud<CloudType>::penetration
label
i
=
0
;
scalar
mSum
=
0.0
;
for
AllConstIter
(
typename
SprayCloud
<
CloudType
>
,
*
this
,
iter
)
for
(
const
parcelType
&
p
:
*
this
)
{
const
parcelType
&
p
=
iter
();
scalar
m
=
p
.
nParticle
()
*
p
.
mass
();
scalar
d
=
mag
(
p
.
position
()
-
p
.
position0
());
mSum
+=
m
;
...
...
@@ -120,7 +119,7 @@ inline Foam::scalar Foam::SprayCloud<CloudType>::penetration
mass
[
i
]
=
m
;
dist
[
i
]
=
d
;
i
++
;
++
i
;
}
// calculate total mass across all processors
...
...
src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C
View file @
4da4f40d
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016
-2019
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
...
...
@@ -200,9 +200,8 @@ void Foam::SprayParcel<ParcelType>::readFields
c
.
checkFieldIOobject
(
c
,
user
);
label
i
=
0
;
for
AllIter
(
typename
Cloud
<
SprayParcel
<
ParcelType
>
>
,
c
,
iter
)
for
(
SprayParcel
<
ParcelType
>
&
p
:
c
)
{
SprayParcel
<
ParcelType
>&
p
=
iter
();
p
.
d0_
=
d0
[
i
];
p
.
position0_
=
position0
[
i
];
p
.
sigma_
=
sigma
[
i
];
...
...
@@ -216,7 +215,7 @@ void Foam::SprayParcel<ParcelType>::readFields
p
.
injector_
=
injector
[
i
];
p
.
tMom_
=
tMom
[
i
];
p
.
user_
=
user
[
i
];
i
++
;
++
i
;
}
}
...
...
@@ -268,9 +267,8 @@ void Foam::SprayParcel<ParcelType>::writeFields
IOField
<
scalar
>
user
(
c
.
fieldIOobject
(
"user"
,
IOobject
::
NO_READ
),
np
);
label
i
=
0
;
for
AllConstIter
(
typename
Cloud
<
SprayParcel
<
ParcelType
>
>
,
c
,
iter
)
for
(
const
SprayParcel
<
ParcelType
>
&
p
:
c
)
{
const
SprayParcel
<
ParcelType
>&
p
=
iter
();
d0
[
i
]
=
p
.
d0_
;
position0
[
i
]
=
p
.
position0_
;
sigma
[
i
]
=
p
.
sigma_
;
...
...
@@ -284,7 +282,7 @@ void Foam::SprayParcel<ParcelType>::writeFields
injector
[
i
]
=
p
.
injector_
;
tMom
[
i
]
=
p
.
tMom_
;
user
[
i
]
=
p
.
user_
;
i
++
;
++
i
;
}
const
bool
valid
=
np
>
0
;
...
...
@@ -354,9 +352,8 @@ void Foam::SprayParcel<ParcelType>::writeObjects
IOField
<
scalar
>&
user
(
cloud
::
createIOField
<
scalar
>
(
"user"
,
np
,
obr
));
label
i
=
0
;
for
AllConstIter
(
typename
Cloud
<
SprayParcel
<
ParcelType
>
>
,
c
,
iter
)
for
(
const
SprayParcel
<
ParcelType
>
&
p
:
c
)
{
const
SprayParcel
<
ParcelType
>&
p
=
iter
();
d0
[
i
]
=
p
.
d0_
;
position0
[
i
]
=
p
.
position0_
;
sigma
[
i
]
=
p
.
sigma_
;
...
...
@@ -370,7 +367,7 @@ void Foam::SprayParcel<ParcelType>::writeObjects
injector
[
i
]
=
p
.
injector_
;
tMom
[
i
]
=
p
.
tMom_
;
user
[
i
]
=
p
.
user_
;
i
++
;
++
i
;
}
}
...
...
src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C
View file @
4da4f40d
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd |
Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
...
...
@@ -43,9 +43,9 @@ void Foam::ORourkeCollision<CloudType>::collide
{
// Create the occupancy list for the cells
labelList
occupancy
(
this
->
owner
().
mesh
().
nCells
(),
Zero
);
for
AllIter
(
typename
CloudType
,
this
->
owner
()
,
iter
)
for
(
const
parcelType
&
p
:
this
->
owner
())
{
occupancy
[
iter
()
.
cell
()]
++
;
occupancy
[
p
.
cell
()]
++
;
}
// Initialize the sizes of the lists of parcels in each cell
...
...
@@ -55,9 +55,9 @@ void Foam::ORourkeCollision<CloudType>::collide
occupancy
=
0
;
// Set the parcel pointer lists for each cell
for
AllIter
(
typename
CloudType
,
this
->
owner
()
,
iter
)
for
(
parcelType
&
p
:
this
->
owner
())
{
pInCell
(
iter
()
.
cell
(),
occupancy
[
iter
()
.
cell
()]
++
)
=
&
iter
()
;
pInCell
(
p
.
cell
(),
occupancy
[
p
.
cell
()]
++
)
=
&
p
;
}
for
(
label
celli
=
0
;
celli
<
this
->
owner
().
mesh
().
nCells
();
celli
++
)
...
...
@@ -108,9 +108,8 @@ void Foam::ORourkeCollision<CloudType>::collide
}
// Remove coalesced parcels that fall below minimum mass threshold
for
AllIter
(
typename
CloudType
,
this
->
owner
()
,
iter
)
for
(
parcelType
&
p
:
this
->
owner
())
{
parcelType
&
p
=
iter
();
scalar
mass
=
p
.
nParticle
()
*
p
.
mass
();
if
(
mass
<
this
->
owner
().
constProps
().
minParcelMass
())
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment