From a65c6f234d670937f15fd32123ec32901e18ae89 Mon Sep 17 00:00:00 2001 From: mattijs <m.janssens@opencfd.co.uk> Date: Wed, 20 Aug 2008 12:10:43 +0100 Subject: [PATCH] make SortableList::sort always use stable sort --- .../Lists/SortableList/SortableList.C | 23 +------------------ .../Lists/SortableList/SortableList.H | 5 +--- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/src/OpenFOAM/containers/Lists/SortableList/SortableList.C b/src/OpenFOAM/containers/Lists/SortableList/SortableList.C index 7cde863a632..a4264578d10 100644 --- a/src/OpenFOAM/containers/Lists/SortableList/SortableList.C +++ b/src/OpenFOAM/containers/Lists/SortableList/SortableList.C @@ -86,28 +86,7 @@ void Foam::SortableList<Type>::sort() indices_[i] = i; } - Foam::sort(indices_, less(*this)); - - List<Type> tmpValues(this->size()); - - forAll(indices_, i) - { - tmpValues[i] = this->operator[](indices_[i]); - } - - List<Type>::transfer(tmpValues); -} - - - -template <class Type> -void Foam::SortableList<Type>::stableSort() -{ - forAll(indices_, i) - { - indices_[i] = i; - } - + //Foam::sort(indices_, less(*this)); Foam::stableSort(indices_, less(*this)); List<Type> tmpValues(this->size()); diff --git a/src/OpenFOAM/containers/Lists/SortableList/SortableList.H b/src/OpenFOAM/containers/Lists/SortableList/SortableList.H index a9ab2ae8294..dd0f0af0d43 100644 --- a/src/OpenFOAM/containers/Lists/SortableList/SortableList.H +++ b/src/OpenFOAM/containers/Lists/SortableList/SortableList.H @@ -109,12 +109,9 @@ public: //- Size the list. If grow can cause undefined indices (until next sort) void setSize(const label); - //- Sort the list (if changed after construction time) + //- (stable) sort the list (if changed after construction time) void sort(); - //- Sort the list (if changed after construction time) - void stableSort(); - // Member Operators -- GitLab