gmvOutputHeader.H
Go to the documentation of this file.
1 const pointField& points = mesh.points();
2 label nPoints = points.size();
3 const cellShapeList& cells = mesh.cellShapes();
4 
5 gmvFile << "gmvinput " << format << nl;
6 gmvFile << "nodes " << nPoints << nl;
7 for (label indx=0;indx<nPoints;indx++)
8 {
9  gmvFile << points[indx].x() << " ";
10 }
11 gmvFile << nl;
12 for (label indx=0;indx<nPoints;indx++)
13 {
14  gmvFile << points[indx].y() << " ";
15 }
16 gmvFile << nl;
17 for (label indx=0;indx<nPoints;indx++)
18 {
19  gmvFile << points[indx].z() << " ";
20 }
21 gmvFile << nl;
22 gmvFile << "cells " << cells.size() << nl;
23 forAll(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 }
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
word format(conversionProperties.lookup("format"))
fvMesh & mesh
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:42
List< cellShape > cellShapeList
List of cellShapes and PtrList of List of cellShape.
Definition: cellShapeList.H:43
const pointField & points
label nPoints
static const char nl
Definition: Ostream.H:260