99#ifndef Foam_IOobject_H
100#define Foam_IOobject_H
110#include <type_traits>
173 static bool bannerEnabled_;
182 unsigned char sizeofLabel_;
185 unsigned char sizeofScalar_;
191 word headerClassName_;
215 bool readAndCheckHeader
219 const bool checkType =
true,
221 const bool verbose =
true
235 const word& objectType,
245 const word& objectType,
281 return bannerEnabled_;
288 bool old(bannerEnabled_);
313 const fileName&
path,
321 template<class StringType>
334 const std::
string& scope,
342 const std::
string& scope,
365 const
word& ioName =
""
372 IOobject(const IOobject&) = default;
375 virtual ~IOobject() = default;
461 IOobject(const IOobject&
io, const
word&
name);
694 [[maybe_unused]] const
bool checkType = true,
698 const
bool verbose = true
703 template<class Type,
bool Searching>
707 const
bool checkType = true,
709 const
bool verbose = true
749 const
word& objectType,
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
registerOption
Enumeration for use with registerObject(). Values map to bool (false/true).
constexpr IOobjectOption(readOption rOpt=readOption::NO_READ, writeOption wOpt=writeOption::NO_WRITE, registerOption registerObject=registerOption::REGISTER, bool globalObject=false) noexcept
Default construct (NO_READ, NO_WRITE, REGISTER, non-global) or construct with specified options.
bool globalObject() const noexcept
True if object is treated the same for all processors.
bool registerObject() const noexcept
Should objects created with this IOobject be registered?
Layout
The layout of the case structure.
readOption
Enumeration defining read preferences.
writeOption
Enumeration defining write preferences.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
objectState
Enumeration defining the valid states of an IOobject.
const Time & time() const noexcept
Return Time associated with the objectRegistry.
bool isHeaderClass() const
Check if headerClassName() equals Type::typeName Always true for a void type.
const word & name() const noexcept
Return the object name.
const word & headerClassName() const noexcept
Return name of the class name read from header.
bool readHeader(Istream &is)
Read header ('FoamFile' dictionary) and set the IOobject and stream characteristics.
static bool bannerEnabled() noexcept
Status of output file banner.
bool isHeaderClassName() const
Same as isHeaderClass().
void warnNoRereading() const
Helper: warn that type does not support re-reading.
static Ostream & writeDivider(Ostream &os)
Write the standard file section divider.
virtual const dictionary * findMetaData() const noexcept
Return pointer to meta-data (if any) or nullptr.
const fileName & rootPath() const noexcept
Return the Time::rootPath().
unsigned scalarByteSize() const noexcept
The sizeof (scalar) in bytes, possibly read from the header.
fileName typeFilePath(const bool search=true) const
Call localFilePath or globalFilePath for given type depending on its is_globalIOobject trait.
fileName globalObjectPath() const
The complete global path + object name.
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (respects is_globalIOobject trait) and check its info. A void type suppresses trait and t...
static Ostream & writeEndDivider(Ostream &os)
Write the standard end file divider.
fileCheckTypes
Enumeration defining the file checking options (time-stamp | inotify) | (all | masterOnly).
static word member(const word &name)
Return member (name without the extension).
static Ostream & writeBanner(Ostream &os, const bool noSyntaxHint=false)
Write the standard OpenFOAM file/dictionary banner.
const objectRegistry & db() const noexcept
Return the local objectRegistry.
bool good() const noexcept
Did last readHeader() succeed?
void resetHeader(const word &newName=word::null)
Clear various bits (headerClassName, note, sizeof...) that would be obtained when reading from a file...
bool bad() const noexcept
Did last readHeader() fail?
InfoProxy< IOobject > info() const noexcept
Return info proxy, for printing information to a stream.
autoPtr< IOobject > clone(const objectRegistry ®istry) const
Clone resetting registry.
scalar instanceValue() const
Return the scalar value of the instance component (or 0), which often corresponds to a time index/val...
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
static char scopeSeparator
Character for scoping object names (':' or '_').
static word group(const word &name)
Return group (extension part of name).
fileName globalFilePath(const word &typeName, const bool search=true) const
Redirect to fileHandler filePath, searching up if in parallel.
bool hasHeaderClass() const noexcept
True if headerClassName() is non-empty (after reading).
void operator=(const IOobject &io)
Copy assignment, copies all values (except the registry).
static bool fileModificationChecking_masterOnly() noexcept
Test fileModificationChecking for master-only.
static IOobject selectIO(const IOobject &io, const fileName &altFile, const word &ioName="")
Return the IOobject, but also consider an alternative file name.
static bool fileNameComponents(const fileName &path, fileName &instance, fileName &local, word &name)
Split path into instance, local, name components.
const fileName & local() const noexcept
Read access to local path component.
static void writeHeaderContent(Ostream &os, const IOobject &io, const word &objectType, const dictionary *metaDataDict=nullptr)
Helper: write content for FoamFile IOobject header with optional meta information.
fileName objectRelPath() const
The object path relative to the case.
fileName localFilePath(const word &typeName, const bool search=true) const
Redirect to fileHandler filePath, searching locally.
word group() const
Return group (extension part of name).
IOstreamOption parseHeader(const dictionary &headerDict)
Parse 'FoamFile' header contents and set the IOobject characteristics and return the stream character...
const fileName & instance() const noexcept
Read access to instance path component.
const fileName & globalCaseName() const noexcept
Return the Time::globalCaseName().
TypeName("IOobject")
Declare type-name, virtual type (with debug switch).
static float fileModificationSkew
Time skew (seconds) for file modification checks.
static fileCheckTypes fileModificationChecking
Type of file modification checking.
virtual void rename(const word &newName)
Rename the object.
unsigned labelByteSize() const noexcept
The sizeof (label) in bytes, possibly read from the header.
static const Enum< fileCheckTypes > fileCheckTypesNames
Names for the fileCheckTypes.
fileName path() const
The complete path for the object (with instance, local,...).
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
autoPtr< IOobject > clone() const
Clone.
word member() const
Return member (name without the extension).
static bool bannerEnabled(bool on) noexcept
Enable/disable output file banner.
const string & note() const noexcept
Return the optional note.
static int maxFileModificationPolls
Max number of times to poll for file modification changes.
fileName objectPath() const
The complete path + object name.
bool writeHeader(Ostream &os) const
Write header with current type().
void setBad(const string &s)
Set the object state to bad.
const fileName & caseName() const noexcept
Return the Time::caseName().
fileName globalPath() const
The complete global path for the object (with instance, local,...).
A simple container for options an IOstream can normally have.
A helper class for outputting values to Ostream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling file names.
Registry of regIOobjects.
A class for handling words, derived from Foam::string.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
OBJstream os(runTime.globalPath()/outputName)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
Typedefs for float/double/scalar without requiring scalar.H.
Trait for specifying IOobject types that support the coherent format.
Trait for specifying global vs. local IOobject file types.
Basic run-time type information using word as the type's name. Used to enhance the standard RTTI to c...
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.