From 6a541ccc92468758ca0a4787ef0f7f4c2fcd4081 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 15 Mar 2018 15:20:00 +0100 Subject: [PATCH] COMP: avoid attempted auto-vivify with PackedBoolList [] - also ensure fewer side-effects from inplaceReorder - provide ListOps::reorder especially for PackedList and PackedBoolList since they behave differently from regular lists. --- applications/test/ListOps/Test-ListOps.C | 40 ++++++++- .../containers/Lists/ListOps/ListOps.C | 57 +++++++++++++ .../containers/Lists/ListOps/ListOps.H | 56 ++++++++++-- .../Lists/ListOps/ListOpsTemplates.C | 85 +++++++++++++++++-- .../polyTopoChange/polyTopoChange.C | 16 +--- 5 files changed, 226 insertions(+), 28 deletions(-) diff --git a/applications/test/ListOps/Test-ListOps.C b/applications/test/ListOps/Test-ListOps.C index e722ced197..c4fb44a0f5 100644 --- a/applications/test/ListOps/Test-ListOps.C +++ b/applications/test/ListOps/Test-ListOps.C @@ -125,7 +125,6 @@ int main(int argc, char *argv[]) ) << nl << endl; - test6.append(identity(13)); // Randomize the list @@ -135,6 +134,45 @@ int main(int argc, char *argv[]) inplaceUniqueSort(test6); Info<< "Unique : " << flatOutput(test6) << endl; + + // List reorder + labelList oldToNew(identity(40)); + std::random_shuffle(oldToNew.begin(), oldToNew.end()); + + // Force a few -1: + oldToNew[4] = oldToNew[8] = -1; + + Info<<"Test reorder - oldToNew:" << nl + << flatOutput(oldToNew) << nl << nl; + + PackedBoolList bitset + ( + ListOps::createWithValue + ( + 25, + labelList({8, 12, 15, 22, 4}), + true + ) + ); + + Info<<"bitset input: " << flatOutput(bitset) << nl; + inplaceReorder(oldToNew, bitset); + Info<<" reorder: " << flatOutput(bitset) << nl << nl; + + PackedList<2> packed + ( + ListOps::createWithValue