88 #include "readFields.H"
99 template<
class GeoField>
100 void print(
const char* msg, Ostream& os,
const PtrList<GeoField>& flds)
107 os <<
' ' << flds[i].name();
114 void print(Ostream& os,
const wordList& flds)
118 os <<
' ' << flds[i];
126 const polyBoundaryMesh&
patches,
127 const List<wordRe>& excludePatches
130 DynamicList<label> patchIDs(
patches.size());
132 Info<<
"Combining patches:" <<
endl;
140 isType<emptyPolyPatch>(pp)
141 || (Pstream::parRun() && isType<processorPolyPatch>(pp))
144 Info<<
" discarding empty/processor patch " <<
patchi
145 <<
" " << pp.name() <<
endl;
150 <<
" " << pp.name() <<
endl;
158 return patchIDs.shrink();
165 int main(
int argc,
char *argv[])
169 "Tecplot binary file format writer"
172 timeSelector::addOptions();
179 "convert selected fields only. eg, '(p T U)'"
185 "restrict conversion to the specified cellSet"
191 "restrict conversion to the specified cellSet"
193 argList::addBoolOption
196 "output cell value on patches instead of patch value itself"
198 argList::addBoolOption
201 "do not generate file for mesh, only for patches"
203 argList::addBoolOption
211 "patches (wildcards) to exclude"
213 argList::addBoolOption
230 <<
"Using neighbouring cell value instead of patch value"
237 <<
"Outputting cell values only" <<
nl <<
endl;
240 List<wordRe> excludePatches;
245 Info<<
"Not including patches " << excludePatches <<
nl <<
endl;
253 vtkName = cellSetName;
255 else if (Pstream::parRun())
258 vtkName = runTime.caseName();
262 if (i != string::npos)
264 vtkName = vtkName.substr(i);
269 vtkName = runTime.caseName();
278 fileName fvPath(runTime.path()/
"Tecplot360");
280 fileName regionPrefix =
"";
294 || cellSetName.size()
298 Info<<
"Keeping old files in " << fvPath <<
nl <<
endl;
302 Info<<
"Deleting old VTK files in " << fvPath <<
nl <<
endl;
312 vtkMesh vMesh(mesh, cellSetName);
316 runTime.setTime(
timeDirs[timeI], timeI);
318 Info<<
"Time: " << runTime.name() <<
endl;
320 const word timeDesc =
name(timeI);
324 fvMesh::readUpdateState meshState = vMesh.readUpdate();
326 const fvMesh& mesh = vMesh.mesh();
328 INTEGER4 nFaceNodes = 0;
329 forAll(mesh.faces(), facei)
331 nFaceNodes += mesh.faces()[facei].size();
339 IOobjectList
objects(mesh, runTime.name());
341 HashSet<word> selectedFields;
349 PtrList<volScalarField> vsf;
351 print(
" volScalarFields :",
Info, vsf);
353 PtrList<volVectorField> vvf;
355 print(
" volVectorFields :",
Info, vvf);
357 PtrList<volSphericalTensorField> vSpheretf;
359 print(
" volSphericalTensorFields :",
Info, vSpheretf);
361 PtrList<volSymmTensorField> vSymmtf;
363 print(
" volSymmTensorFields :",
Info, vSymmtf);
365 PtrList<volTensorField> vtf;
367 print(
" volTensorFields :",
Info, vtf);
374 Info<<
" pointScalarFields : switched off"
375 <<
" (\"-noPointValues\" (at your option)\n";
376 Info<<
" pointVectorFields : switched off"
377 <<
" (\"-noPointValues\" (at your option)\n";
380 PtrList<pointScalarField> psf;
381 PtrList<pointVectorField> pvf;
425 print(
" pointScalarFields :",
Info, psf);
435 print(
" pointVectorFields :",
Info, pvf);
474 DynamicList<INTEGER4> varLocation;
477 DynamicList<INTEGER4> cellVarLocation;
480 tecplotWriter::getTecplotNames
483 ValueLocation_CellCentered,
487 tecplotWriter::getTecplotNames
490 ValueLocation_CellCentered,
495 tecplotWriter::getTecplotNames
498 ValueLocation_CellCentered,
502 tecplotWriter::getTecplotNames
505 ValueLocation_CellCentered,
510 tecplotWriter::getTecplotNames
513 ValueLocation_CellCentered,
517 tecplotWriter::getTecplotNames
520 ValueLocation_CellCentered,
525 tecplotWriter::getTecplotNames
528 ValueLocation_CellCentered,
532 tecplotWriter::getTecplotNames
535 ValueLocation_CellCentered,
540 tecplotWriter::getTecplotNames
543 ValueLocation_CellCentered,
547 tecplotWriter::getTecplotNames
550 ValueLocation_CellCentered,
558 tecplotWriter::getTecplotNames
566 tecplotWriter::getTecplotNames
576 INTEGER4 strandID = 1;
579 if (meshState != fvMesh::UNCHANGED)
592 tecplotWriter writer(runTime);
594 string allVarNames = string(
"X Y Z ") + varNames;
595 DynamicList<INTEGER4> allVarLocation;
596 allVarLocation.append(ValueLocation_Nodal);
597 allVarLocation.append(ValueLocation_Nodal);
598 allVarLocation.append(ValueLocation_Nodal);
599 allVarLocation.append(varLocation);
609 writer.writePolyhedralZone
619 writer.writeField(mesh.points().component(0)());
620 writer.writeField(mesh.points().component(1)());
621 writer.writeField(mesh.points().component(2)());
626 writer.writeField(vsf[i]);
630 writer.writeField(vvf[i]);
634 writer.writeField(vSpheretf[i]);
638 writer.writeField(vSymmtf[i]);
642 writer.writeField(vtf[i]);
647 writer.writeField(psf[i]);
651 writer.writeField(pvf[i]);
654 writer.writeConnectivity(mesh);
673 tecplotWriter writer(runTime);
683 writer.writePolyhedralZone
688 List<INTEGER4>(3, ValueLocation_Nodal),
693 writer.writeField(mesh.points().component(0)());
694 writer.writeField(mesh.points().component(1)());
695 writer.writeField(mesh.points().component(2)());
697 writer.writeConnectivity(mesh);
710 tecplotWriter writer(runTime);
717 DataFileType_Solution
720 writer.writePolyhedralZone
732 writer.writeField(vsf[i]);
736 writer.writeField(vvf[i]);
740 writer.writeField(vSpheretf[i]);
744 writer.writeField(vSymmtf[i]);
748 writer.writeField(vtf[i]);
753 writer.writeField(psf[i]);
757 writer.writeField(pvf[i]);
773 const word setName =
args[
"faceSet"];
774 labelList faceLabels(faceSet(mesh, setName).toc());
777 mkDir(fvPath/setName);
779 fileName patchFileName
781 fvPath/setName/setName
787 Info<<
" FaceSet : " << patchFileName <<
endl;
789 tecplotWriter writer(runTime);
791 string allVarNames = string(
"X Y Z ") + cellVarNames;
792 DynamicList<INTEGER4> allVarLocation;
793 allVarLocation.append(ValueLocation_Nodal);
794 allVarLocation.append(ValueLocation_Nodal);
795 allVarLocation.append(ValueLocation_Nodal);
796 allVarLocation.append(cellVarLocation);
808 IndirectList<face>(mesh.faces(), faceLabels),
812 writer.writePolygonalZone
821 writer.writeField(ipp.localPoints().component(0)());
822 writer.writeField(ipp.localPoints().component(1)());
823 writer.writeField(ipp.localPoints().component(2)());
881 writer.writeConnectivity(ipp);
894 const polyBoundaryMesh&
patches = mesh.boundaryMesh();
898 mkDir(fvPath/
"boundaryMesh");
900 fileName patchFileName;
902 if (vMesh.useSubMesh())
905 fvPath/
"boundaryMesh"/cellSetName
913 fvPath/
"boundaryMesh"/
"boundaryMesh"
919 Info<<
" Combined patches : " << patchFileName <<
endl;
921 tecplotWriter writer(runTime);
923 string allVarNames = string(
"X Y Z ") + varNames;
924 DynamicList<INTEGER4> allVarLocation;
925 allVarLocation.append(ValueLocation_Nodal);
926 allVarLocation.append(ValueLocation_Nodal);
927 allVarLocation.append(ValueLocation_Nodal);
928 allVarLocation.append(varLocation);
940 label patchID = patchIDs[i];
941 const polyPatch& pp =
patches[patchID];
946 Info<<
" Writing patch " << patchID <<
"\t" << pp.name()
947 <<
"\tstrand:" << strandID <<
nl <<
endl;
955 writer.writePolygonalZone
964 writer.writeField(ipp.localPoints().component(0)());
965 writer.writeField(ipp.localPoints().component(1)());
966 writer.writeField(ipp.localPoints().component(2)());
1009 writer.getPatchField
1021 writer.getPatchField
1034 psf[i].boundaryField()[patchID].patchInternalField()()
1041 pvf[i].boundaryField()[patchID].patchInternalField()()
1045 writer.writeConnectivity(ipp);
1049 Info<<
" Skipping zero sized patch " << patchID
1050 <<
"\t" << pp.name()
1065 const faceZoneList& zones = mesh.faceZones();
1067 if (doFaceZones && zones.size() > 0)
1069 mkDir(fvPath/
"faceZones");
1071 fileName patchFileName;
1073 if (vMesh.useSubMesh())
1076 fvPath/
"faceZones"/cellSetName
1084 fvPath/
"faceZones"/
"faceZones"
1090 Info<<
" FaceZone : " << patchFileName <<
endl;
1092 tecplotWriter writer(runTime);
1094 string allVarNames = string(
"X Y Z ") + cellVarNames;
1095 DynamicList<INTEGER4> allVarLocation;
1096 allVarLocation.append(ValueLocation_Nodal);
1097 allVarLocation.append(ValueLocation_Nodal);
1098 allVarLocation.append(ValueLocation_Nodal);
1099 allVarLocation.append(cellVarLocation);
1111 const faceZone& pp = zones[zoneI];
1117 IndirectList<face>(mesh.faces(), pp),
1121 writer.writePolygonalZone
1130 writer.writeField(ipp.localPoints().component(0)());
1131 writer.writeField(ipp.localPoints().component(1)());
1132 writer.writeField(ipp.localPoints().component(2)());
1191 writer.writeConnectivity(ipp);
1195 Info<<
" Skipping zero sized faceZone " << zoneI
1196 <<
"\t" << pp.name()
1216 runTime.timePath()/regionPrefix/cloud::prefix,
1221 forAll(cloudDirs, cloudI)
1223 IOobjectList sprayObjs
1227 cloud::prefix/cloudDirs[cloudI]
1230 IOobject* positionsPtr = sprayObjs.lookup(
"positions");
1234 mkDir(fvPath/cloud::prefix/cloudDirs[cloudI]);
1236 fileName lagrFileName
1238 fvPath/cloud::prefix/cloudDirs[cloudI]/cloudDirs[cloudI]
1239 +
"_" + timeDesc +
".plt"
1242 Info<<
" Lagrangian: " << lagrFileName <<
endl;
1244 wordList labelNames(sprayObjs.names(labelIOField::typeName));
1246 print(
Info, labelNames);
1248 wordList scalarNames(sprayObjs.names(scalarIOField::typeName));
1249 Info<<
" scalars :";
1250 print(
Info, scalarNames);
1252 wordList vectorNames(sprayObjs.names(vectorIOField::typeName));
1253 Info<<
" vectors :";
1254 print(
Info, vectorNames);
1285 passiveParticleCloud parcels(mesh, cloudDirs[cloudI]);
1292 positions[
n++] = elmnt().position();
1296 string allVarNames = string(
"X Y Z");
1297 DynamicList<INTEGER4> allVarLocation;
1298 allVarLocation.append(ValueLocation_Nodal);
1299 allVarLocation.append(ValueLocation_Nodal);
1300 allVarLocation.append(ValueLocation_Nodal);
1302 tecplotWriter::getTecplotNames<label>
1305 ValueLocation_Nodal,
1310 tecplotWriter::getTecplotNames<scalar>
1313 ValueLocation_Nodal,
1318 tecplotWriter::getTecplotNames<vector>
1321 ValueLocation_Nodal,
1327 tecplotWriter writer(runTime);
1337 writer.writeOrderedZone
1346 writer.writeField(positions.component(0)());
1347 writer.writeField(positions.component(1)());
1348 writer.writeField(positions.component(2)());
1359 cloud::prefix/cloudDirs[cloudI],
1361 IOobject::MUST_READ,
1370 sfld[j] = scalar(
fld[j]);
1372 writer.writeField(sfld);
1383 cloud::prefix/cloudDirs[cloudI],
1385 IOobject::MUST_READ,
1390 writer.writeField(
fld);
1401 cloud::prefix/cloudDirs[cloudI],
1403 IOobject::MUST_READ,
1408 writer.writeField(
fld);
graph_traits< Graph >::vertices_size_type size_type
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
bool optionFound(const word &opt) const
Return true if the named option is found.
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.
int main(int argc, char *argv[])
volScalarField scalarField(fieldObject, mesh)
static instantList timeDirs
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const fvPatchList & patches
#define WarningInFunction
Report a warning using Foam::Warning.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
List< word > wordList
A List of words.
List< fileName > fileNameList
A List of fileNames.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool findStrings(const wordReListMatcher &matcher, const std::string &str)
Return true if string matches one of the regular expressions.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const HashSet< word > &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the specified type.
vectorField pointField
pointField is a vectorField.
tmp< SurfaceField< Type > > linearInterpolate(const VolField< Type > &vf)
List< instant > instantList
List of instants.
bool rmDir(const fileName &)
Remove a directory and its contents.
bool isDir(const fileName &, const bool followLink=true)
Does the name exist as a directory in the file system?
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
fileNameList readDir(const fileName &, const fileType=fileType::file, const bool filterVariants=true, const bool followLink=true)
Read a directory and return the entries as a string list.
Foam::argList args(argc, argv)
Operations on lists of strings.