1 // write time values to case file
3 scalar timeCorrection = 0;
4 if (timeDirs[0].value() < 0)
6 timeCorrection = - timeDirs[0].value();
7 Info<< "Correcting time values. Adding " << timeCorrection << endl;
10 // the case file is always ASCII
11 Info << "write case: " << caseFileName.c_str() << endl;
13 OFstream caseFile(ensightDir/caseFileName, IOstream::ASCII);
14 caseFile.setf(ios_base::left);
16 caseFile.setf(ios_base::scientific, ios_base::floatfield);
17 caseFile.precision(5);
21 << setw(16) << "type:" << "ensight gold" << nl << nl;
27 << setw(16) << "model: 1" << (dataMask/geometryName).c_str() << nl;
33 << setw(16) << "model:" << geometryName << nl;
37 // add information for clouds
38 // multiple clouds currently require the same time index
39 forAllConstIter(HashTable<HashTable<word> >, cloudFields, cloudIter)
41 const word& cloudName = cloudIter.key();
44 << setw(16) << "measured: 2"
45 << fileName(dataMask/cloud::prefix/cloudName/"positions").c_str()
49 << nl << "VARIABLE" << nl;
51 forAllConstIter(HashTable<word>, volumeFields, fieldIter)
53 const word& fieldName = fieldIter.key();
54 const word& fieldType = fieldIter();
57 if (fieldType == volScalarField::typeName)
59 ensightType = "scalar";
61 else if (fieldType == volVectorField::typeName)
63 ensightType = "vector";
65 else if (fieldType == volSphericalTensorField::typeName)
67 ensightType = "tensor symm";
69 else if (fieldType == volSymmTensorField::typeName)
71 ensightType = "tensor symm";
73 else if (fieldType == volTensorField::typeName)
75 ensightType = "tensor asym";
78 if (ensightType.size())
90 // TODO: allow similar/different time-steps for each cloud
94 forAllConstIter(HashTable<HashTable<word> >, cloudFields, cloudIter)
96 const word& cloudName = cloudIter.key();
98 forAllConstIter(HashTable<word>, cloudIter(), fieldIter)
100 const word& fieldName = fieldIter.key();
101 const word& fieldType = fieldIter();
104 if (fieldType == scalarIOField::typeName)
106 ensightType = "scalar";
108 else if (fieldType == vectorIOField::typeName)
110 ensightType = "vector";
112 else if (fieldType == tensorIOField::typeName)
114 ensightType = "tensor";
117 if (ensightType.size())
125 cloud::prefix/cloudName,
136 caseFile << nl << "TIME" << nl;
138 // time set 1 - geometry and volume fields
139 if (fieldTimesUsed.size())
142 << "time set: " << 1 << nl
143 << "number of steps: " << fieldTimesUsed.size() << nl
144 << "filename numbers:" << nl;
147 forAll(fieldTimesUsed, i)
150 << " " << setw(12) << fieldTimesUsed[i];
152 if (++count % 6 == 0)
159 << nl << "time values:" << nl;
162 forAll(fieldTimesUsed, i)
166 << timeIndices[fieldTimesUsed[i]] + timeCorrection;
168 if (++count % 6 == 0)
173 caseFile << nl << nl;
176 // TODO: allow similar/different time-steps for each cloud
178 forAllConstIter(HashTable<DynamicList<label> >, cloudTimesUsed, cloudIter)
180 // const word& cloudName = cloudIter.key();
181 const DynamicList<label>& timesUsed = cloudIter();
183 if (timesUsed.size() && cloudNo == 0)
186 << "time set: " << 2 << nl
187 << "number of steps: " << timesUsed.size() << nl
188 << "filename numbers:" << nl;
194 << " " << setw(12) << timesUsed[i];
196 if (++count % 6 == 0)
203 << nl << "time values:" << nl;
210 << timeIndices[timesUsed[i]] + timeCorrection;
212 if (++count % 6 == 0)
217 caseFile << nl << nl;
223 caseFile << "# end" << nl;