62 WarningIn(
"IOobject::fileNameComponents(const fileName&, ...)")
63 <<
" called with directory: " << path <<
"\n";
67 string::size_type first = path.find(
'/');
72 WarningIn(
"IOobject::fileNameComponents(const fileName&, ...)")
73 <<
"called with absolute path: " << path <<
"\n";
77 if (first == string::npos)
82 name.string::operator=(path);
86 instance = path.substr(0, first);
88 string::size_type last = path.rfind(
'/');
92 local = path.substr(first+1, last-first-1);
96 name.string::operator=(path.substr(last+1));
101 if (name.empty() || string::stripInvalid<word>(
name))
103 WarningIn(
"IOobject::fileNameComponents(const fileName&, ...)")
104 <<
"has invalid word for name: \"" << name
105 <<
"\"\nwhile processing path: " << path <<
"\n";
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_))
200 "IOobject::IOobject" "(const fileName&, const objectRegistry&, ...)"
202 <<
" invalid path specification\n"
206 if (objectRegistry::debug)
208 Info<<
"Constructing IOobject called " << name_
209 <<
" of type " << headerClassName_
237 return time().caseName();
243 return time().rootPath();
249 return rootPath()/caseName()/instance()/db_.dbDir()/local();
255 const word& instance,
259 return rootPath()/caseName()/instance/db_.dbDir()/local;
276 time().processorCase()
278 instance() == time().
system()
279 || instance() == time().constant()
284 rootPath()/caseName()
285 /
".."/instance()/db_.dbDir()/local()/
name();
287 if (
isFile(parentObjectPath))
289 return parentObjectPath;
295 word newInstancePath = time().findInstancePath(
instant(instance()));
297 if (newInstancePath.size())
301 rootPath()/caseName()
302 /newInstancePath/db_.dbDir()/local()/
name()
346 Istream* isPtr = objectStream();
351 if (objectRegistry::debug)
354 <<
"IOobject::headerOk() : "
355 <<
"file " << objectPath() <<
" could not be opened"
364 if (!readHeader(*isPtr))
366 if (objectRegistry::debug)
369 <<
"failed to read header of file " << objectPath()
385 if (objState_ != GOOD)
388 <<
"recurrent failure for object " << s
394 Info<<
"IOobject::setBad(const string&) : "
395 <<
"broken object " << s << info() <<
endl;
403 static bool bannerSet =
false;
404 static char spaces[50];
406 static string bannerWithHint;
407 static string bannerNoHint;
411 memset(spaces,
' ', 50);
415 spaces[48 - len] =
'\0';
422 "| ______ _ ____ __ __ |\n"
423 "| | ____| _| |_ / __ \\ /\\ | \\/ | |\n"
424 "| | |__ _ __ ___ ___ / \\| | | | / \\ | \\ / | |\n"
425 "| | __| '__/ _ \\/ _ ( (| |) ) | | |/ /\\ \\ | |\\/| | |\n"
426 "| | | | | | __/ __/\\_ _/| |__| / ____ \\| | | | |\n"
427 "| |_| |_| \\___|\\___| |_| \\____/_/ \\_\\_| |_| |\n"
429 "| FreeFOAM: The Cross-Platform CFD Toolkit |\n"
431 "| Web: http://freefoam.sourceforge.net |\n"
432 "\\*---------------------------------------------------------------------------*/\n";
434 "/*---------------------------------------------------------------------------*\\\n"
437 "/*-------------------*- FOAMDict -*-- vim: set ft=foamdict: -----------------*\\\n"
444 return bannerNoHint.c_str();
448 return bannerWithHint.c_str();
457 headerClassName_ = io.headerClassName_;
459 instance_ = io.instance_;
463 objState_ = io.objState_;