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
0bd5bc85
Commit
0bd5bc85
authored
14 years ago
by
graham
Browse files
Options
Downloads
Patches
Plain Diff
ENH: UList shuffle function to randomly reorder a list.
parent
9b1788ac
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/OpenFOAM/containers/Lists/UList/UList.C
+7
-0
7 additions, 0 deletions
src/OpenFOAM/containers/Lists/UList/UList.C
src/OpenFOAM/containers/Lists/UList/UList.H
+3
-0
3 additions, 0 deletions
src/OpenFOAM/containers/Lists/UList/UList.H
with
10 additions
and
0 deletions
src/OpenFOAM/containers/Lists/UList/UList.C
+
7
−
0
View file @
0bd5bc85
...
@@ -145,6 +145,13 @@ void Foam::stableSort(UList<T>& a, const Cmp& cmp)
...
@@ -145,6 +145,13 @@ void Foam::stableSort(UList<T>& a, const Cmp& cmp)
}
}
template
<
class
T
>
void
Foam
::
shuffle
(
UList
<
T
>&
a
)
{
std
::
random_shuffle
(
a
.
begin
(),
a
.
end
());
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template
<
class
T
>
template
<
class
T
>
...
...
This diff is collapsed.
Click to expand it.
src/OpenFOAM/containers/Lists/UList/UList.H
+
3
−
0
View file @
0bd5bc85
...
@@ -344,6 +344,9 @@ void stableSort(UList<T>&);
...
@@ -344,6 +344,9 @@ void stableSort(UList<T>&);
template
<
class
T
,
class
Cmp
>
template
<
class
T
,
class
Cmp
>
void
stableSort
(
UList
<
T
>&
,
const
Cmp
&
);
void
stableSort
(
UList
<
T
>&
,
const
Cmp
&
);
template
<
class
T
>
void
shuffle
(
UList
<
T
>&
);
// Reverse the first n elements of the list
// Reverse the first n elements of the list
template
<
class
T
>
template
<
class
T
>
inline
void
reverse
(
UList
<
T
>&
,
const
label
n
);
inline
void
reverse
(
UList
<
T
>&
,
const
label
n
);
...
...
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