<metaname="description"content="PhasicFlow is an open-source parallel DEM (discrete element method) package for simulating granular flow. It is developed in C++ and can be exectued on both GPU (like CUDA) and CPU.">
<!-- iframe showing the search results (closed by default) -->
<divid="MSearchResultsWindow">
<iframesrc="javascript:void(0)"frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<divclass="header">
<divclass="headertitle">
<divclass="title">tokenIO.cpp</div></div>
</div><!--header-->
<divclass="contents">
<ahref="tokenIO_8cpp.html">Go to the documentation of this file.</a><divclass="fragment"><divclass="line"><aname="l00001"></a><spanclass="lineno"> 1</span> <spanclass="comment">/*------------------------------- phasicFlow ---------------------------------</span></div>
<divclass="line"><aname="l00002"></a><spanclass="lineno"> 2</span> <spanclass="comment"> O C enter of</span></div>
<divclass="line"><aname="l00003"></a><spanclass="lineno"> 3</span> <spanclass="comment"> O O E ngineering and</span></div>
<divclass="line"><aname="l00004"></a><spanclass="lineno"> 4</span> <spanclass="comment"> O O M ultiscale modeling of</span></div>
<divclass="line"><aname="l00005"></a><spanclass="lineno"> 5</span> <spanclass="comment"> OOOOOOO F luid flow </span></div>
<divclass="line"><aname="l00011"></a><spanclass="lineno"> 11</span> <spanclass="comment"> This file is part of phasicFlow code. It is a free software for simulating </span></div>
<divclass="line"><aname="l00012"></a><spanclass="lineno"> 12</span> <spanclass="comment"> granular and multiphase flows. You can redistribute it and/or modify it under</span></div>
<divclass="line"><aname="l00013"></a><spanclass="lineno"> 13</span> <spanclass="comment"> the terms of GNU General Public License v3 or any other later versions. </span></div>
<divclass="line"><aname="l00015"></a><spanclass="lineno"> 15</span> <spanclass="comment"> phasicFlow is distributed to help others in their research in the field of </span></div>
<divclass="line"><aname="l00016"></a><spanclass="lineno"> 16</span> <spanclass="comment"> granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the</span></div>
<divclass="line"><aname="l00017"></a><spanclass="lineno"> 17</span> <spanclass="comment"> implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span></div>
<divclass="line"><aname="l00020"></a><spanclass="lineno"> 20</span> <spanclass="comment">// based on OpenFOAM stream, with some modifications/simplifications</span></div>
<divclass="line"><aname="l00021"></a><spanclass="lineno"> 21</span> <spanclass="comment">// to be tailored to our needs</span></div>
<divclass="line"><aname="l00034"></a><spanclass="lineno"> 34</span>  os <<<spanclass="stringliteral">"on line "</span><< tok.<aclass="code"href="classpFlow_1_1token.html#a1c8abe34223b7d5e9341eac78c9907b5">lineNumber</a>() <<<spanclass="stringliteral">": "</span>;</div>
<divclass="line"><aname="l00049"></a><spanclass="lineno"> 49</span>  os << tok.<aclass="code"href="classpFlow_1_1token.html#aaa8bf55f686d97ee30090681fd0bfc04">pToken</a>();</div>
<divclass="line"><aname="l00054"></a><spanclass="lineno"> 54</span>  os << tok.<aclass="code"href="classpFlow_1_1token.html#a527884d8106fbcdc51fb1d8b937b9f71">int64Token</a>();</div>
<divclass="line"><aname="l00058"></a><spanclass="lineno"> 58</span>  os << tok.<aclass="code"href="classpFlow_1_1token.html#a4c72fd962e5ec6cf9143fb6a78ddb2ab">floatToken</a>();</div>
<divclass="line"><aname="l00062"></a><spanclass="lineno"> 62</span>  os <<tok.<aclass="code"href="classpFlow_1_1token.html#a9de6957d916b0d8a10cab9c0e2688fe6">doubleToken</a>();</div>
<divclass="line"><aname="l00065"></a><spanclass="lineno"> 65</span> <spanclass="comment">// Different behaviour for (serial/parallel) streams: preserve types</span></div>
<divclass="line"><aname="l00069"></a><spanclass="lineno"> 69</span>  os << tok.<aclass="code"href="classpFlow_1_1token.html#aa81aefc6aea3503b1eb4aefbafc8d0bc">stringToken</a>();</div>
<divclass="line"><aname="l00073"></a><spanclass="lineno"> 73</span>  os << tok.<aclass="code"href="classpFlow_1_1token.html#a8658f0b0a04ffdb6e74c5af4ca27edf1">wordToken</a>();</div>
<divclass="line"><aname="l00077"></a><spanclass="lineno"> 77</span>  os << tok.<aclass="code"href="classpFlow_1_1token.html#aa81aefc6aea3503b1eb4aefbafc8d0bc">stringToken</a>();</div>
<divclass="line"><aname="l00139"></a><spanclass="lineno"><aclass="line"href="namespacepFlow.html#ad26e60e655d7da2a3d92ceb1d65b7803"> 139</a></span> <aclass="code"href="classpFlow_1_1iIstream.html">pFlow::iIstream</a>&<aclass="code"href="namespacepFlow.html#a85ed561d066dae339196cd058783674f">pFlow::operator>></a>(<aclass="code"href="classpFlow_1_1iIstream.html">iIstream</a>& is, <aclass="code"href="classpFlow_1_1token.html">token</a>& tok)</div>
<divclass="line"><aname="l00161"></a><spanclass="lineno"> 161</span>  os << tok.<aclass="code"href="classpFlow_1_1token.html#aaa8bf55f686d97ee30090681fd0bfc04">pToken</a>();</div>
<divclass="line"><aname="l00166"></a><spanclass="lineno"> 166</span>  os << tok.<aclass="code"href="classpFlow_1_1token.html#a527884d8106fbcdc51fb1d8b937b9f71">int64Token</a>();</div>
<divclass="line"><aname="l00170"></a><spanclass="lineno"> 170</span>  os << tok.<aclass="code"href="classpFlow_1_1token.html#a4c72fd962e5ec6cf9143fb6a78ddb2ab">floatToken</a>();</div>
<divclass="line"><aname="l00174"></a><spanclass="lineno"> 174</span>  os <<tok.<aclass="code"href="classpFlow_1_1token.html#a9de6957d916b0d8a10cab9c0e2688fe6">doubleToken</a>();</div>
<divclass="line"><aname="l00177"></a><spanclass="lineno"> 177</span> <spanclass="comment">// Different behaviour for (serial/parallel) streams: preserve types</span></div>
<divclass="line"><aname="l00185"></a><spanclass="lineno"> 185</span>  os << tok.<aclass="code"href="classpFlow_1_1token.html#a8658f0b0a04ffdb6e74c5af4ca27edf1">wordToken</a>();</div>
<divclass="line"><aname="l00189"></a><spanclass="lineno"> 189</span>  os << tok.<aclass="code"href="classpFlow_1_1token.html#aa81aefc6aea3503b1eb4aefbafc8d0bc">stringToken</a>();</div>
<divclass="ttc"id="aclasspFlow_1_1iOstream_html_a8da7514808d6493ccfd30582fc945aa1"><divclass="ttname"><ahref="classpFlow_1_1iOstream.html#a8da7514808d6493ccfd30582fc945aa1">pFlow::iOstream::write</a></div><divclass="ttdeci">virtual bool write(const token &tok)=0</div><divclass="ttdoc">Write token to stream or otherwise handle it.</div></div>
<divclass="ttc"id="aclasspFlow_1_1token_html_a60330c34e8555025752e615e0c73e99a"><divclass="ttname"><ahref="classpFlow_1_1token.html#a60330c34e8555025752e615e0c73e99a">pFlow::token::type</a></div><divclass="ttdeci">tokenType type() const</div><divclass="ttdoc">Return the token type.</div><divclass="ttdef"><b>Definition:</b><ahref="tokenI_8hpp_source.html#l00302">tokenI.hpp:302</a></div></div>
<divclass="ttc"id="aclasspFlow_1_1iIstream_html_ac35c0ab7b3a6a0cdcf8c2bd2bf24de11"><divclass="ttname"><ahref="classpFlow_1_1iIstream.html#ac35c0ab7b3a6a0cdcf8c2bd2bf24de11">pFlow::iIstream::read</a></div><divclass="ttdeci">virtual iIstream & read(token &)=0</div><divclass="ttdoc">Return next token from stream.</div></div>
<divclass="ttc"id="aclasspFlow_1_1token_html"><divclass="ttname"><ahref="classpFlow_1_1token.html">pFlow::token</a></div><divclass="ttdoc">Token class based on OpenFOAM stream, with some modifications/simplifications to be tailored to our n...</div><divclass="ttdef"><b>Definition:</b><ahref="token_8hpp_source.html#l00044">token.hpp:44</a></div></div>
<divclass="ttc"id="anamespacepFlow_html_a085bff06be72a06c81e84c1d1cb3a21a"><divclass="ttname"><ahref="namespacepFlow.html#a085bff06be72a06c81e84c1d1cb3a21a">pFlow::printTokenInfo</a></div><divclass="ttdeci">static OS & printTokenInfo(OS &os, const token &tok)</div><divclass="ttdef"><b>Definition:</b><ahref="tokenIO_8cpp_source.html#l00032">tokenIO.cpp:32</a></div></div>
<divclass="ttc"id="aerror_8hpp_html_a889d5e8bf195a24964ffb883bcb2fc3b"><divclass="ttname"><ahref="error_8hpp.html#a889d5e8bf195a24964ffb883bcb2fc3b">warningInFunction</a></div><divclass="ttdeci">#define warningInFunction</div><divclass="ttdoc">Report a warning.</div><divclass="ttdef"><b>Definition:</b><ahref="error_8hpp_source.html#l00095">error.hpp:95</a></div></div>
<divclass="ttc"id="aclasspFlow_1_1token_html_a4aba281d025f1d580c3835d67656fd31"><divclass="ttname"><ahref="classpFlow_1_1token.html#a4aba281d025f1d580c3835d67656fd31">pFlow::token::punctuationToken</a></div><divclass="ttdeci">punctuationToken</div><divclass="ttdoc">Standard punctuation tokens (a character)</div><divclass="ttdef"><b>Definition:</b><ahref="token_8hpp_source.html#l00083">token.hpp:83</a></div></div>
<divclass="ttc"id="aclasspFlow_1_1token_html_aa81aefc6aea3503b1eb4aefbafc8d0bc"><divclass="ttname"><ahref="classpFlow_1_1token.html#aa81aefc6aea3503b1eb4aefbafc8d0bc">pFlow::token::stringToken</a></div><divclass="ttdeci">const word & stringToken() const</div><divclass="ttdoc">Return const reference to the string contents.</div><divclass="ttdef"><b>Definition:</b><ahref="tokenI_8hpp_source.html#l00642">tokenI.hpp:642</a></div></div>
<divclass="ttc"id="anamespacepFlow_html_aba8f0c455a3fdb4b05ad33a25b13b189"><divclass="ttname"><ahref="namespacepFlow.html#aba8f0c455a3fdb4b05ad33a25b13b189">pFlow::endl</a></div><divclass="ttdeci">iOstream & endl(iOstream &os)</div><divclass="ttdoc">Add newline and flush stream.</div><divclass="ttdef"><b>Definition:</b><ahref="iOstream_8hpp_source.html#l00341">iOstream.hpp:341</a></div></div>
<divclass="ttc"id="aclasspFlow_1_1IOstream_html_a367eb3425fc4e8270e2aa961df8ac8a5"><divclass="ttname"><ahref="classpFlow_1_1IOstream.html#a367eb3425fc4e8270e2aa961df8ac8a5">pFlow::IOstream::check</a></div><divclass="ttdeci">virtual bool check(const char *operation) const</div><divclass="ttdoc">Check IOstream status for given operation.</div><divclass="ttdef"><b>Definition:</b><ahref="IOstream_8cpp_source.html#l00042">IOstream.cpp:42</a></div></div>
<divclass="ttc"id="aclasspFlow_1_1token_html_ad20897c5c8bd47f5d4005989bead0e55"><divclass="ttname"><ahref="classpFlow_1_1token.html#ad20897c5c8bd47f5d4005989bead0e55">pFlow::token::reset</a></div><divclass="ttdeci">void reset()</div><divclass="ttdoc">Reset token to UNDEFINED and clear any allocated storage.</div><divclass="ttdef"><b>Definition:</b><ahref="tokenI_8hpp_source.html#l00263">tokenI.hpp:263</a></div></div>
<divclass="ttc"id="aclasspFlow_1_1token_html_a72af10fee1f9c2ef1de55b08a0c429ed"><divclass="ttname"><ahref="classpFlow_1_1token.html#a72af10fee1f9c2ef1de55b08a0c429ed">pFlow::token::token</a></div><divclass="ttdeci">constexpr token() noexcept</div><divclass="ttdoc">Default construct, initialized to an UNDEFINED token.</div><divclass="ttdef"><b>Definition:</b><ahref="tokenI_8hpp_source.html#l00089">tokenI.hpp:89</a></div></div>
<divclass="ttc"id="aclasspFlow_1_1iIstream_html"><divclass="ttname"><ahref="classpFlow_1_1iIstream.html">pFlow::iIstream</a></div><divclass="ttdoc">Interface class for any input stream</div><divclass="ttdef"><b>Definition:</b><ahref="iIstream_8hpp_source.html#l00037">iIstream.hpp:37</a></div></div>
<divclass="ttc"id="aclasspFlow_1_1token_html_aa74a2c0611922abf868950e4fe75d00d"><divclass="ttname"><ahref="classpFlow_1_1token.html#aa74a2c0611922abf868950e4fe75d00d">pFlow::token::printInfo</a></div><divclass="ttdeci">iOstream & printInfo(iOstream &os) const</div><divclass="ttdef"><b>Definition:</b><ahref="tokenIO_8cpp_source.html#l00224">tokenIO.cpp:224</a></div></div>
<divclass="ttc"id="anamespacepFlow_html_a85ed561d066dae339196cd058783674f"><divclass="ttname"><ahref="namespacepFlow.html#a85ed561d066dae339196cd058783674f">pFlow::operator>></a></div><divclass="ttdeci">INLINE_FUNCTION iIstream & operator>>(iIstream &str, AB3History &ab3)</div><divclass="ttdef"><b>Definition:</b><ahref="AdamsBashforth3_8hpp_source.html#l00041">AdamsBashforth3.hpp:41</a></div></div>
<divclass="ttc"id="aclasspFlow_1_1token_html_a4c4b7703e6fdb86d441032675709e39c"><divclass="ttname"><ahref="classpFlow_1_1token.html#a4c4b7703e6fdb86d441032675709e39c">pFlow::token::name</a></div><divclass="ttdeci">word name() const</div><divclass="ttdoc">Return the name of the token type.</div><divclass="ttdef"><b>Definition:</b><ahref="tokenIO_8cpp_source.html#l00110">tokenIO.cpp:110</a></div></div>
<divclass="ttc"id="aclasspFlow_1_1iOstream_html"><divclass="ttname"><ahref="classpFlow_1_1iOstream.html">pFlow::iOstream</a></div><divclass="ttdoc">Interface class for any output stream.</div><divclass="ttdef"><b>Definition:</b><ahref="iOstream_8hpp_source.html#l00059">iOstream.hpp:59</a></div></div>
<divclass="ttc"id="aclasspFlow_1_1token_html_a8658f0b0a04ffdb6e74c5af4ca27edf1"><divclass="ttname"><ahref="classpFlow_1_1token.html#a8658f0b0a04ffdb6e74c5af4ca27edf1">pFlow::token::wordToken</a></div><divclass="ttdeci">const word & wordToken() const</div><divclass="ttdoc">Return const reference to the word contents.</div><divclass="ttdef"><b>Definition:</b><ahref="tokenI_8hpp_source.html#l00618">tokenI.hpp:618</a></div></div>
<divclass="ttc"id="aclasspFlow_1_1token_html_a1c8abe34223b7d5e9341eac78c9907b5"><divclass="ttname"><ahref="classpFlow_1_1token.html#a1c8abe34223b7d5e9341eac78c9907b5">pFlow::token::lineNumber</a></div><divclass="ttdeci">int32 lineNumber() const</div><divclass="ttdoc">The line number for the token.</div><divclass="ttdef"><b>Definition:</b><ahref="tokenI_8hpp_source.html#l00378">tokenI.hpp:378</a></div></div>