Loading...
Searching...
No Matches
gmvOutput.H
Go to the documentation of this file.
1for (const word& fieldType : fieldTypes)
2{
3 const wordList fieldNames = objects.sortedNames(fieldType);
4
5 if (fieldType == "volScalarField")
6 {
7 gmvFile << "variable" << nl;
8 }
9
10 for (const word& fieldName : fieldNames)
11 {
12 IOobject fieldObject
13 (
14 fieldName,
15 runTime.timeName(),
16 mesh,
17 IOobject::MUST_READ,
18 IOobject::NO_WRITE
19 );
20
21 if (fieldType == "volScalarField")
22 {
23 volScalarField fld(fieldObject, mesh);
24 gmvFile << fieldName << " 0" << nl;
25 for (label indx=0; indx<mesh.nCells(); ++indx)
26 {
27 gmvFile << fld[indx] << " ";
28 }
29 gmvFile << nl;
30 }
31
32 if (fieldType == "volVectorField")
33 {
34 if (fieldName == vComp)
35 {
36 volVectorField fld(fieldObject, mesh);
37 gmvFile << "velocity 0" << nl;
38 for (label indx=0;indx<mesh.nCells();indx++)
39 {
40 gmvFile << fld[indx].x() << " ";
41 }
42 for (label indx=0;indx<mesh.nCells();indx++)
43 {
44 gmvFile << fld[indx].y() << " ";
45 }
46 for (label indx=0;indx<mesh.nCells();indx++)
47 {
48 gmvFile << fld[indx].z() << " ";
49 }
50 gmvFile << nl;
51 }
52 }
53
54 if (fieldType == "surfaceScalarField")
55 {
56 // ...
57 }
58
59 }
60
61 if (fieldType == cloud::prefix)
62 {
63 IOobject positionsHeader
64 (
65 "positions",
66 runTime.timeName(),
67 cloud::prefix,
68 mesh,
69 IOobject::NO_READ
70 );
71
72 IOobject coordinatesHeader
73 (
74 "coordinates",
75 runTime.timeName(),
76 cloud::prefix,
77 mesh,
78 IOobject::NO_READ
79 );
80
81 if
82 (
83 positionsHeader.typeHeaderOk<IOPosition<Cloud<passiveParticle>>>
84 (
85 false
86 )
87 || coordinatesHeader.typeHeaderOk<IOPosition<Cloud<passiveParticle>>>
88 (
89 false
90 )
91 )
92 {
93 Cloud<passiveParticle> particles(mesh, cloud::defaultName);
94
95 IOobjectList objects(mesh, runTime.timeName(), cloud::prefix);
96
97 wordList lagrangianScalarNames(objects.sortedNames("scalarField"));
98 wordList lagrangianVectorNames(objects.sortedNames("vectorField"));
99
100 if (particles.size())
101 {
102 #include "gmvOutputLagrangian.H"
103 }
104 }
105 }
106
107 if (fieldType == "volScalarField")
108 {
109 gmvFile << "endvars" << nl;
110 }
111}
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
dynamicFvMesh & mesh
engineTime & runTime
word vComp(conversionProperties.get< word >("vector"))