Go to the documentation of this file.
34 template<
class T,
class BaseType>
37 Istream& is = readStream(word::null);
39 if (headerClassName() == IOList<T>::typeName)
41 is >>
static_cast<List<T>&
>(*this);
44 else if (headerClassName() == typeName)
52 <<
"unexpected class name " << headerClassName()
53 <<
" expected " << typeName <<
" or " << IOList<T>::typeName
55 <<
" while reading object " <<
name()
61 template<
class T,
class BaseType>
67 const label oldSize = size;
68 size += this->operator[](i).size();
80 template<
class T,
class BaseType>
87 io.
readOpt() == IOobject::MUST_READ
88 || (io.
readOpt() == IOobject::READ_IF_PRESENT && headerOk())
96 template<
class T,
class BaseType>
107 io.
readOpt() == IOobject::MUST_READ
108 || (io.
readOpt() == IOobject::READ_IF_PRESENT && headerOk())
120 template<
class T,
class BaseType>
131 io.
readOpt() == IOobject::MUST_READ
132 || (io.
readOpt() == IOobject::READ_IF_PRESENT && headerOk())
144 template<
class T,
class BaseType>
157 io.
readOpt() == IOobject::MUST_READ
158 || (io.
readOpt() == IOobject::READ_IF_PRESENT && headerOk())
168 template<
class T,
class BaseType>
177 streamOpt.
format() == IOstream::BINARY
181 streamOpt.
format(IOstream::ASCII);
184 <<
"Overall number of elements of CompactIOList of size "
185 << this->size() <<
" overflows the representation of a label"
186 <<
nl <<
" Switching to ascii writing" <<
endl;
189 if (streamOpt.
format() == IOstream::ASCII)
192 const word oldTypeName(typeName);
196 bool good = regIOobject::writeObject(streamOpt, valid);
199 const_cast<word&
>(typeName) = oldTypeName;
204 return regIOobject::writeObject(streamOpt, valid);
208 template<
class T,
class BaseType>
211 return (os << *
this).good();
217 template<
class T,
class BaseType>
229 template<
class T,
class BaseType>
241 L.setSize(start.size()-1);
247 label index = start[i];
248 subList.setSize(start[i+1] - index);
252 subList[j] = elems[index++];
260 template<
class T,
class BaseType>
268 if (os.format() == IOstream::ASCII)
270 os << static_cast<const List<T>&>(
L);
278 for (label i = 1; i < start.size(); i++)
280 const label prev = start[i-1];
281 start[i] = prev+
L[i-1].size();
286 <<
"Overall number of elements " << start[i]
287 <<
" of CompactIOList of size "
288 <<
L.size() <<
" overflows the representation of a label"
289 <<
endl <<
"Please recompile with a larger representation"
294 List<BaseType> elems(start[start.size()-1]);
299 const T& subList =
L[i];
303 elems[elemI++] = subList[j];
306 os << start << elems;
List< label > labelList
A List of labels.
points setSize(newPointi)
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const vector L(dict.get< vector >("L"))
A class for handling words, derived from Foam::string.
streamFormat format() const noexcept
Get the current stream format.
Ostream & endl(Ostream &os)
Add newline and flush stream.
#define forAll(list, i)
Loop across all elements in list.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
word name(const complex &c)
Return string representation of complex.
The IOstreamOption is a simple container for options an IOstream can normally have.
CompactIOList(const CompactIOList &)=default
Default copy construct.
A List of objects of type <T> with automated input and output using a compact storage....
virtual bool writeData(Ostream &) const
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write using stream options. Checks for overflow in binary.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
readOption readOpt() const
The read option.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
A List of objects of type <T> with automated input and output.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
#define WarningInFunction
Report a warning using Foam::Warning.