34 template<
class T,
class BaseType>
37 if (readOpt() == IOobject::MUST_READ)
41 else if (isReadOptional())
55 Istream& is = readStream(word::null, readOnProc);
59 if (headerClassName() == IOField<T>::typeName)
61 is >>
static_cast<Field<T>&
>(*this);
64 else if (headerClassName() == typeName)
72 <<
"Unexpected class name " << headerClassName()
73 <<
" expected " << typeName
74 <<
" or " << IOField<T>::typeName <<
nl 75 <<
" while reading object " <<
name()
86 template<
class T,
class BaseType>
95 template<
class T,
class BaseType>
104 readIOcontents(readOnProc);
108 template<
class T,
class BaseType>
121 template<
class T,
class BaseType>
130 if (!readIOcontents())
137 template<
class T,
class BaseType>
141 const UList<T>& content
146 if (!readIOcontents())
153 template<
class T,
class BaseType>
170 template<
class T,
class BaseType>
174 const bool writeOnProc
180 const word oldTypeName(typeName);
187 const_cast<word&
>(typeName) = oldTypeName;
196 template<
class T,
class BaseType>
199 return (
os << *
this).good();
205 template<
class T,
class BaseType>
222 template<
class T,
class BaseType>
231 const Field<BaseType> elems(is);
234 L.setSize(start.size()-1);
240 label index = start[i];
241 subField.setSize(start[i+1] - index);
245 subField[j] = elems[index++];
253 template<
class T,
class BaseType>
263 os << static_cast<const Field<T>&>(
L);
271 for (label i = 1; i < start.size(); i++)
273 start[i] = start[i-1]+
L[i-1].size();
276 Field<BaseType> elems(start[start.size()-1]);
281 const T& subField =
L[i];
285 elems[elemI++] = subField[j];
288 os << start << elems;
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write using stream options.
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)
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.
#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 ...