ITstream.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2017-2024 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::ITstream
29 
30 Description
31  An input stream of tokens.
32 
33  Although ITstream is principally meant to be used as a read-only
34  input stream, it also provides additional methods to help when
35  composing its contents (eg, when parsing).
36 
37 SourceFiles
38  ITstream.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef Foam_ITstream_H
43 #define Foam_ITstream_H
44 
45 #include "Istream.H"
46 #include "tokenList.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class ITstream Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class ITstream
58 :
59  public Istream,
60  public tokenList
61 {
62  // Private Data
63 
64  //- Name associated with the stream
65  fileName name_;
66 
67  //- Index of token currently being read
68  label tokenIndex_;
69 
70 
71  // Private Member Functions
72 
73  //- An ad hoc combination of reserve and setCapacity somewhat
74  //- similar to DynamicList.
75  //
76  // Increase list size if needed,
77  // but leave any excess capacity (ie, like reserve).
78  void reserveCapacity(const label newCapacity);
79 
80  //- Convert input sequence into a list of tokens,
81  static tokenList parse_chars
82  (
83  const char* s,
84  size_t nbytes,
85  IOstreamOption streamOpt
86  );
87 
88  //- Convert input sequence into a list of tokens,
89  //- using the existing stream format. Rewinds the stream
90  void reset(const char* input, size_t nbytes);
91 
92  //- Failsafe read-access to token at specified location
93  //- or undefinedToken
94  inline const token& peekNoFail(const label i) const noexcept
95  {
96  return
97  (
98  (i >= 0 && i < tokenList::size())
99  ? tokenList::cdata()[i]
101  );
102  }
103 
104 
105 public:
106 
107  // Constructors
108 
109  //- Copy construct
110  ITstream(const ITstream& is);
111 
112  //- Move construct
113  ITstream(ITstream&& is);
114 
115  //- Default construct. Empty stream, optionally with given name
116  explicit ITstream
117  (
118  IOstreamOption streamOpt = IOstreamOption(),
119  const string& name = "input"
120  );
121 
122  //- Construct empty, optionally with given name
123  explicit ITstream
124  (
125  const Foam::zero,
126  const string& name = "input",
127  IOstreamOption streamOpt = IOstreamOption()
128  );
129 
130  //- Copy construct from tokens, optionally with given name
131  explicit ITstream
132  (
133  const UList<token>& tokens,
134  IOstreamOption streamOpt = IOstreamOption(),
135  const string& name = "input"
136  );
137 
138  //- Move construct from tokens, optionally with given name
139  explicit ITstream
140  (
142  IOstreamOption streamOpt = IOstreamOption(),
143  const string& name = "input"
144  );
145 
146  //- Construct token list by parsing the input character sequence
147  // Uses static parse function internally.
148  explicit ITstream
149  (
150  const UList<char>& input,
151  IOstreamOption streamOpt = IOstreamOption(),
152  const string& name = "input"
153  );
154 
155  //- Construct token list by parsing the input string
156  // Uses static parse function internally.
157  explicit ITstream
158  (
159  const std::string& input,
160  IOstreamOption streamOpt = IOstreamOption(),
161  const string& name = "input"
162  );
163 
164  //- Construct token list by parsing the input character sequence
165  // Uses static parse function internally.
166  explicit ITstream
167  (
168  const char* input,
169  IOstreamOption streamOpt = IOstreamOption(),
170  const string& name = "input"
171  );
172 
173  #if __cplusplus >= 201703L
174  //- Construct token list by parsing the input character sequence
175  // Uses static parse function internally.
176  explicit ITstream
177  (
178  std::string_view s,
179  IOstreamOption streamOpt = IOstreamOption()
180  )
181  :
182  ITstream(streamOpt)
183  {
184  reset(s.data(), s.size());
185  }
186  #endif
187 
188  //- Construct token list by parsing the input character sequence
189  // Uses static parse function internally.
190  explicit ITstream
191  (
193  IOstreamOption streamOpt = IOstreamOption()
194  )
195  :
196  ITstream(streamOpt)
197  {
198  reset(s.data(), s.size());
199  }
200 
201  //- Construct token list by parsing the input character sequence
202  // Uses static parse function internally.
203  explicit ITstream
204  (
206  IOstreamOption streamOpt = IOstreamOption()
207  )
208  :
209  ITstream(streamOpt)
210  {
211  reset(s.data(), s.size());
212  }
213 
214 
215  // Additional constructors
216 
217  //- Copy construct from tokens, with given name
218  ITstream
219  (
220  const string& name,
221  const UList<token>& tokens,
222  IOstreamOption streamOpt = IOstreamOption()
223  )
224  :
225  ITstream(tokens, streamOpt, name)
226  {}
227 
228  //- Move construct from tokens, with given name
229  ITstream
230  (
231  const string& name,
233  IOstreamOption streamOpt = IOstreamOption()
234  )
235  :
236  ITstream(std::move(tokens), streamOpt, name)
237  {}
238 
239 
240  //- Destructor
241  virtual ~ITstream() = default;
243 
244  // Static Functions
245 
246  //- Return reference to an empty ITstream, for functions needing to
247  //- return an ITstream reference but which don't have anything valid
248  //- of their own. <b>The stream shall be considered \em read-only.</b>
249  //
250  // The returned stream has no tokens and has a 'bad' state,
251  // to indicate that it is invalid for reading.
252  //
253  // \caution the caller is still able to modify its contents,
254  // but they should not do that!
255  static ITstream& empty_stream();
256 
257  //- Create token list by parsing the input character sequence
258  //- until no good tokens remain.
260  (
261  const UList<char>& input,
262  IOstreamOption streamOpt = IOstreamOption()
263  )
264  {
265  return parse_chars(input.cdata(), input.size(), streamOpt);
266  }
267 
268  //- Create token list by parsing the input string
269  //- until no good tokens remain.
270  static tokenList parse
271  (
272  const std::string& input,
273  IOstreamOption streamOpt = IOstreamOption()
274  )
275  {
276  return parse_chars(input.data(), input.size(), streamOpt);
277  }
278 
279  //- Create token list by parsing the input character sequence
280  //- until no good tokens remain.
281  static tokenList parse
282  (
283  const char* input,
284  IOstreamOption streamOpt = IOstreamOption()
285  )
286  {
287  return parse_chars(input, strlen(input), streamOpt);
288  }
289 
290  #if __cplusplus >= 201703L
291  //- Create token list by parsing the input character sequence
292  //- until no good tokens remain.
293  static tokenList parse
294  (
295  std::string_view s,
296  IOstreamOption streamOpt = IOstreamOption()
297  )
298  {
299  return parse_chars(s.data(), s.size(), streamOpt);
300  }
301  #endif
302 
303  //- Create token list by parsing the input character sequence
304  //- until no good tokens remain.
305  static tokenList parse
306  (
308  IOstreamOption streamOpt = IOstreamOption()
309  )
310  {
311  return parse_chars(s.data(), s.size(), streamOpt);
312  }
313 
314  //- Create token list by parsing the input character sequence
315  //- until no good tokens remain.
316  static tokenList parse
317  (
319  IOstreamOption streamOpt = IOstreamOption()
320  )
321  {
322  return parse_chars(s.data(), s.size(), streamOpt);
323  }
324 
325 
326  // Member Functions
327 
328  // Characteristics
329 
330  //- The name of the input token stream.
331  virtual const fileName& name() const override { return name_; }
332 
333  //- The name of the input token stream, for modification.
334  virtual fileName& name() { return name_; }
336  //- The line number of the first token in stream
337  label startLineNumber() const
338  {
339  return (tokenList::empty() ? -1 : tokenList::front().lineNumber());
340  }
341 
342  //- The line number of the last token in stream
343  label endLineNumber() const
344  {
345  return (tokenList::empty() ? -1 : tokenList::back().lineNumber());
346  }
347 
348 
349  // Token Access
350 
351  //- The token contents (read-only access)
352  const tokenList& tokens() const noexcept { return *this; }
353 
354  //- The token contents (read/write access)
355  tokenList& tokens() noexcept { return *this; }
356 
357 
358  //- True if putback token is in use
359  bool hasPutback() const noexcept { return Istream::hasPutback(); }
360 
361  //- Failsafe peek at the token at the \b front of the tokenList
362  // \return \c undefinedToken if the list is empty.
363  const token& front() const noexcept
364  {
365  return peekNoFail(0);
366  }
367 
368  //- Failsafe peek at the token at the \b back of the tokenList
369  // \return \c undefinedToken if the list is empty.
370  const token& back() const noexcept
371  {
372  return peekNoFail(tokenList::size()-1);
373  }
374 
375  //- Failsafe peek at what the next read would return,
376  //- including handling of any putback
377  // \return \c undefinedToken if list is exhausted
378  const token& peek() const noexcept;
379 
380  //- Read access to the token at the current tokenIndex.
381  //- \returns \c undefinedToken if list is exhausted
382  const token& currentToken() const noexcept
383  {
384  return peekNoFail(tokenIndex_);
385  }
386 
387  //- Write access to the token at the current tokenIndex.
388  //- Fatal if not in range
389  token& currentToken();
390 
391  //- Failsafe read access to token at given position in the tokenList
392  // \return \c undefinedToken for out-of-range
393  const token& peekToken(const label i) const { return peekNoFail(i); };
394 
395  //- The current token index when reading, or the insertion point.
396  label tokenIndex() const noexcept { return tokenIndex_; }
398  //- Non-const access to the current token index
399  label& tokenIndex() noexcept { return tokenIndex_; }
400 
401  //- Set the token index (no checks). \return the previous value
402  label tokenIndex(const label num) noexcept
403  {
404  label old(tokenIndex_);
405  tokenIndex_ = num;
406  return old;
407  }
408 
409  //- Number of tokens remaining
411  {
412  return (tokenList::size() - tokenIndex_);
413  }
414 
415  //- Move tokenIndex to the specified position
416  //- and adjust the stream status (open/good/eof ...)
417  // Using seek(0) is identical to rewind().
418  // Using seek(-1) moves to the end.
419  void seek(label pos) noexcept;
420 
421  //- Move tokenIndex relative to the current position.
422  // Will not overrun the beginning (0) or one-past end positions.
423  //
424  // Use skip(2) to move forward two tokens.
425  // Use skip(-2) to move backward two tokens.
426  // \return True if the indexing completed without underflow/overflow
427  bool skip(label n = 1) noexcept;
428 
429 
430  // Searching
431 
432  //- Regular searching
433  using tokenList::find;
434 
435  //- Find range containing matching delimiter pair, starting at the
436  //- specified position. The position -1 indicates to continue
437  //- from the present tokenIndex() position.
439  (
440  const token::punctuationToken delimOpen,
441  const token::punctuationToken delimClose,
442  label pos = 0
443  ) const;
444 
445  //- Find compoundToken of specified Type, starting at the
446  //- specified position. The position -1 indicates to continue
447  //- from the present tokenIndex() position.
448  // \return nullptr if not found
449  template<class Type>
450  const Type* findCompound(label pos = 0) const;
451 
452 
453  // Token list modification
454 
455  //- Remove a (start,size) subset from the list and move remaining
456  //- elements down.
457  // If the tokenIndex() is within or to the right of the removed
458  // region, it will be adjusted to remain valid. However, this may
459  // not correspond to the expected parsing point so external bookkeeping
460  // is likely necessary.
461  // \note The range is subsetted with the list size itself to ensure
462  // the result always addresses a valid section of the list.
464 
465  //- Remove a (start,size) subset from the list and move remaining
466  //- elements down.
467  // If the tokenIndex() is within or to the right of the removed
468  // region, it will be adjusted to remain valid. However, this may
469  // not correspond to the expected parsing point so external bookkeeping
470  // is likely necessary.
471  // \note The range is subsetted with the list size itself to ensure
472  // the result always addresses a valid section of the list.
473  label remove(const labelRange& range);
474 
475  //- Copy append a token at the current tokenIndex,
476  //- incrementing the index.
477  void add_tokens(const token& tok);
478 
479  //- Move append a token at the current tokenIndex,
480  //- incrementing the index.
481  void add_tokens(token&& tok);
483  //- Copy append a list of tokens at the current tokenIndex,
484  //- incrementing the index.
485  //
486  // \param newTokens the list of tokens to copy append
487  // \param lazy leaves any excess capacity for further appends.
488  // The caller will be responsible for resizing later.
489  void add_tokens(const UList<token>& toks);
490 
491  //- Move append a list of tokens at the current tokenIndex,
492  //- incrementing the index.
493  //
494  // \param newTokens the list of tokens to move append
495  // \param lazy leaves any excess capacity for further appends.
496  // The caller will be responsible for resizing later.
497  void add_tokens(List<token>&& toks);
498 
499 
500  // Stream State Functions
501 
502  //- Return current stream flags.
503  //- Dummy for token stream, returns 0.
504  virtual std::ios_base::fmtflags flags() const override
505  {
506  return std::ios_base::fmtflags(0);
507  }
508 
509  //- Set stream flags, return old stream flags.
510  //- Dummy for token stream, returns 0.
511  std::ios_base::fmtflags flags(std::ios_base::fmtflags) override
512  {
513  return std::ios_base::fmtflags(0);
514  }
515 
516 
517  // Read Functions
518 
519  //- Return next token from stream
520  virtual Istream& read(token& tok) override;
521 
522  //- Read a character : triggers not implemented error
523  virtual Istream& read(char&) override;
524 
525  //- Read a word : triggers not implemented error
526  virtual Istream& read(word&) override;
527 
528  //- Read a string (including enclosing double-quotes) :
529  //- triggers not implemented error
530  virtual Istream& read(string&) override;
531 
532  //- Read a label : triggers not implemented error
533  virtual Istream& read(label&) override;
534 
535  //- Read a float : triggers not implemented error
536  virtual Istream& read(float&) override;
537 
538  //- Read a double : triggers not implemented error
539  virtual Istream& read(double&) override;
540 
541  //- Read binary block : triggers not implemented error
542  virtual Istream& read(char* data, std::streamsize) override;
543 
544  //- Low-level raw binary read : triggers not implemented error
545  virtual Istream& readRaw(char* data, std::streamsize count) override;
546 
547  //- Start of low-level raw binary read : no-op
548  virtual bool beginRawRead() override { return false; }
549 
550  //- End of low-level raw binary read : no-op
551  virtual bool endRawRead() override { return false; }
552 
553  //- Rewind the stream so that it may be read again. Same as seek(0)
554  virtual void rewind() override { ITstream::seek(0); }
555 
556 
557  // Output
558 
559  //- Print stream description to Ostream
560  void print(Ostream& os) const override;
561 
562  //- Concatenate tokens into a space-separated std::string.
563  //- The resulting string may contain quote characters.
564  std::string toString() const;
565 
566 
567  // Member Operators
568 
569  //- Return a non-const reference to const Istream
570  using Istream::operator();
571 
572  //- Copy assignment, with rewind()
573  void operator=(const ITstream& is);
574 
575  //- Copy assignment of tokens, with rewind()
576  void operator=(const UList<token>& toks);
577 
578  //- Move assignment of tokens, with rewind()
579  void operator=(List<token>&& toks);
580 
581 
582  // Additional constructors and methods (as per v2012 and earlier)
583  #ifdef Foam_IOstream_extras
584 
585  //- Construct from components, copying the tokens
586  ITstream
587  (
588  const string& name,
589  const UList<token>& tokens,
591  )
592  :
594  {}
595 
596  //- Construct from components, transferring the tokens
597  ITstream
598  (
599  const string& name,
600  List<token>&& tokens,
602  )
603  :
604  ITstream(name, std::move(tokens), IOstreamOption(fmt))
605  {}
606 
607  #endif /* Foam_IOstream_extras */
608 
609 
610  // Housekeeping
611 
612  //- Same as front()
613  FOAM_DEPRECATED_STRICT(2022-11, "front()")
614  const token& peekFirst() const { return front(); }
615 
616  FOAM_DEPRECATED_STRICT(2023-10, "add_tokens()")
617  void append(const token& t, bool) { add_tokens(t); }
618 
619  FOAM_DEPRECATED_STRICT(2023-10, "add_tokens()")
620  void append(token&& t, bool) { add_tokens(std::move(t)); }
621 
622  FOAM_DEPRECATED_STRICT(2023-10, "add_tokens()")
623  void append(const UList<token>& t, bool) { add_tokens(t); }
624 
625  FOAM_DEPRECATED_STRICT(2023-10, "add_tokens()")
626  void append(List<token>&& t, bool) { add_tokens(std::move(t)); }
627 
628  FOAM_DEPRECATED_STRICT(2023-10, "add_tokens()")
629  void push_back(const token& t, bool) { add_tokens(t); }
630 
631  FOAM_DEPRECATED_STRICT(2023-10, "add_tokens()")
632  void push_back(token&& t, bool) { add_tokens(std::move(t)); }
633 
634  FOAM_DEPRECATED_STRICT(2023-10, "add_tokens()")
635  void push_back(const UList<token>& t, bool) { add_tokens(t); }
636 
637  FOAM_DEPRECATED_STRICT(2023-10, "add_tokens()")
638  void push_back(List<token>&& t, bool) { add_tokens(std::move(t)); }
639 };
640 
642 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
643 
644 } // End namespace Foam
645 
646 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
647 
648 #include "ITstreamI.H"
649 
650 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
651 
652 #endif
653 
654 // ************************************************************************* //
virtual bool beginRawRead() override
Start of low-level raw binary read : no-op.
Definition: ITstream.H:698
void add_tokens(const token &tok)
Copy append a token at the current tokenIndex, incrementing the index.
Definition: ITstream.C:690
static const token undefinedToken
An undefined token.
Definition: token.H:559
A class for handling file names.
Definition: fileName.H:72
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:56
label endLineNumber() const
The line number of the last token in stream.
Definition: ITstream.H:410
A range or interval of labels defined by a start and a size.
Definition: labelRange.H:52
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
bool empty() const noexcept
True if List is empty (ie, size() is zero)
Definition: UList.H:675
A token holds an item read from Istream.
Definition: token.H:65
T * data() noexcept
Return pointer to the underlying array serving as data storage.
Definition: UListI.H:265
T & front()
Access first element of the list, position [0].
Definition: UListI.H:230
label remove(const labelRange &range)
Remove a (start,size) subset from the list and move remaining elements down.
Definition: ITstream.C:575
const token & front() const noexcept
Failsafe peek at the token at the front of the tokenList.
Definition: ITstream.H:439
A simple container for options an IOstream can normally have.
std::string toString() const
Concatenate tokens into a space-separated std::string. The resulting string may contain quote charact...
Definition: ITstream.C:291
label startLineNumber() const
The line number of the first token in stream.
Definition: ITstream.H:402
label tokenIndex() const noexcept
The current token index when reading, or the insertion point.
Definition: ITstream.H:487
label nRemainingTokens() const noexcept
Number of tokens remaining.
Definition: ITstream.H:507
List< token > tokenList
List of token, used for dictionary primitive entry (for example)
Definition: tokenList.H:32
scalar range
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression...
dimensionedScalar pos(const dimensionedScalar &ds)
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of &#39;true&#39; entries.
Definition: BitOps.H:73
virtual Istream & read(token &tok) override
Return next token from stream.
Definition: ITstream.C:434
virtual Istream & readRaw(char *data, std::streamsize count) override
Low-level raw binary read : triggers not implemented error.
Definition: ITstream.C:676
const tokenList & tokens() const noexcept
The token contents (read-only access)
Definition: ITstream.H:421
static Istream & input(Istream &is, IntRange< T > &range)
Definition: IntRanges.C:33
bool hasPutback() const noexcept
True if putback token is in use.
Definition: ITstream.H:432
const token & peekFirst() const
Same as front()
Definition: ITstream.H:786
void push_back(const token &t, bool)
Definition: ITstream.H:801
const token & currentToken() const noexcept
Read access to the token at the current tokenIndex.
Definition: ITstream.H:466
#define FOAM_DEPRECATED_STRICT(since, replacement)
Definition: stdFoam.H:55
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:105
void append(const token &t, bool)
Definition: ITstream.H:789
const direction noexcept
Definition: Scalar.H:258
virtual const fileName & name() const override
The name of the input token stream.
Definition: ITstream.H:392
label size() const noexcept
The number of elements in the container.
Definition: UList.H:680
OBJstream os(runTime.globalPath()/outputName)
label lineNumber() const noexcept
Const access to the current stream line number.
Definition: IOstream.H:390
static tokenList parse(const UList< char > &input, IOstreamOption streamOpt=IOstreamOption())
Create token list by parsing the input character sequence until no good tokens remain.
Definition: ITstream.H:309
const Type * findCompound(label pos=0) const
Find compoundToken of specified Type, starting at the specified position. The position -1 indicates t...
Definition: ITstreamI.H:22
constexpr UList() noexcept
Default construct, zero-sized and nullptr.
Definition: UListI.H:28
const token & peek() const noexcept
Failsafe peek at what the next read would return, including handling of any putback.
Definition: ITstream.C:329
virtual ~ITstream()=default
Destructor.
bool hasPutback() const noexcept
True if putback token is in use.
Definition: Istream.H:81
labelRange find(const token::punctuationToken delimOpen, const token::punctuationToken delimClose, label pos=0) const
Find range containing matching delimiter pair, starting at the specified position. The position -1 indicates to continue from the present tokenIndex() position.
Definition: ITstream.C:487
streamFormat
Data format (ascii | binary)
T & back()
Access last element of the list, position [size()-1].
Definition: UListI.H:244
Rudimentary functionality similar to std::span for holding memory view.
Definition: stdFoam.H:500
static ITstream & empty_stream()
Return reference to an empty ITstream, for functions needing to return an ITstream reference but whic...
Definition: ITstream.C:68
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:57
label n
const T * cdata() const noexcept
Return pointer to the underlying array serving as data storage.
Definition: UListI.H:258
void print(Ostream &os) const override
Print stream description to Ostream.
Definition: ITstream.C:266
bool skip(label n=1) noexcept
Move tokenIndex relative to the current position.
Definition: ITstream.C:387
virtual bool endRawRead() override
End of low-level raw binary read : no-op.
Definition: ITstream.H:703
ITstream(const ITstream &is)
Copy construct.
Definition: ITstream.C:140
void operator=(const ITstream &is)
Copy assignment, with rewind()
Definition: ITstream.C:731
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
constexpr List() noexcept
Default construct.
Definition: ListI.H:116
void seek(label pos) noexcept
Move tokenIndex to the specified position and adjust the stream status (open/good/eof ...
Definition: ITstream.C:355
const token & back() const noexcept
Failsafe peek at the token at the back of the tokenList.
Definition: ITstream.H:449
virtual std::ios_base::fmtflags flags() const override
Return current stream flags. Dummy for token stream, returns 0.
Definition: ITstream.H:632
An input stream of tokens.
Definition: ITstream.H:52
Namespace for OpenFOAM.
virtual void rewind() override
Rewind the stream so that it may be read again. Same as seek(0)
Definition: ITstream.H:708
Istream(const Istream &)=default
Copy construct.
const token & peekToken(const label i) const
Failsafe read access to token at given position in the tokenList.
Definition: ITstream.H:482
ITstream extract(const labelRange &range)
Remove a (start,size) subset from the list and move remaining elements down.
Definition: ITstream.C:540