57 "IOobject::fileNameComponents" 64 ) <<
" called with directory: " << path <<
endl;
72 instance = path.substr(0, last);
75 name.string::operator=(path.substr(last+1));
81 if (first == string::npos)
86 name.string::operator=(
path);
90 instance = path.substr(0, first);
96 local = path.substr(first+1, last-first-1);
100 name.string::operator=(path.substr(last+1));
106 if (name.empty() || string::stripInvalid<word>(
name))
110 "IOobject::fileNameComponents" 118 <<
"has invalid word for name: \"" << name
119 <<
"\"\nwhile processing path: " << path <<
endl;
141 headerClassName_(typeName),
148 registerObject_(registerObject),
151 if (objectRegistry::debug)
153 Info<<
"Constructing IOobject called " << name_
154 <<
" of type " << headerClassName_
172 headerClassName_(typeName),
179 registerObject_(registerObject),
182 if (objectRegistry::debug)
184 Info<<
"Constructing IOobject called " << name_
185 <<
" of type " << headerClassName_
201 headerClassName_(typeName),
208 registerObject_(registerObject),
211 if (!fileNameComponents(path, instance_, local_, name_))
218 "const objectRegistry&, " 224 <<
" invalid path specification" 228 if (objectRegistry::debug)
230 Info<<
"Constructing IOobject called " << name_
231 <<
" of type " << headerClassName_
267 if (i == word::npos || i == 0)
273 return name_.substr(i+1, word::npos);
282 if (i == word::npos || i == 0)
288 return name_.substr(0, i);
295 return time().rootPath();
301 if (instance().isAbsolute())
307 return rootPath()/caseName()/instance()/db_.dbDir()/local();
314 const word& instance,
319 return rootPath()/caseName()/instance/db_.dbDir()/local;
325 if (instance().isAbsolute())
350 time().processorCase()
352 instance() == time().
system()
358 rootPath()/time().globalCaseName()
359 /instance()/db_.dbDir()/local()/
name();
361 if (
isFile(parentObjectPath))
363 return parentObjectPath;
369 word newInstancePath = time().findInstancePath
374 if (newInstancePath.size())
378 rootPath()/caseName()
379 /newInstancePath/db_.dbDir()/local()/
name()
397 return objectStream(filePath());
428 Istream* isPtr = objectStream();
433 if (objectRegistry::debug)
436 <<
"IOobject::headerOk() : " 437 <<
"file " << objectPath() <<
" could not be opened" 446 if (!readHeader(*isPtr))
448 if (objectRegistry::debug)
451 <<
"failed to read header of file " << objectPath()
467 if (objState_ != GOOD)
470 <<
"recurrent failure for object " << s
476 Info<<
"IOobject::setBad(const string&) : " 477 <<
"broken object " << s << info() <<
endl;
487 headerClassName_ = io.headerClassName_;
489 instance_ = io.instance_;
493 objState_ = io.objState_;
word member() const
Return member (name without the extension)
fileName filePath() const
Return complete path + object name if the file exists.
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 ))
word name(const complex &)
Return a string representation of a complex.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
A class for handling words, derived from string.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void setBad(const string &)
Set the object state to bad.
void operator=(const IOobject &)
#define IOWarningIn(functionName, ios)
Report an IO warning using Foam::Warning.
graph_traits< Graph >::vertices_size_type size_type
fileName path() const
Return complete path.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Ostream & endl(Ostream &os)
Add newline and flush stream.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
#define WarningIn(functionName)
Report a warning using Foam::Warning.
Istream * objectStream()
Construct and return an IFstream for the object.
static bool fileNameComponents(const fileName &path, fileName &instance, fileName &local, word &name)
Split path into instance, local, name components.
readOption
Enumeration defining the read options.
string caseName() const
Return file name (part beyond last /), subsitute for FOAM_CASE.
bool good() const
Return true if next operation might succeed.
static const fileName null
An empty fileName.
const fileName & rootPath() const
An instant of time. Contains the time value and name.
bool isAbsolute() const
Return true if file name is absolute.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
word group() const
Return group (extension part of name)
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
bool isDir(const fileName &)
Does the name exist as a DIRECTORY in the file system?
const fileName & caseName() const
int system(const std::string &command)
Execute the specified command.
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.
Constant dispersed-phase particle diameter model.
Registry of regIOobjects.
writeOption
Enumeration defining the write options.
A class for handling file names.
const Time & time() const
Return time.
const Time & time() const
Return time.
bool headerOk()
Read and check header info.
bool isFile(const fileName &, const bool checkGzip=true)
Does the name exist as a FILE in the file system?
virtual ~IOobject()
Destructor.
const objectRegistry & db() const
Return the local objectRegistry.
static const word null
An empty word.
defineTypeNameAndDebug(combustionModel, 0)