Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
5c6b0989
Commit
5c6b0989
authored
Jan 07, 2019
by
Mark Olesen
Committed by
Andrew Heather
Jan 07, 2019
Browse files
ENH: for-range, forAllIters() ... in sampling/, surfMesh/
- reduced clutter when iterating over containers
parent
655f7d19
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/sampling/meshToMesh/meshToMeshParallelOps.C
View file @
5c6b0989
...
...
@@ -638,10 +638,9 @@ void Foam::meshToMesh::distributeAndMergeCells
key
[
1
]
=
max
(
proci
,
nbrProci
[
i
]);
key
[
2
]
=
localFacei
[
i
];
procCoupleInfo
::
const_iterator
fnd
=
procFaceToGlobalCell
.
find
(
key
);
const
auto
fnd
=
procFaceToGlobalCell
.
cfind
(
key
);
if
(
fnd
==
procFaceToGlobalCell
.
e
nd
())
if
(
!
fnd
.
fou
nd
())
{
procFaceToGlobalCell
.
insert
(
key
,
-
1
);
}
...
...
@@ -754,9 +753,9 @@ void Foam::meshToMesh::distributeAndMergeCells
key
[
1
]
=
max
(
proci
,
nbrProci
[
i
]);
key
[
2
]
=
localFacei
[
i
];
procCoupleInfo
::
iter
ato
r
fnd
=
procFaceToGlobalCell
.
find
(
key
);
a
u
to
fnd
=
procFaceToGlobalCell
.
find
(
key
);
if
(
fnd
!=
procFaceToGlobalCell
.
e
nd
())
if
(
fnd
.
fou
nd
())
{
label
tgtFacei
=
fnd
();
if
(
tgtFacei
==
-
1
)
...
...
src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C
View file @
5c6b0989
...
...
@@ -367,7 +367,7 @@ void Foam::UnsortedMeshedSurface<Face>::setZones
{
zoneToc_
[
zonei
]
=
surfZoneIdentifier
(
word
(
"zone"
)
+
::
Foam
::
name
(
zonei
),
"zone"
+
::
Foam
::
name
(
zonei
),
zonei
);
...
...
@@ -477,53 +477,39 @@ Foam::surfZoneList Foam::UnsortedMeshedSurface<Face>::sortedZones
// Step 1: get zone sizes and store (origId => zoneI)
Map
<
label
>
lookup
;
for
All
(
zoneIds_
,
facei
)
for
(
const
label
origId
:
zoneIds_
)
{
const
label
origId
=
zoneIds_
[
facei
];
Map
<
label
>::
iterator
fnd
=
lookup
.
find
(
origId
);
if
(
fnd
!=
lookup
.
end
())
{
fnd
()
++
;
}
else
{
lookup
.
insert
(
origId
,
1
);
}
++
(
lookup
(
origId
,
0
));
}
// Step 2: assign start/size (and name) to the newZones
// re-use the lookup to map (zoneId => zoneI)
surfZoneList
zoneLst
(
lookup
.
size
());
label
start
=
0
;
label
zone
I
=
0
;
forAllIter
(
Map
<
label
>
,
lookup
,
iter
)
label
zone
i
=
0
;
forAllIter
s
(
lookup
,
iter
)
{
label
origId
=
iter
.
key
();
const
label
origId
=
iter
.
key
();
word
name
;
Map
<
word
>::
const_iterator
fnd
=
zoneNames
.
find
(
origId
);
if
(
fnd
!=
zoneNames
.
end
())
{
name
=
fnd
();
}
else
{
name
=
word
(
"zone"
)
+
::
Foam
::
name
(
zoneI
);
}
const
word
zoneName
=
zoneNames
.
lookup
(
origId
,
"zone"
+
::
Foam
::
name
(
zonei
)
// default name
);
zoneLst
[
zone
I
]
=
surfZone
zoneLst
[
zone
i
]
=
surfZone
(
n
ame
,
zoneN
ame
,
0
,
// initialize with zero size
start
,
zone
I
zone
i
);
// increment the start for the next zone
// and save the (zoneId => zoneI) mapping
start
+=
iter
();
iter
()
=
zone
I
++
;
iter
()
=
zone
i
++
;
}
...
...
@@ -532,7 +518,7 @@ Foam::surfZoneList Foam::UnsortedMeshedSurface<Face>::sortedZones
forAll
(
zoneIds_
,
facei
)
{
label
zonei
=
lookup
[
zoneIds_
[
facei
]];
const
label
zonei
=
lookup
[
zoneIds_
[
facei
]];
faceMap
[
facei
]
=
zoneLst
[
zonei
].
start
()
+
zoneLst
[
zonei
].
size
()
++
;
}
...
...
@@ -575,10 +561,9 @@ Foam::UnsortedMeshedSurface<Face>::subsetMesh
newFaces
[
facei
]
=
Face
(
locFaces
[
origFacei
]);
// Renumber labels for face
Face
&
f
=
newFaces
[
facei
];
forAll
(
f
,
fp
)
for
(
label
&
pointi
:
newFaces
[
facei
])
{
f
[
fp
]
=
oldToNew
[
f
[
fp
]
];
pointi
=
oldToNew
[
pointi
];
}
newZones
[
facei
]
=
zoneIds_
[
origFacei
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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