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;
15 ensightDir/caseFileName,
16 ios_base::out|ios_base::trunc,
19 caseFile.setf(ios_base::left);
21 caseFile.setf(ios_base::scientific, ios_base::floatfield);
22 caseFile.precision(5);
26 << setw(16) << "type:" << "ensight gold" << nl << nl;
32 << setw(16) << "model: 1" << (dataMask/geometryName).c_str() << nl;
38 << setw(16) << "model:" << geometryName << nl;
42 // add information for clouds
43 // multiple clouds currently require the same time index
44 forAllConstIter(HashTable<HashTable<word> >, cloudFields, cloudIter)
46 const word& cloudName = cloudIter.key();
49 << setw(16) << "measured: 2"
50 << fileName(dataMask/cloud::prefix/cloudName/"positions").c_str()
54 << nl << "VARIABLE" << nl;
56 forAllConstIter(HashTable<word>, volumeFields, fieldIter)
58 const word& fieldName = fieldIter.key();
59 const word& fieldType = fieldIter();
62 if (fieldType == volScalarField::typeName)
64 ensightType = "scalar";
66 else if (fieldType == volVectorField::typeName)
68 ensightType = "vector";
70 else if (fieldType == volSphericalTensorField::typeName)
72 ensightType = "tensor symm";
74 else if (fieldType == volSymmTensorField::typeName)
76 ensightType = "tensor symm";
78 else if (fieldType == volTensorField::typeName)
80 ensightType = "tensor asym";
83 if (ensightType.size())
95 // TODO: allow similar/different time-steps for each cloud
99 forAllConstIter(HashTable<HashTable<word> >, cloudFields, cloudIter)
101 const word& cloudName = cloudIter.key();
103 forAllConstIter(HashTable<word>, cloudIter(), fieldIter)
105 const word& fieldName = fieldIter.key();
106 const word& fieldType = fieldIter();
109 if (fieldType == scalarIOField::typeName)
111 ensightType = "scalar";
113 else if (fieldType == vectorIOField::typeName)
115 ensightType = "vector";
117 else if (fieldType == tensorIOField::typeName)
119 ensightType = "tensor";
122 if (ensightType.size())
130 cloud::prefix/cloudName,
141 caseFile << nl << "TIME" << nl;
143 // time set 1 - geometry and volume fields
144 if (fieldTimesUsed.size())
147 << "time set: " << 1 << nl
148 << "number of steps: " << fieldTimesUsed.size() << nl
149 << "filename numbers:" << nl;
152 forAll (fieldTimesUsed, i)
155 << " " << setw(12) << fieldTimesUsed[i];
157 if (++count % 6 == 0)
164 << nl << "time values:" << nl;
167 forAll (fieldTimesUsed, i)
171 << timeIndices[fieldTimesUsed[i]] + timeCorrection;
173 if (++count % 6 == 0)
178 caseFile << nl << nl;
181 // TODO: allow similar/different time-steps for each cloud
183 forAllConstIter(HashTable<DynamicList<label> >, cloudTimesUsed, cloudIter)
185 // const word& cloudName = cloudIter.key();
186 const DynamicList<label>& timesUsed = cloudIter();
188 if (timesUsed.size() && cloudNo == 0)
191 << "time set: " << 2 << nl
192 << "number of steps: " << timesUsed.size() << nl
193 << "filename numbers:" << nl;
196 forAll (timesUsed, i)
199 << " " << setw(12) << timesUsed[i];
201 if (++count % 6 == 0)
208 << nl << "time values:" << nl;
211 forAll (timesUsed, i)
215 << timeIndices[timesUsed[i]] + timeCorrection;
217 if (++count % 6 == 0)
222 caseFile << nl << nl;
228 caseFile << "# end" << nl;