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.name(),
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.name(),
69  cloud::prefix,
70  mesh,
71  IOobject::NO_READ
72  );
73 
74  if (lagrangianHeader.headerOk())
75  {
76  Cloud<passiveParticle> particles(mesh, cloud::defaultName);
77 
78  IOobjectList objects(mesh, runTime.name(), cloud::prefix);
79 
80  wordList lagrangianScalarNames = objects.names("scalarField");
81  wordList lagrangianVectorNames = objects.names("vectorField");
82 
83  if (particles.size())
84  {
85  #include "gmvOutputLagrangian.H"
86  }
87  }
88  }
89 
90  if (fieldTypes[i] == "volScalarField")
91  {
92  gmvFile << "endvars" << nl;
93  }
94 }
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
IOobject fieldObject(fieldNames[var2field[nVar]], runTime.name(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE)
static List< word > lagrangianScalarNames
Definition: globalFoam.H:47
static List< word > lagrangianVectorNames
Definition: globalFoam.H:48
static List< word > fieldNames
Definition: globalFoam.H:46
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
List< word > wordList
A List of words.
Definition: fileName.H:54
VolField< vector > volVectorField
Definition: volFieldsFwd.H:65
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
VolField< scalar > volScalarField
Definition: volFieldsFwd.H:64
static const char nl
Definition: Ostream.H:266
word vComp(conversionProperties.lookup("vector"))
objects