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

Function writeTRI

src/triSurface/triSurface/interfaces/TRI/writeTRI.C:36–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
35
36void triSurface::writeTRI(const bool writeSorted, Ostream& os) const
37{
38 const pointField& ps = points();
39
40 // Write as cloud of triangles
41
42 labelList faceMap;
43
44 surfacePatchList patches(calcPatches(faceMap));
45
46 if (writeSorted)
47 {
48 label faceIndex = 0;
49
50 forAll(patches, patchi)
51 {
52 for
53 (
54 label patchFacei = 0;
55 patchFacei < patches[patchi].size();
56 patchFacei++
57 )
58 {
59 const label facei = faceMap[faceIndex++];
60
61 const point& p1 = ps[operator[](facei)[0]];
62 const point& p2 = ps[operator[](facei)[1]];
63 const point& p3 = ps[operator[](facei)[2]];
64
65 os << p1.x() << token::SPACE
66 << p1.y() << token::SPACE
67 << p1.z() << token::SPACE
68
69 << p2.x() << token::SPACE
70 << p2.y() << token::SPACE
71 << p2.z() << token::SPACE
72
73 << p3.x() << token::SPACE
74 << p3.y() << token::SPACE
75 << p3.z() << token::SPACE
76
77 << "0x" << hex << operator[](facei).region() << dec
78 << endl;
79 }
80 }
81 }
82 else
83 {
84 forAll(*this, facei)
85 {
86 const point& p1 = ps[operator[](facei)[0]];
87 const point& p2 = ps[operator[](facei)[1]];
88 const point& p3 = ps[operator[](facei)[2]];
89
90 os << p1.x() << token::SPACE
91 << p1.y() << token::SPACE
92 << p1.z() << token::SPACE
93

Callers 1

writeFunction · 0.85

Calls 7

pointsFunction · 0.85
forAllFunction · 0.50
sizeMethod · 0.45
xMethod · 0.45
yMethod · 0.45
zMethod · 0.45
regionMethod · 0.45

Tested by

no test coverage detected