56 <<
" called with directory: " << path <<
endl;
64 instance = path.substr(0, last);
67 name.string::operator=(path.substr(last+1));
73 if (first == string::npos)
78 name.string::operator=(
path);
82 instance = path.substr(0, first);
88 local = path.substr(first+1, last-first-1);
92 name.string::operator=(path.substr(last+1));
98 if (name.empty() || string::stripInvalid<word>(
name))
101 <<
"has invalid word for name: \"" << name
102 <<
"\"\nwhile processing path: " << path <<
endl;
124 headerClassName_(typeName),
131 registerObject_(registerObject),
134 if (objectRegistry::debug)
137 <<
"Constructing IOobject called " << name_
138 <<
" of type " << headerClassName_
156 headerClassName_(typeName),
163 registerObject_(registerObject),
166 if (objectRegistry::debug)
169 <<
"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)
206 <<
"Constructing IOobject called " << name_
207 <<
" of type " << headerClassName_
243 if (i == word::npos || i == 0)
249 return name_.substr(i+1, word::npos);
258 if (i == word::npos || i == 0)
264 return name_.substr(0, i);
271 return time().rootPath();
277 if (instance().isAbsolute())
283 return rootPath()/caseName()/instance()/db_.dbDir()/local();
290 const word& instance,
295 return rootPath()/caseName()/instance/db_.dbDir()/local;
301 if (instance().isAbsolute())
326 time().processorCase()
328 instance() == time().
system()
334 rootPath()/time().globalCaseName()
335 /instance()/db_.dbDir()/local()/
name();
337 if (
isFile(parentObjectPath))
339 return parentObjectPath;
345 word newInstancePath = time().findInstancePath
350 if (newInstancePath.size())
354 rootPath()/caseName()
355 /newInstancePath/db_.dbDir()/local()/
name()
373 return objectStream(filePath());
404 Istream* isPtr = objectStream();
409 if (objectRegistry::debug)
412 <<
"File " << objectPath() <<
" could not be opened" 421 if (!readHeader(*isPtr))
423 if (objectRegistry::debug)
426 <<
"Failed to read header of file " << objectPath()
442 if (objState_ != GOOD)
445 <<
"Recurrent failure for object " << s
452 <<
"Broken object " << s << info() <<
endl;
462 headerClassName_ = io.headerClassName_;
464 instance_ = io.instance_;
468 objState_ = io.objState_;
const Time & time() const
Return time.
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.
const objectRegistry & db() const
Return the local objectRegistry.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void operator=(const IOobject &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
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.
static const fileName null
An empty fileName.
bool good() const
Return true if next operation might succeed.
bool isFile(const fileName &, const bool checkGzip=true)
Does the name exist as a FILE in the file system?
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual ~IOobject()
Destructor.
bool isDir(const fileName &)
Does the name exist as a DIRECTORY in the file system?
word member() const
Return member (name without the extension)
readOption
Enumeration defining the read options.
string caseName() const
Return file name (part beyond last /), subsitute for FOAM_CASE.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
fileName path() const
Return complete path.
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))
fileName filePath() const
Return complete path + object name if the file exists.
const fileName & caseName() const
A class for handling words, derived from string.
const Time & time() const
Return time.
void setBad(const string &)
Set the object state to bad.
static const word null
An empty word.
graph_traits< Graph >::vertices_size_type size_type
bool isAbsolute() const
Return true if file name is absolute.
Istream * objectStream()
Construct and return an IFstream for the object.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
defineTypeNameAndDebug(combustionModel, 0)
word name(const complex &)
Return a string representation of a complex.
An instant of time. Contains the time value and name.
#define WarningInFunction
Report a warning using Foam::Warning.
Constant dispersed-phase particle diameter model.
bool headerOk()
Read and check header info.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
const fileName & rootPath() const
Registry of regIOobjects.
word group() const
Return group (extension part of name)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
int system(const std::string &command)
Execute the specified command.
#define InfoInFunction
Report an information message using Foam::Info.