153 #include "readFields.H"
165 using namespace Foam;
169 template<
class GeoField>
177 os <<
' ' << flds[i].name();
188 os <<
' ' << flds[i];
202 Info<<
"Combining patches:" <<
endl;
210 isA<emptyPolyPatch>(pp)
211 || isA<nonConformalPolyPatch>(pp)
215 Info<<
" discarding empty/nonConformal/processor patch "
230 return patchIDs.shrink();
236 int main(
int argc,
char *argv[])
240 "legacy VTK file format writer"
249 "only convert the specified fields - eg '(p T U)'"
255 "convert a mesh subset corresponding to the specified cellSet"
261 "restrict conversion to the specified faceSet"
267 "restrict conversion to the specified pointSet"
272 "write in ASCII format instead of binary"
278 "cell types to write as polyhedra - 'none', 'polyhedra', or 'all'"
283 "write surfaceScalarFields (e.g., phi)"
288 "use cell value on patches instead of patch value itself"
293 "do not generate file for mesh, only for patches"
303 "combine all patches into a single file"
309 "a list of patches to exclude - eg '( inlet \".*Wall\" )' "
319 "don't link processor VTK files - parallel only"
324 "use the time name instead of the time index when naming the files"
348 <<
"Using ASCII rather than binary VTK format because "
349 "floatScalar and/or label are not 4 bytes in size."
359 <<
"Using neighbouring cell value instead of patch value"
368 <<
"Outputting cell values only" <<
nl <<
endl;
378 Info<<
"Not including patches " << excludePatches <<
nl <<
endl;
384 string vtkName = runTime.caseName();
388 vtkName = cellSetName;
395 if (i != string::npos)
397 vtkName = vtkName.substr(i);
410 fileName fvPath(runTime.path()/
"VTK");
427 || cellSetName.size()
428 || faceSetName.size()
429 || pointSetName.size()
433 Info<<
"Keeping old VTK files in " << fvPath <<
nl <<
endl;
437 Info<<
"Deleting old VTK files in " << fvPath <<
nl <<
endl;
447 vtkMesh vMesh(mesh, polyhedra, cellSetName);
454 runTime.setTime(
timeDirs[timeI], timeI);
472 IOobject* positionsPtr = sprayObjs.lookup(
word(
"positions"));
476 if (allCloudDirs.
insert(cloudDirs[i]))
478 Info<<
"At time: " << runTime.name()
479 <<
" detected cloud directory : " << cloudDirs[i]
489 runTime.setTime(
timeDirs[timeI], timeI);
491 Info<<
"Time: " << runTime.name() <<
endl;
494 useTimeName ? runTime.name() :
Foam::name(runTime.timeIndex());
508 if (faceSetName.size())
511 faceSet set(mesh, faceSetName);
514 mkDir(fvPath/set.name());
518 fvPath/set.name()/set.name()
524 Info<<
" FaceSet : " << patchFileName <<
endl;
532 if (pointSetName.size())
538 mkDir(fvPath/set.name());
542 fvPath/set.name()/set.name()
548 Info<<
" pointSet : " << patchFileName <<
endl;
575 if (!specifiedFields || selectedFields.
size())
578 print(
" volScalarField::Internal :",
Info, visf);
581 print(
" volVectorField::Internal :",
Info, vivf);
591 print(
" volSphericalTensorFields::Internal :",
Info, visptf);
601 print(
" volSymmTensorFields::Internal :",
Info, visytf);
604 print(
" volTensorFields::Internal :",
Info, vitf);
607 label nVolInternalFields =
623 if (!specifiedFields || selectedFields.
size())
626 print(
" volScalarFields :",
Info, vsf);
629 print(
" volVectorFields :",
Info, vvf);
639 print(
" volSphericalTensorFields :",
Info, vsptf);
649 print(
" volSymmTensorFields :",
Info, vsytf);
652 print(
" volTensorFields :",
Info, vtf);
666 Info<<
" pointScalarFields : switched off"
667 <<
" (\"-noPointValues\" (at your option)\n";
668 Info<<
" pointVectorFields : switched off"
669 <<
" (\"-noPointValues\" (at your option)\n";
678 if (!noPointValues && !(specifiedFields && selectedFields.
empty()))
688 print(
" pointScalarFields :",
Info, psf);
698 print(
" pointVectorFields :",
Info, pvf);
708 print(
" pointSphericalTensorFields :",
Info, psptf);
718 print(
" pointSymmTensorFields :",
Info, psytf);
728 print(
" pointTensorFields :",
Info, ptf);
750 Info<<
" Internal : " << vtkFileName <<
endl;
760 1 + nVolInternalFields + nVolFields
764 writer.writeCellIndices();
769 writer.write(visptf);
770 writer.write(visytf);
785 vMesh.nFieldPoints(),
786 nVolFields + nPointFields
802 writer.write(pInterp, vsf);
803 writer.write(pInterp, vvf);
804 writer.write(pInterp, vsptf);
805 writer.write(pInterp, vsytf);
806 writer.write(pInterp, vtf);
827 print(
" surfScalarFields :",
Info, ssf);
838 print(
" surfVectorFields :",
Info, svf);
853 svf.
set(sz+i, ssfiPtr);
857 mkDir(fvPath /
"surfaceFields");
892 mkDir(fvPath/
"allPatches");
896 if (vMesh.useSubMesh())
899 fvPath/
"allPatches"/cellSetName
907 fvPath/
"allPatches"/
"allPatches"
913 Info<<
" Combined patches : " << patchFileName <<
endl;
921 getSelectedPatches(
patches, excludePatches)
933 writer.writePatchIndices();
969 if (vMesh.useSubMesh())
972 fvPath/pp.
name()/cellSetName
986 Info<<
" Patch : " << patchFileName <<
endl;
1006 writer.writePatchIndices();
1011 writer.write(vsptf);
1012 writer.write(vsytf);
1028 writer.write(psptf);
1029 writer.write(psytf);
1038 writer.write(pInter, vsf);
1039 writer.write(pInter, vvf);
1040 writer.write(pInter, vsptf);
1041 writer.write(pInter, vsytf);
1042 writer.write(pInter, vtf);
1064 print(
" surfScalarFields :",
Info, ssf);
1075 print(
" surfVectorFields :",
Info, svf);
1087 if (vMesh.useSubMesh())
1090 fvPath/fz.
name()/cellSetName
1104 Info<<
" FaceZone : " << patchFileName <<
endl;
1151 +
"_" + timeDesc +
".vtk"
1154 Info<<
" Lagrangian: " << lagrFileName <<
endl;
1164 IOobject* positionsPtr = sprayObjs.lookup(
word(
"positions"));
1170 print(
Info, labelNames);
1173 Info<<
" scalars :";
1174 print(
Info, scalarNames);
1177 Info<<
" vectors :";
1178 print(
Info, vectorNames);
1187 Info<<
" spherical tensors :";
1188 print(
Info, sphereNames);
1197 Info<<
" symm tensors :";
1198 print(
Info, symmNames);
1201 Info<<
" tensors :";
1202 print(
Info, tensorNames);
1214 writer.writeFieldsHeader
1217 + scalarNames.size()
1218 + vectorNames.size()
1219 + sphereNames.size()
1221 + tensorNames.size()
1225 writer.writeIOField<
label>(labelNames);
1226 writer.writeIOField<scalar>(scalarNames);
1227 writer.writeIOField<
vector>(vectorNames);
1230 writer.writeIOField<
tensor>(tensorNames);
1244 writer.writeFieldsHeader(0);
1258 mkDir(runTime.globalPath()/
"VTK");
1259 chDir(runTime.globalPath()/
"VTK");
1261 Info<<
"Linking all processor files to " << runTime.globalPath()/
"VTK"
1273 label sz = dirs.size();
1274 dirs.setSize(sz + 1);
1283 fileName procFile(procVTK/dirs[i]/subFiles[j]);
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.
static pointMesh & New(const word &name, const polyMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
static const char *const typeName
Generic GeometricField class.
A HashTable with keys but without contents.
bool insert(const Key &key)
Insert a new entry.
label size() const
Return number of elements in table.
bool empty() const
Return true if the hash table is empty.
List of IOobjects with searching and retrieving facilities.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
A List with indirect addressing.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Interpolation class within a primitive patch. Allows interpolation from points to faces and vice vers...
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
bool set(const label) const
Is element set.
void clear()
Clear the PtrList, i.e. set size to zero deleting all the.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Templated 3D SphericalTensor derived from VectorSpace adding construction from 1 component,...
label size() const
Return the number of elements in the UList.
static bool & parRun()
Is this a parallel run?
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
label size() const
Return the number of elements in the UPtrList.
const word & name() const
Return name.
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
static void addNote(const string &)
Add extra notes for the usage information.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
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.
T optionLookupOrDefault(const word &opt, const T &deflt) const
Read a value from the named option if present.
static const word prefix
The prefix to local: lagrangian.
A subset of mesh faces organised as a primitive patch.
A class for handling file names.
Mesh data needed to do the Finite Volume discretisation.
readUpdateState
Enumeration defining the state of the mesh after a read update.
const surfaceVectorField & Sf() const
Return cell face area vectors.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
const polyMesh & mesh() const
Return reference to polyMesh.
Writes Lagrangian points and fields.
const word & name() const
Return name.
static word defaultRegion
Return the default region name.
virtual const faceList & faces() const
Return raw faces.
const faceZoneList & faceZones() const
Return face zones.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const pointField & points() const
Return raw points.
A patch is a list of labels that address the faces in the global face list.
virtual void rename(const word &newName)
Rename.
static void addOptions(const bool constant=true, const bool withZero=false)
Add the options handled by timeSelector to argList::validOptions.
static instantList select0(Time &runTime, const argList &args)
Return the set of times selected based on the argList options.
Interpolate from cell centres to points (vertices) using inverse distance weighting.
Encapsulation of VTK mesh data. Holds mesh or meshsubset and polyhedral-cell decomposition on it.
static const NamedEnum< vtkPolyhedra, 3 > vtkPolyhedraNames_
Names of groups of cell types retain as polyhedra.
vtkPolyhedra
Groups of cell types retain as polyhedra.
A class for handling words, derived from string.
int main(int argc, char *argv[])
static instantList timeDirs
const fvPatchList & patches
#define WarningInFunction
Report a warning using Foam::Warning.
void writePointDataHeader(std::ostream &, const label nPoints, const label nFields)
Write point data header.
void writeCellDataHeader(std::ostream &, const label nCells, const label nFields)
Write cell data header.
void writeSurfFields(const bool binary, const vtkMesh &vMesh, const fileName &fileName, const UPtrList< const surfaceVectorField > &surfVectorFields)
void writeFaceSet(const bool binary, const vtkMesh &vMesh, const faceSet &set, const fileName &fileName)
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.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
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.
const word & regionName(const solver ®ion)
bool exists(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist (as directory or file) in the file system?
bool rmDir(const fileName &)
Remove a directory and its contents.
float floatScalar
Float precision floating point scalar type.
bool isDir(const fileName &, const bool followLink=true)
Does the name exist as a directory in the file system?
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.
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
void writePointSet(const bool binary, const vtkMesh &vMesh, const pointSet &set, const fileName &fileName)
bool chDir(const fileName &dir)
Change the current directory to the one given and return true,.
Foam::argList args(argc, argv)
Operations on lists of strings.
const word cloudName(propsDict.lookup("cloudName"))
Write faceSet to vtk polydata file. Only one data which is original faceID.
Write pointSet to vtk polydata file. Only one data which is original pointID.
Write a patch with its data.