expressionEntryDimensioned.C
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-2021 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 \*---------------------------------------------------------------------------*/
28 
30 #include "primitiveEntry.H"
31 #include "dimensionedScalar.H"
32 #include "dimensionedVector.H"
33 #include "dimensionedTensor.H"
34 #include "dimensionedSymmTensor.H"
37 
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 
40 namespace Foam
41 {
42 namespace exprTools
43 {
44 
46 (
47  expressionEntry,
48  dimensionedScalarEntry,
49  empty,
51 );
52 
54 (
55  expressionEntry,
56  dimensionedVectorEntry,
57  empty,
59 );
60 
62 (
63  expressionEntry,
64  dimensionedTensorEntry,
65  empty,
67 );
68 
70 (
71  expressionEntry,
72  dimensionedSymmTensorEntry,
73  empty,
75 );
76 
78 (
79  expressionEntry,
80  dimensionedSphericalTensorEntry,
81  empty,
83 );
84 
85 } // End namespace exprTools
86 } // End namespace Foam
87 
88 
89 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
90 
91 #undef defineExpressionEntryType
92 #define defineExpressionEntryType(DimType) \
93  Foam::string Foam::exprTools::DimType##Entry::evaluate(const entry& e) \
94  { \
95  DimType dt(dynamicCast<const primitiveEntry>(e)); \
96  return toExprStr<DimType::value_type>(dt.value()); \
97  }
98 
99 
101 {
102  dimensionedScalar dt(dynamicCast<const primitiveEntry>(e));
103  return std::to_string(dt.value());
104 }
105 
106 
111 
112 #undef defineExpressionEntryType
113 
114 // ************************************************************************* //
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Macros for easy insertion into run-time selection tables.
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
dimensioned< tensor > dimensionedTensor
Dimensioned tensor obtained from generic dimensioned type.
static string evaluate(const entry &e)
Entry to string.
dimensioned< symmTensor > dimensionedSymmTensor
Dimensioned tensor obtained from generic dimensioned type.
dimensioned< sphericalTensor > dimensionedSphericalTensor
Dimensioned sphericalTensor obtained from generic dimensioned type.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
addNamedToRunTimeSelectionTable(expressionEntry, expressionEntry, empty, direct)
A class for handling character strings derived from std::string.
Definition: string.H:72
Namespace for OpenFOAM.
A keyword and a list of tokens is an &#39;entry&#39;.
Definition: entry.H:63
#define defineExpressionEntryType(DimType)
Creates an expression string from various standard dimensioned types.