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  Original code 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 // ************************************************************************* //
Foam::entry
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:67
Foam::dimensionedSphericalTensor
dimensioned< sphericalTensor > dimensionedSphericalTensor
Dimensioned sphericalTensor obtained from generic dimensioned type.
Definition: dimensionedSphericalTensor.H:50
primitiveEntry.H
Foam::dimensionedSymmTensor
dimensioned< symmTensor > dimensionedSymmTensor
Dimensioned tensor obtained from generic dimensioned type.
Definition: dimensionedSymmTensor.H:50
Foam::dimensioned::value
const Type & value() const
Return const reference to value.
Definition: dimensionedType.C:434
Foam::string
A class for handling character strings derived from std::string.
Definition: string.H:76
Foam::dimensionedVector
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Definition: dimensionedVector.H:50
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
dimensionedVector.H
dimensionedSymmTensor.H
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::dimensioned< scalar >
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
dimensionedScalar.H
Foam::exprTools::addNamedToRunTimeSelectionTable
addNamedToRunTimeSelectionTable(expressionEntry, expressionEntry, empty, direct)
dimensionedTensor.H
defineExpressionEntryType
#define defineExpressionEntryType(DimType)
Definition: expressionEntryDimensioned.C:92
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
expressionEntryDimensioned.H
Creates an expression string from various standard dimensioned types.
Foam::dimensionedTensor
dimensioned< tensor > dimensionedTensor
Dimensioned tensor obtained from generic dimensioned type.
Definition: dimensionedTensor.H:52
Foam::exprTools::dimensionedScalarEntry::evaluate
static string evaluate(const entry &e)
Entry to string.
Definition: expressionEntryDimensioned.C:100
dimensionedSphericalTensor.H