Loading...
Searching...
No Matches
subtract.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::subtract
29
30Group
31 grpFieldFunctionObjects
32
33Description
34 Subtracts a given list of (at least one or more) fields from a field and
35 produces a new field, where the fields possess the same sizes and
36 dimensions.
37
38 \verbatim
39 fieldResult = field1 - field2 - ... - fieldN
40 \endverbatim
41
42 Operands:
43 \table
44 Operand | Type | Location
45 input | {vol,surface}<Type>Field(s) | <time>/inputFields
46 output file | - | -
47 output field | {vol,surface}<Type>Field | <time>/outputField
48 \endtable
49
50 where \c Type can be one of:
51 \c Scalar, \c Vector, \c SphericalTensor, \c SymmTensor, or \c Tensor.
52
53Usage
54 Minimal example by using \c system/controlDict.functions:
55 \verbatim
56 subtractFO
57 {
58 // Mandatory entries
59 type subtract;
60 libs (fieldFunctionObjects);
61 fields (<wordList>); // (<field1> <field2> ... <fieldN>);
62
63 // Inherited entries
64 ...
65 }
66 \endverbatim
67
68 where the entries mean:
69 \table
70 Property | Description | Type | Reqd | Deflt
71 type | Type name: subtract | word | yes | -
72 libs | Library name: fieldFunctionObjects | word | yes | -
73 fields | Names of the operand fields | wordList | yes | -
74 \endtable
75
76 The inherited entries are elaborated in:
77 - \link fieldsExpression.H \endlink
78
79SourceFiles
80 subtract.C
81 subtractTemplates.C
82
83\*---------------------------------------------------------------------------*/
84
85#ifndef Foam_functionObjects_subtract_H
86#define Foam_functionObjects_subtract_H
87
88#include "fieldsExpression.H"
89
90// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91
92namespace Foam
93{
94namespace functionObjects
95{
96
97/*---------------------------------------------------------------------------*\
98 Class subtract Declaration
99\*---------------------------------------------------------------------------*/
100
101class subtract
102:
103 public fieldsExpression
104{
105 // Private Member Functions
106
107 //- Subtract the list of fields of the specified type
108 //- and return the result
109 template<class GeoFieldType>
110 tmp<GeoFieldType> calcFieldType() const;
111
112 //- Subtract the list of fields and return true if successful
113 virtual bool calc();
114
115
116public:
117
118 //- Grants fieldsExpression access to private and protected members
119 friend class fieldsExpression;
120
121
122 //- Runtime type information
123 TypeName("subtract");
124
125
126 // Constructors
127
128 //- Construct from name, Time and dictionary
130 (
131 const word& name,
132 const Time& runTime,
133 const dictionary& dict
134 );
135
136 //- No copy construct
137 subtract(const subtract&) = delete;
138
139 //- No copy assignment
140 void operator=(const subtract&) = delete;
141
142
143 //- Destructor
144 virtual ~subtract() = default;
145};
146
147
148// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149
150} // End namespace functionObjects
151} // End namespace Foam
152
153// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154
155#ifdef NoRepository
156 #include "subtractTemplates.C"
157#endif
158
159// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161#endif
162
163// ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const word & name() const noexcept
Return the name of this functionObject.
Intermediate class for handling field expression function objects (e.g. add, subtract etc....
virtual bool calc()=0
Calculate expression.
Subtracts a given list of (at least one or more) fields from a field and produces a new field,...
Definition subtract.H:139
friend class fieldsExpression
Grants fieldsExpression access to private and protected members.
Definition subtract.H:160
virtual ~subtract()=default
Destructor.
subtract(const subtract &)=delete
No copy construct.
void operator=(const subtract &)=delete
No copy assignment.
TypeName("subtract")
Runtime type information.
subtract(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
Definition subtract.C:48
Foam::tmp< GeoFieldType > calcFieldType() const
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68