Go to the documentation of this file.
166 template<
class GeoField>
174 os <<
' ' << flds[i].name();
185 os <<
' ' << flds[i];
199 Info<<
"Combining patches:" <<
endl;
207 isType<emptyPolyPatch>(pp)
208 || (Pstream::parRun() && isType<processorPolyPatch>(pp))
211 Info<<
" discarding empty/processor patch " << patchI
216 Info<<
" excluding patch " << patchI
231 int main(
int argc,
char *argv[])
236 "legacy VTK file format writer"
238 timeSelector::addOptions();
245 "only convert the specified fields - eg '(p T U)'"
251 "convert a mesh subset corresponding to the specified cellSet"
257 "restrict conversion to the specified faceSet"
263 "restrict conversion to the specified pointSet"
265 argList::addBoolOption
268 "write in ASCII format instead of binary"
270 argList::addBoolOption
273 "write polyhedral cells without tet/pyramid decomposition"
275 argList::addBoolOption
278 "write surfaceScalarFields (e.g., phi)"
280 argList::addBoolOption
283 "use cell value on patches instead of patch value itself"
285 argList::addBoolOption
288 "do not generate file for mesh, only for patches"
290 argList::addBoolOption
295 argList::addBoolOption
298 "combine all patches into a single file"
304 "a list of patches to exclude - eg '( inlet \".*Wall\" )' "
306 argList::addBoolOption
311 argList::addBoolOption
314 "don't link processor VTK files - parallel only"
316 argList::addBoolOption
319 "use the time name instead of the time index when naming the files"
337 <<
"doubleScalar and/or label are not 4 bytes in size" <<
nl
338 <<
"Hence cannot use binary VTK format. Please use -ascii"
347 <<
"Using neighbouring cell value instead of patch value"
356 <<
"Outputting cell values only" <<
nl <<
endl;
366 Info<<
"Not including patches " << excludePatches <<
nl <<
endl;
372 string vtkName = runTime.caseName();
376 vtkName = cellSetName;
378 else if (Pstream::parRun())
383 if (i != string::npos)
385 vtkName = vtkName.substr(i);
398 fileName fvPath(runTime.path()/
"VTK");
414 || cellSetName.size()
415 || faceSetName.size()
416 || pointSetName.size()
420 Info<<
"Keeping old VTK files in " << fvPath <<
nl <<
endl;
424 Info<<
"Deleting old VTK files in " << fvPath <<
nl <<
endl;
441 runTime.setTime(
timeDirs[timeI], timeI);
446 runTime.timePath()/regionPrefix/cloud::prefix,
456 cloud::prefix/cloudDirs[i]
463 if (allCloudDirs.
insert(cloudDirs[i]))
465 Info<<
"At time: " << runTime.timeName()
466 <<
" detected cloud directory : " << cloudDirs[i]
476 runTime.setTime(
timeDirs[timeI], timeI);
478 Info<<
"Time: " << runTime.timeName() <<
endl;
481 useTimeName ? runTime.timeName() :
Foam::name(runTime.timeIndex());
491 meshState == polyMesh::TOPO_CHANGE
492 || meshState == polyMesh::TOPO_PATCH_CHANGE
500 if (faceSetName.size())
516 Info<<
" FaceSet : " << patchFileName <<
endl;
523 if (pointSetName.size())
539 Info<<
" pointSet : " << patchFileName <<
endl;
565 if (!specifiedFields || selectedFields.
size())
581 print(
" volSphericalTensorFields :",
Info, vSpheretf);
591 print(
" volSymmTensorFields :",
Info, vSymmtf);
612 if (!specifiedFields || selectedFields.
size())
615 print(
" volScalarFields::Internal :",
Info, dsf);
618 print(
" volVectorFields::Internal :",
Info, dvf);
628 print(
" volSphericalTensorFields::Internal :",
Info, dSpheretf);
638 print(
" volSymmTensorFields::Internal :",
Info, dSymmtf);
641 print(
" volTensorFields::Internal :",
Info, dtf);
656 Info<<
" pointScalarFields : switched off"
657 <<
" (\"-noPointValues\" (at your option)\n";
658 Info<<
" pointVectorFields : switched off"
659 <<
" (\"-noPointValues\" (at your option)\n";
668 if (!noPointValues && !(specifiedFields && selectedFields.
empty()))
678 print(
" pointScalarFields :",
Info, psf);
688 print(
" pointVectorFields :",
Info, pvf);
698 print(
" pointSphericalTensorFields :",
Info, pSpheretf);
708 print(
" pointSymmTensorFields :",
Info, pSymmtf);
718 print(
" pointTensorFields :",
Info, ptf);
743 Info<<
" Internal : " << vtkFileName <<
endl;
748 Info <<
"write defined OK!!" <<
endl;
750 writeFuns::writeCellDataHeader
754 1 + nVolFields + nDimFields
757 Info <<
"writeHeader defined!!" <<
endl;
761 Info <<
"writeField defined!!" <<
endl;
778 writeFuns::writePointDataHeader
782 nVolFields + nDimFields + nPointFields
849 svf.
set(sz+i, ssf[i]*
n);
850 svf[sz+i].rename(ssf[i].
name());
854 mkDir(fvPath /
"surfaceFields");
887 mkDir(fvPath/
"allPatches");
894 fvPath/
"allPatches"/cellSetName
902 fvPath/
"allPatches"/
"allPatches"
908 Info<<
" Combined patches : " << patchFileName <<
endl;
920 writeFuns::writeCellDataHeader
939 writeFuns::writePointDataHeader
986 Info<<
" Patch : " << patchFileName <<
endl;
997 if (!isA<emptyPolyPatch>(pp))
1000 writeFuns::writeCellDataHeader
1019 writeFuns::writePointDataHeader
1068 print(
" surfScalarFields :",
Info, ssf);
1079 print(
" surfVectorFields :",
Info, svf);
1108 Info<<
" FaceZone : " << patchFileName <<
endl;
1125 writeFuns::writeCellDataHeader
1155 +
"_" + timeDesc +
".vtk"
1158 Info<<
" Lagrangian: " << lagrFileName <<
endl;
1172 wordList labelNames(sprayObjs.
names(labelIOField::typeName));
1176 wordList scalarNames(sprayObjs.
names(scalarIOField::typeName));
1177 Info<<
" scalars :";
1180 wordList vectorNames(sprayObjs.
names(vectorIOField::typeName));
1181 Info<<
" vectors :";
1188 sphericalTensorIOField::typeName
1191 Info<<
" spherical tensors :";
1198 symmTensorIOField::typeName
1201 Info<<
" symm tensors :";
1204 wordList tensorNames(sprayObjs.
names(tensorIOField::typeName));
1205 Info<<
" tensors :";
1221 + scalarNames.
size()
1222 + vectorNames.
size()
1223 + sphereNames.
size()
1225 + tensorNames.
size()
1230 writer.writeIOField<scalar>(scalarNames);
1248 writer.writeParcelHeader(0);
1260 if (Pstream::parRun() && doLinks)
1262 mkDir(runTime.path()/
".."/
"VTK");
1263 chDir(runTime.path()/
".."/
"VTK");
1265 Info<<
"Linking all processor files to " << runTime.path()/
".."/
"VTK"
1272 /
"processor" +
name(Pstream::myProcNo())
1287 fileName procFile(procVTK/dirs[i]/subFiles[j]);
1297 +
name(Pstream::myProcNo())
1301 if (
system(cmd.c_str()) == -1)
1304 <<
"Could not execute command " << cmd <<
endl;
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
virtual const pointField & points() const
Return raw points.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
double doubleScalar
Double precision floating point scalar type.
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars.
Write pointSet to vtk polydata file. Only one data which is original pointID.
A class for handling words, derived from string.
autoPtr< BasicCompressibleTurbulenceModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleTurbulenceModel::transportModel &transport, const word &propertiesName)
void print(const char *msg, Ostream &os, const PtrList< GeoField > &flds)
A class for handling file names.
bool exists(const fileName &, const bool checkGzip=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
List< label > labelList
A List of labels.
#define forAll(list, i)
Loop across all elements in list.
Mesh data needed to do the Finite Volume discretisation.
Tensor< scalar > tensor
Tensor of scalars.
virtual void write(const coordSet &, const wordList &, const List< const Field< Type > * > &, Ostream &) const =0
General entry point for writing.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Encapsulation of VTK mesh data. Holds mesh or meshsubset and polyhedral-cell decomposition on it.
wordList names() const
Return the list of names of the IOobjects.
A HashTable with keys but without contents.
Write faceSet to vtk polydata file. Only one data which is original faceID.
Write a patch with its data.
word name() const
Return file name (part beyond last /)
void writeFaceSet(const bool binary, const vtkMesh &vMesh, const faceSet &set, const fileName &fileName)
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
const faceZoneMesh & faceZones() const
Return face zone mesh.
const fvMesh & baseMesh() const
Whole mesh.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
bool set(const label) const
Is element set.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A subset of mesh faces organised as a primitive patch.
bool empty() const
Return true if the hash table is empty.
A patch is a list of labels that address the faces in the global face list.
A List with indirect addressing.
SymmTensor< scalar > symmTensor
SymmTensor of scalars.
const word & name() const
Return name.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
graph_traits< Graph >::vertices_size_type size_type
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
IOstream & fixed(IOstream &io)
IOobject * lookup(const word &name) const
Lookup a given name and return IOobject ptr if found else NULL.
label size() const
Return number of elements in table.
Base class for graphics format writing. Entry points are.
const surfaceVectorField & Sf() const
Return cell face area vectors.
void clear()
Clear the PtrList, i.e. set size to zero deleting all the.
Mesh data needed to do the Finite Volume discretisation.
bool isDir(const fileName &)
Does the name exist as a DIRECTORY in the file system?
const word & name() const
Return name.
Vector< scalar > vector
A scalar version of the templated Vector.
Templated 3D SphericalTensor derived from VectorSpace adding construction from 1 component,...
List of IOobjects with searching and retrieving facilities.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void writeSurfFields(const bool binary, const vtkMesh &vMesh, const fileName &fileName, const PtrList< surfaceVectorField > &surfVectorFields)
const fvMesh & mesh() const
Access either mesh or submesh.
readUpdateState
Enumeration defining the state of the mesh after a read update.
bool chDir(const fileName &dir)
Change the current directory to the one given and return true,.
void setSize(const label)
Reset size of List.
static instantList timeDirs
bool findStrings(const wordReListMatcher &matcher, const std::string &str)
Return true if string matches one of the regular expressions.
virtual const faceList & faces() const
Return raw faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Interpolation class within a primitive patch. Allows interpolation from points to faces and vice vers...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void readFields(const boolList &haveMesh, const fvMesh &mesh, const autoPtr< fvMeshSubset > &subsetterPtr, IOobjectList &allObjects, PtrList< GeoField > &fields)
label nFieldPoints() const
Number of field points.
label size() const
Return the number of elements in the PtrList.
bool insert(const Key &key)
Insert a new entry.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
const word cloudName(propsDict.lookup("cloudName"))
bool optionFound(const word &opt) const
Return true if the named option is found.
bool useSubMesh() const
Check if running subMesh.
Operations on lists of strings.
int main(int argc, char *argv[])
void size(const label)
Override size to be inconsistent with allocated storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
fileNameList readDir(const fileName &, const fileName::Type=fileName::FILE, const bool filtergz=true)
Read a directory and return the entries as a string list.
polyMesh::readUpdateState readUpdate()
Read mesh.
Generic GeometricField class.
Foam::argList args(argc, argv)
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
label nFieldCells() const
Number of field cells.
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
labelList getSelectedPatches(const polyBoundaryMesh &patches, const List< wordRe > &excludePatches)
const word & name() const
Return name.
Interpolate from cell centres to points (vertices) using inverse distance weighting.
#define WarningInFunction
Report a warning using Foam::Warning.
int system(const std::string &command)
Execute the specified command.
bool rmDir(const fileName &)
Remove a dirctory and its contents.
word name(const complex &)
Return a string representation of a complex.
void writePointSet(const bool binary, const primitiveMesh &mesh, const topoSet &set, const fileName &fileName)
Write pointSet to vtk polydata file.
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.
A list of faces which address into the list of points.