ENH: improve support for assignment from indirect list

- copy assignment from indirect list to SubList and Field
This commit is contained in:
Mark Olesen
2021-05-10 10:02:15 +02:00
parent 40567b844a
commit 17e6a14773
8 changed files with 89 additions and 18 deletions

View File

@ -62,7 +62,9 @@ void testFind(const T& val, const ListType& lst)
int main(int argc, char *argv[])
{
List<label> completeList(20);
labelList completeList(20);
labelList scratch(20);
scratch = -1;
forAll(completeList, i)
{
@ -71,12 +73,24 @@ int main(int argc, char *argv[])
Info<< "raw : " << flatOutput(completeList) << nl << endl;
List<label> addresses{1, 0, 3, 7, 4, 8, 5, 1, 0, 3, 7, 4, 8, 5, };
List<label> addresses({ 1, 0, 3, 7, 4, 8, 5, 1, 0, 3, 7, 4, 8, 5 });
labelUIndList idl1(completeList, addresses);
printInfo(idl1);
labelList::subList slice(scratch, idl1.size());
slice = idl1;
Info<< "sliced: " << flatOutput(slice) << nl;
Info<< "scratch: " << flatOutput(scratch) << nl;
// Again, but offset and using intermediate only
scratch = -1;
labelList::subList(scratch, idl1.size(), 5) = idl1;
Info<< "offset: " << flatOutput(scratch) << nl;
for (const label val : { 10, 30, 40, 50, 90, 80, 120 } )
{
testFind(val, idl1);