BUGFIX: Illegal use of uninitialised value (backport)
[foam-extend-3.2.git] / applications / utilities / postProcessing / dataConversion / foamToGMV / gmvOutput.H
blob00a1b4cb5f309cfb32db5796755ad16ebba567a0
1 for (label i = 0; i < nTypes; i++)
3     wordList fieldNames = objects.names(fieldTypes[i]);
5     if (fieldTypes[i] == "volScalarField")
6     {
7         gmvFile << "variable" << nl;
8     }
9     for (label j=0; j < fieldNames.size(); j++)
10     {
12         word fieldName = fieldNames[j];
14         IOobject fieldObject
15         (
16             fieldName,
17             runTime.timeName(),
18             mesh,
19             IOobject::MUST_READ,
20             IOobject::NO_WRITE
21         );
23         if (fieldTypes[i] == "volScalarField")
24         {
25             volScalarField gmvScalarField(fieldObject, mesh);
26             gmvFile << fieldName << " 0" << nl;
27             for(label indx=0;indx<mesh.nCells();indx++)
28             {
29                 gmvFile << gmvScalarField[indx] << " ";
30             }
31             gmvFile << nl;
32         }
34         if (fieldTypes[i] == "volVectorField")
35         {
36             if (fieldName == vComp)
37             {
38                 volVectorField gmvVectorField(fieldObject, mesh);
39                 gmvFile << "velocity 0" << nl;
40                 for (label indx=0;indx<mesh.nCells();indx++)
41                 {
42                     gmvFile << gmvVectorField[indx].x() << " ";
43                 }
44                 for (label indx=0;indx<mesh.nCells();indx++)
45                 {
46                     gmvFile << gmvVectorField[indx].y() << " ";
47                 }
48                 for (label indx=0;indx<mesh.nCells();indx++)
49                 {
50                     gmvFile << gmvVectorField[indx].z() << " ";
51                 }
52                 gmvFile << nl;
53             }
54         }
56         if (fieldTypes[i] == "surfaceScalarField")
57         {
58             // ...
59         }
61     }
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         );
74         if (lagrangianHeader.headerOk())
75         {
76             Cloud<passiveParticle> particles(mesh);
78             IOobjectList objects(mesh, runTime.timeName(), cloud::prefix);
80             wordList lagrangianScalarNames = objects.names("scalarField");
81             wordList lagrangianVectorNames = objects.names("vectorField");
83             if (particles.size())
84             {
85 #               include "gmvOutputLagrangian.H"
86             }
87         }
88     }
90     if (fieldTypes[i] == "volScalarField")
91     {
92         gmvFile << "endvars" << nl;
93     }