Go to the documentation of this file.00001
00002
00003 scalar timeCorrection = 0;
00004 if (timeDirs[0].value() < 0)
00005 {
00006 timeCorrection = - timeDirs[0].value();
00007 Info<< "Correcting time values. Adding " << timeCorrection << endl;
00008 }
00009
00010
00011 Info << "write case: " << caseFileName.c_str() << endl;
00012
00013 OFstream caseFile(ensightDir/caseFileName, IOstream::ASCII);
00014 caseFile.setf(ios_base::left);
00015
00016 caseFile.setf(ios_base::scientific, ios_base::floatfield);
00017 caseFile.precision(5);
00018
00019 caseFile
00020 << "FORMAT" << nl
00021 << setw(16) << "type:" << "ensight gold" << nl << nl;
00022
00023 if (hasMovingMesh)
00024 {
00025 caseFile
00026 << "GEOMETRY" << nl
00027 << setw(16) << "model: 1" << (dataMask/geometryName).c_str() << nl;
00028 }
00029 else
00030 {
00031 caseFile
00032 << "GEOMETRY" << nl
00033 << setw(16) << "model:" << geometryName << nl;
00034 }
00035
00036
00037
00038
00039 forAllConstIter(HashTable<HashTable<word> >, cloudFields, cloudIter)
00040 {
00041 const word& cloudName = cloudIter.key();
00042
00043 caseFile
00044 << setw(16) << "measured: 2"
00045 << fileName(dataMask/cloud::prefix/cloudName/"positions").c_str()
00046 << nl;
00047 }
00048 caseFile
00049 << nl << "VARIABLE" << nl;
00050
00051 forAllConstIter(HashTable<word>, volumeFields, fieldIter)
00052 {
00053 const word& fieldName = fieldIter.key();
00054 const word& fieldType = fieldIter();
00055 string ensightType;
00056
00057 if (fieldType == volScalarField::typeName)
00058 {
00059 ensightType = "scalar";
00060 }
00061 else if (fieldType == volVectorField::typeName)
00062 {
00063 ensightType = "vector";
00064 }
00065 else if (fieldType == volSphericalTensorField::typeName)
00066 {
00067 ensightType = "tensor symm";
00068 }
00069 else if (fieldType == volSymmTensorField::typeName)
00070 {
00071 ensightType = "tensor symm";
00072 }
00073 else if (fieldType == volTensorField::typeName)
00074 {
00075 ensightType = "tensor asym";
00076 }
00077
00078 if (ensightType.size())
00079 {
00080 ensightCaseEntry
00081 (
00082 caseFile,
00083 ensightType,
00084 fieldName,
00085 dataMask
00086 );
00087 }
00088 }
00089
00090
00091
00092
00093 label cloudNo = 0;
00094 forAllConstIter(HashTable<HashTable<word> >, cloudFields, cloudIter)
00095 {
00096 const word& cloudName = cloudIter.key();
00097
00098 forAllConstIter(HashTable<word>, cloudIter(), fieldIter)
00099 {
00100 const word& fieldName = fieldIter.key();
00101 const word& fieldType = fieldIter();
00102 string ensightType;
00103
00104 if (fieldType == scalarIOField::typeName)
00105 {
00106 ensightType = "scalar";
00107 }
00108 else if (fieldType == vectorIOField::typeName)
00109 {
00110 ensightType = "vector";
00111 }
00112 else if (fieldType == tensorIOField::typeName)
00113 {
00114 ensightType = "tensor";
00115 }
00116
00117 if (ensightType.size())
00118 {
00119 ensightCaseEntry
00120 (
00121 caseFile,
00122 ensightType,
00123 fieldName,
00124 dataMask,
00125 cloud::prefix/cloudName,
00126 cloudNo,
00127 2
00128 );
00129 }
00130 }
00131 cloudNo++;
00132 }
00133
00134
00135
00136 caseFile << nl << "TIME" << nl;
00137
00138
00139 if (fieldTimesUsed.size())
00140 {
00141 caseFile
00142 << "time set: " << 1 << nl
00143 << "number of steps: " << fieldTimesUsed.size() << nl
00144 << "filename numbers:" << nl;
00145
00146 label count = 0;
00147 forAll (fieldTimesUsed, i)
00148 {
00149 caseFile
00150 << " " << setw(12) << fieldTimesUsed[i];
00151
00152 if (++count % 6 == 0)
00153 {
00154 caseFile << nl;
00155 }
00156 }
00157
00158 caseFile
00159 << nl << "time values:" << nl;
00160
00161 count = 0;
00162 forAll (fieldTimesUsed, i)
00163 {
00164 caseFile
00165 << " " << setw(12)
00166 << timeIndices[fieldTimesUsed[i]] + timeCorrection;
00167
00168 if (++count % 6 == 0)
00169 {
00170 caseFile << nl;
00171 }
00172 }
00173 caseFile << nl << nl;
00174 }
00175
00176
00177 cloudNo = 0;
00178 forAllConstIter(HashTable<autoPtr<DynamicList<label> > >, cloudTimesUsed, cloudIter)
00179 {
00180
00181 const DynamicList<label>& timesUsed = cloudIter()();
00182
00183 if (timesUsed.size() && cloudNo == 0)
00184 {
00185 caseFile
00186 << "time set: " << 2 << nl
00187 << "number of steps: " << timesUsed.size() << nl
00188 << "filename numbers:" << nl;
00189
00190 label count = 0;
00191 forAll (timesUsed, i)
00192 {
00193 caseFile
00194 << " " << setw(12) << timesUsed[i];
00195
00196 if (++count % 6 == 0)
00197 {
00198 caseFile << nl;
00199 }
00200 }
00201
00202 caseFile
00203 << nl << "time values:" << nl;
00204
00205 count = 0;
00206 forAll (timesUsed, i)
00207 {
00208 caseFile
00209 << " " << setw(12)
00210 << timeIndices[timesUsed[i]] + timeCorrection;
00211
00212 if (++count % 6 == 0)
00213 {
00214 caseFile << nl;
00215 }
00216 }
00217 caseFile << nl << nl;
00218
00219 cloudNo++;
00220 }
00221 }
00222
00223 caseFile << "# end" << nl;
00224