98 #ifndef Foam_IOobject_H 99 #define Foam_IOobject_H 117 class objectRegistry;
125 public IOobjectOption
156 static bool bannerEnabled_;
165 unsigned char sizeofLabel_;
168 unsigned char sizeofScalar_;
174 word headerClassName_;
199 const word& objectType,
209 const word& objectType,
245 return bannerEnabled_;
252 bool old(bannerEnabled_);
274 const fileName&
path,
282 template<
class StringType>
295 const std::string& scope,
317 const word& ioName =
"" 453 const Time&
time() const;
471 virtual
void rename(const word& newName)
506 inline word
group() const;
509 inline word
member() const;
527 fileName
path() const;
533 const fileName&
local = fileName::null
547 const word& typeName,
556 const word& typeName,
565 IOstreamOption
parseHeader(const dictionary& headerDict);
583 const
bool checkType = true,
585 const
bool verbose = true
620 const
word& objectType,
652 inline bool IOobject::isHeaderClass<void>()
const 659 Ostream& operator<<(Ostream& os, const InfoProxy<IOobject>& ip);
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...
writeOption
Enumeration defining write preferences.
autoPtr< IOobject > clone() const
Clone.
static bool fileNameComponents(const fileName &path, fileName &instance, fileName &local, word &name)
Split path into instance, local, name components.
A class for handling file names.
bool typeGlobal()
Template function for obtaining global vs. local status.
fileName globalFilePath(const word &typeName, const bool search=true) const
Redirect to fileHandler filePath, searching up if in parallel.
static float fileModificationSkew
Time skew (seconds) for file modification checks.
void operator=(const IOobject &io)
Copy assignment, copies all values (except the registry)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
virtual const dictionary * findMetaData() const noexcept
Return pointer to meta-data (if any) or nullptr.
const word & name() const noexcept
Return the object name.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
virtual void rename(const word &newName)
Rename the object.
static Ostream & writeDivider(Ostream &os)
Write the standard file section divider.
const string & note() const noexcept
Return the optional note.
word member() const
Return member (name without the extension)
void setBad(const string &s)
Set the object state to bad.
A simple container for options an IOstream can normally have.
bool bad() const noexcept
Did last readHeader() fail?
word group() const
Return group (extension part of name)
bool good() const noexcept
Did last readHeader() succeed?
Ignore writing from objectRegistry::writeObject()
bool writeHeader(Ostream &os) const
Write header with current type()
fileName objectPath() const
The complete path + object name.
IOstreamOption parseHeader(const dictionary &headerDict)
Parse 'FoamFile' header contents and set the IOobject characteristics and return the stream character...
fileName path() const
The complete path.
bool hasHeaderClass() const noexcept
True if headerClassName() is non-empty (after reading)
bool globalObject() const noexcept
True if object is treated the same for all processors.
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
fileName typeFilePath(const IOobject &io, const bool search=true)
Template function for obtaining local or global filePath.
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
A class for handling words, derived from Foam::string.
fileCheckTypes
Enumeration defining the file checking options.
static int maxFileModificationPolls
Max number of times to poll for file modification changes.
const objectRegistry & db() const noexcept
Return the local objectRegistry.
fileName localFilePath(const word &typeName, const bool search=true) const
Redirect to fileHandler filePath, searching locally.
virtual ~IOobject()=default
Destructor.
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (uses typeFilePath to find file) and check its info.
static Ostream & writeEndDivider(Ostream &os)
Write the standard end file divider.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
static const Enum< fileCheckTypes > fileCheckTypesNames
Names for the fileCheckTypes.
OBJstream os(runTime.globalPath()/outputName)
static fileCheckTypes fileModificationChecking
Type of file modification checking.
static bool bannerEnabled() noexcept
Status of output file banner.
const fileName & instance() const noexcept
Read access to instance path component.
static char scopeSeparator
Character for scoping object names (':' or '_')
unsigned labelByteSize() const noexcept
The sizeof (label) in bytes, possibly read from the header.
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.
const fileName & rootPath() const
Return the Time::rootPath()
const word & headerClassName() const noexcept
Return name of the class name read from header.
A helper class for outputting values to Ostream.
bool isHeaderClassName() const
Same as isHeaderClass()
const Time & time() const
Return Time associated with the objectRegistry.
IOobject(const IOobject &)=default
Copy construct.
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
TypeName("IOobject")
Declare type-name, virtual type (with debug switch)
fileName objectRelPath() const
The object path relative to the root.
bool registerObject() const noexcept
Should objects created with this IOobject be registered?
static Ostream & writeBanner(Ostream &os, const bool noSyntaxHint=false)
Write the standard OpenFOAM file/dictionary banner.
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
InfoProxy< IOobject > info() const
Return info proxy, for printing information to a stream.
Registry of regIOobjects.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
objectState
Enumeration defining the valid states of an IOobject.
const fileName & local() const noexcept
Read access to local path component.
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))
bool readHeader(Istream &is)
Read header ('FoamFile' dictionary) and set the IOobject and stream characteristics.
Defines the attributes of an object for which implicit objectRegistry management is supported...
const fileName & caseName() const
Return the Time::caseName()
void warnNoRereading() const
Helper: warn that type does not support re-reading.
static IOobject selectIO(const IOobject &io, const fileName &altFile, const word &ioName="")
Return the IOobject, but also consider an alternative file name.
bool isHeaderClass() const
Check if headerClassName() equals Type::typeName.
unsigned scalarByteSize() const noexcept
The sizeof (scalar) in bytes, possibly read from the header.
readOption
Enumeration defining read preferences.