Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wp3-refactoring
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
exaFOAM
wp3-refactoring
Commits
33fb730f
Commit
33fb730f
authored
1 year ago
by
Gregor Weiss
Committed by
Sergey Lesnik
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
BUG&ENH: simpler and faster applyPermutation
parent
f6eff821
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/foam/meshes/polyMesh/CoherentMesh/sliceMeshHelperI.H
+11
-14
11 additions, 14 deletions
src/foam/meshes/polyMesh/CoherentMesh/sliceMeshHelperI.H
with
11 additions
and
14 deletions
src/foam/meshes/polyMesh/CoherentMesh/sliceMeshHelperI.H
+
11
−
14
View file @
33fb730f
...
...
@@ -156,22 +156,19 @@ void Foam::findValueExtend
template
<
typename
Container
,
typename
IndexContainer
>
void
Foam
::
applyPermutation
(
Container
&
data
,
const
IndexContainer
&
permutation
)
{
typedef
typename
IndexContainer
::
value_type
size_type
;
IndexContainer
indices
{
permutation
};
auto
size
=
static_cast
<
size_type
>
(
indices
.
size
());
for
(
size_type
rootIndex
=
0
;
rootIndex
<
size
;
rootIndex
++
)
Container
output
(
data
.
size
());
Foam
::
label
size
=
static_cast
<
Foam
::
label
>
(
indices
.
size
());
for
(
Foam
::
label
rootIndex
=
0
;
rootIndex
<
size
;
rootIndex
++
)
{
// Swap data elements and indices until indices match
auto
currentIndex
=
rootIndex
;
while
(
rootIndex
!=
indices
[
currentIndex
])
{
using
std
::
swap
;
auto
leafIndex
=
indices
[
currentIndex
];
swap
(
data
[
currentIndex
],
data
[
leafIndex
]);
swap
(
indices
[
currentIndex
],
currentIndex
);
}
indices
[
currentIndex
]
=
currentIndex
;
output
[
rootIndex
]
=
std
::
move
(
data
[
indices
[
rootIndex
]]);
}
std
::
move
(
data
.
begin
()
+
size
,
data
.
end
(),
output
.
begin
()
+
size
);
data
=
std
::
move
(
output
);
}
...
...
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