43namespace functionObjects
53Foam::label Foam::functionObjects::vtkWrite::writeAllVolFields
57 const fvMeshSubset& proxy,
58 const wordHashSet& acceptField
61 #undef vtkWrite_WRITE_FIELD
62 #define vtkWrite_WRITE_FIELD(FieldType) \
63 writeVolFields<FieldType> \
79 #undef vtkWrite_WRITE_FIELD
84Foam::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
130 writeOpts_(vtk::formatType::INLINE_BASE64),
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;
285 auto& meshProxy = meshSubsets_[regioni];
286 auto& vtuMeshCells = vtuMappings_[regioni];
289 const fvMesh& baseMesh = meshProxy.baseMesh();
296 [](
const word&
k){
return k.ends_with(
"_0"); },
302 (doInternal_ || doBoundary_)
347 if (vtuMeshCells.empty())
350 vtuMeshCells.reset(meshProxy.mesh());
352 if (interpolate_ && vtuMeshCells.manifold())
354 interpolate_ =
false;
356 <<
"Manifold cells detected - disabling PointData"
375 Info<<
" Internal : "
409 if (oneBoundary_ &&
patchIds.size())
419 ? (outputDir_/
regionDir/
"boundary"/
"boundary" + timeDesc)
432 Info<<
" Boundaries: "
433 << time_.relativePath(
writer->output()) <<
nl;
436 writer->writeTimeValue(timeValue);
455 label nPatchInterps = 0;
472 / (pp.
name()) + timeDesc
497 Info<<
" Boundary : "
498 << time_.relativePath(
writer->output()) <<
nl;
500 writer->writeTimeValue(timeValue);
597 const label nPatchFields =
660 if (writeOpts_.legacy())
677 series.
load(seriesName,
true, timeValue);
680 series.
append(timeValue, timeDesc);
681 series.
write(seriesName);
704 series.
load(seriesName,
true, timeValue);
708 series.
write(seriesName);
735 outputDir_/vtkName +
"-regions" + timeDesc +
".vtm"
738 vtmMultiRegion.
setTime(timeValue);
750 series.
load(seriesName,
true, timeValue);
754 series.
write(seriesName);
763 meshSubsets_.clear();
764 vtuMappings_.clear();
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
vtk::internalMeshWriter writer(topoMesh, topoCells, vtk::formatType::INLINE_ASCII, runTime.path()/"blockTopology")
label filterKeys(const UnaryPredicate &pred, const bool pruning=false)
Generalized means to filter table entries based on their keys.
@ ASCII
"ascii" (normal default)
static streamFormat formatEnum(const word &formatName, const streamFormat deflt=streamFormat::ASCII)
static unsigned int defaultPrecision() noexcept
Return the default precision.
Interpolation class within a primitive patch. Allows interpolation from points to faces and vice vers...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
virtual bool read()
Re-read model coefficients if they have changed.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
static bool & parRun() noexcept
Test if this a parallel run.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Base functionality common to reader and writer classes.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling file names.
Abstract base-class for Time/database function objects.
static word outputPrefix
Directory prefix.
Virtual base class for function objects with a reference to Time.
Writes fields in VTK (xml or legacy) format. Writes cell-values or point-interpolated values for volF...
virtual bool read(const dictionary &dict)
Read the vtkWrite specification.
virtual bool execute()
Execute - does nothing.
virtual bool write()
Write fields.
virtual bool end()
On end - cleanup internal allocations.
Mesh data needed to do the Finite Volume discretisation.
wordList names() const
The unsorted names of all objects.
label count(const char *clsName) const
The number of objects of the given class name.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
label index() const noexcept
The index of this patch in the boundaryMesh.
const word & name() const noexcept
The patch name.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Mesh consisting of general polyhedral cells.
const word & regionName() const
The mesh region name or word::null if polyMesh::defaultRegion.
A patch is a list of labels that address the faces in the global face list.
splitCell * master() const
Interpolate from cell centres to points (vertices) using inverse distance weighting.
Write OpenFOAM patches and patch fields in VTP or legacy vtk format.
Provides a means of accumulating and generating VTK file series.
bool append(const fileNameInstant &inst)
Append the specified file instant.
bool empty() const noexcept
True if there are no data sets.
label load(const fileName &seriesName, const bool checkFiles=false, const scalar restartTime=ROOTVGREAT)
Clear contents and reload by parsing the specified file.
static void write(const fileName &base, const UList< instant > &series, const char sep='_')
Write file series (JSON format) to disk, for specified instances.
Provides a means of accumulating file entries for generating a vtkMultiBlockDataSet (....
label write(const fileName &file)
void setTime(scalar timeValue)
Define "TimeValue" for FieldData (name as per Catalyst output)
void add(const word &blockName, const vtmWriter &other)
A class for handling words, derived from Foam::string.
static word printf(const char *fmt, const PrimitiveType &val)
Use a printf-style formatter for a primitive.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
fileName vtmOutputBase(outputDir/regionDir/vtkName+timeDesc)
autoPtr< vtk::internalWriter > internalWriter
PtrList< vtk::patchWriter > patchWriters
const polyBoundaryMesh & patches
Foam::word regionName(Foam::polyMesh::defaultRegion)
word outputName("finiteArea-edges.obj")
PtrList< PrimitivePatchInterpolation< primitivePatch > > patchInterps
autoPtr< volPointInterpolation > pInterp
vtk::vtmWriter vtmBoundaries
#define WarningInFunction
Report a warning using Foam::Warning.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
const wordList volume
Standard volume field types (scalar, vector, tensor, etc)
const word fileExtension
Legacy file extension ("vtk")
@ INLINE_BASE64
XML inline base64, base64Formatter.
GeometricField< vector, fvPatchField, volMesh > volVectorField
label writeAllVolFields(ensightCase &ensCase, const ensightMesh &ensMesh, const IOobjectList &objects, const bool nearCellValue=false)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
GeometricField< tensor, fvPatchField, volMesh > volTensorField
GeometricField< sphericalTensor, fvPatchField, volMesh > volSphericalTensorField
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
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.
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
Operations on lists of strings.
Functor to determine if a string is exists in a list of strings.
#define vtkWrite_WRITE_FIELD(FieldType)