34 template<
class ListType>
40 && token::compound::isCompound
58 template<
class ListType>
62 os <<
nl << l.size() <<
nl << token::BEGIN_LIST;
72 os <<
nl << token::END_LIST <<
nl;
76 template<
class ListType>
81 os << token::END_STATEMENT <<
endl;
95 Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::UList<T>& L)
98 if (os.format() == IOstream::ASCII || !contiguous<T>())
102 if (L.
size() > 1 && contiguous<T>())
119 os << L.
size() << token::BEGIN_BLOCK;
125 os << token::END_BLOCK;
127 else if (L.
size() <= 1 || (L.
size() < 11 && contiguous<T>()))
130 os << L.
size() << token::BEGIN_LIST;
135 if (i > 0) os << token::SPACE;
140 os << token::END_LIST;
145 os <<
nl << L.
size() <<
nl << token::BEGIN_LIST;
154 os <<
nl << token::END_LIST <<
nl;
162 os.write(reinterpret_cast<const char*>(L.v_), L.
byteSize());
167 os.check(
"Ostream& operator<<(Ostream&, const UList&)");
176 is.
fatalCheck(
"operator>>(Istream&, UList<T>&)");
178 token firstToken(is);
180 is.
fatalCheck(
"operator>>(Istream&, UList<T>&) : reading first token");
198 <<
"incorrect length for UList. Read " << s
199 <<
" expected " << L.
size()
215 <<
"incorrect length for UList. Read " << s
216 <<
" expected " << L.
size()
222 if (is.
format() == IOstream::ASCII || !contiguous<T>())
229 if (delimiter == token::BEGIN_LIST)
237 "operator>>(Istream&, UList<T>&) : reading entry" 248 "operator>>(Istream&, UList<T>&) : " 249 "reading the single entry" 266 is.
read(reinterpret_cast<char*>(L.
data()), s*
sizeof(
T));
270 "operator>>(Istream&, UList<T>&) : reading the binary block" 277 if (firstToken.
pToken() != token::BEGIN_LIST)
280 <<
"incorrect first token, expected '(', found " 291 if (sll.size() != L.
size())
294 <<
"incorrect length for UList. Read " << sll.size()
295 <<
" expected " << L.
size()
315 <<
"incorrect first token, expected <int> or '(', found "
#define forAll(list, i)
Loop across all elements in list.
punctuationToken pToken() const
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
compound & transferCompoundToken(const Istream &is)
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...
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
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