Loading...
Searching...
No Matches
expressionEntryI.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) 2014-2018 Bernhard Gschaider
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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\*---------------------------------------------------------------------------*/
28
29#include "OStringStream.H"
30
31// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
32
33inline Foam::string
36 return e.stream().toString();
37}
38
39
40template<class Type>
41inline Foam::string
43{
44 OStringStream buf;
45
46 buf << pTraits<Type>::typeName << '(';
47 for (direction cmpt=0; cmpt < pTraits<Type>::nComponents; ++cmpt)
48 {
49 if (cmpt) buf << ',';
50 buf << component(data, cmpt);
51 }
52 buf << ')';
54 return buf.str();
55}
56
57
58template<class Type>
59inline Foam::string
61{
62 Type data(Zero);
63 is >> data;
64
65 return toExprStr<Type>(data);
66}
67
68
69// ************************************************************************* //
An input stream of tokens.
Definition ITstream.H:56
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
Foam::string str() const
Get the string. As Foam::string instead of std::string (may change in future).
A keyword and a list of tokens is an 'entry'.
Definition entry.H:66
static string toExprStr(const Type &data)
Stringified version of data with comma-separated components. Uses prefix corresponding to the pTraits...
static string evaluate(const entry &e)
Generic concatenate tokens to space-separated string.
A class for handling character strings derived from std::string.
Definition string.H:76
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
uint8_t direction
Definition direction.H:49
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
volScalarField & e