volumeExprDriver.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) 2019 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 "volumeExprDriver.H"
29 #include "volumeExprScanner.H"
30 #include "error.H"
31 #include "fvPatch.H"
32 #include "fvMesh.H"
33 #include "className.H"
35 
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 
38 namespace Foam
39 {
40 namespace expressions
41 {
42 namespace volumeExpr
43 {
44 
46 
48 (
51  dictionary,
52  volume
53 );
54 
56 (
59  idName,
60  volume
61 );
62 
64 (
67  dictionary,
68  internalField
69 );
70 
72 (
75  idName,
76  internalField
77 );
78 
79 } // End namespace volumeExpr
80 } // End namespace expressions
81 } // End namespace Foam
82 
83 
84 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
85 
87 (
88  const fvMesh& mesh,
89  bool cacheReadFields
90 )
91 :
93  expressions::fvExprDriver(cacheReadFields),
94  mesh_(mesh),
95  resultType_(),
96  isLogical_(false),
97  fieldGeoType_(NO_DATA),
98  resultDimension_()
99 {}
100 
101 
103 (
104  const fvMesh& mesh,
105  const dictionary& dict
106 )
107 :
110  mesh_(mesh),
111  resultType_(),
112  isLogical_(false),
113  fieldGeoType_(NO_DATA),
114  resultDimension_()
115 {}
116 
117 
119 (
120  const fvMesh& mesh,
121  const parseDriver& driver
122 )
123 :
126  mesh_(mesh),
127  resultType_(),
128  isLogical_(false),
129  fieldGeoType_(NO_DATA),
130  resultDimension_()
131 {}
132 
133 
135 (
136  const word& meshName,
137  const fvMesh& mesh
138 )
139 :
141 {
142  //?? Info<< "Warn that meshName is ignored?" << nl;
143 }
144 
145 
147 (
148  const dictionary& dict,
149  const fvMesh& mesh
150 )
151 :
154  mesh_(mesh),
155  resultType_(),
156  isLogical_(false),
157  fieldGeoType_(NO_DATA),
158  resultDimension_()
159 {}
160 
161 
162 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
163 
165 (
166  const dictionary& dict
167 )
168 {
169  expressions::fvExprDriver::readDict(dict);
170  dict.readIfPresent("dimensions", resultDimension_);
171 
172  return true;
173 }
174 
175 
176 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
177 
179 (
180  const std::string& expr,
181  size_t pos,
182  size_t len
183 )
184 {
185  scanner scan(this->debugScanner());
186 
187  scan.process(expr, pos, len, *this);
188 
189  return 0;
190 }
191 
192 
193 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::expressions::volumeExpr::parseDriver
Driver for volume, surface, point field expressions.
Definition: volumeExprDriver.H:229
Foam::expressions::volumeExpr::parseDriver::parseDriver
parseDriver(const parseDriver &)=delete
Foam::expressions::fvExprDriver
Base driver for parsing value expressions associated with an fvMesh.
Definition: fvExprDriver.H:137
Foam::fieldTypes::volume
const wordList volume
Standard volume field types (scalar, vector, tensor, etc)
Foam::expressions::patchExpr::NO_DATA
No data.
Definition: patchExprFwd.H:59
volumeExprScanner.H
error.H
Foam::expressions::volumeExpr::parseDriver::readDict
virtual bool readDict(const dictionary &dict)
Read variables, tables etc.
Definition: volumeExprDriver.C:165
Foam::parsing::genericRagelLemonDriver
Generic interface code for Ragel/Lemon combination Subclasses should implement one or more process() ...
Definition: genericRagelLemonDriver.H:59
className.H
Macro definitions for declaring ClassName(), NamespaceName(), etc.
volumeExprDriver.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::expressions::volumeExpr::scanner
Ragel lexer/scanner interface for volume expressions.
Definition: volumeExprScanner.H:68
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::expressions::volumeExpr::defineTypeNameAndDebug
defineTypeNameAndDebug(parseDriver, 0)
Foam::expressions::volumeExpr::scanner::process
bool process(const std::string &str, size_t pos, size_t len, parseDriver &driver_)
Evaluate sub-string.
Foam::expressions::volumeExpr::addNamedToRunTimeSelectionTable
addNamedToRunTimeSelectionTable(fvExprDriver, parseDriver, dictionary, volume)
fvPatch.H
Foam::expressions::volumeExpr::parseDriver::parse
virtual unsigned parse(const std::string &expr, size_t pos=0, size_t len=std::string::npos)
Execute the parser.
Definition: volumeExprDriver.C:179
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:177