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

Function writeAC

src/triSurface/triSurface/interfaces/AC3D/writeAC.C:32–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
31
32void Foam::triSurface::writeAC(Ostream& os) const
33{
34 // Write with patches as separate objects under "world" object.
35 // Header is taken over from sample file.
36 // Defines separate materials for all patches. Recycle colours.
37
38 // Define 8 standard colours as r,g,b components
39 static scalar colourMap[] =
40 {
41 1, 1, 1,
42 1, 0, 0,
43 0, 1, 0,
44 0, 0, 1,
45 1, 1, 0,
46 0, 1, 1,
47 1, 0, 1,
48 0.5, 0.5, 1
49 };
50
51 // Calculate patch face indexing
52
53 labelList faceMap;
54
55 surfacePatchList patches(calcPatches(faceMap));
56
57
58 // Write header. Define materials.
59
60 os << "AC3Db" << endl;
61
62 forAll(patches, patchi)
63 {
64 const word& pName = patches[patchi].name();
65
66 label colourI = patchi % 8;
67 label colourCompI = 3 * colourI;
68
69 os << "MATERIAL \"" << pName << "Mat\" rgb "
70 << colourMap[colourCompI] << ' ' << colourMap[colourCompI+1]
71 << ' ' << colourMap[colourCompI+2]
72 << " amb 0.2 0.2 0.2 emis 0 0 0 spec 0.5 0.5 0.5 shi 10"
73 << " trans 0"
74 << endl;
75 }
76
77 os << "OBJECT world" << endl
78 << "kids " << patches.size() << endl;
79
80
81 // Write patch points & faces.
82
83 label faceIndex = 0;
84
85 forAll(patches, patchi)
86 {
87 const surfacePatch& sp = patches[patchi];
88
89 os << "OBJECT poly" << endl

Callers 1

writeFunction · 0.85

Calls 9

subsetMeshFunction · 0.85
localPointsMethod · 0.80
forAllFunction · 0.50
nameMethod · 0.45
sizeMethod · 0.45
nPointsMethod · 0.45
xMethod · 0.45
yMethod · 0.45
zMethod · 0.45

Tested by

no test coverage detected