34 template<
class T,
unsigned Size>
43 template<
class T,
unsigned Size>
50 template<
class T,
unsigned Size>
53 is.
fatalCheck(
"operator>>(Istream&, FixedList<T, Size>&)");
55 if (is.
format() == IOstream::ASCII || !contiguous<T>())
61 "operator>>(Istream&, FixedList<T, Size>&) : reading first token" 66 L = dynamicCast<token::Compound<List<T>>>
81 <<
"incorrect first token, expected <label> " 82 "or '(' or '{', found " 95 if (delimiter == token::BEGIN_LIST)
97 for (
unsigned i=0; i<Size; i++)
103 "operator>>(Istream&, FixedList<T, Size>&) : " 115 "operator>>(Istream&, FixedList<T, Size>&) : " 116 "reading the single entry" 119 for (
unsigned i=0; i<Size; i++)
130 is.
read(reinterpret_cast<char*>(L.
data()), Size*
sizeof(
T));
134 "operator>>(Istream&, FixedList<T, Size>&) : " 135 "reading the binary block" 145 template<
class T,
unsigned Size>
146 Foam::Ostream& Foam::operator<<(Ostream& os, const FixedList<T, Size>& L)
149 if (os.format() == IOstream::ASCII || !contiguous<T>())
153 if (Size > 1 && contiguous<T>())
170 os << L.
size() << token::BEGIN_BLOCK;
176 os << token::END_BLOCK;
178 else if (Size <= 1 ||(Size < 11 && contiguous<T>()))
181 os << token::BEGIN_LIST;
186 if (i > 0) os << token::SPACE;
191 os << token::END_LIST;
196 os <<
nl << token::BEGIN_LIST;
205 os <<
nl << token::END_LIST <<
nl;
210 os.write(reinterpret_cast<const char*>(L.
cdata()), Size*
sizeof(
T));
214 os.check(
"Ostream& operator<<(Ostream&, const FixedList&)");
#define forAll(list, i)
Loop across all elements in list.
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)
errorManipArg< error, int > exit(error &err, const int errNo=1)
A 1D vector of objects of type <T> with a fixed size <Size>.
char readEndList(const char *funcName)
InfoProxy< token > info() const
Return info proxy.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
A token holds items read from Istream.
void putBack(const token &)
Put back token.
Template function to specify if the data of a type are contiguous.
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.
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.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void checkSize(const label size) const
Check size is within valid range (0 ... size)
label size() const
Return the number of elements in the FixedList.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
FixedList()
Null constructor.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
T * data()
Return a pointer to the first data element,.
void writeListEntry(Ostream &os, const ListType &l)
bool isPunctuation() const
const T * cdata() const
Return a const pointer to the first data element,.