add.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) 2016 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::functionObjects::add
29
30Group
31 grpFieldFunctionObjects
32
33Description
34 Sums a given list of (at least two or more) fields and outputs the result
35 into a new field, where the fields possess the same sizes and dimensions:
36
37 \verbatim
38 fieldResult = field1 + field2 + ... + fieldN
39 \endverbatim
40
41 Operands:
42 \table
43 Operand | Type | Location
44 input | {vol,surface}<Type>Field(s) <!--
45 --> |$FOAM_CASE/<time>/<inpField>s
46 output file | - |-
47 output field | {vol,surface}<Type>Field <!--
48 --> | $FOAM_CASE/<time>/<outField>
49 \endtable
50
51 where \c <Type>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
52
53Usage
54 Minimal example by using \c system/controlDict.functions:
55 \verbatim
56 add1
57 {
58 // Mandatory entries (unmodifiable)
59 type add;
60 libs (fieldFunctionObjects);
61
62 // Mandatory (inherited) entry (runtime modifiable)
63 fields (<field1> <field2> ... <fieldN>);
64
65 // Optional (inherited) entries
66 ...
67 }
68 \endverbatim
69
70 where the entries mean:
71 \table
72 Property | Description | Type | Req'd | Dflt
73 type | Type name: add | word | yes | -
74 libs | Library name: fieldFunctionObjects | word | yes | -
75 fields | Names of the operand fields | wordList | yes | -
76 \endtable
77
78 The inherited entries are elaborated in:
79 - \link functionObject.H \endlink
80 - \link fieldsExpression.H \endlink
81
82 Minimal example by using the \c postProcess utility:
83 \verbatim
84 postProcess -func "add(<field1>, <field2>, ..., <fieldN>)"
85 \endverbatim
86
87See also
88 - Foam::functionObject
89 - Foam::functionObjects::fieldsExpression
90 - Foam::functionObjects::fvMeshFunctionObject
91 - ExtendedCodeGuide::functionObjects::field::add
92
93SourceFiles
94 add.C
95 addTemplates.C
96
97\*---------------------------------------------------------------------------*/
98
99#ifndef functionObjects_add_H
100#define functionObjects_add_H
101
102#include "fieldsExpression.H"
103
104// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105
106namespace Foam
107{
108namespace functionObjects
109{
110
111/*---------------------------------------------------------------------------*\
112 Class add Declaration
113\*---------------------------------------------------------------------------*/
114
115class add
116:
117 public fieldsExpression
118{
119 // Private Member Functions
120
121 //- Add the list of fields of the specified type
122 //- and return the result
123 template<class GeoFieldType>
124 tmp<GeoFieldType> calcFieldType() const;
125
126 //- Add the list of fields and return true if successful
127 virtual bool calc();
128
129
130public:
131
132 friend class fieldsExpression;
133
134
135 //- Runtime type information
136 TypeName("add");
137
138
139 // Constructors
140
141 //- Construct from Time and dictionary
142 add
143 (
144 const word& name,
145 const Time& runTime,
146 const dictionary& dict
147 );
148
149 //- No copy construct
150 add(const add&) = delete;
151
152 //- No copy assignment
153 void operator=(const add&) = delete;
154
155
156 //- Destructor
157 virtual ~add() = default;
159
160
161// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162
163} // End namespace functionObjects
164} // End namespace Foam
165
166// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167
168#ifdef NoRepository
169 #include "addTemplates.C"
170#endif
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173
174#endif
176// ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const word & name() const noexcept
Return the name of this functionObject.
Sums a given list of (at least two or more) fields and outputs the result into a new field,...
Definition: add.H:161
friend class fieldsExpression
Definition: add.H:175
virtual ~add()=default
Destructor.
void operator=(const add &)=delete
No copy assignment.
TypeName("add")
Runtime type information.
add(const add &)=delete
No copy construct.
Intermediate class for handling field expression function objects (e.g. add, subtract etc....
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
Namespace for OpenFOAM.
dict add("bounds", meshBb)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73