Merge branch 'listoutput' into 'develop'

Flat list output

See merge request !93
This commit is contained in:
Sergio Ferraris
2017-02-20 18:47:24 +00:00
30 changed files with 574 additions and 360 deletions

View File

@ -40,7 +40,6 @@ See also
#include "IStringStream.H"
#include "scalar.H"
#include "vector.H"
#include "ListOps.H"
#include "labelRange.H"
#include "ListOps.H"
@ -140,11 +139,36 @@ int main(int argc, char *argv[])
Info<< "Elements " << map << " out of " << list3
<< " => " << subList3 << endl;
// test flattened output
{
Info<< nl;
labelList longLabelList = identity(15);
Info<< "labels (contiguous=" << contiguous<label>() << ")" << nl;
Info<< "normal: " << longLabelList << nl;
Info<< "flatOutput: " << flatOutput(longLabelList) << nl;
// Info<< "flatOutput(14): " << flatOutput(longLabelList, 14) << nl;
// Info<< "flatOutput(15): " << flatOutput(longLabelList, 15) << nl;
stringList longStringList(12);
forAll(longStringList, i)
{
longStringList[i].resize(3, 'a' + i);
}
Info<< "string (contiguous=" << contiguous<string>() << ")" << nl;
Info<< "normal: " << longStringList << nl;
Info<< "flatOutput: " << flatOutput(longStringList) << nl;
// contiguous longStringList[i].resize(3, 'a' + i);
}
wordReList reLst;
wordList wLst;
stringList sLst;
scalar xxx(-1);
if (args.optionFound("flag"))
@ -173,9 +197,9 @@ int main(int argc, char *argv[])
}
Info<< nl
<< "-reList: " << reLst << nl
<< "-wordList: " << wLst << nl
<< "-stringList: " << sLst << endl;
<< "-reList: " << flatOutput(reLst) << nl
<< "-wordList: " << flatOutput(wLst) << nl
<< "-stringList: " << flatOutput(sLst) << endl;
return 0;
}

View File

@ -143,7 +143,7 @@ int main(int argc, char *argv[])
Info<< "\ntest Istream constructor\n";
list4.printInfo(Info, true);
Info<< list4 << " indices: " << list4.used()() <<endl;
Info<< list4 << " indices: " << list4.used()() << nl;
Info<< "\nassign from labelList\n";
list4 = labelList
@ -155,7 +155,7 @@ int main(int argc, char *argv[])
);
list4.printInfo(Info, true);
Info<< list4 << " indices: " << list4.used()() <<endl;
Info<< list4 << " indices: " << list4.used()() << nl;
Info<< "\nassign from indices\n";
list4.read
@ -168,7 +168,7 @@ int main(int argc, char *argv[])
list4.printInfo(Info, true);
Info<< list4 << " indices: " << list4.used()() <<endl;
Info<< list4 << " indices: " << list4.used()() << nl;
List<bool> boolLst(list4.size());
forAll(list4, i)
@ -176,8 +176,7 @@ int main(int argc, char *argv[])
boolLst[i] = list4[i];
}
Info<< "List<bool>: " << boolLst <<endl;
Info<< "List<bool>: " << boolLst << nl;
// check roundabout assignments
PackedList<2> pl2
@ -188,7 +187,7 @@ int main(int argc, char *argv[])
)()
);
Info<< "roundabout assignment: " << pl2 << endl;
Info<< "roundabout assignment: " << pl2 << nl;
list4.clear();
forAll(pl2, i)
@ -196,7 +195,7 @@ int main(int argc, char *argv[])
list4[i] = pl2[i];
}
list4.write(Info, true) << endl;
list4.writeList(Info, -1) << nl; // indexed output
list4.writeEntry("PackedBoolList", Info);