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 }
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
Foam::cellShapeList
List< cellShape > cellShapeList
List of cellShapes and PtrList of List of cellShape.
Definition: cellShapeList.H:45
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
nPoints
label nPoints
Definition: gmvOutputHeader.H:2
format
word format(conversionProperties.get< word >("format"))
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::nl
constexpr char nl
Definition: Ostream.H:404
points
const pointField & points
Definition: gmvOutputHeader.H:1
cells
const cellShapeList & cells
Definition: gmvOutputHeader.H:3