163 static const label VTK_TETRA = 10;
164 static const label VTK_PYRAMID = 14;
165 static const label VTK_WEDGE = 13;
166 static const label VTK_HEXAHEDRON = 12;
169 template<
class GeoField>
177 os<<
' ' << flds[i].name();
202 Info<<
"Combining patches:" <<
endl;
210 isA<emptyPolyPatch>(pp)
211 || (Pstream::parRun() && isA<processorPolyPatch>(pp))
214 Info<<
" discarding empty/processor patch " << patchI
217 else if (!excludePatches.
found(pp.
name()))
219 patchIDs.append(patchI);
223 return patchIDs.shrink();
231 int main(
int argc,
char *argv[])
233 timeSelector::addOptions();
237 argList::validOptions.insert(
"fields",
"fields");
238 argList::validOptions.insert(
"cellSet",
"cellSet name");
239 argList::validOptions.insert(
"faceSet",
"faceSet name");
240 argList::validOptions.insert(
"pointSet",
"pointSet name");
241 argList::validOptions.insert(
"ascii",
"");
242 argList::validOptions.insert(
"surfaceFields",
"");
243 argList::validOptions.insert(
"nearCellValue",
"");
244 argList::validOptions.insert(
"noInternal",
"");
245 argList::validOptions.insert(
"noPointValues",
"");
246 argList::validOptions.insert(
"allPatches",
"");
247 argList::validOptions.insert(
"excludePatches",
"patches to exclude");
248 argList::validOptions.insert(
"noFaceZones",
"");
249 argList::validOptions.insert(
"noLinks",
"");
250 argList::validOptions.insert(
"useTimeName",
"");
261 if (binary && (
sizeof(
floatScalar) != 4 ||
sizeof(label) != 4))
264 <<
"floatScalar and/or label are not 4 bytes in size" <<
nl
265 <<
"Hence cannot use binary VTK format. Please use -ascii"
274 <<
"Using neighbouring cell value instead of patch value"
283 <<
"Outputting cell values only" <<
nl << endl;
293 Info<<
"Not including patches " << excludePatches <<
nl <<
endl;
302 vtkName = cellSetName;
304 else if (Pstream::parRun())
307 vtkName = runTime.caseName();
309 string::size_type i = vtkName.rfind(
"processor");
311 if (i != string::npos)
313 vtkName = vtkName.substr(i);
318 vtkName = runTime.caseName();
327 fileName fvPath(runTime.path()/
"VTK");
343 || cellSetName.size()
347 Info<<
"Keeping old VTK files in " << fvPath <<
nl <<
endl;
351 Info<<
"Deleting old VTK files in " << fvPath <<
nl <<
endl;
368 runTime.setTime(timeDirs[timeI], timeI);
373 runTime.timePath()/regionPrefix/cloud::prefix,
383 cloud::prefix/cloudDirs[i]
386 IOobject* positionsPtr = sprayObjs.lookup(
"positions");
390 if (allCloudDirs.
insert(cloudDirs[i]))
392 Info<<
"At time: " << runTime.timeName()
393 <<
" detected cloud directory : " << cloudDirs[i]
403 runTime.setTime(timeDirs[timeI], timeI);
405 Info<<
"Time: " << runTime.timeName() <<
endl;
410 timeDesc = runTime.timeName();
414 timeDesc =
name(runTime.timeIndex());
425 meshState == polyMesh::TOPO_CHANGE
426 || meshState == polyMesh::TOPO_PATCH_CHANGE
450 Info<<
" FaceSet : " << patchFileName <<
endl;
473 Info<<
" pointSet : " << patchFileName <<
endl;
493 readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vsf);
494 print(
" volScalarFields :",
Info, vsf);
497 readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vvf);
498 print(
" volVectorFields :",
Info, vvf);
501 readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vSpheretf);
502 print(
" volSphericalTensorFields :",
Info, vSpheretf);
505 readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vSymmtf);
506 print(
" volSymmTensorFields :",
Info, vSymmtf);
509 readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vtf);
510 print(
" volTensorFields :",
Info, vtf);
524 Info<<
" pointScalarFields : switched off"
525 <<
" (\"-noPointValues\" option)\n";
526 Info<<
" pointVectorFields : switched off"
527 <<
" (\"-noPointValues\" option)\n";
541 pointMesh::New(vMesh.baseMesh()),
546 print(
" pointScalarFields :",
Info, psf);
551 pointMesh::New(vMesh.baseMesh()),
556 print(
" pointVectorFields :",
Info, pvf);
561 pointMesh::New(vMesh.baseMesh()),
566 print(
" pointSphericalTensorFields :",
Info, pSpheretf);
571 pointMesh::New(vMesh.baseMesh()),
576 print(
" pointSymmTensorFields :",
Info, pSymmtf);
581 pointMesh::New(vMesh.baseMesh()),
586 print(
" pointTensorFields :",
Info, ptf);
610 Info<<
" Internal : " << vtkFileName <<
endl;
616 writeFuns::writeCellDataHeader
635 writeFuns::writePointDataHeader
638 vMesh.nFieldPoints(),
639 nVolFields+nPointFields
676 print(
" surfScalarFields :",
Info, ssf);
687 print(
" surfVectorFields :",
Info, svf);
692 label sz = svf.
size();
700 svf.
set(sz+i, ssf[i]*n);
701 svf[sz+i].rename(ssf[i].
name());
705 mkDir(fvPath /
"surfaceFields");
738 mkDir(fvPath/
"allPatches");
742 if (vMesh.useSubMesh())
745 fvPath/
"allPatches"/cellSetName
753 fvPath/
"allPatches"/
"allPatches"
759 Info<<
" Combined patches : " << patchFileName <<
endl;
767 getSelectedPatches(patches, excludePatches)
771 writeFuns::writeCellDataHeader
790 writeFuns::writePointDataHeader
820 if (vMesh.useSubMesh())
823 fvPath/pp.
name()/cellSetName
837 Info<<
" Patch : " << patchFileName <<
endl;
848 if (!isA<emptyPolyPatch>(pp))
851 writeFuns::writeCellDataHeader
870 writeFuns::writePointDataHeader
920 if (vMesh.useSubMesh())
923 fvPath/pp.
name()/cellSetName
937 Info<<
" FaceZone : " << patchFileName <<
endl;
939 std::ofstream str(patchFileName.c_str());
941 writeFuns::writeHeader(str, binary, pp.
name());
967 mkDir(fvPath/cloud::prefix/cloudName);
971 fvPath/cloud::prefix/cloudName/cloudName
972 +
"_" + timeDesc +
".vtk"
975 Info<<
" Lagrangian: " << lagrFileName <<
endl;
985 IOobject* positionsPtr = sprayObjs.lookup(
"positions");
989 wordList labelNames(sprayObjs.names(labelIOField::typeName));
991 print(Info, labelNames);
993 wordList scalarNames(sprayObjs.names(scalarIOField::typeName));
995 print(Info, scalarNames);
997 wordList vectorNames(sprayObjs.names(vectorIOField::typeName));
999 print(Info, vectorNames);
1005 sphericalTensorIOField::typeName
1008 Info<<
" spherical tensors :";
1009 print(Info, sphereNames);
1015 symmTensorIOField::typeName
1018 Info<<
" symm tensors :";
1019 print(Info, symmNames);
1021 wordList tensorNames(sprayObjs.names(tensorIOField::typeName));
1022 Info<<
" tensors :";
1023 print(Info, tensorNames);
1038 + scalarNames.size()
1039 + vectorNames.size()
1040 + sphereNames.size()
1042 + tensorNames.size()
1046 writer.writeIOField<label>(labelNames);
1047 writer.writeIOField<scalar>(scalarNames);
1065 writer.writeParcelHeader(0);
1077 if (Pstream::parRun() && doLinks)
1079 mkDir(runTime.path()/
".."/
"VTK");
1080 chDir(runTime.path()/
".."/
"VTK");
1082 Info<<
"Linking all processor files to " << runTime.path()/
".."/
"VTK"
1089 /
"processor" +
name(Pstream::myProcNo())
1094 label sz = dirs.size();
1104 fileName procFile(procVTK/dirs[i]/subFiles[j]);
1114 +
name(Pstream::myProcNo())
1118 if (
system(cmd.c_str()) == -1)
1121 <<
"Could not execute command " << cmd << endl;
1128 Info<<
"End\n" <<
endl;