exprTools.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) 2019 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Namespace
27 Foam::exprTools
28
29Description
30 Helper methods for creating expressions.
31
32SourceFiles
33 exprTools.C
34 exprToolsTemplates.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef exprTools_H
39#define exprTools_H
40
41#include "exprOps.H"
42#include "exprString.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49/*---------------------------------------------------------------------------*\
50 Namespace exprTools Declarations
51\*---------------------------------------------------------------------------*/
52
53namespace exprTools
54{
55
56//- Stringified value for zero of given type
57template<class Type>
58string zeroValue();
59
60//- Stringified version of data with comma separators between components
61template<class Type>
62string toString(const Type& data, const word& prefix);
63
64//- Stringified version of data with comma separators between components.
65//- Uses prefix corresponding to the pTraits of Type.
66template<class Type>
67string toString(const Type& data);
68
69//- Stringified version of primitiveEntry of Type.
70//- Uses comma separators and prefix corresponding to the pTraits of Type
71template<class Type>
72string toString(ITstream& is);
73
74//- Get an expression string list from a dictionary
75// Supports list and inline specifications, as well as indirect
76// inclusion of other expression string lists.
77//
78// Syntax examples,
79// \code
80//
81// // Single items. Inline or list format.
82// list1a "var1=p";
83// list1b ( "var1=p" );
84//
85// // Multiple items. Inline or list format.
86// list2a "var2=T; var3=U; var4=rho";
87// list2b ( "var2=T" "var3=U; var4=rho" );
88//
89// // Indirection. Inline or list format.
90// list3a "#list1a; #list2b";
91// list2b ( "var1=p" "#list2a" );
92//
93// \endcode
95(
96 const dictionary& dict,
97 const word& keyword,
98 bool mandatory = true,
99 label recursionDepth = 0
100);
101
102
103} // End namespace exprTools
104
105
106// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107
108} // End namespace Foam
109
110// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111
112#ifdef NoRepository
113 #include "exprToolsTemplates.C"
114#endif
115
116// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117
118#endif
119
120// ************************************************************************* //
An input stream of tokens.
Definition: ITstream.H:56
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
Database for solution data, solver performance and other reduced data.
Definition: data.H:58
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for handling words, derived from Foam::string.
Definition: word.H:68
Operations involving expressions.
List< expressions::exprString > getList(const dictionary &dict, const word &keyword, bool mandatory=true, label recursionDepth=0)
Get an expression string list from a dictionary.
Definition: exprTools.C:120
string toString(const Type &data, const word &prefix)
Stringified version of data with comma separators between components.
string zeroValue()
Stringified value for zero of given type.
Namespace for OpenFOAM.
dictionary dict