stringOpsEvaluate.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 -------------------------------------------------------------------------------
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 InNamespace
27  Foam::stringOps
28 
29 Description
30  String expression evaluation.
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef stringOpsEvaluate_H
35 #define stringOpsEvaluate_H
36 
37 #include "string.H"
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 namespace stringOps
44 {
45  //- A simple string evaluation that handles various basic
46  //- expressions. For trivial input, use readScalar instead (faster).
47  //
48  // The evaluation supports the following:
49  // - operations: - + * / %
50  // - functions: exp, log, log10, pow, sqrt, cbrt, sqr, mag, magSqr
51  // - trigonometric: sin, cos, tan, asin, acos, atan, atan2, hypot
52  // - hyperbolic: sinh, cosh, tanh
53  // - conversions: degToRad, radToDeg
54  // - type conversion: bool, mag
55  // - constants: pi(), true, false
56  // - limits: neg, pos, neg0, pos0, sign, floor, ceil, round
57  // - other: rand, rand(seed)
58  // - logic: ! ? : == != <= => < >
59  //
60  // \note
61  // Unlike C/C++, the ternary and logical operations are \b not
62  // short-circuiting. So additional guards may be required.
63  //
64  // \note
65  // The rand() function returns a uniform scalar on [0-1] interval
66  // and uses a constant seed.
67  string evaluate
68  (
69  const std::string& s,
70  size_t pos = 0,
71  size_t len = std::string::npos
72  );
73 
74 } // End namespace stringOps
75 
76 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
77 
78 } // End namespace Foam
79 
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 
82 #endif
83 
84 // ************************************************************************* //
s
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputSpray.H:25
string.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::stringOps::evaluate
string evaluate(const std::string &s, size_t pos=0, size_t len=std::string::npos)
Definition: stringOpsEvaluate.C:37
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:177