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

Function main

applications/test/Circulator/Test-Circulator.C:44–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42// Main program:
43
44int main(int argc, char *argv[])
45{
46 Info<< "Test the implementation of a circular iterator" << nl << endl;
47
48 Info<< "Test const circulator. First go forwards, then backwards."
49 << nl << endl;
50
51 face f(identity(4));
52
53 ConstCirculator<face> cStart(f);
54
55 if (cStart.size()) do
56 {
57 Info<< "Iterate forwards over face (prev/curr/next) : "
58 << cStart.prev() << " / " << cStart() << " / " << cStart.next()
59 << endl;
60
61 } while (cStart.circulate(CirculatorBase::CLOCKWISE));
62
63 if (cStart.size()) do
64 {
65 Info<< "Iterate backwards over face : " << cStart() << endl;
66
67 } while (cStart.circulate(CirculatorBase::ANTICLOCKWISE));
68
69
70 Info<< nl << nl << "Test non-const circulator" << nl << endl;
71
72 Circulator<face> cStart2(f);
73
74 Info<< "Face before : " << f << endl;
75
76 if (cStart2.size()) do
77 {
78 Info<< "Iterate forwards over face (prev/curr/next) : "
79 << cStart2.prev() << " / " << cStart2() << " / " << cStart2.next()
80 << endl;
81
82 } while (cStart2.circulate(CirculatorBase::CLOCKWISE));
83
84 if (cStart2.size()) do
85 {
86 Info<< "Iterate forwards over face, adding 1 to each element : "
87 << cStart2();
88
89 cStart2() += 1;
90
91 Info<< " -> " << cStart2() << endl;
92 } while (cStart2.circulate(CirculatorBase::CLOCKWISE));
93
94 Info<< "Face after : " << f << endl;
95
96
97 Info<< nl << nl << "Compare two faces: " << endl;
98 face a(identity(5));
99 Info<< "Compare " << a << " and " << a << " Match = " << face::compare(a, a)
100 << endl;
101

Callers

nothing calls this directly

Calls 6

compareFunction · 0.85
faceClass · 0.50
sizeMethod · 0.45
prevMethod · 0.45
nextMethod · 0.45
circulateMethod · 0.45

Tested by

no test coverage detected