Go to the documentation of this file.
41 bool Foam::IOobject::bannerEnabled_(
true);
59 { fileCheckTypes::timeStamp,
"timeStamp" },
60 { fileCheckTypes::timeStampMaster,
"timeStampMaster" },
61 { fileCheckTypes::inotify,
"inotify" },
62 { fileCheckTypes::inotifyMaster,
"inotifyMaster" },
68 fileCheckTypesNames.get
70 "fileModificationChecking",
82 "fileModificationSkew",
93 "maxFileModificationPolls",
103 class addfileModificationCheckingToOpt
109 addfileModificationCheckingToOpt
110 (
const addfileModificationCheckingToOpt&) =
delete;
113 (
const addfileModificationCheckingToOpt&) =
delete;
115 explicit addfileModificationCheckingToOpt(
const char*
name)
120 virtual ~addfileModificationCheckingToOpt() =
default;
135 addfileModificationCheckingToOpt addfileModificationCheckingToOpt_
137 "fileModificationChecking"
155 if (
path.starts_with(
"./") ||
path.starts_with(
"../"))
160 return fileNameComponents(absPath, instance, local,
name);
171 <<
" called with directory: " <<
path <<
endl;
176 const auto first =
path.find(
'/');
177 const auto last =
path.rfind(
'/');
180 auto nameLen =
path.size();
182 if (first == std::string::npos)
193 || (first == 2 &&
path[1] ==
':')
200 instance =
path.substr(0, last);
202 const std::string ending =
path.substr(last+1);
203 nameLen = ending.size();
210 instance =
path.substr(0, first);
215 local =
path.substr(first+1, last-first-1);
218 const std::string ending =
path.substr(last+1);
219 nameLen = ending.size();
224 if (!nameLen || nameLen !=
name.size())
227 <<
"has invalid word for name: \"" <<
name
228 <<
"\"\nwhile processing path: " <<
path <<
endl;
259 altPath /= io.
name();
284 const auto i =
name.rfind(
'.');
286 if (i == std::string::npos || i == 0)
291 return name.substr(i+1);
297 const auto i =
name.rfind(
'.');
299 if (i == std::string::npos || i == 0)
304 return name.substr(0, i);
322 headerClassName_(typeName),
328 registerObject_(registerObject),
329 globalObject_(globalObject),
331 sizeofLabel_(
static_cast<unsigned char>(
sizeof(label))),
332 sizeofScalar_(
static_cast<unsigned char>(
sizeof(scalar))),
339 <<
"Constructing IOobject called " << name_
340 <<
" of type " << headerClassName_
359 headerClassName_(typeName),
365 registerObject_(registerObject),
366 globalObject_(globalObject),
368 sizeofLabel_(
static_cast<unsigned char>(
sizeof(label))),
369 sizeofScalar_(
static_cast<unsigned char>(
sizeof(scalar))),
376 <<
"Constructing IOobject called " << name_
377 <<
" of type " << headerClassName_
394 headerClassName_(typeName),
400 registerObject_(registerObject),
401 globalObject_(globalObject),
403 sizeofLabel_(
static_cast<unsigned char>(
sizeof(label))),
404 sizeofScalar_(
static_cast<unsigned char>(
sizeof(scalar))),
408 if (!fileNameComponents(
path, instance_, local_, name_))
411 <<
" invalid path specification"
418 <<
"Constructing IOobject called " << name_
419 <<
" of type " << headerClassName_
432 headerClassName_(io.headerClassName_),
434 instance_(io.instance_),
438 registerObject_(io.registerObject_),
439 globalObject_(io.globalObject_),
440 objState_(io.objState_),
441 sizeofLabel_(io.sizeofLabel_),
442 sizeofScalar_(io.sizeofScalar_),
455 headerClassName_(io.headerClassName_),
457 instance_(io.instance_),
461 registerObject_(io.registerObject_),
462 globalObject_(io.globalObject_),
463 objState_(io.objState_),
464 sizeofLabel_(io.sizeofLabel_),
465 sizeofScalar_(io.sizeofScalar_),
501 return time().rootPath();
507 return time().caseName();
516 const auto first = instance().find(
'/');
522 || (first == 2 && instance()[1] ==
':')
530 return rootPath()/caseName()/instance()/db_.dbDir()/local();
536 const word& instance,
541 return rootPath()/caseName()/instance/db_.dbDir()/local;
550 const auto first = instance().find(
'/');
556 || (first == 2 && instance()[1] ==
':')
561 return instance()/
name();
564 return instance()/db_.dbDir()/local()/
name();
570 const word& typeName,
581 const word& typeName,
592 if (objState_ != GOOD)
595 <<
"Recurrent failure for object " <<
s
602 <<
"Broken object " <<
s << info() <<
endl;
614 headerClassName_ = io.headerClassName_;
616 instance_ = io.instance_;
620 globalObject_ = io.globalObject_;
621 objState_ = io.objState_;
622 sizeofLabel_ = io.sizeofLabel_;
623 sizeofScalar_ = io.sizeofScalar_;
int debug
Static debugging option.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
#define InfoInFunction
Report an information message using Foam::Info.
fileCheckTypes
Enumeration defining the file checking options.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
fileName localFilePath(const word &typeName, const bool search=true) const
Helper for filePath that searches locally.
A class for handling words, derived from Foam::string.
static const Enum< fileCheckTypes > fileCheckTypesNames
Names for the fileCheckTypes.
A class for handling file names.
bool registerObject() const noexcept
Should object created with this IOobject be registered?
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))
registerOptSwitch("fileModificationSkew", float, Foam::IOobject::fileModificationSkew)
const fileName & rootPath() const
static int level
The output level (verbosity) of messages.
static fileCheckTypes fileModificationChecking
Type of file modification checking.
virtual fileName filePath(const bool checkGlobal, const IOobject &, const word &typeName, const bool search=true) const =0
Search for an object. checkGlobal : also check undecomposed case.
static char scopeSeparator
Character for scoping object names (':' or '_')
const fileOperation & fileHandler()
Get current file handler.
IOobject(const IOobject &)=default
Copy construct.
Ostream & endl(Ostream &os)
Add newline and flush stream.
fileName objectRelPath() const
The object path relative to the root.
writeOption writeOpt() const noexcept
The write option.
const Time & time() const
Return Time associated with the objectRegistry.
Registry of regIOobjects.
int infoSwitch(const char *name, const int deflt=0)
Lookup info switch or add default value.
writeOption
Enumeration defining the write options.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
const fileName & caseName() const
bool globalObject() const noexcept
Is object same for all processors?
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.
static float fileModificationSkew
Time skew (seconds) for file modification checks.
int optimisationSwitch(const char *name, const int deflt=0)
Lookup optimisation switch or add default value.
static void writeData(Ostream &os, const Type &val)
fileName globalFilePath(const word &typeName, const bool search=true) const
Helper for filePath that searches up if in parallel.
OBJstream os(runTime.globalPath()/outputName)
errorManipArg< error, int > exit(error &err, const int errNo=1)
readOption readOpt() const noexcept
The read option.
void operator=(const IOobject &io)
const word & name() const noexcept
Return name.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
float floatOptimisationSwitch(const char *name, const float deflt=0)
Lookup optimisation switch or add default value.
word member() const
Return member (name without the extension)
string & expand(const bool allowEmpty=false)
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
static const word null
An empty word.
word group() const
Return group (extension part of name)
void setBad(const string &s)
Set the object state to bad.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
static bool clean(std::string &str)
fileName cwd()
The physical or logical current working directory path name.
readOption
Enumeration defining the read options.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
StringType validate(const std::string &str, const UnaryPredicate &accept, const bool invert=false)
Return a copy of the input string with validated characters.
fileName path() const
The complete path.
dictionary & optimisationSwitches()
The OptimisationSwitches sub-dictionary in the central controlDict(s).
EnumType read(Istream &is) const
Read a word from Istream and return the corresponding enumeration.
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.
void addOptimisationObject(const char *name, simpleRegIOobject *obj)
Register optimisation switch read/write object.
const Time & time() const noexcept
Return time registry.
Abstract base class for registered object with I/O. Used in debug symbol registration.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
const objectRegistry & db() const noexcept
Return the local objectRegistry.
static int maxFileModificationPolls
Max number of times to poll for file modification changes.