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;
124 IOobject::fileModificationChecking =
125 IOobject::fileCheckTypesNames.read(is);
130 os << IOobject::fileCheckTypesNames
131 [IOobject::fileModificationChecking];
135 addfileModificationCheckingToOpt addfileModificationCheckingToOpt_
137 "fileModificationChecking"
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] ==
':')
202 const std::string ending =
path.substr(last+1);
203 nameLen = ending.size();
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;
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))),
336 if (objectRegistry::debug)
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))),
373 if (objectRegistry::debug)
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))),
411 <<
" invalid path specification"
415 if (objectRegistry::debug)
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_),
514 return time().rootPath();
520 return time().caseName();
529 const auto first = instance().find(
'/');
535 || (first == 2 && instance()[1] ==
':')
543 return rootPath()/caseName()/instance()/db_.dbDir()/local();
549 const word& instance,
554 return rootPath()/caseName()/instance/db_.dbDir()/local;
563 const auto first = instance().find(
'/');
569 || (first == 2 && instance()[1] ==
':')
574 return instance()/
name();
577 return instance()/db_.dbDir()/local()/
name();
583 const word& typeName,
594 const word& typeName,
605 if (objState_ != objectState::GOOD)
608 <<
"Recurrent failure for object " <<
s
615 <<
"Broken object " <<
s << info() <<
endl;
618 objState_ = objectState::BAD;
627 headerClassName_ =
io.headerClassName_;
629 instance_ =
io.instance_;
633 globalObject_ =
io.globalObject_;
634 objState_ =
io.objState_;
635 sizeofLabel_ =
io.sizeofLabel_;
636 sizeofScalar_ =
io.sizeofScalar_;
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
objectState
Enumeration defining the valid states of an IOobject.
const fileName & caseName() const
Return the Time::caseName()
const word & name() const noexcept
Return the object name.
const Time & time() const
Return Time associated with the objectRegistry.
readOption readOpt() const noexcept
The read option.
bool globalObject() const noexcept
Is object same for all processors?
fileCheckTypes
Enumeration defining the file checking options.
const objectRegistry & db() const noexcept
Return the local objectRegistry.
bool registerObject() const noexcept
Should object created with this IOobject be registered?
static char scopeSeparator
Character for scoping object names (':' or '_')
fileName globalFilePath(const word &typeName, const bool search=true) const
Helper for filePath that searches 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 root.
fileName localFilePath(const word &typeName, const bool search=true) const
Helper for filePath that searches locally.
word group() const
Return group (extension part of name)
const fileName & instance() const noexcept
Read access to instance path component.
writeOption
Enumeration defining the write options.
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.
word member() const
Return member (name without the extension)
const fileName & rootPath() const
Return the Time::rootPath()
static int maxFileModificationPolls
Max number of times to poll for file modification changes.
writeOption writeOpt() const noexcept
The write option.
readOption
Enumeration defining the read options.
void setBad()
Set stream state to be 'bad'.
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.
A class for handling file names.
static bool clean(std::string &str)
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.
virtual void validate()
Validate the turbulence fields after construction.
static int level
The output level (verbosity) of messages.
Registry of regIOobjects.
const Time & time() const noexcept
Return time registry.
Abstract base class for registered object with I/O. Used in debug symbol registration.
bool starts_with(const std::string &s) const
True if string starts with the given prefix (cf. C++20)
string & expand(const bool allowEmpty=false)
A class for handling words, derived from Foam::string.
static const word null
An empty word.
#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))
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
#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.
const fileOperation & fileHandler()
Get current file handler.
fileName cwd()
The physical or logical current working directory path name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for 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"))