Commit 8a72a1bd authored by COULAUD Olivier's avatar COULAUD Olivier
Browse files
parents 26c9c6bf 9c394b9a
......@@ -109,13 +109,24 @@ public:
#if _OPENMP < 200805 || defined(__ICC) || defined(__INTEL_COMPILER)
struct TaskInterval{
class TaskInterval{
IndexType left;
IndexType right;
int deep;
TaskInterval(const IndexType inLeft, const IndexType inRight, const int inDeep)
: left(inLeft), right(inRight), deep(inDeep){
const IndexType left;
const IndexType right;
const int deep;
IndexType getLeft() const{
return left;
IndexType getRight() const{
return right;
int getDeep() const{
return deep;
static void QsOmp(SortType elements[], const int nbElements){
......@@ -141,10 +152,10 @@ public:
// Does this task should create some other?
if(ts.deep == 0){
if(ts.getDeep() == 0){
// No release the mutex and run in seq
QsSequentialStep(elements , ts.left, ts.right);
QsSequentialStep(elements , ts.getLeft(), ts.getRight());
// Yes so inform other and release the mutex
......@@ -152,12 +163,12 @@ public:
// Partition
const IndexType part = QsPartition(elements, ts.left, ts.right);
const IndexType part = QsPartition(elements, ts.getLeft(), ts.getRight());
// Push the new task in the vector
tasks.push_back(TaskInterval(part+1, ts.right, ts.deep-1));
tasks.push_back(TaskInterval(ts.left, part-1, ts.deep-1));
tasks.push_back(TaskInterval(part+1, ts.getRight(), ts.getDeep()-1));
tasks.push_back(TaskInterval(ts.getLeft(), part-1, ts.getDeep()-1));
// We create new task but we are not working so inform other
numberOfThreadProceeding -= 1;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment