Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ScalFMM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
solverstack
ScalFMM
Commits
c440a8f4
Commit
c440a8f4
authored
Dec 17, 2015
by
BRAMAS Berenger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update mpi qs
parent
6095b0ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
Src/Utils/FQuickSortMpi.hpp
Src/Utils/FQuickSortMpi.hpp
+17
-12
No files found.
Src/Utils/FQuickSortMpi.hpp
View file @
c440a8f4
...
...
@@ -257,27 +257,32 @@ class FQuickSortMpi : public FQuickSort< SortType, IndexType> {
NO_VALUES
,
AVERAGE_2
};
// We need to know the max value to ensure that the pivot will be different
CompareType
maxFoundValue
=
CompareType
(
workingArray
[
0
]);
// Check if all the same
bool
allTheSame
=
true
;
for
(
int
idx
=
1
;
idx
<
currentSize
&&
allTheSame
;
++
idx
){
if
(
workingArray
[
0
]
!=
workingArray
[
idx
]){
allTheSame
=
false
;
}
// Keep the max
maxFoundValue
=
FMath
::
Max
(
maxFoundValue
,
CompareType
(
workingArray
[
idx
]));
}
// Check if empty
const
bool
noValues
=
(
currentSize
==
0
);
// Get the local pivot if not empty
CompareType
localPivot
=
CompareType
(
0
);
if
(
!
noValues
){
localPivot
=
(
CompareType
(
workingArray
[
currentSize
/
3
])
+
CompareType
(
workingArray
[(
2
*
currentSize
)
/
3
]))
/
2
;
if
(
noValues
==
false
){
// We need to know the max value to ensure that the pivot will be different
CompareType
maxFoundValue
=
CompareType
(
workingArray
[
0
]);
// We need to know the min value to ensure that the pivot will be different
CompareType
minFoundValue
=
CompareType
(
workingArray
[
0
]);
for
(
int
idx
=
1
;
idx
<
currentSize
;
++
idx
){
// Keep the max
maxFoundValue
=
FMath
::
Max
(
maxFoundValue
,
CompareType
(
workingArray
[
idx
]));
// Keep the min
minFoundValue
=
FMath
::
Min
(
minFoundValue
,
CompareType
(
workingArray
[
idx
]));
}
allTheSame
=
(
maxFoundValue
==
minFoundValue
);
// Value equal to pivot are kept on the left so
localPivot
=
((
maxFoundValue
-
minFoundValue
)
/
2
)
+
minFoundValue
;
// The pivot must be different (to ensure that the partition will return two parts)
if
(
localPivot
==
maxFoundValue
&&
!
allTheSame
){
FLOG
(
FLog
::
Controller
<<
"SCALFMM-DEBUG ["
<<
currentComm
.
processId
()
<<
"] Pivot "
<<
localPivot
<<
" is equal max and allTheSame equal "
<<
allTheSame
<<
"
\n
"
;
)
FLOG
(
FLog
::
Controller
.
flush
());
FLOG
(
FLog
::
Controller
.
flush
());
localPivot
-=
1
;
}
}
...
...
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