55 "fileModificationChecking",
57 fileModificationChecking
79 <<
" called with directory: " << path <<
endl;
87 instance = path.substr(0, last);
90 name.string::operator=(path.substr(last+1));
96 if (first == string::npos)
101 name.string::operator=(path);
105 instance = path.substr(0, first);
111 local = path.substr(first+1, last-first-1);
115 name.string::operator=(path.substr(last+1));
121 if (name.empty() || string::stripInvalid<word>(
name))
124 <<
"has invalid word for name: \"" << name
125 <<
"\"\nwhile processing path: " << path <<
endl;
138 if (i == word::npos || i == 0)
144 return name.substr(i+1, word::npos);
153 if (i == word::npos || i == 0)
159 return name.substr(0, i);
177 headerClassName_(typeName),
184 registerObject_(registerObject),
187 if (objectRegistry::debug)
190 <<
"Constructing IOobject called " << name_
191 <<
" of type " << headerClassName_
209 headerClassName_(typeName),
216 registerObject_(registerObject),
219 if (objectRegistry::debug)
222 <<
"Constructing IOobject called " << name_
223 <<
" of type " << headerClassName_
239 headerClassName_(typeName),
246 registerObject_(registerObject),
249 if (!fileNameComponents(path, instance_, local_, name_))
252 <<
" invalid path specification" 256 if (objectRegistry::debug)
259 <<
"Constructing IOobject called " << name_
260 <<
" of type " << headerClassName_
273 headerClassName_(io.headerClassName_),
275 instance_(io.instance_),
280 registerObject_(io.registerObject_),
281 objState_(io.objState_)
292 headerClassName_(io.headerClassName_),
294 instance_(io.instance_),
299 registerObject_(io.registerObject_),
300 objState_(io.objState_)
332 return member(name_);
338 return time().rootPath();
346 return time().globalCaseName();
365 !instance_.isAbsolute()
366 && instance_ != time().system()
367 && instance_ != time().constant()
368 && instance_ != time().timeName()
374 instance_ = time().timeName();
382 if (instance_.isAbsolute())
388 return rootPath()/caseName(global)/instance()/db_.dbDir()/local();
395 if (instance().isAbsolute())
401 return instance()/db_.dbDir()/local();
408 const word& typeName,
418 if (objState_ != GOOD)
421 <<
"Recurrent failure for object " << s
428 <<
"Broken object " << s << info() <<
endl;
438 headerClassName_ = io.headerClassName_;
440 instance_ = io.instance_;
444 objState_ = io.objState_;
fileCheckTypes
Enumeration defining the file checking options.
const char *const group
Group name for atomic constants.
labelList first(const UList< labelPair > &p)
writeOption
Enumeration defining the write options.
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.
void updateInstance() const
If the instance is a time directory update to the current time.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void operator=(const IOobject &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
string caseName() const
Return file name (part beyond last /), substitute for FOAM_CASE.
IOobject(const word &name, const fileName &instance, const objectRegistry ®istry, readOption r=NO_READ, writeOption w=NO_WRITE, bool registerObject=true)
Construct from name, instance, registry, io options.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const fileName & caseName(const bool global) const
word member() const
Return member (name without the extension)
virtual ~IOobject()
Destructor.
word group() const
Return group (extension part of name)
fileName filePath(const word &typeName, const bool global) const
Return complete path + object name if the file exists.
readOption
Enumeration defining the read options.
Initialise the NamedEnum HashTable from the static list of names.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().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 isAbsolute() const
Return true if file name is absolute.
bool isDir(const fileName &, const bool followLink=true)
Does the name exist as a directory in the file system?
A class for handling words, derived from string.
virtual fileName filePath(const bool globalFile, const IOobject &, const word &typeName) const =0
Search for an object. globalFile : also check undecomposed case.
fileName relativePath() const
Return the path relative to the case directory.
void setBad(const string &)
Set the object state to bad.
static const word null
An empty word.
fileName path(const bool global) const
Return complete path including the processor sub-directory.
const fileOperation & fileHandler()
Get current file handler.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
graph_traits< Graph >::vertices_size_type size_type
const Time & time() const
Return time.
defineTypeNameAndDebug(combustionModel, 0)
static fileCheckTypes fileModificationChecking
Type of file modification checking.
word name(const complex &)
Return a string representation of a complex.
const fileName & rootPath() const
static const NamedEnum< fileCheckTypes, 4 > fileCheckTypesNames
#define WarningInFunction
Report a warning using Foam::Warning.
const Time & time() const
Return time.
Enum namedEnumOptimisationSwitch(const char *name, const NamedEnum< Enum, nEnum > &enumNames, const Enum defaultValue)
Lookup optimisation switch or add default value.
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
Registry of regIOobjects.
const objectRegistry & db() const
Return the local objectRegistry.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
#define InfoInFunction
Report an information message using Foam::Info.