Go to the documentation of this file.
58 <<
" called with directory: " <<
path <<
endl;
63 if (
path.isAbsolute())
66 instance =
path.substr(0, last);
69 name.string::operator=(
path.substr(last+1));
75 if (first == string::npos)
84 instance =
path.substr(0, first);
90 local =
path.substr(first+1, last-first-1);
94 name.string::operator=(
path.substr(last+1));
100 if (
name.empty() || string::stripInvalid<word>(
name))
103 <<
"has invalid word for name: \"" <<
name
104 <<
"\"\nwhile processing path: " <<
path <<
endl;
126 headerClassName_(typeName),
133 registerObject_(registerObject),
136 if (objectRegistry::debug)
138 Info<<
"Constructing IOobject called " << name_
139 <<
" of type " << headerClassName_
157 headerClassName_(typeName),
164 registerObject_(registerObject),
167 if (objectRegistry::debug)
169 Info<<
"Constructing IOobject called " << name_
170 <<
" of type " << headerClassName_
186 headerClassName_(typeName),
193 registerObject_(registerObject),
196 if (!fileNameComponents(
path, instance_, local_, name_))
199 <<
" invalid path specification"
203 if (objectRegistry::debug)
205 Info<<
"Constructing IOobject called " << name_
206 <<
" of type " << headerClassName_
261 if (i == word::npos || i == 0)
267 return name_.substr(i+1, word::npos);
276 if (i == word::npos || i == 0)
282 return name_.substr(0, i);
289 return time().rootPath();
295 if (instance().isAbsolute())
301 return rootPath()/caseName()/instance()/db_.dbDir()/local();
308 const word& instance,
313 return rootPath()/caseName()/instance/db_.dbDir()/local;
338 const word & diskFileName = uniqueFileName();
340 if (instance().isAbsolute())
342 fileName objectPath = instance()/diskFileName;
365 time().processorCase()
367 instance() == time().
system()
373 rootPath()/time().globalCaseName()
374 /instance()/db_.dbDir()/local()/diskFileName;
376 if (
isFile(parentObjectPath))
378 return parentObjectPath;
384 word newInstancePath = time().findInstancePath
389 if (newInstancePath.size())
393 rootPath()/caseName()
394 /newInstancePath/db_.dbDir()/local()/diskFileName
412 return objectStream(filePath());
443 Istream* isPtr = objectStream();
448 if (objectRegistry::debug)
451 <<
"IOobject::headerOk() : "
452 <<
"file " << objectPath() <<
" could not be opened"
461 if (!readHeader(*isPtr))
463 if (objectRegistry::debug)
466 <<
"failed to read header of file " << objectPath()
482 if (objState_ != GOOD)
485 <<
"recurrent failure for object " <<
s
491 Info<<
"IOobject::setBad(const string&) : "
492 <<
"broken object " <<
s << info() <<
endl;
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
fileName filePath() const
Return complete path + object name if the file exists.
void setBad(const string &)
Set the object state to bad.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Istream * objectStream()
Construct and return an IFstream for the object.
A class for handling words, derived from string.
readOption rOpt_
Read option.
A class for handling file names.
bool registerObject_
Register object created from this IOobject with registry if true.
fileName instance_
Instance path component.
const fileName & rootPath() const
const Time & time() const
Return time.
Ostream & endl(Ostream &os)
Add newline and flush stream.
string note_
Optional note.
static void replaceFileName(const word &from, const word &to)
const Time & time() const
Return time.
Constant dispersed-phase particle diameter model.
const objectRegistry & db() const
Return the local objectRegistry.
Registry of regIOobjects.
bool headerOk()
Read and check header info.
const objectRegistry & db_
objectRegistry reference
STL conforming hash table.
word headerClassName_
Class name read from header.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
const fileName & caseName() const
writeOption
Enumeration defining the write options.
graph_traits< Graph >::vertices_size_type size_type
writeOption wOpt_
Write option.
static bool fileNameComponents(const fileName &path, fileName &instance, fileName &local, word &name)
Split path into instance, local, name components.
void operator=(const IOobject &)
bool isFile(const fileName &, const bool checkGzip=true)
Does the name exist as a FILE in the file system?
bool isDir(const fileName &)
Does the name exist as a DIRECTORY in the file system?
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))
static const fileName null
An empty fileName.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual ~IOobject()
Destructor.
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.
word member() const
Return member (name without the extension)
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
static Foam::StaticHashTable< Foam::word > replacedFileNames_
static const word null
An empty word.
word group() const
Return group (extension part of name)
const word & uniqueFileName() const
Unique on disk file name.
string caseName() const
Return file name (part beyond last /), subsitute for FOAM_CASE.
fileName local_
Local path component.
An instant of time. Contains the time value and name.
readOption
Enumeration defining the read options.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
bool good() const
Return true if next operation might succeed.
objectState objState_
IOobject state.
fileName path() const
Return complete path.
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.
int system(const std::string &command)
Execute the specified command.
word name(const complex &)
Return a string representation of a complex.