mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: add inplaceUniqueSort function
- determines a unique sort order (as per uniqueOrder) and uses that to reorder the list and possibly truncate it.
This commit is contained in:
@ -113,9 +113,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< nl << "Test lambda predicates:" << nl << endl;
|
||||
|
||||
List<label> test6(identity(19));
|
||||
List<label> test6(identity(11));
|
||||
// shift range for general testing
|
||||
std::for_each(test6.begin(), test6.end(), [](label& x){ x -= 10; });
|
||||
std::for_each(test6.begin(), test6.end(), [](label& x){ x -= 4; });
|
||||
|
||||
Info<< "Subset of non-zero, even values: "
|
||||
<< subsetList
|
||||
@ -125,6 +125,16 @@ int main(int argc, char *argv[])
|
||||
) << nl
|
||||
<< endl;
|
||||
|
||||
|
||||
test6.append(identity(13));
|
||||
|
||||
// Randomize the list
|
||||
std::random_shuffle(test6.begin(), test6.end());
|
||||
|
||||
Info<< "Randomized: " << flatOutput(test6) << endl;
|
||||
inplaceUniqueSort(test6);
|
||||
Info<< "Unique : " << flatOutput(test6) << endl;
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user