86 #include "readFields.H"
97 template<
class GeoField>
98 void print(
const char* msg, Ostream& os,
const PtrList<GeoField>& flds)
105 os <<
' ' << flds[i].name();
116 os <<
' ' << flds[i];
124 const polyBoundaryMesh&
patches,
128 DynamicList<label> patchIDs(
patches.size());
130 Info<<
"Combining patches:" <<
endl;
134 const polyPatch& pp =
patches[patchI];
138 isType<emptyPolyPatch>(pp)
139 || (Pstream::parRun() && isType<processorPolyPatch>(pp))
142 Info<<
" discarding empty/processor patch " << patchI
143 <<
" " << pp.name() <<
endl;
147 Info<<
" excluding patch " << patchI
148 <<
" " << pp.name() <<
endl;
152 patchIDs.append(patchI);
153 Info<<
" patch " << patchI <<
" " << pp.name() <<
endl;
156 return patchIDs.shrink();
163 int main(
int argc,
char *argv[])
167 "Tecplot binary file format writer"
170 timeSelector::addOptions();
177 "convert selected fields only. eg, '(p T U)'"
183 "restrict conversion to the specified cellSet"
189 "restrict conversion to the specified cellSet"
191 argList::addBoolOption
194 "output cell value on patches instead of patch value itself"
196 argList::addBoolOption
199 "do not generate file for mesh, only for patches"
201 argList::addBoolOption
209 "patches (wildcards) to exclude"
211 argList::addBoolOption
228 <<
"Using neighbouring cell value instead of patch value"
235 <<
"Outputting cell values only" <<
nl <<
endl;
243 Info<<
"Not including patches " << excludePatches <<
nl <<
endl;
251 vtkName = cellSetName;
253 else if (Pstream::parRun())
256 vtkName = runTime.caseName();
260 if (i != string::npos)
262 vtkName = vtkName.substr(i);
267 vtkName = runTime.caseName();
276 fileName fvPath(runTime.path()/
"Tecplot360");
278 fileName regionPrefix =
"";
292 || cellSetName.size()
296 Info<<
"Keeping old files in " << fvPath <<
nl <<
endl;
300 Info<<
"Deleting old VTK files in " << fvPath <<
nl <<
endl;
310 vtkMesh vMesh(
mesh, cellSetName);
314 runTime.setTime(
timeDirs[timeI], timeI);
316 Info<<
"Time: " << runTime.timeName() <<
endl;
318 const word timeDesc =
name(timeI);
322 polyMesh::readUpdateState meshState = vMesh.readUpdate();
324 const fvMesh&
mesh = vMesh.mesh();
326 INTEGER4 nFaceNodes = 0;
329 nFaceNodes +=
mesh.faces()[faceI].size();
337 IOobjectList objects(
mesh, runTime.timeName());
339 HashSet<word> selectedFields;
347 PtrList<volScalarField> vsf;
348 readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vsf);
351 PtrList<volVectorField> vvf;
352 readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vvf);
355 PtrList<volSphericalTensorField> vSpheretf;
356 readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vSpheretf);
357 print(
" volSphericalTensorFields :",
Info, vSpheretf);
359 PtrList<volSymmTensorField> vSymmtf;
360 readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vSymmtf);
361 print(
" volSymmTensorFields :",
Info, vSymmtf);
363 PtrList<volTensorField> vtf;
364 readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vtf);
372 Info<<
" pointScalarFields : switched off"
373 <<
" (\"-noPointValues\" (at your option)\n";
374 Info<<
" pointVectorFields : switched off"
375 <<
" (\"-noPointValues\" (at your option)\n";
378 PtrList<pointScalarField> psf;
379 PtrList<pointVectorField> pvf;
423 print(
" pointScalarFields :",
Info, psf);
433 print(
" pointVectorFields :",
Info, pvf);
472 DynamicList<INTEGER4> varLocation;
475 DynamicList<INTEGER4> cellVarLocation;
478 tecplotWriter::getTecplotNames
481 ValueLocation_CellCentered,
485 tecplotWriter::getTecplotNames
488 ValueLocation_CellCentered,
493 tecplotWriter::getTecplotNames
496 ValueLocation_CellCentered,
500 tecplotWriter::getTecplotNames
503 ValueLocation_CellCentered,
508 tecplotWriter::getTecplotNames
511 ValueLocation_CellCentered,
515 tecplotWriter::getTecplotNames
518 ValueLocation_CellCentered,
523 tecplotWriter::getTecplotNames
526 ValueLocation_CellCentered,
530 tecplotWriter::getTecplotNames
533 ValueLocation_CellCentered,
538 tecplotWriter::getTecplotNames
541 ValueLocation_CellCentered,
545 tecplotWriter::getTecplotNames
548 ValueLocation_CellCentered,
556 tecplotWriter::getTecplotNames
564 tecplotWriter::getTecplotNames
574 INTEGER4 strandID = 1;
577 if (meshState != polyMesh::UNCHANGED)
590 tecplotWriter writer(runTime);
592 string allVarNames = string(
"X Y Z ") + varNames;
593 DynamicList<INTEGER4> allVarLocation;
594 allVarLocation.append(ValueLocation_Nodal);
595 allVarLocation.append(ValueLocation_Nodal);
596 allVarLocation.append(ValueLocation_Nodal);
597 allVarLocation.append(varLocation);
607 writer.writePolyhedralZone
617 writer.writeField(
mesh.points().component(0)());
618 writer.writeField(
mesh.points().component(1)());
619 writer.writeField(
mesh.points().component(2)());
624 writer.writeField(vsf[i]);
628 writer.writeField(vvf[i]);
632 writer.writeField(vSpheretf[i]);
636 writer.writeField(vSymmtf[i]);
640 writer.writeField(vtf[i]);
645 writer.writeField(psf[i]);
649 writer.writeField(pvf[i]);
652 writer.writeConnectivity(
mesh);
671 tecplotWriter writer(runTime);
681 writer.writePolyhedralZone
691 writer.writeField(
mesh.points().component(0)());
692 writer.writeField(
mesh.points().component(1)());
693 writer.writeField(
mesh.points().component(2)());
695 writer.writeConnectivity(
mesh);
708 tecplotWriter writer(runTime);
715 DataFileType_Solution
718 writer.writePolyhedralZone
730 writer.writeField(vsf[i]);
734 writer.writeField(vvf[i]);
738 writer.writeField(vSpheretf[i]);
742 writer.writeField(vSymmtf[i]);
746 writer.writeField(vtf[i]);
751 writer.writeField(psf[i]);
755 writer.writeField(pvf[i]);
771 const word setName =
args[
"faceSet"];
775 mkDir(fvPath/setName);
777 fileName patchFileName
779 fvPath/setName/setName
785 Info<<
" FaceSet : " << patchFileName <<
endl;
787 tecplotWriter writer(runTime);
789 string allVarNames = string(
"X Y Z ") + cellVarNames;
790 DynamicList<INTEGER4> allVarLocation;
791 allVarLocation.append(ValueLocation_Nodal);
792 allVarLocation.append(ValueLocation_Nodal);
793 allVarLocation.append(ValueLocation_Nodal);
794 allVarLocation.append(cellVarLocation);
806 IndirectList<face>(
mesh.faces(), faceLabels),
810 writer.writePolygonalZone
819 writer.writeField(ipp.localPoints().component(0)());
820 writer.writeField(ipp.localPoints().component(1)());
821 writer.writeField(ipp.localPoints().component(2)());
879 writer.writeConnectivity(ipp);
892 const polyBoundaryMesh&
patches =
mesh.boundaryMesh();
896 mkDir(fvPath/
"boundaryMesh");
898 fileName patchFileName;
900 if (vMesh.useSubMesh())
903 fvPath/
"boundaryMesh"/cellSetName
911 fvPath/
"boundaryMesh"/
"boundaryMesh"
917 Info<<
" Combined patches : " << patchFileName <<
endl;
919 tecplotWriter writer(runTime);
921 string allVarNames = string(
"X Y Z ") + varNames;
922 DynamicList<INTEGER4> allVarLocation;
923 allVarLocation.append(ValueLocation_Nodal);
924 allVarLocation.append(ValueLocation_Nodal);
925 allVarLocation.append(ValueLocation_Nodal);
926 allVarLocation.append(varLocation);
938 label patchID = patchIDs[i];
939 const polyPatch& pp =
patches[patchID];
944 Info<<
" Writing patch " << patchID <<
"\t" << pp.name()
945 <<
"\tstrand:" << strandID <<
nl <<
endl;
949 IndirectList<face>(pp,
identity(pp.size())),
953 writer.writePolygonalZone
962 writer.writeField(ipp.localPoints().component(0)());
963 writer.writeField(ipp.localPoints().component(1)());
964 writer.writeField(ipp.localPoints().component(2)());
1007 writer.getPatchField
1019 writer.getPatchField
1043 writer.writeConnectivity(ipp);
1047 Info<<
" Skipping zero sized patch " << patchID
1048 <<
"\t" << pp.name()
1065 if (doFaceZones && zones.size() > 0)
1067 mkDir(fvPath/
"faceZoneMesh");
1069 fileName patchFileName;
1071 if (vMesh.useSubMesh())
1074 fvPath/
"faceZoneMesh"/cellSetName
1082 fvPath/
"faceZoneMesh"/
"faceZoneMesh"
1088 Info<<
" FaceZone : " << patchFileName <<
endl;
1090 tecplotWriter writer(runTime);
1092 string allVarNames = string(
"X Y Z ") + cellVarNames;
1093 DynamicList<INTEGER4> allVarLocation;
1094 allVarLocation.append(ValueLocation_Nodal);
1095 allVarLocation.append(ValueLocation_Nodal);
1096 allVarLocation.append(ValueLocation_Nodal);
1097 allVarLocation.append(cellVarLocation);
1109 const faceZone& pp = zones[zoneI];
1115 IndirectList<face>(
mesh.faces(), pp),
1119 writer.writePolygonalZone
1128 writer.writeField(ipp.localPoints().component(0)());
1129 writer.writeField(ipp.localPoints().component(1)());
1130 writer.writeField(ipp.localPoints().component(2)());
1189 writer.writeConnectivity(ipp);
1193 Info<<
" Skipping zero sized faceZone " << zoneI
1194 <<
"\t" << pp.name()
1214 runTime.timePath()/regionPrefix/cloud::prefix,
1219 forAll(cloudDirs, cloudI)
1221 IOobjectList sprayObjs
1225 cloud::prefix/cloudDirs[cloudI]
1228 IOobject* positionsPtr = sprayObjs.lookup(
"positions");
1232 mkDir(fvPath/cloud::prefix/cloudDirs[cloudI]);
1234 fileName lagrFileName
1236 fvPath/cloud::prefix/cloudDirs[cloudI]/cloudDirs[cloudI]
1237 +
"_" + timeDesc +
".plt"
1240 Info<<
" Lagrangian: " << lagrFileName <<
endl;
1242 wordList labelNames(sprayObjs.names(labelIOField::typeName));
1246 wordList scalarNames(sprayObjs.names(scalarIOField::typeName));
1247 Info<<
" scalars :";
1250 wordList vectorNames(sprayObjs.names(vectorIOField::typeName));
1251 Info<<
" vectors :";
1283 passiveParticleCloud parcels(
mesh, cloudDirs[cloudI]);
1290 positions[
n++] = elmnt().position();
1294 string allVarNames = string(
"X Y Z");
1295 DynamicList<INTEGER4> allVarLocation;
1296 allVarLocation.append(ValueLocation_Nodal);
1297 allVarLocation.append(ValueLocation_Nodal);
1298 allVarLocation.append(ValueLocation_Nodal);
1300 tecplotWriter::getTecplotNames<label>
1303 ValueLocation_Nodal,
1308 tecplotWriter::getTecplotNames<scalar>
1311 ValueLocation_Nodal,
1316 tecplotWriter::getTecplotNames<vector>
1319 ValueLocation_Nodal,
1325 tecplotWriter writer(runTime);
1335 writer.writeOrderedZone
1344 writer.writeField(positions.component(0)());
1345 writer.writeField(positions.component(1)());
1346 writer.writeField(positions.component(2)());
1356 mesh.time().timeName(),
1357 cloud::prefix/cloudDirs[cloudI],
1359 IOobject::MUST_READ,
1368 sfld[j] = scalar(
fld[j]);
1370 writer.writeField(sfld);
1380 mesh.time().timeName(),
1381 cloud::prefix/cloudDirs[cloudI],
1383 IOobject::MUST_READ,
1388 writer.writeField(
fld);
1398 mesh.time().timeName(),
1399 cloud::prefix/cloudDirs[cloudI],
1401 IOobject::MUST_READ,
1406 writer.writeField(
fld);