Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
5c6b0989
Commit
5c6b0989
authored
6 years ago
by
Mark OLESEN
Committed by
Andrew Heather
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ENH: for-range, forAllIters() ... in sampling/, surfMesh/
- reduced clutter when iterating over containers
parent
655f7d19
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sampling/meshToMesh/meshToMeshParallelOps.C
+4
-5
4 additions, 5 deletions
src/sampling/meshToMesh/meshToMeshParallelOps.C
src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C
+19
-34
19 additions, 34 deletions
src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C
with
23 additions
and
39 deletions
src/sampling/meshToMesh/meshToMeshParallelOps.C
+
4
−
5
View file @
5c6b0989
...
@@ -638,10 +638,9 @@ void Foam::meshToMesh::distributeAndMergeCells
...
@@ -638,10 +638,9 @@ void Foam::meshToMesh::distributeAndMergeCells
key
[
1
]
=
max
(
proci
,
nbrProci
[
i
]);
key
[
1
]
=
max
(
proci
,
nbrProci
[
i
]);
key
[
2
]
=
localFacei
[
i
];
key
[
2
]
=
localFacei
[
i
];
procCoupleInfo
::
const_iterator
fnd
=
const
auto
fnd
=
procFaceToGlobalCell
.
cfind
(
key
);
procFaceToGlobalCell
.
find
(
key
);
if
(
fnd
==
procFaceToGlobalCell
.
e
nd
())
if
(
!
fnd
.
fou
nd
())
{
{
procFaceToGlobalCell
.
insert
(
key
,
-
1
);
procFaceToGlobalCell
.
insert
(
key
,
-
1
);
}
}
...
@@ -754,9 +753,9 @@ void Foam::meshToMesh::distributeAndMergeCells
...
@@ -754,9 +753,9 @@ void Foam::meshToMesh::distributeAndMergeCells
key
[
1
]
=
max
(
proci
,
nbrProci
[
i
]);
key
[
1
]
=
max
(
proci
,
nbrProci
[
i
]);
key
[
2
]
=
localFacei
[
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
();
label
tgtFacei
=
fnd
();
if
(
tgtFacei
==
-
1
)
if
(
tgtFacei
==
-
1
)
...
...
This diff is collapsed.
Click to expand it.
src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C
+
19
−
34
View file @
5c6b0989
...
@@ -367,7 +367,7 @@ void Foam::UnsortedMeshedSurface<Face>::setZones
...
@@ -367,7 +367,7 @@ void Foam::UnsortedMeshedSurface<Face>::setZones
{
{
zoneToc_
[
zonei
]
=
surfZoneIdentifier
zoneToc_
[
zonei
]
=
surfZoneIdentifier
(
(
word
(
"zone"
)
+
::
Foam
::
name
(
zonei
),
"zone"
+
::
Foam
::
name
(
zonei
),
zonei
zonei
);
);
...
@@ -477,53 +477,39 @@ Foam::surfZoneList Foam::UnsortedMeshedSurface<Face>::sortedZones
...
@@ -477,53 +477,39 @@ Foam::surfZoneList Foam::UnsortedMeshedSurface<Face>::sortedZones
// Step 1: get zone sizes and store (origId => zoneI)
// Step 1: get zone sizes and store (origId => zoneI)
Map
<
label
>
lookup
;
Map
<
label
>
lookup
;
for
All
(
zoneIds_
,
facei
)
for
(
const
label
origId
:
zoneIds_
)
{
{
const
label
origId
=
zoneIds_
[
facei
];
++
(
lookup
(
origId
,
0
));
Map
<
label
>::
iterator
fnd
=
lookup
.
find
(
origId
);
if
(
fnd
!=
lookup
.
end
())
{
fnd
()
++
;
}
else
{
lookup
.
insert
(
origId
,
1
);
}
}
}
// Step 2: assign start/size (and name) to the newZones
// Step 2: assign start/size (and name) to the newZones
// re-use the lookup to map (zoneId => zoneI)
// re-use the lookup to map (zoneId => zoneI)
surfZoneList
zoneLst
(
lookup
.
size
());
surfZoneList
zoneLst
(
lookup
.
size
());
label
start
=
0
;
label
start
=
0
;
label
zone
I
=
0
;
label
zone
i
=
0
;
forAllIter
(
Map
<
label
>
,
lookup
,
iter
)
forAllIter
s
(
lookup
,
iter
)
{
{
label
origId
=
iter
.
key
();
const
label
origId
=
iter
.
key
();
word
name
;
const
word
zoneName
=
Map
<
word
>::
const_iterator
fnd
=
zoneNames
.
find
(
origId
);
zoneNames
.
lookup
if
(
fnd
!=
zoneNames
.
end
())
(
{
origId
,
name
=
fnd
();
"zone"
+
::
Foam
::
name
(
zonei
)
// default name
}
);
else
{
name
=
word
(
"zone"
)
+
::
Foam
::
name
(
zoneI
);
}
zoneLst
[
zone
I
]
=
surfZone
zoneLst
[
zone
i
]
=
surfZone
(
(
n
ame
,
zoneN
ame
,
0
,
// initialize with zero size
0
,
// initialize with zero size
start
,
start
,
zone
I
zone
i
);
);
// increment the start for the next zone
// increment the start for the next zone
// and save the (zoneId => zoneI) mapping
// and save the (zoneId => zoneI) mapping
start
+=
iter
();
start
+=
iter
();
iter
()
=
zone
I
++
;
iter
()
=
zone
i
++
;
}
}
...
@@ -532,7 +518,7 @@ Foam::surfZoneList Foam::UnsortedMeshedSurface<Face>::sortedZones
...
@@ -532,7 +518,7 @@ Foam::surfZoneList Foam::UnsortedMeshedSurface<Face>::sortedZones
forAll
(
zoneIds_
,
facei
)
forAll
(
zoneIds_
,
facei
)
{
{
label
zonei
=
lookup
[
zoneIds_
[
facei
]];
const
label
zonei
=
lookup
[
zoneIds_
[
facei
]];
faceMap
[
facei
]
=
zoneLst
[
zonei
].
start
()
+
zoneLst
[
zonei
].
size
()
++
;
faceMap
[
facei
]
=
zoneLst
[
zonei
].
start
()
+
zoneLst
[
zonei
].
size
()
++
;
}
}
...
@@ -575,10 +561,9 @@ Foam::UnsortedMeshedSurface<Face>::subsetMesh
...
@@ -575,10 +561,9 @@ Foam::UnsortedMeshedSurface<Face>::subsetMesh
newFaces
[
facei
]
=
Face
(
locFaces
[
origFacei
]);
newFaces
[
facei
]
=
Face
(
locFaces
[
origFacei
]);
// Renumber labels for face
// Renumber labels for face
Face
&
f
=
newFaces
[
facei
];
for
(
label
&
pointi
:
newFaces
[
facei
])
forAll
(
f
,
fp
)
{
{
f
[
fp
]
=
oldToNew
[
f
[
fp
]
];
pointi
=
oldToNew
[
pointi
];
}
}
newZones
[
facei
]
=
zoneIds_
[
origFacei
];
newZones
[
facei
]
=
zoneIds_
[
origFacei
];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment