mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
make SortableList::sort always use stable sort
This commit is contained in:
@ -86,28 +86,7 @@ void Foam::SortableList<Type>::sort()
|
|||||||
indices_[i] = i;
|
indices_[i] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
Foam::sort(indices_, less(*this));
|
//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::stableSort(indices_, less(*this));
|
Foam::stableSort(indices_, less(*this));
|
||||||
|
|
||||||
List<Type> tmpValues(this->size());
|
List<Type> tmpValues(this->size());
|
||||||
|
|||||||
@ -109,12 +109,9 @@ public:
|
|||||||
//- Size the list. If grow can cause undefined indices (until next sort)
|
//- Size the list. If grow can cause undefined indices (until next sort)
|
||||||
void setSize(const label);
|
void setSize(const label);
|
||||||
|
|
||||||
//- Sort the list (if changed after construction time)
|
//- (stable) sort the list (if changed after construction time)
|
||||||
void sort();
|
void sort();
|
||||||
|
|
||||||
//- Sort the list (if changed after construction time)
|
|
||||||
void stableSort();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user