Go to the documentation of this file.
43 namespace functionObjects
53 Foam::label Foam::functionObjects::vtkWrite::writeAllVolFields
57 const fvMeshSubset& proxy,
61 #undef vtkWrite_WRITE_FIELD
62 #define vtkWrite_WRITE_FIELD(FieldType) \
63 writeVolFields<FieldType> \
79 #undef vtkWrite_WRITE_FIELD
84 Foam::label Foam::functionObjects::vtkWrite::writeAllVolFields
87 const autoPtr<volPointInterpolation>&
pInterp,
90 const UPtrList<PrimitivePatchInterpolation<primitivePatch>>&
patchInterps,
91 const fvMeshSubset& proxy,
95 #undef vtkWrite_WRITE_FIELD
96 #define vtkWrite_WRITE_FIELD(FieldType) \
97 writeVolFields<FieldType> \
99 internalWriter, pInterp, \
100 patchWriters, patchInterps, \
113 #undef vtkWrite_WRITE_FIELD
120 Foam::functionObjects::vtkWrite::vtkWrite
174 doInternal_ =
dict.getOrDefault(
"internal",
true);
175 doBoundary_ =
dict.getOrDefault(
"boundary",
true);
176 oneBoundary_ =
dict.getOrDefault(
"single",
false);
177 interpolate_ =
dict.getOrDefault(
"interpolate",
false);
190 writeOpts_.legacy(
dict.getOrDefault(
"legacy",
false));
200 const int padWidth =
dict.getOrDefault<
int>(
"width", 8);
203 if (padWidth < 1 || padWidth > 31)
209 printf_ =
"%0" + std::to_string(padWidth) +
"d";
216 decompose_ =
dict.getOrDefault(
"decompose",
false);
217 writeIds_ =
dict.getOrDefault(
"writeIds",
false);
223 dict.readIfPresent(
"directory", outputDir_);
225 if (outputDir_.size())
229 if (!outputDir_.isAbsolute())
231 outputDir_ = time_.globalPath()/outputDir_;
256 const word timeDesc =
"_" +
263 const scalar timeValue = time_.value();
267 if (meshes_.empty() || (!doInternal_ && !doBoundary_))
274 fileName vtkName = time_.globalCaseName();
278 Info<<
name() <<
" output Time: " << time_.timeName() <<
nl;
289 auto& meshProxy = meshSubsets_[regioni];
290 auto& vtuMeshCells = vtuMappings_[regioni];
293 const fvMesh& baseMesh = meshProxy.baseMesh();
300 [](
const word&
k){
return k.ends_with(
"_0"); },
306 (doInternal_ || doBoundary_)
334 outputDir_/regionPrefix/vtkName + timeDesc
356 if (vtuMeshCells.empty())
359 vtuMeshCells.reset(meshProxy.mesh());
376 Info<<
" Internal : "
405 if (oneBoundary_ &&
patchIds.size())
415 ? (outputDir_/regionPrefix/
"boundary"/
"boundary" + timeDesc)
428 Info<<
" Boundaries: "
429 << time_.relativePath(
writer->output()) <<
nl;
432 writer->writeTimeValue(timeValue);
451 label nPatchInterps = 0;
467 outputDir_/regionPrefix/pp.
name()
468 / (pp.
name()) + timeDesc
493 Info<<
" Boundary : "
494 << time_.relativePath(
writer->output()) <<
nl;
496 writer->writeTimeValue(timeValue);
593 const label nPatchFields =
656 if (writeOpts_.legacy())
673 series.
load(seriesName,
true, timeValue);
676 series.
append(timeValue, timeDesc);
677 series.
write(seriesName);
700 series.
load(seriesName,
true, timeValue);
703 series.
append(timeValue, outputName);
704 series.
write(seriesName);
731 outputDir_/vtkName +
"-regions" + timeDesc +
".vtm"
734 vtmMultiRegion.
setTime(timeValue);
735 vtmMultiRegion.
write(outputName);
746 series.
load(seriesName,
true, timeValue);
749 series.
append(timeValue, outputName);
750 series.
write(seriesName);
759 meshSubsets_.clear();
760 vtuMappings_.clear();
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
List< label > labelList
A List of labels.
void setTime(scalar timeValue)
Define "TimeValue" for FieldData (name as per Catalyst output)
GeometricField< tensor, fvPatchField, volMesh > volTensorField
void add(const word &blockName, const vtmWriter &other)
virtual bool end()
On end - cleanup internal allocations.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
virtual bool execute()
Execute - does nothing.
#define vtkWrite_WRITE_FIELD(FieldType)
A class for handling file names.
static fileName base(const fileName &outputName, char sep='_')
Extract the base name for a file series.
const word fileExtension
Legacy file extension ("vtk")
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
static word defaultRegion
Return the default region name.
Functor to determine if a string is exists in a list of strings.
virtual bool read(const dictionary &dict)
Read the vtkWrite specification.
autoPtr< vtk::internalWriter > internalWriter
bool read(const char *buf, int32_t &val)
Same as readInt32.
static bool & parRun()
Test if this a parallel run, or allow modify access.
Virtual base class for function objects with a reference to Time.
fileName vtmOutputBase(outputDir/regionPrefix/vtkName+timeDesc)
vtk::vtmWriter vtmBoundaries
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
static bool master(const label communicator=worldComm)
Am I the master process.
PtrList< vtk::patchWriter > patchWriters
virtual bool write()
Write fields.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const wordList volume
Standard volume field types (scalar, vector, tensor, etc)
#define forAll(list, i)
Loop across all elements in list.
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
messageStream Info
Information stream (uses stdout - output is on the master only)
A patch is a list of labels that address the faces in the global face list.
word name(const complex &c)
Return string representation of complex.
label write(const fileName &file)
label writeAllVolFields(ensightCase &ensCase, const ensightMesh &ensMesh, const IOobjectList &objects, const bool nearCellValue=false)
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
static word outputPrefix
Directory prefix.
label load(const fileName &seriesName, const bool checkFiles=false, const scalar restartTime=ROOTVGREAT)
Clear contents and reload by parsing the specified file.
label filterKeys(const UnaryPredicate &pred, const bool pruning=false)
Generalized means to filter table entries based on their keys.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
XML inline base64, base64Formatter.
Base class for graphics format writing. Entry points are.
Provides a means of accumulating and generating VTK file series.
static void write(const fileName &base, const UList< instant > &series, const char sep='_')
Write file series (JSON format) to disk, for specified instances.
word ext() const
Return file name extension (part after last .)
Mesh data needed to do the Finite Volume discretisation.
Write OpenFOAM patches and patch fields in VTP or legacy vtk format.
GeometricField< vector, fvPatchField, volMesh > volVectorField
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Provides a means of accumulating file entries for generating a vtkMultiBlockDataSet (....
Interpolation class within a primitive patch. Allows interpolation from points to faces and vice vers...
static unsigned int defaultPrecision()
Return the default precision.
wordList names() const
The names of all objects.
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
static streamFormat formatEnum(const word &formatName, const streamFormat deflt=streamFormat::ASCII)
bool empty() const noexcept
True if there are no data sets.
label k
Boltzmann constant.
defineTypeNameAndDebug(ObukhovLength, 0)
const polyBoundaryMesh & patches
HashSet< word > wordHashSet
A HashSet with word keys.
static word printf(const char *fmt, const PrimitiveType &val)
Use a printf-style formatter for a primitive.
Operations on lists of strings.
bool append(const fileNameInstant &inst)
Append the specified file instant.
GeometricField< sphericalTensor, fvPatchField, volMesh > volSphericalTensorField
label count(const char *clsName) const
The number of objects of the given class name.
const word & name() const
The patch name.
Interpolate from cell centres to points (vertices) using inverse distance weighting.
label index() const
The index of this patch in the boundaryMesh.
PtrList< PrimitivePatchInterpolation< primitivePatch > > patchInterps
autoPtr< volPointInterpolation > pInterp