41bool 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",
71 debug::optimisationSwitches()
82 "fileModificationSkew",
93 "maxFileModificationPolls",
103 class addfileModificationCheckingToOpt
109 addfileModificationCheckingToOpt
110 (
const addfileModificationCheckingToOpt&) =
delete;
113 (
const addfileModificationCheckingToOpt&) =
delete;
115 explicit addfileModificationCheckingToOpt(
const char*
name)
117 ::
Foam::simpleRegIOobject(
Foam::debug::addOptimisationObject,
name)
120 virtual ~addfileModificationCheckingToOpt() =
default;
122 virtual void readData(Foam::Istream& is)
124 IOobject::fileModificationChecking =
125 IOobject::fileCheckTypesNames.read(is);
130 os << IOobject::fileCheckTypesNames
131 [IOobject::fileModificationChecking];
135 addfileModificationCheckingToOpt addfileModificationCheckingToOpt_
137 "fileModificationChecking"
153 return !str.empty() &&
161 (str.length() > 2 && str[1] ==
':')
180 if (
path.starts_with(
"./") ||
path.starts_with(
"../"))
196 <<
" called with directory: " <<
path <<
endl;
201 const auto first =
path.find(
'/');
202 const auto last =
path.rfind(
'/');
205 auto nameLen =
path.size();
207 if (first == std::string::npos)
218 || (first == 2 &&
path[1] ==
':')
227 const std::string ending =
path.substr(last+1);
228 nameLen = ending.size();
240 local =
path.substr(first+1, last-first-1);
243 const std::string ending =
path.substr(last+1);
244 nameLen = ending.size();
249 if (!nameLen || nameLen !=
name.size())
252 <<
"has invalid word for name: \"" <<
name
253 <<
"\"\nwhile processing path: " <<
path <<
endl;
265 const fileName& altFile,
284 altPath /=
io.name();
309 const auto i =
name.rfind(
'.');
311 if (i == std::string::npos || i == 0)
316 return name.substr(i+1);
322 const auto i =
name.rfind(
'.');
324 if (i == std::string::npos || i == 0)
329 return name.substr(0, i);
339 sizeofLabel_(static_cast<unsigned char>(sizeof(label))),
340 sizeofScalar_(static_cast<unsigned char>(sizeof(scalar))),
345Foam::IOobject::IOobject
358 if (objectRegistry::debug)
361 <<
"Constructing IOobject: " << name_ <<
endl;
366Foam::IOobject::IOobject
369 const fileName& instance,
370 const fileName&
local,
371 const objectRegistry& registry,
375 IOobject(registry, ioOpt)
381 if (objectRegistry::debug)
384 <<
"Constructing IOobject: " << name_ <<
endl;
389Foam::IOobject::IOobject
391 const fileName&
path,
392 const objectRegistry& registry,
396 IOobject(registry, ioOpt)
401 <<
" invalid path specification"
405 if (objectRegistry::debug)
408 <<
"Constructing IOobject: " << name_ <<
endl;
413Foam::IOobject::IOobject
416 const objectRegistry& registry
419 IOobjectOption(static_cast<IOobjectOption>(
io)),
420 objState_(
io.objState_),
421 sizeofLabel_(
io.sizeofLabel_),
422 sizeofScalar_(
io.sizeofScalar_),
425 headerClassName_(
io.headerClassName_),
427 instance_(
io.instance_),
434Foam::IOobject::IOobject
441 objState_(
io.objState_),
442 sizeofLabel_(
io.sizeofLabel_),
443 sizeofScalar_(
io.sizeofScalar_),
446 headerClassName_(
io.headerClassName_),
448 instance_(
io.instance_),
471 return time().rootPath();
477 return time().caseName();
483 return time().globalCaseName();
490 return time().caseName(layout);
499 if (Foam::readScalar(instance_, val))
515 return rootPath()/caseName()/instance()/db_.dbDir()/
local();
527 return rootPath()/globalCaseName()/instance()/db_.dbDir()/
local();
539 return rootPath()/caseName(layout)/instance()/db_.dbDir()/
local();
545 const word& instance,
546 const fileName&
local
556 const word& instance,
568 const word& instance,
595 return instance()/db_.dbDir()/
local()/
name();
637 <<
"Recurrent failure for object " <<
s
647 objState_ = objectState::BAD;
653 if (!newName.empty())
657 objState_ = objectState::GOOD;
658 sizeofLabel_ =
static_cast<unsigned char>(
sizeof(label));
659 sizeofScalar_ =
static_cast<unsigned char>(
sizeof(scalar));
660 headerClassName_.clear();
669 readOpt(
io.readOpt());
670 writeOpt(
io.writeOpt());
672 globalObject(
io.globalObject());
674 objState_ =
io.objState_;
675 sizeofLabel_ =
io.sizeofLabel_;
676 sizeofScalar_ =
io.sizeofScalar_;
679 headerClassName_ =
io.headerClassName_;
681 instance_ =
io.instance_;
static bool file_isOutsideCase(const std::string &str)
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...
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.
readOption readOpt() const noexcept
Get the read option.
writeOption writeOpt() const noexcept
Get the write option.
Layout
The layout of the case structure.
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.
const word & name() const noexcept
Return the object name.
const fileName & rootPath() const noexcept
Return the Time::rootPath().
fileCheckTypes
Enumeration defining the file checking options (time-stamp | inotify) | (all | masterOnly).
const objectRegistry & db() const noexcept
Return the local objectRegistry.
void resetHeader(const word &newName=word::null)
Clear various bits (headerClassName, note, sizeof...) that would be obtained when reading from a file...
InfoProxy< IOobject > info() const noexcept
Return info proxy, for printing information to a stream.
scalar instanceValue() const
Return the scalar value of the instance component (or 0), which often corresponds to a time index/val...
static char scopeSeparator
Character for scoping object names (':' or '_').
fileName globalFilePath(const word &typeName, const bool search=true) const
Redirect to fileHandler filePath, searching up if in parallel.
void operator=(const IOobject &io)
Copy assignment, copies all values (except the registry).
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.
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).
const fileName & instance() const noexcept
Read access to instance path component.
const fileName & globalCaseName() const noexcept
Return the Time::globalCaseName().
static float fileModificationSkew
Time skew (seconds) for file modification checks.
static fileCheckTypes fileModificationChecking
Type of file modification checking.
static const Enum< fileCheckTypes > fileCheckTypesNames
Names for the fileCheckTypes.
fileName path() const
The complete path for the object (with instance, local,...).
word member() const
Return member (name without the extension).
static int maxFileModificationPolls
Max number of times to poll for file modification changes.
fileName objectPath() const
The complete path + object name.
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,...).
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling file names.
static bool clean(std::string &str)
Cleanup filename string, possibly applies other transformations such as changing the path separator e...
static int level
The output level (verbosity) of messages.
Registry of regIOobjects.
Abstract base class for registered object with I/O. Used in debug symbol registration.
string & expand(const bool allowEmpty=false)
Inplace expand initial tags, tildes, and all occurrences of environment variables as per stringOps::e...
A class for handling words, derived from Foam::string.
static word validate(const std::string &s, const bool prefix=false)
Construct validated word (no invalid characters).
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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))
#define WarningInFunction
Report a warning using Foam::Warning.
#define InfoInFunction
Report an information message using Foam::Info.
int infoSwitch(const char *name, const int deflt=0)
Lookup info switch or add default value.
float floatOptimisationSwitch(const char *name, const float deflt=0)
Lookup optimisation switch or add default value.
int optimisationSwitch(const char *name, const int deflt=0)
Lookup optimisation switch or add default value.
fileName cwd()
The physical or logical current working directory path name.
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler().
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
#define registerOptSwitch(Name, Type, SwitchVar)
const bool writeData(pdfDictionary.get< bool >("writeData"))