FreeFOAM The Cross-Platform CFD Toolkit
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 for(label indx=0;indx<cells.size();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 }
54 
55 // ************************ vim: set sw=4 sts=4 et: ************************ //