34 template<
class T,
class BaseType>
37 if (isReadRequired() || (isReadOptional() && headerOk()))
40 Istream& is = readStream(word::null, readOnProc);
44 if (headerClassName() == IOField<T>::typeName)
46 is >>
static_cast<Field<T>&
>(*this);
49 else if (headerClassName() == typeName)
57 <<
"Unexpected class name " << headerClassName()
58 <<
" expected " << typeName
59 <<
" or " << IOField<T>::typeName <<
nl 60 <<
" while reading object " <<
name()
74 template<
class T,
class BaseType>
83 template<
class T,
class BaseType>
92 readIOcontents(readOnProc);
96 template<
class T,
class BaseType>
109 template<
class T,
class BaseType>
118 if (!readIOcontents())
125 template<
class T,
class BaseType>
129 const UList<T>& content
134 if (!readIOcontents())
141 template<
class T,
class BaseType>
158 template<
class T,
class BaseType>
162 const bool writeOnProc
168 const word oldTypeName(typeName);
175 const_cast<word&
>(typeName) = oldTypeName;
184 template<
class T,
class BaseType>
187 return (
os << *
this).good();
193 template<
class T,
class BaseType>
210 template<
class T,
class BaseType>
219 const Field<BaseType> elems(is);
222 L.setSize(start.size()-1);
228 label index = start[i];
229 subField.setSize(start[i+1] - index);
233 subField[j] = elems[index++];
241 template<
class T,
class BaseType>
251 os << static_cast<const Field<T>&>(
L);
259 for (label i = 1; i < start.size(); i++)
261 start[i] = start[i-1]+
L[i-1].size();
264 Field<BaseType> elems(start[start.size()-1]);
269 const T& subField =
L[i];
273 elems[elemI++] = subField[j];
276 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 ...