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
bd78da22
Commit
bd78da22
authored
Jan 07, 2019
by
Mark OLESEN
Committed by
Andrew Heather
Jan 07, 2019
Browse files
ENH: for-range, forAllIters() ... in mesh/
- reduced clutter when iterating over containers
parent
a766d386
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/mesh/blockMesh/blockEdges/blockEdge/blockEdge.H
View file @
bd78da22
...
...
@@ -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
...
...
@@ -168,8 +168,7 @@ public:
//- Destructor
virtual
~
blockEdge
()
{}
virtual
~
blockEdge
()
=
default
;
// Member Functions
...
...
src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C
View file @
bd78da22
...
...
@@ -913,13 +913,12 @@ Foam::label Foam::meshRefinement::splitFacesUndo
forAll
(
map
.
faceMap
(),
facei
)
{
label
oldFacei
=
map
.
faceMap
()[
facei
];
Map
<
label
>::
iterator
oldFaceFnd
=
splitFaceToIndex
.
find
(
oldFacei
);
if
(
oldFaceFnd
!=
splitFaceToIndex
.
end
())
const
auto
oldFaceFnd
=
splitFaceToIndex
.
cfind
(
oldFacei
);
if
(
oldFaceFnd
.
found
())
{
labelPair
&
twoFaces
=
facePairs
[
oldFaceFnd
()];
labelPair
&
twoFaces
=
facePairs
[
oldFaceFnd
.
val
()];
if
(
twoFaces
[
0
]
==
-
1
)
{
twoFaces
[
0
]
=
facei
;
...
...
src/mesh/snappyHexMesh/meshRefinement/meshRefinementBaffles.C
View file @
bd78da22
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-201
8
OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-201
9
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2014 OpenFOAM Foundation
...
...
@@ -1235,10 +1235,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergeBaffles
}
}
forAllConstIter
(
Map
<
label
>
,
faceToPatch
,
iter
)
forAllConstIter
s
(
faceToPatch
,
iter
)
{
label
faceI
=
iter
.
key
();
label
patchI
=
iter
();
const
label
faceI
=
iter
.
key
();
const
label
patchI
=
iter
.
val
();
if
(
!
mesh_
.
isInternalFace
(
faceI
))
{
...
...
src/mesh/snappyHexMesh/meshRefinement/meshRefinementProblemCells.C
View file @
bd78da22
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-201
8
OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-201
9
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2015 OpenFOAM Foundation
...
...
@@ -1300,18 +1300,18 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCellsGeometric
}
for
AllConstIter
(
faceSet
,
wrongFaces
,
iter
)
for
(
const
label
facei
:
wrongFaces
)
{
label
patchi
=
mesh_
.
boundaryMesh
().
whichPatch
(
iter
.
key
()
);
const
label
patchi
=
mesh_
.
boundaryMesh
().
whichPatch
(
facei
);
if
(
patchi
==
-
1
||
mesh_
.
boundaryMesh
()[
patchi
].
coupled
())
{
facePatch
[
iter
.
key
()
]
=
nearestAdaptPatch
[
iter
.
key
()
];
facePatch
[
facei
]
=
nearestAdaptPatch
[
facei
];
nBaffleFaces
++
;
//Pout<< " " <<
iter.key()
//Pout<< " " <<
facei
// //<< " on patch " << mesh_.boundaryMesh()[patchi].name()
// << " is destined for patch " << facePatch[
iter.key()
]
// << " is destined for patch " << facePatch[
facei
]
// << endl;
}
}
...
...
src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C
View file @
bd78da22
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015
-2019
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
...
...
@@ -504,12 +504,10 @@ void Foam::meshRefinement::markFeatureCellLevel
Pout
<<
"Constructing cloud for cell marking"
<<
endl
;
}
for
AllIter
(
Cloud
<
trackedParticle
>
,
startPointCloud
,
iter
)
for
(
const
trackedParticle
&
startTp
:
startPointCloud
)
{
const
trackedParticle
&
startTp
=
iter
();
label
featI
=
startTp
.
i
();
label
pointI
=
startTp
.
j
();
const
label
featI
=
startTp
.
i
();
const
label
pointI
=
startTp
.
j
();
const
edgeMesh
&
featureMesh
=
features_
[
featI
];
const
labelList
&
pEdges
=
featureMesh
.
pointEdges
()[
pointI
];
...
...
@@ -562,12 +560,10 @@ void Foam::meshRefinement::markFeatureCellLevel
cloud
.
move
(
cloud
,
td
,
maxTrackLen
);
// Make particle follow edge.
for
AllIter
(
Cloud
<
trackedParticle
>
,
cloud
,
iter
)
for
(
trackedParticle
&
tp
:
cloud
)
{
trackedParticle
&
tp
=
iter
();
label
featI
=
tp
.
i
();
label
pointI
=
tp
.
j
();
const
label
featI
=
tp
.
i
();
const
label
pointI
=
tp
.
j
();
const
edgeMesh
&
featureMesh
=
features_
[
featI
];
const
labelList
&
pEdges
=
featureMesh
.
pointEdges
()[
pointI
];
...
...
src/mesh/snappyHexMesh/meshRefinement/meshRefinementTemplates.C
View file @
bd78da22
...
...
@@ -209,11 +209,10 @@ void Foam::meshRefinement::addPatchFields
mesh
.
objectRegistry
::
lookupClass
<
GeoField
>
()
);
forAllIter
(
typename
HashTable
<
GeoField
*>
,
flds
,
iter
)
forAllIter
s
(
flds
,
iter
)
{
GeoField
&
fld
=
*
iter
();
typename
GeoField
::
Boundary
&
fldBf
=
fld
.
boundaryFieldRef
();
auto
&
fldBf
=
fld
.
boundaryFieldRef
();
label
sz
=
fldBf
.
size
();
fldBf
.
setSize
(
sz
+
1
);
...
...
@@ -243,7 +242,7 @@ void Foam::meshRefinement::reorderPatchFields
mesh
.
objectRegistry
::
lookupClass
<
GeoField
>
()
);
forAllIter
(
typename
HashTable
<
GeoField
*>
,
flds
,
iter
)
forAllIter
s
(
flds
,
iter
)
{
iter
()
->
boundaryFieldRef
().
reorder
(
oldToNew
);
}
...
...
src/mesh/snappyHexMesh/refinementSurfaces/refinementSurfaces.C
View file @
bd78da22
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-201
8
OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-201
9
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2015 OpenFOAM Foundation
...
...
@@ -461,11 +461,11 @@ Foam::refinementSurfaces::refinementSurfaces
}
// Overwrite with region specific information
forAllConstIter
(
Map
<
label
>
,
regionMinLevel
[
surfI
],
iter
)
forAllConstIter
s
(
regionMinLevel
[
surfI
],
iter
)
{
label
globalRegionI
=
regionOffset_
[
surfI
]
+
iter
.
key
();
minLevel_
[
globalRegionI
]
=
iter
();
minLevel_
[
globalRegionI
]
=
iter
.
val
();
maxLevel_
[
globalRegionI
]
=
regionMaxLevel
[
surfI
][
iter
.
key
()];
gapLevel_
[
globalRegionI
]
=
maxLevel_
[
globalRegionI
]
...
...
@@ -475,7 +475,7 @@ Foam::refinementSurfaces::refinementSurfaces
extendedGapMode_
[
globalRegionI
]
=
regionGapMode
[
surfI
][
iter
.
key
()];
}
forAllConstIter
(
Map
<
scalar
>
,
regionAngle
[
surfI
],
iter
)
forAllConstIter
s
(
regionAngle
[
surfI
],
iter
)
{
label
globalRegionI
=
regionOffset_
[
surfI
]
+
iter
.
key
();
...
...
@@ -483,11 +483,12 @@ Foam::refinementSurfaces::refinementSurfaces
}
const
Map
<
autoPtr
<
dictionary
>>&
localInfo
=
regionPatchInfo
[
surfI
];
forAllConstIter
(
Map
<
autoPtr
<
dictionary
>>
,
localInfo
,
iter
)
forAllConstIter
s
(
localInfo
,
iter
)
{
label
globalRegionI
=
regionOffset_
[
surfI
]
+
iter
.
key
();
const
dictionary
&
dict
=
*
(
iter
.
val
());
patchInfo_
.
set
(
globalRegionI
,
iter
()()
.
clone
());
patchInfo_
.
set
(
globalRegionI
,
dict
.
clone
());
}
}
}
...
...
src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C
View file @
bd78da22
...
...
@@ -314,18 +314,7 @@ void Foam::snappyLayerDriver::countCommonPoints
if
(
facei
<
nbFacei
)
{
// Only check once for each combination of two faces.
Map
<
label
>::
iterator
fnd
=
nCommonPoints
.
find
(
nbFacei
);
if
(
fnd
==
nCommonPoints
.
end
())
{
// First common vertex found.
nCommonPoints
.
insert
(
nbFacei
,
1
);
}
else
{
fnd
()
++
;
}
++
(
nCommonPoints
(
nbFacei
,
0
));
}
}
}
...
...
@@ -437,10 +426,10 @@ void Foam::snappyLayerDriver::checkCommonOrder
List
<
extrudeMode
>&
extrudeStatus
)
const
{
forAllConstIter
(
Map
<
label
>
,
nCommonPoints
,
iter
)
forAllConstIter
s
(
nCommonPoints
,
iter
)
{
label
nbFacei
=
iter
.
key
();
label
nCommon
=
iter
();
const
label
nbFacei
=
iter
.
key
();
const
label
nCommon
=
iter
.
val
();
const
face
&
curFace
=
pp
[
facei
];
const
face
&
nbFace
=
pp
[
nbFacei
];
...
...
@@ -1415,10 +1404,10 @@ void Foam::snappyLayerDriver::determineSidePatches
forAll
(
edgePatchID
,
i
)
{
label
patchi
=
edgePatchID
[
i
];
Map
<
label
>::
const_itera
to
r
fnd
=
wantedToAddedPatch
.
find
(
patchi
);
if
(
fnd
!=
wantedToAddedPatch
.
e
nd
())
const
au
to
fnd
=
wantedToAddedPatch
.
c
find
(
patchi
);
if
(
fnd
.
fou
nd
())
{
edgePatchID
[
i
]
=
fnd
();
edgePatchID
[
i
]
=
fnd
.
val
();
}
}
...
...
@@ -2098,10 +2087,8 @@ Foam::label Foam::snappyLayerDriver::truncateDisplacement
const
Map
<
label
>&
meshPointMap
=
pp
.
meshPointMap
();
for
AllConstIter
(
faceSet
,
illegalPatchFaces
,
iter
)
for
(
const
label
facei
:
illegalPatchFaces
)
{
label
facei
=
iter
.
key
();
if
(
mesh
.
isInternalFace
(
facei
))
{
FatalErrorInFunction
...
...
@@ -2115,9 +2102,10 @@ Foam::label Foam::snappyLayerDriver::truncateDisplacement
forAll
(
f
,
fp
)
{
if
(
meshPointMap
.
found
(
f
[
fp
]))
const
auto
fnd
=
meshPointMap
.
cfind
(
f
[
fp
]);
if
(
fnd
.
found
())
{
label
patchPointi
=
meshPointMap
[
f
[
fp
]]
;
const
label
patchPointi
=
fnd
.
val
()
;
if
(
extrudeStatus
[
patchPointi
]
!=
NOEXTRUDE
)
{
...
...
@@ -2820,8 +2808,8 @@ Foam::List<Foam::labelPair> Foam::snappyLayerDriver::getBafflesOnAddedMesh
{
label
oldFacei
=
newToOldFaces
[
facei
];
Map
<
label
>::
const_itera
to
r
faceFnd
=
baffleSet
.
find
(
oldFacei
);
if
(
faceFnd
!=
baffleSet
.
e
nd
())
const
au
to
faceFnd
=
baffleSet
.
find
(
oldFacei
);
if
(
faceFnd
.
fou
nd
())
{
label
bafflei
=
faceFnd
();
labelPair
&
p
=
newBaffles
[
bafflei
];
...
...
src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C
View file @
bd78da22
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-201
8
OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-201
9
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2015 OpenFOAM Foundation
...
...
@@ -1113,9 +1113,8 @@ Foam::label Foam::snappyRefineDriver::refinementInterfaceRefine
// Pass2: check for oppositeness
//for
AllConstIter(cellSet,
transitionCells
, iter
)
//for
(const label celli :
transitionCells)
//{
// const label celli : iter.key();
// const cell& cFaces = cells[celli];
// const point& cc = cellCentres[celli];
// const scalar rCVol = pow(cellVolumes[celli], -5.0/3.0);
...
...
@@ -1226,9 +1225,8 @@ Foam::label Foam::snappyRefineDriver::refinementInterfaceRefine
const
scalar
oppositeCos
=
Foam
::
cos
(
degToRad
(
135
.
0
));
for
AllConstIter
(
cellSet
,
transitionCells
,
iter
)
for
(
const
label
celli
:
transitionCells
)
{
label
celli
=
iter
.
key
();
const
cell
&
cFaces
=
cells
[
celli
];
label
cLevel
=
cutter
.
cellLevel
()[
celli
];
...
...
src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C
View file @
bd78da22
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-201
6
OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-201
9
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2015 OpenFOAM Foundation
...
...
@@ -225,10 +225,7 @@ Foam::tmp<Foam::pointField> Foam::snappySnapDriver::smoothInternalDisplacement
// Unmark any point on the boundary. If we're doing zero iterations of
// face-cell wave we might have coupled points not being unmarked.
forAll
(
pp
.
meshPoints
(),
pointi
)
{
isMovingPoint
.
unset
(
pp
.
meshPoints
()[
pointi
]);
}
isMovingPoint
.
unset
(
pp
.
meshPoints
());
// Make sure that points that are coupled to meshPoints but not on a patch
// are unmarked as well
...
...
@@ -962,12 +959,11 @@ Foam::labelList Foam::snappySnapDriver::getZoneSurfacePoints
{
label
meshPointi
=
f
[
fp
];
Map
<
label
>::
const_iterator
iter
=
pp
.
meshPointMap
().
find
(
meshPointi
);
const
auto
iter
=
pp
.
meshPointMap
().
cfind
(
meshPointi
);
if
(
iter
!=
pp
.
meshPointMap
().
e
nd
())
if
(
iter
.
fou
nd
())
{
label
pointi
=
iter
();
const
label
pointi
=
iter
.
val
();
pointOnZone
[
pointi
]
=
true
;
}
}
...
...
src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriverTemplates.C
View file @
bd78da22
...
...
@@ -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) 2015 OpenFOAM Foundation
...
...
@@ -49,12 +49,11 @@ Foam::labelList Foam::snappySnapDriver::getFacePoints
{
label
meshPointi
=
f
[
fp
];
Map
<
label
>::
const_iterator
iter
=
pp
.
meshPointMap
().
find
(
meshPointi
);
const
auto
iter
=
pp
.
meshPointMap
().
cfind
(
meshPointi
);
if
(
iter
!=
pp
.
meshPointMap
().
e
nd
())
if
(
iter
.
fou
nd
())
{
label
pointi
=
iter
();
const
label
pointi
=
iter
.
val
();
pointOnZone
[
pointi
]
=
true
;
}
}
...
...
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