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;
288 auto& meshProxy = meshSubsets_[regioni];
289 auto& vtuMeshCells = vtuMappings_[regioni];
292 const fvMesh& baseMesh = meshProxy.baseMesh();
297 acceptField.filterKeys
299 [](
const word&
k){
return k.ends_with(
"_0"); },
305 (doInternal_ || doBoundary_)
355 if (vtuMeshCells.empty())
358 vtuMeshCells.reset(meshProxy.mesh());
375 Info<<
" Internal : "
404 if (oneBoundary_ &&
patchIds.size())
414 ? (outputDir_/
regionDir/
"boundary"/
"boundary" + timeDesc)
427 Info<<
" Boundaries: "
428 << time_.relativePath(
writer->output()) <<
nl;
431 writer->writeTimeValue(timeValue);
450 label nPatchInterps = 0;
467 / (pp.
name()) + timeDesc
492 Info<<
" Boundary : "
493 << time_.relativePath(
writer->output()) <<
nl;
495 writer->writeTimeValue(timeValue);
592 const label nPatchFields =
655 if (writeOpts_.legacy())
672 series.
load(seriesName,
true, timeValue);
675 series.
append(timeValue, timeDesc);
676 series.
write(seriesName);
699 series.
load(seriesName,
true, timeValue);
703 series.
write(seriesName);
730 outputDir_/vtkName +
"-regions" + timeDesc +
".vtm"
733 vtmMultiRegion.
setTime(timeValue);
745 series.
load(seriesName,
true, timeValue);
749 series.
write(seriesName);
758 meshSubsets_.clear();
759 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.
Virtual base class for function objects with a reference to Time.
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)
fileName vtmOutputBase(outputDir/regionDir/vtkName+timeDesc)
#define forAll(list, i)
Loop across all elements in list.
word outputName("finiteArea-edges.obj")
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
messageStream Info
Information stream (stdout output on master, null elsewhere)
A patch is a list of labels that address the faces in the global face list.
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.
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.
Mesh data needed to do the Finite Volume discretisation.
label index() const noexcept
The index of this patch in the boundaryMesh.
Write OpenFOAM patches and patch fields in VTP or legacy vtk format.
GeometricField< vector, fvPatchField, volMesh > volVectorField
static unsigned int defaultPrecision() noexcept
Return the default precision.
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...
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)
static bool & parRun() noexcept
Test if this a parallel run.
bool empty() const noexcept
True if there are no data sets.
label k
Boltzmann constant.
defineTypeNameAndDebug(ObukhovLength, 0)
static const word null
An empty word.
const polyBoundaryMesh & patches
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
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.
const word & name() const noexcept
The patch name.
GeometricField< sphericalTensor, fvPatchField, volMesh > volSphericalTensorField
label count(const char *clsName) const
The number of objects of the given class name.
Interpolate from cell centres to points (vertices) using inverse distance weighting.
PtrList< PrimitivePatchInterpolation< primitivePatch > > patchInterps
autoPtr< volPointInterpolation > pInterp