gmvOutputHeader.H
Go to the documentation of this file.
1const pointField& points = mesh.points();
2label nPoints = points.size();
3const cellShapeList& cells = mesh.cellShapes();
4
5gmvFile << "gmvinput " << format << nl;
6gmvFile << "nodes " << nPoints << nl;
7for (label indx=0;indx<nPoints;indx++)
8{
9 gmvFile << points[indx].x() << " ";
10}
11gmvFile << nl;
12for (label indx=0;indx<nPoints;indx++)
13{
14 gmvFile << points[indx].y() << " ";
15}
16gmvFile << nl;
17for (label indx=0;indx<nPoints;indx++)
18{
19 gmvFile << points[indx].z() << " ";
20}
21gmvFile << nl;
22gmvFile << "cells " << cells.size() << nl;
23forAll(cells, indx)
24{
25 label nNodes = cells[indx].size();
26 if (nNodes == 8)
27 {
28 gmvFile << "hex " << 8 << " ";
29 for (label ip=0; ip<nNodes; ip++)
30 {
31 gmvFile << cells[indx][ip] + 1 << " ";
32 }
33 gmvFile << nl;
34 }
35 else if (nNodes == 4)
36 {
37 gmvFile << "tet " << 4 << " ";
38 for (label ip=0; ip<nNodes; ip++)
39 {
40 gmvFile << cells[indx][ip] + 1 << " ";
41 }
42 gmvFile << nl;
43 }
44 else if (nNodes == 6)
45 {
46 gmvFile << "prism " << 6 << " ";
47 for (label ip=0; ip<nNodes; ip++)
48 {
49 gmvFile << cells[indx][ip] + 1 << " ";
50 }
51 gmvFile << nl;
52 }
53}
dynamicFvMesh & mesh
const pointField & points
label nPoints
const cellShapeList & cells
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
word format(conversionProperties.get< word >("format"))
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333