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_)
346 autoPtr<volPointInterpolation>
pInterp;
352 pInterp.reset(
new volPointInterpolation(meshProxy.mesh()));
355 if (vtuMeshCells.empty())
358 vtuMeshCells.reset(meshProxy.mesh());
375 Info<<
" Internal : "
393 const polyBoundaryMesh&
patches = meshProxy.mesh().boundaryMesh();
396 PtrList<PrimitivePatchInterpolation<primitivePatch>>
patchInterps;
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);
506 new PrimitivePatchInterpolation<primitivePatch>(pp)
592 const label nPatchFields =
655 if (writeOpts_.legacy())
665 vtk::seriesWriter& series = series_(seriesName);
672 series.load(seriesName,
true, timeValue);
675 series.append(timeValue, timeDesc);
676 series.write(seriesName);
692 vtk::seriesWriter& series = series_(seriesName);
699 series.load(seriesName,
true, timeValue);
703 series.write(seriesName);
730 outputDir_/vtkName +
"-regions" + timeDesc +
".vtm"
733 vtmMultiRegion.
setTime(timeValue);
738 vtk::seriesWriter& series = series_(seriesName);
745 series.load(seriesName,
true, timeValue);
749 series.write(seriesName);
758 meshSubsets_.clear();
759 vtuMappings_.clear();
static autoPtr< T > New(Args &&... args)
List< label > labelList
A List of labels.
void setTime(scalar timeValue)
GeometricField< tensor, fvPatchField, volMesh > volTensorField
void add(const word &blockName, const vtmWriter &other)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
#define vtkWrite_WRITE_FIELD(FieldType)
A class for handling file names.
static fileName base(const fileName &outputName, char sep='_')
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
static word defaultRegion
virtual bool read(const dictionary &dict)
autoPtr< vtk::internalWriter > internalWriter
bool read(const char *buf, int32_t &val)
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)
PtrList< vtk::patchWriter > patchWriters
Ostream & endl(Ostream &os)
fileName vtmOutputBase(outputDir/regionDir/vtkName+timeDesc)
A HashTable with keys but without contents that is similar to std::unordered_set.
Mesh consisting of general polyhedral cells.
word outputName("finiteArea-edges.obj")
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
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)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
label load(const fileName &seriesName, const bool checkFiles=false, const scalar restartTime=ROOTVGREAT)
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.
@ INLINE_BASE64
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='_')
Mesh data needed to do the Finite Volume discretisation.
label index() const noexcept
Write OpenFOAM patches and patch fields in VTP or legacy vtk format.
GeometricField< vector, fvPatchField, volMesh > volVectorField
static unsigned int defaultPrecision() noexcept
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 (....
@ ASCII
"ascii" (normal default)
Interpolation class within a primitive patch. Allows interpolation from points to faces and vice vers...
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
unsigned int count(const UList< bool > &bools, const bool val=true)
static streamFormat formatEnum(const word &formatName, const streamFormat deflt=streamFormat::ASCII)
static bool & parRun() noexcept
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool empty() const noexcept
defineTypeNameAndDebug(ObukhovLength, 0)
const polyBoundaryMesh & patches
HashSet< word, Hash< word > > wordHashSet
A HashSet with word keys and string hasher.
word name(const expressions::valueTypeCode typeCode)
static word printf(const char *fmt, const PrimitiveType &val)
Operations on lists of strings.
bool append(const fileNameInstant &inst)
const word & name() const noexcept
GeometricField< sphericalTensor, fvPatchField, volMesh > volSphericalTensorField
vtk::internalMeshWriter writer(topoMesh, topoCells, vtk::formatType::INLINE_ASCII, runTime.path()/"blockTopology")
label count(const char *clsName) const
Interpolate from cell centres to points (vertices) using inverse distance weighting.
PtrList< PrimitivePatchInterpolation< primitivePatch > > patchInterps
autoPtr< volPointInterpolation > pInterp