42 namespace functionObjects
52 void Foam::functionObjects::vtkCloud::writeVerts
54 autoPtr<vtk::formatter>&
format,
55 const label nTotParcels
62 const uint64_t payLoad = vtk::sizeofData<label>(nTotParcels);
72 format().writeSize(payLoad);
86 format().writeSize(payLoad);
98 bool Foam::functionObjects::vtkCloud::writeCloud
100 const fileName& file,
104 const auto* objPtr = mesh_.findObject<cloud>(
cloudName);
110 objectRegistry obrTmp
115 mesh_.time().constant(),
123 objPtr->writeObjects(obrTmp);
133 applyFilter_ = calculateFilter(obrTmp,
log);
138 label nParcels = (applyFilter_ ? parcelAddr_.count() : pointsPtr->size());
141 const label nTotParcels =
returnReduce(nParcels, sumOp<label>());
146 Log <<
"After filtering using " << nTotParcels <<
'/' 151 if (pruneEmpty_ && !nTotParcels)
157 autoPtr<vtk::formatter>
format;
159 if (!file.has_ext(
"vtp"))
162 <<
type() <<
" File missing .vtp extension!" <<
nl <<
endl 171 format = writeOpts_.newFormatter(
os);
180 "case='" + time_.globalCaseName()
182 +
"' time='" + time_.timeName()
192 .writeTimeValue(time_.value())
221 const uint64_t payLoad = vtk::sizeofData<float,3>(nTotParcels);
226 format().writeSize(payLoad);
249 writeVerts(
format, nTotParcels);
259 return k.starts_with(
"position") ||
k.starts_with(
"coordinate");
265 if (selectFields_.size())
267 obrTmp.filterKeys(selectFields_);
281 format().beginPointData();
285 DynamicList<word> written(obrTmp.size());
287 written.append(writeFields<label>(
format, obrTmp, nTotParcels));
288 written.append(writeFields<scalar>(
format, obrTmp, nTotParcels));
289 written.append(writeFields<vector>(
format, obrTmp, nTotParcels));
324 time_.relativePath(file,
true)
336 Foam::functionObjects::vtkCloud::vtkCloud
388 writeOpts_.append(
false);
389 writeOpts_.legacy(
false);
399 const int padWidth =
dict.getOrDefault<
int>(
"width", 8);
402 if (padWidth < 1 || padWidth > 31)
408 printf_ =
"%0" + std::to_string(padWidth) +
"d";
413 useVerts_ =
dict.getOrDefault(
"cellData",
false);
414 pruneEmpty_ =
dict.getOrDefault(
"prune",
false);
416 selectClouds_.clear();
417 dict.readIfPresent(
"clouds", selectClouds_);
419 if (selectClouds_.empty())
421 selectClouds_.resize(1);
422 selectClouds_.first() =
426 selectFields_.clear();
427 dict.readIfPresent(
"fields", selectFields_);
428 selectFields_.uniq();
431 parcelSelect_ =
dict.subOrEmptyDict(
"selection");
436 dict.readIfPresent(
"directory", directory_);
438 if (directory_.size())
442 if (!directory_.isAbsolute())
444 directory_ = time_.globalPath()/directory_;
466 const wordList cloudNames(mesh_.sortedNames<
cloud>(selectClouds_));
468 if (cloudNames.empty())
473 const scalar timeValue = time_.value();
475 const word timeDesc =
"_" +
482 Log <<
name() <<
" output Time: " << time_.timeName() <<
nl;
513 series.
load(seriesName,
true, timeValue);
517 series.
write(seriesName);
static word defaultName
The default cloud name: defaultCloud.
static const IOField< point > * findIOPosition(const objectRegistry &obr)
Locate the "position" IOField within object registry.
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.
dimensionedScalar log(const dimensionedScalar &ds)
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static unsigned int defaultPrecision() noexcept
Return the default precision.
static void reduceOr(bool &value, const label communicator=worldComm)
Logical (or) reduction (cf. MPI AllReduce)
label k
Boltzmann constant.
Ignore writing from objectRegistry::writeObject()
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
IOdictionary propsDict(dictIO)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
static streamFormat formatEnum(const word &formatName, const streamFormat deflt=streamFormat::ASCII)
The stream format enum corresponding to the string (ascii | binary).
virtual bool execute()
Execute, currently does nothing.
word outputName("finiteArea-edges.obj")
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
virtual bool read(const dictionary &dict)
Read the vtkCloud specification.
Provides a means of accumulating and generating VTK file series.
const word cloudName(propsDict.get< word >("cloud"))
A class for handling words, derived from Foam::string.
void writeIdentity(vtk::formatter &fmt, const label len, label start=0)
Write an identity list of labels.
A cloud is a registry collection of lagrangian particles.
formatType
The output format type for file contents.
virtual bool write()
Write fields.
static word printf(const char *fmt, const PrimitiveType &val)
Use a printf-style formatter for a primitive.
OBJstream os(runTime.globalPath()/outputName)
bool empty() const noexcept
True if there are no data sets.
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
word format(conversionProperties.get< word >("format"))
static void write(const fileName &base, const UList< instant > &series, const char sep='_')
Write file series (JSON format) to disk, for specified instances.
static bool master(const label communicator=worldComm)
Am I the master rank.
static word outputPrefix
Directory prefix.
virtual bool read(const dictionary &dict)
Read optional controls.
void writeListParallel(vtk::formatter &fmt, const UList< Type > &values)
Write a list of values.
label load(const fileName &seriesName, const bool checkFiles=false, const scalar restartTime=ROOTVGREAT)
Clear contents and reload by parsing the specified file.
XML inline base64, base64Formatter.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
bool append(const fileNameInstant &inst)
Append the specified file instant.