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 applyFilter_ =
false;
106 const auto* cloudPtr = mesh_.cfindObject<cloud>(
cloudName);
112 const auto& currCloud = *cloudPtr;
114 objectRegistry obrTmp
119 mesh_.time().constant(),
127 currCloud.writeObjects(obrTmp);
137 applyFilter_ = calculateFilter(obrTmp,
log);
144 applyFilter_ ? parcelAddr_.count() : pointsPtr->size()
148 const label nTotParcels =
returnReduce(nParcels, sumOp<label>());
153 Log <<
"After filtering using " << nTotParcels <<
'/' 158 if (pruneEmpty_ && !nTotParcels)
164 autoPtr<vtk::formatter>
format;
166 if (!file.has_ext(
"vtp"))
169 <<
type() <<
" File missing .vtp extension!" <<
nl <<
endl 178 format = writeOpts_.newFormatter(
os);
187 "case='" + time_.globalCaseName()
189 +
"' time='" + time_.timeName()
199 .writeTimeValue(time_.value())
228 const uint64_t payLoad = vtk::sizeofData<float,3>(nTotParcels);
233 format().writeSize(payLoad);
256 writeVerts(
format, nTotParcels);
266 return k.starts_with(
"position") ||
k.starts_with(
"coordinate");
272 if (selectFields_.size())
274 obrTmp.filterKeys(selectFields_);
288 format().beginPointData();
292 DynamicList<word> written(obrTmp.size() + currCloud.objectRegistry::size());
296 writeFields<label>(
format, obrTmp, nTotParcels)
300 writeFields<scalar>(
format, obrTmp, nTotParcels)
304 writeFields<vector>(
format, obrTmp, nTotParcels)
310 writeFields<scalar>(
format, currCloud, nTotParcels)
346 time_.relativePath(file,
true)
358 Foam::functionObjects::vtkCloud::vtkCloud
410 writeOpts_.append(
false);
411 writeOpts_.legacy(
false);
421 const int padWidth =
dict.getOrDefault<
int>(
"width", 8);
424 if (padWidth < 1 || padWidth > 31)
430 printf_ =
"%0" + std::to_string(padWidth) +
"d";
435 useVerts_ =
dict.getOrDefault(
"cellData",
false);
436 pruneEmpty_ =
dict.getOrDefault(
"prune",
false);
438 selectClouds_.clear();
439 dict.readIfPresent(
"clouds", selectClouds_);
440 selectClouds_.uniq();
442 if (selectClouds_.empty())
447 selectClouds_.push_back(std::move(
cloudName));
451 selectFields_.clear();
452 dict.readIfPresent(
"fields", selectFields_);
453 selectFields_.uniq();
456 parcelSelect_ =
dict.subOrEmptyDict(
"selection");
461 dict.readIfPresent(
"directory", directory_);
463 if (directory_.size())
467 if (!directory_.isAbsolute())
469 directory_ = time_.globalPath()/directory_;
493 selectClouds_.empty()
494 ? mesh_.sortedNames<
cloud>()
498 if (cloudNames.empty())
503 const scalar timeValue = time_.value();
505 const word timeDesc =
"_" +
512 Log <<
name() <<
" output Time: " << time_.timeName() <<
nl;
543 series.
load(seriesName,
true, timeValue);
547 series.
write(seriesName);
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 (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.
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 expressions::valueTypeCode::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.
wordList sortedNames() const
The sorted names of all objects.
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 streamFormat formatEnum(const word &fmtName, const streamFormat deflt=streamFormat::ASCII)
Lookup streamFormat enum corresponding to the string (ascii | binary).
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)
True if process corresponds to the master rank in the communicator.
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...
Do not request registration (bool: false)
bool append(const fileNameInstant &inst)
Append the specified file instant.