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;
297 auto& meshProxy = meshSubsets_[regioni];
298 auto& vtuMeshCells = vtuMappings_[regioni];
301 const fvMesh& baseMesh = meshProxy.baseMesh();
309 if (!selectFields_.empty())
311 if (!blockFields_.empty())
316 candidateNames = baseMesh.
names<
void>(filter);
321 candidateNames = baseMesh.
names<
void>(selectFields_);
328 [](
const word&
k){
return k.ends_with(
"_0"); },
334 (doInternal_ || doBoundary_)
375 autoPtr<volPointInterpolation>
pInterp;
379 if (vtuMeshCells.empty())
382 vtuMeshCells.reset(meshProxy.mesh());
384 if (interpolate_ && vtuMeshCells.manifold())
386 interpolate_ =
false;
388 <<
"Manifold cells detected - disabling PointData" 407 Info<<
" Internal : " 423 pInterp.reset(
new volPointInterpolation(meshProxy.mesh()));
430 const polyBoundaryMesh&
patches = meshProxy.mesh().boundaryMesh();
433 PtrList<PrimitivePatchInterpolation<primitivePatch>>
patchInterps;
441 if (oneBoundary_ &&
patchIds.size())
451 ? (outputDir_/
regionDir/
"boundary"/
"boundary" + timeDesc)
464 Info<<
" Boundaries: " 465 << time_.relativePath(
writer->output()) <<
nl;
468 writer->writeTimeValue(timeValue);
487 label nPatchInterps = 0;
504 / (
pp.name()) + timeDesc
529 Info<<
" Boundary : " 530 << time_.relativePath(
writer->output()) <<
nl;
532 writer->writeTimeValue(timeValue);
543 new PrimitivePatchInterpolation<primitivePatch>(
pp)
629 const label nPatchFields =
690 if (writeOpts_.legacy())
700 vtk::seriesWriter& series = series_(seriesName);
707 series.load(seriesName,
true, timeValue);
710 series.append(timeValue, timeDesc);
711 series.write(seriesName);
727 vtk::seriesWriter& series = series_(seriesName);
734 series.load(seriesName,
true, timeValue);
738 series.write(seriesName);
765 outputDir_/vtkName +
"-regions" + timeDesc +
".vtm" 768 vtmMultiRegion.
setTime(timeValue);
773 vtk::seriesWriter& series = series_(seriesName);
780 series.load(seriesName,
true, timeValue);
784 series.write(seriesName);
793 meshSubsets_.clear();
794 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.
vtk::lineWriter writer(edgeCentres, edgeList::null(), fileName(aMesh.time().globalPath()/"finiteArea-edgesCentres"))
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
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 expressions::valueTypeCode::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)
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
PtrList< PrimitivePatchInterpolation< primitivePatch > > patchInterps
#define WarningInFunction
Report a warning using Foam::Warning.
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
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 streamFormat formatEnum(const word &fmtName, const streamFormat deflt=streamFormat::ASCII)
Lookup streamFormat enum corresponding to the string (ascii | binary).
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
const polyBoundaryMesh & patches
static word outputPrefix
Directory prefix.
label filterKeys(const UnaryPredicate &pred, const bool pruning=false)
Generalized means to filter table entries based on their keys.
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.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
autoPtr< volPointInterpolation > pInterp
#define doLocalCode(FieldType)