MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / main

Function main

applications/test/CompactListList/Test-CompactListList.C:43–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41// Main program:
42
43int main(int argc, char *argv[])
44{
45 {
46 // null construct
47 CompactListList<label> cll1;
48 Info<< "cll1:" << cll1 << endl;
49
50 // Resize and assign row by row
51 labelList row0(2, 0);
52 labelList row1(3, 1);
53
54 labelList rowSizes(2);
55 rowSizes[0] = row0.size();
56 rowSizes[1] = row1.size();
57 cll1.resize(rowSizes);
58
59 cll1[0].deepCopy(row0);
60 cll1[1].deepCopy(row1);
61 Info<< "cll1:" << cll1 << endl;
62
63 forAll(cll1.m(), i)
64 {
65 Info<< "i:" << i << " whichRow:" << cll1.whichRow(i) << endl;
66 }
67 }
68
69 List<List<label>> lll(5);
70 lll[0].setSize(3, 0);
71 lll[1].setSize(2, 1);
72 lll[2].setSize(6, 2);
73 lll[3].setSize(0, 3);
74 lll[4].setSize(1, 4);
75
76 CompactListList<label> cll2(lll);
77
78 Info<< "cll2 = " << cll2 << endl;
79
80 forAll(cll2, i)
81 {
82 Info<< cll2[i] << endl;
83 }
84
85 Info<< endl;
86
87 Info<< "cll2(2, 3) = " << cll2(2, 3) << nl << endl;
88 cll2(2, 3) = 999;
89 Info<< "cll2(2, 3) = " << cll2(2, 3) << nl << endl;
90
91 Info<< "cll2 as List<List<label >> " << cll2()
92 << endl;
93
94 cll2.setSize(3);
95
96 Info<< "cll2 = " << cll2 << endl;
97
98 cll2.setSize(0);
99
100 Info<< "cll2 = " << cll2 << endl;

Callers

nothing calls this directly

Calls 9

whichRowMethod · 0.80
forAllFunction · 0.50
faceClass · 0.50
sizeMethod · 0.45
resizeMethod · 0.45
mMethod · 0.45
setSizeMethod · 0.45
transferMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected