calcIncludeEntry.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::functionEntries::calcIncludeEntry
26 
27 Description
28  Specify an include file for #calc, expects a single string to follow.
29 
30  For example if functions from transform.H are used in the #calc expression
31  \verbatim
32  angleOfAttack 5; // degs
33 
34  angle #calc "-degToRad($angleOfAttack)";
35 
36  #calcInclude "transform.H"
37  liftDir #calc "transform(Ry($angle), vector(0, 0, 1))";
38  dragDir #calc "transform(Ry($angle), vector(1, 0, 0))";
39  \endverbatim
40 
41  The usual expansion of environment variables and other constructs
42  (eg, the \c ~OpenFOAM/ expansion) is retained.
43 
44 See also
45  Foam::functionEntries::calcEntry
46 
47 SourceFiles
48  calcIncludeEntry.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef calcIncludeEntry_H
53 #define calcIncludeEntry_H
54 
55 #include "functionEntry.H"
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 namespace Foam
60 {
61 namespace functionEntries
62 {
63 
64 /*---------------------------------------------------------------------------*\
65  Class calcIncludeEntry Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 class calcIncludeEntry
69 :
70  public functionEntry
71 {
72  // Private static data
73 
74  // Static include file name cache
75  static DynamicList<fileName> includeFiles_;
76 
77 
78 public:
79 
80  //- Runtime type information
81  ClassName("calcInclude");
82 
83 
84  // Constructors
85 
86  //- Disallow default bitwise copy construction
87  calcIncludeEntry(const calcIncludeEntry&) = delete;
88 
89 
90  // Member Functions
91 
92  //- Execute the functionEntry in a sub-dict context
93  static bool execute(dictionary& parentDict, Istream&);
94 
95  //- Reset the cache of #calc include file names
96  static void clear();
97 
98  //- Add the cached include file names to the codeInclude entry
99  // in codeDict
100  static void codeInclude(dictionary& codeDict);
101 
102 
103  // Member Operators
104 
105  //- Disallow default bitwise assignment
106  void operator=(const calcIncludeEntry&) = delete;
107 };
108 
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 } // End namespace functionEntries
113 } // End namespace Foam
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 #endif
118 
119 // ************************************************************************* //
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:78
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Specify an include file for #calc, expects a single string to follow.
static bool execute(dictionary &parentDict, Istream &)
Execute the functionEntry in a sub-dict context.
static void codeInclude(dictionary &codeDict)
Add the cached include file names to the codeInclude entry.
ClassName("calcInclude")
Runtime type information.
void operator=(const calcIncludeEntry &)=delete
Disallow default bitwise assignment.
calcIncludeEntry(const calcIncludeEntry &)=delete
Disallow default bitwise copy construction.
static void clear()
Reset the cache of #calc include file names.
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
Definition: functionEntry.H:66
Namespace for OpenFOAM.