34void Foam::rawIOField<Type>::readIOcontents
37 IOobjectOption::readOption readAverage
40 is >>
static_cast<Field<Type>&
>(*this);
42 if (IOobjectOption::isReadRequired(readAverage))
47 else if (IOobjectOption::isReadOptional(readAverage))
68bool Foam::rawIOField<Type>::readIOcontents
70 IOobjectOption::readOption readAverage
73 if (isReadRequired() || isReadOptional())
75 bool haveFile =
false;
76 bool haveHeader =
false;
81 const fileName fName(filePath());
84 autoPtr<ISstream> isPtr(
fileHandler().NewIFstream(fName));
86 if (isPtr && isPtr->good())
92 const token firstToken(is);
94 haveHeader = is.good() && firstToken.isWord(
"FoamFile");
99 Pout<<
"rawIOField : object:" <<
name()
100 <<
" haveFile:" << haveFile
101 <<
" haveHeader:" << haveHeader <<
endl;
110 Istream& is = readStream(word::null);
114 readIOcontents(is, readAverage);
121 autoPtr<ISstream> isPtr(
fileHandler().NewIFstream(objectPath()));
123 if (isPtr && isPtr->good())
125 readIOcontents(*isPtr, readAverage);
130 if (isReadRequired())
133 <<
"Trying to read raw field" <<
endl
134 <<
exit(FatalIOError);
141 Pout<<
"rawIOField : object:" <<
name()
142 <<
" size:" << this->size() <<
endl;
168 readIOcontents(readAverage);
176 const bool readAverage
203 rawIOField<Type> reader(rio);
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
constexpr Field() noexcept
Default construct.
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
@ NO_REGISTER
Do not request registration (bool: false).
readOption readOpt() const noexcept
Get the read option.
readOption
Enumeration defining read preferences.
@ NO_READ
Nothing to be read.
@ MUST_READ
Reading required.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
void warnNoRereading() const
Helper: warn that type does not support re-reading.
void resetHeader(const word &newName=word::null)
Clear various bits (headerClassName, note, sizeof...) that would be obtained when reading from a file...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
bool throwing() const noexcept
Return the current exception throwing state (on or off).
Like IOField but falls back to raw IFstream if no header found. Optionally reads average value....
rawIOField(const rawIOField &)=default
Default copy construct.
virtual bool writeData(Ostream &os) const
The writeData method for regIOobject write operation.
static Field< Type > readContents(const IOobject &io)
Read and return contents. The IOobject will not be registered.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
regIOobject(const IOobject &io, const bool isTimeObject=false)
Construct from IOobject. The optional flag adds special handling if the object is the top-level regIO...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OBJstream os(runTime.globalPath()/outputName)
refPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler - forwards to fileOperation::handler().
Ostream & endl(Ostream &os)
Add newline and flush stream.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0).
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
errorManipArg< error, int > exit(error &err, const int errNo=1)