56 bool isHeaderOk =
false;
77 return fileHandler().read(*
this, masterOnly, fmt, typeName);
86 void Foam::regIOobject::readStream(
const bool readOnProc)
91 <<
"NO_READ specified for read-constructor of object " <<
name()
92 <<
" of class " << headerClassName()
100 if (watchIndices_.size())
103 objPath =
fileHandler().getFile(watchIndices_.back());
108 objPath = filePath();
112 Pout<<
"regIOobject::readStream() : " 113 <<
"found object " <<
name()
114 <<
" (global " << global() <<
")" 115 <<
" in file " << objPath
127 const word& expectName,
128 const bool readOnProc
133 Pout<<
"regIOobject::readStream(const word&) : " 134 <<
"reading object " <<
name()
135 <<
" of type " <<
type()
136 <<
" from file " << filePath()
143 readStream(readOnProc);
152 && headerClassName() != expectName
153 && headerClassName() !=
"dictionary" 157 <<
"unexpected class name " << headerClassName()
158 <<
" expected " << expectName <<
endl 159 <<
" while reading object " <<
name()
172 Pout<<
"regIOobject::close() : " 173 <<
"finished reading " 174 << (isPtr_ ? isPtr_->name() :
"dummy")
178 isPtr_.reset(
nullptr);
194 const bool masterOnly
206 const bool needWatch(!watchIndices_.empty());
208 if (!watchIndices_.empty())
214 watchIndices_.clear();
255 modified = watchIndices_[i];
262 const fileName fName =
fileHandler().getFile(watchIndices_.back());
264 if (modified == watchIndices_.back())
267 <<
" Re-reading object " <<
name()
268 <<
" from file " << fName <<
endl;
273 <<
" Re-reading object " <<
name()
274 <<
" from file " << fName
275 <<
" because of modified file "
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual bool read()
Read object.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#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)...
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
bool headerOk()
Read and check header info. Does not check the headerClassName.
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler()
bool isReadOptional() const noexcept
True if (LAZY_READ) bits are set [same as READ_IF_PRESENT].
static void broadcast(Type &value, const label comm=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all communicator ranks. Does nothing in non-paral...
bool read(const char *buf, int32_t &val)
Same as readInt32.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
void close()
Close Istream.
A class for handling words, derived from Foam::string.
virtual bool readIfModified()
Read object if modified (as set by call to modified)
errorManip< error > abort(error &err)
int debug
Static debugging option.
static fileCheckTypes fileModificationChecking
Type of file modification checking.
bool isReadRequired() const noexcept
True if (MUST_READ | READ_MODIFIED) bits are set.
virtual bool global() const
Is object global.
virtual bool readData(Istream &)
Virtual readData function.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
virtual bool modified() const
Return true if the object's file (or files for objectRegistry) have been modified. (modified state is cached by Time)
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
streamFormat
Data format (ascii | binary)
#define forAllReverse(list, i)
Reverse loop across all elements in list.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
bool readHeaderOk(const IOstreamOption::streamFormat fmt, const word &typeName)
Helper: check readOpt flags and read if necessary.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
#define InfoInFunction
Report an information message using Foam::Info.