34 template<
class T,
class BaseType>
37 Istream& is = readStream(word::null, readOnProc);
41 if (headerClassName() == IOField<T>::typeName)
43 is >>
static_cast<Field<T>&
>(*this);
46 else if (headerClassName() == typeName)
54 <<
"Unexpected class name " << headerClassName()
55 <<
" expected " << typeName
56 <<
" or " << IOField<T>::typeName <<
nl 57 <<
" while reading object " <<
name()
64 template<
class T,
class BaseType>
69 readOpt() == IOobject::MUST_READ
70 || (isReadOptional() && headerOk())
83 template<
class T,
class BaseType>
92 template<
class T,
class BaseType>
103 readFromStream(readOnProc);
108 readFromStream(readOnProc && haveFile);
113 template<
class T,
class BaseType>
126 template<
class T,
class BaseType>
142 template<
class T,
class BaseType>
146 const UList<T>& content
158 template<
class T,
class BaseType>
175 template<
class T,
class BaseType>
179 const bool writeOnProc
185 const word oldTypeName(typeName);
192 const_cast<word&
>(typeName) = oldTypeName;
201 template<
class T,
class BaseType>
204 return (
os << *
this).good();
210 template<
class T,
class BaseType>
227 template<
class T,
class BaseType>
236 const Field<BaseType> elems(is);
239 L.setSize(start.size()-1);
245 label index = start[i];
246 subField.setSize(start[i+1] - index);
250 subField[j] = elems[index++];
258 template<
class T,
class BaseType>
268 os << static_cast<const Field<T>&>(
L);
276 for (label i = 1; i < start.size(); i++)
278 start[i] = start[i-1]+
L[i-1].size();
281 Field<BaseType> elems(start[start.size()-1]);
286 const T& subField =
L[i];
290 elems[elemI++] = subField[j];
293 os << start << elems;
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write using stream options.
readOption readOpt() const noexcept
Get the read option.
errorManipArg< error, int > exit(error &err, const int errNo=1)
CompactIOField(const CompactIOField &)=default
Default copy construct.
void resize(const label len)
Adjust allocated size of list.
void transfer(List< Type > &list)
Transfer the contents of the argument List into this list and annul the argument list.
const vector L(dict.get< vector >("L"))
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
constexpr char nl
The newline '\n' character (0x0a)
bool headerOk()
Read and check header info. Does not check the headerClassName.
virtual bool writeData(Ostream &os) const
Pure virtual writeData function.
A simple container for options an IOstream can normally have.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write using stream options.
bool isReadOptional() const noexcept
True if (LAZY_READ) bits are set [same as READ_IF_PRESENT].
#define forAll(list, i)
Loop across all elements in list.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
void operator=(const Field< Type > &)
Copy assignment.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
A Field of objects of type <T> with automated input and output using a compact storage. Behaves like IOField except when binary output in case it writes a CompactListList.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
List< label > labelList
A List of labels.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Defines the attributes of an object for which implicit objectRegistry management is supported...
A primitive field of type <T> with automated input and output.
streamFormat format() const noexcept
Get the current stream format.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...