OpenFOAM: API Guide
v2112
The open source CFD toolbox
exprTraits.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) 2021 OpenCFD Ltd.
9
-------------------------------------------------------------------------------
10
License
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
26
\*---------------------------------------------------------------------------*/
27
28
#include "
exprTraits.H
"
29
30
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
31
32
Foam::expressions::valueTypeCode
33
Foam::expressions::valueTypeCodeOf
(
const
word
& dataTypeName)
34
{
35
#undef stringToTypeCode
36
#define stringToTypeCode(Type) \
37
\
38
if (dataTypeName == exprTypeTraits<Type>::name) \
39
{ \
40
return expressions::valueTypeCode::type_##Type; \
41
}
42
43
if
(!dataTypeName.empty())
44
{
45
stringToTypeCode
(
bool
);
46
stringToTypeCode
(label);
47
stringToTypeCode
(scalar);
48
stringToTypeCode
(
vector
);
49
stringToTypeCode
(
tensor
);
50
stringToTypeCode
(
sphericalTensor
);
51
stringToTypeCode
(
symmTensor
);
52
}
53
#undef stringToTypeCode
54
55
return
expressions::valueTypeCode::INVALID;
56
}
57
58
59
Foam::word
Foam::name
(
const
expressions::valueTypeCode
typeCode)
60
{
61
#undef case_typeCodeToString
62
#define case_typeCodeToString(Type) \
63
\
64
case expressions::valueTypeCode::type_##Type : \
65
{ \
66
return exprTypeTraits<Type>::name; \
67
}
68
69
switch
(typeCode)
70
{
71
case
expressions::valueTypeCode::NONE :
72
{
73
return
"none"
;
74
}
75
76
case
expressions::valueTypeCode::INVALID :
77
{
78
// ie, ""
79
break
;
80
}
81
82
case_typeCodeToString
(
bool
);
83
case_typeCodeToString
(label);
84
case_typeCodeToString
(scalar);
85
case_typeCodeToString
(
vector
);
86
case_typeCodeToString
(
tensor
);
87
case_typeCodeToString
(
sphericalTensor
);
88
case_typeCodeToString
(
symmTensor
);
89
}
90
#undef case_typeCodeToString
91
92
return
word
();
93
}
94
95
96
// ************************************************************************* //
Foam::Tensor< scalar >
Foam::SymmTensor< scalar >
case_typeCodeToString
#define case_typeCodeToString(Type)
Foam::word
A class for handling words, derived from Foam::string.
Definition:
word.H:65
Foam::expressions::valueTypeCode
valueTypeCode
An enumeration of known and expected expression value types.
Definition:
exprTraits.H:65
stringToTypeCode
#define stringToTypeCode(Type)
Foam::SphericalTensor< scalar >
Foam::expressions::valueTypeCodeOf
valueTypeCode valueTypeCodeOf(const word &dataTypeName)
From string to valueTypeCode (if any)
Definition:
exprTraits.C:33
Foam::Vector< scalar >
exprTraits.H
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition:
exprTraits.C:59
src
OpenFOAM
expressions
traits
exprTraits.C
Generated by
1.8.17
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.