34 template<
class ListType>
39 token::compound::isCompound
57 template<
class ListType>
61 os <<
nl << l.size() <<
nl << token::BEGIN_LIST;
71 os <<
nl << token::END_LIST <<
nl;
75 template<
class ListType>
80 os << token::END_STATEMENT <<
endl;
94 Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::UList<T>& L)
97 if (os.format() == IOstream::ASCII || !contiguous<T>())
101 if (L.
size() > 1 && contiguous<T>())
118 os << L.
size() << token::BEGIN_BLOCK;
124 os << token::END_BLOCK;
126 else if (L.
size() <= 1 || (L.
size() < 11 && contiguous<T>()))
129 os << L.
size() << token::BEGIN_LIST;
134 if (i > 0) os << token::SPACE;
139 os << token::END_LIST;
144 os <<
nl << L.
size() <<
nl << token::BEGIN_LIST;
153 os <<
nl << token::END_LIST <<
nl;
161 os.write(reinterpret_cast<const char*>(L.v_), L.
byteSize());
166 os.check(
"Ostream& operator<<(Ostream&, const UList&)");
175 is.
fatalCheck(
"operator>>(Istream&, UList<T>&)");
177 token firstToken(is);
179 is.
fatalCheck(
"operator>>(Istream&, UList<T>&) : reading first token");
197 <<
"incorrect length for UList. Read " << s
198 <<
" expected " << L.
size()
214 <<
"incorrect length for UList. Read " << s
215 <<
" expected " << L.
size()
221 if (is.
format() == IOstream::ASCII || !contiguous<T>())
228 if (delimiter == token::BEGIN_LIST)
236 "operator>>(Istream&, UList<T>&) : reading entry" 247 "operator>>(Istream&, UList<T>&) : " 248 "reading the single entry" 265 is.
read(reinterpret_cast<char*>(L.
data()), s*
sizeof(
T));
269 "operator>>(Istream&, UList<T>&) : reading the binary block" 276 if (firstToken.
pToken() != token::BEGIN_LIST)
279 <<
"incorrect first token, expected '(', found " 290 if (sll.size() != L.
size())
293 <<
"incorrect length for UList. Read " << sll.size()
294 <<
" expected " << L.
size()
314 <<
"incorrect first token, expected <int> or '(', found "
#define forAll(list, i)
Loop across all elements in list.
punctuationToken pToken() const
compound & transferCompoundToken(const Istream &is)
Ostream & writeKeyword(Foam::Ostream &os, const keyType &kw)
Write the keyword to the Ostream with the current level of indentation.
To & dynamicCast(From &r)
Reference type cast template function,.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void writeListEntries(Ostream &os, const ListType &l)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
char readEndList(const char *funcName)
InfoProxy< token > info() const
Return info proxy.
Template class for non-intrusive linked lists.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
void size(const label)
Override size to be inconsistent with allocated storage.
An STL-conforming const_iterator.
A token holds items read from Istream.
void putBack(const token &)
Put back token.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Template function to specify if the data of a type are contiguous.
Traits class for primitives.
A templated class for holding compound tokens.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
virtual Istream & read(token &)=0
Return next token from stream.
A class for handling words, derived from string.
Istream & operator>>(Istream &, directionInfo &)
streamFormat format() const
Return current stream format.
char readBeginList(const char *funcName)
void fatalCheck(const char *operation) const
Check IOstream status for given operation.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
T * data()
Return a pointer to the first data element,.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
std::streamsize byteSize() const
Return the binary size in number of characters of the UList.
label size() const
Return the number of elements in the UList.
Non-intrusive singly-linked list.
void writeListEntry(Ostream &os, const ListType &l)
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
bool isPunctuation() const