gmvOutput.H
Go to the documentation of this file.
1 for (label i=0; i < nTypes; i++)
2 {
3  wordList fieldNames = objects.names(fieldTypes[i]);
4 
5  if (fieldTypes[i] == "volScalarField")
6  {
7  gmvFile << "variable" << nl;
8  }
9 
10  forAll(fieldNames, j)
11  {
12  const word& fieldName = fieldNames[j];
13 
14  IOobject fieldObject
15  (
16  fieldName,
17  runTime.timeName(),
18  mesh,
19  IOobject::MUST_READ,
20  IOobject::NO_WRITE
21  );
22 
23  if (fieldTypes[i] == "volScalarField")
24  {
26  gmvFile << fieldName << " 0" << nl;
27  for (label indx=0;indx<mesh.nCells();indx++)
28  {
29  gmvFile << fld[indx] << " ";
30  }
31  gmvFile << nl;
32  }
33 
34  if (fieldTypes[i] == "volVectorField")
35  {
36  if (fieldName == vComp)
37  {
39  gmvFile << "velocity 0" << nl;
40  for (label indx=0;indx<mesh.nCells();indx++)
41  {
42  gmvFile << fld[indx].x() << " ";
43  }
44  for (label indx=0;indx<mesh.nCells();indx++)
45  {
46  gmvFile << fld[indx].y() << " ";
47  }
48  for (label indx=0;indx<mesh.nCells();indx++)
49  {
50  gmvFile << fld[indx].z() << " ";
51  }
52  gmvFile << nl;
53  }
54  }
55 
56  if (fieldTypes[i] == "surfaceScalarField")
57  {
58  // ...
59  }
60 
61  }
62 
63  if (fieldTypes[i] == cloud::prefix)
64  {
65  IOobject lagrangianHeader
66  (
67  "positions",
68  runTime.timeName(),
69  cloud::prefix,
70  mesh,
71  IOobject::NO_READ
72  );
73 
74  if
75  (
76  lagrangianHeader.typeHeaderOk<IOPosition<Cloud<passiveParticle>>>
77  (
78  false
79  )
80  )
81  {
82  Cloud<passiveParticle> particles(mesh, cloud::defaultName);
83 
84  IOobjectList objects(mesh, runTime.timeName(), cloud::prefix);
85 
86  wordList lagrangianScalarNames = objects.names("scalarField");
87  wordList lagrangianVectorNames = objects.names("vectorField");
88 
89  if (particles.size())
90  {
91  #include "gmvOutputLagrangian.H"
92  }
93  }
94  }
95 
96  if (fieldTypes[i] == "volScalarField")
97  {
98  gmvFile << "endvars" << nl;
99  }
100 }
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
engineTime & runTime
static List< word > lagrangianScalarNames
Definition: globalFoam.H:47
IOobject fieldObject(fieldNames[var2field[nVar]], runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE)
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
static List< word > fieldNames
Definition: globalFoam.H:46
word vComp(conversionProperties.lookup("vector"))
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
dynamicFvMesh & mesh
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
static List< word > lagrangianVectorNames
Definition: globalFoam.H:48
static const char nl
Definition: Ostream.H:265
objects
List< word > wordList
A List of words.
Definition: fileName.H:54