43 namespace functionObjects
56 Foam::label Foam::functionObjects::vtkWrite::writeAllVolFields
60 const fvMeshSubset& proxy,
68 #define doLocalCode(FieldType) \ 69 count += writeVolFieldsImpl<FieldType> \ 90 Foam::label Foam::functionObjects::vtkWrite::writeAllVolFields
93 const autoPtr<volPointInterpolation>&
pInterp,
96 const UPtrList<PrimitivePatchInterpolation<primitivePatch>>&
patchInterps,
97 const fvMeshSubset& proxy,
105 #define doLocalCode(FieldType) \ 106 count += writeVolFieldsImpl<FieldType> \ 108 internalWriter, pInterp, \ 109 patchWriters, patchInterps, \ 129 Foam::functionObjects::vtkWrite::vtkWrite
185 doInternal_ =
dict.getOrDefault(
"internal",
true);
186 doBoundary_ =
dict.getOrDefault(
"boundary",
true);
187 oneBoundary_ =
dict.getOrDefault(
"single",
false);
188 interpolate_ =
dict.getOrDefault(
"interpolate",
false);
201 writeOpts_.legacy(
dict.getOrDefault(
"legacy",
false));
211 const int padWidth =
dict.getOrDefault<
int>(
"width", 8);
214 if (padWidth < 1 || padWidth > 31)
220 printf_ =
"%0" + std::to_string(padWidth) +
"d";
227 decompose_ =
dict.getOrDefault(
"decompose",
false);
228 writeIds_ =
dict.getOrDefault(
"writeIds",
false);
234 dict.readIfPresent(
"directory", outputDir_);
236 if (outputDir_.size())
240 if (!outputDir_.isAbsolute())
242 outputDir_ = time_.globalPath()/outputDir_;
267 const word timeDesc =
"_" +
274 const scalar timeValue = time_.value();
278 if (meshes_.empty() || (!doInternal_ && !doBoundary_))
285 fileName vtkName = time_.globalCaseName();
289 Info<<
name() <<
" output Time: " << time_.timeName() <<
nl;
296 auto& meshProxy = meshSubsets_[regioni];
297 auto& vtuMeshCells = vtuMappings_[regioni];
300 const fvMesh& baseMesh = meshProxy.baseMesh();
308 if (!selectFields_.empty())
310 if (!blockFields_.empty())
315 candidateNames = baseMesh.
names<
void>(filter);
320 candidateNames = baseMesh.
names<
void>(selectFields_);
325 candidateNames.filterKeys
327 [](
const word&
k){
return k.ends_with(
"_0"); },
333 (doInternal_ || doBoundary_)
374 autoPtr<volPointInterpolation>
pInterp;
378 if (vtuMeshCells.empty())
381 vtuMeshCells.reset(meshProxy.mesh());
383 if (interpolate_ && vtuMeshCells.manifold())
385 interpolate_ =
false;
387 <<
"Manifold cells detected - disabling PointData" 406 Info<<
" Internal : " 422 pInterp.reset(
new volPointInterpolation(meshProxy.mesh()));
429 const polyBoundaryMesh&
patches = meshProxy.mesh().boundaryMesh();
432 PtrList<PrimitivePatchInterpolation<primitivePatch>>
patchInterps;
440 if (oneBoundary_ &&
patchIds.size())
450 ? (outputDir_/
regionDir/
"boundary"/
"boundary" + timeDesc)
463 Info<<
" Boundaries: " 464 << time_.relativePath(
writer->output()) <<
nl;
467 writer->writeTimeValue(timeValue);
486 label nPatchInterps = 0;
503 / (pp.name()) + timeDesc
528 Info<<
" Boundary : " 529 << time_.relativePath(
writer->output()) <<
nl;
531 writer->writeTimeValue(timeValue);
542 new PrimitivePatchInterpolation<primitivePatch>(pp)
628 const label nPatchFields =
691 if (writeOpts_.legacy())
701 vtk::seriesWriter& series = series_(seriesName);
708 series.load(seriesName,
true, timeValue);
711 series.append(timeValue, timeDesc);
712 series.write(seriesName);
728 vtk::seriesWriter& series = series_(seriesName);
735 series.load(seriesName,
true, timeValue);
739 series.write(seriesName);
766 outputDir_/vtkName +
"-regions" + timeDesc +
".vtm" 769 vtmMultiRegion.
setTime(timeValue);
774 vtk::seriesWriter& series = series_(seriesName);
781 series.load(seriesName,
true, timeValue);
785 series.write(seriesName);
794 meshSubsets_.clear();
795 vtuMappings_.clear();
Provides a means of accumulating file entries for generating a vtkMultiBlockDataSet (...
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
defineTypeNameAndDebug(ObukhovLength, 0)
A class for handling file names.
static fileName base(const fileName &outputName, char sep='_')
Extract the base name for a file series.
virtual bool write()
Write fields.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
const word & regionName() const
The mesh region name or word::null if polyMesh::defaultRegion.
const word fileExtension
Legacy file extension ("vtk")
GeometricField< tensor, fvPatchField, volMesh > volTensorField
label writeAllVolFields(ensightCase &ensCase, const ensightMesh &ensMesh, const IOobjectList &objects, const bool nearCellValue=false)
label write(const fileName &file)
Open file for writing (creates parent directory) and write the blocks and TimeValue.
constexpr char nl
The newline '\n' character (0x0a)
wordList names() const
The unsorted names of all objects.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
static unsigned int defaultPrecision() noexcept
Return the default precision.
fileName vtmOutputBase(outputDir/regionDir/vtkName+timeDesc)
Operations on lists of strings.
label k
Boltzmann constant.
GeometricField< vector, fvPatchField, volMesh > volVectorField
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
GeometricField< sphericalTensor, fvPatchField, volMesh > volSphericalTensorField
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
static streamFormat formatEnum(const word &formatName, const streamFormat deflt=streamFormat::ASCII)
The stream format enum corresponding to the string (ascii | binary).
Foam::word regionName(Foam::polyMesh::defaultRegion)
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
word outputName("finiteArea-edges.obj")
label count(const char *clsName) const
The number of objects of the given class name.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
A class for handling words, derived from Foam::string.
Functor wrapper of allow/deny lists of wordRe for filtering.
void setTime(scalar timeValue)
Define "TimeValue" for FieldData (name as per Catalyst output)
formatType
The output format type for file contents.
autoPtr< vtk::internalWriter > internalWriter
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
static word printf(const char *fmt, const PrimitiveType &val)
Use a printf-style formatter for a primitive.
const wordList volume
Standard volume field types (scalar, vector, tensor, etc)
vtk::internalMeshWriter writer(topoMesh, topoCells, vtk::formatType::INLINE_ASCII, runTime.path()/"blockTopology")
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
PtrList< PrimitivePatchInterpolation< primitivePatch > > patchInterps
#define WarningInFunction
Report a warning using Foam::Warning.
vtk::vtmWriter vtmBoundaries
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
Mesh data needed to do the Finite Volume discretisation.
static bool master(const label communicator=worldComm)
Am I the master rank.
const polyBoundaryMesh & patches
static word outputPrefix
Directory prefix.
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual bool execute()
Execute - does nothing.
XML inline base64, base64Formatter.
Mesh consisting of general polyhedral cells.
List< label > labelList
A List of labels.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
virtual bool read(const dictionary &dict)
Read the vtkWrite specification.
virtual bool end()
On end - cleanup internal allocations.
void add(const word &blockName, const vtmWriter &other)
Add in content from another vtm and place under the given block name.
PtrList< vtk::patchWriter > patchWriters
Virtual base class for function objects with a reference to Time.
autoPtr< volPointInterpolation > pInterp
#define doLocalCode(FieldType)