1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 Foam::calcTypes::addSubtract
28 adds/subtracts a field or value to/from a base field.
30 New field name specified by -resultName option, or automatically as:
31 <baseFieldName>_add_<addSubtractFieldName>
32 <baseFieldName>_add_value
33 <baseFieldName>_subtract_<addSubtractFieldName>
34 <baseFieldName>_subtract_value
37 addSubtract p add -value 100000 -resultName pAbs
38 addSubtract U subtract -field U0
42 writeaddSubtractField.C
43 writeaddSubtractValue.C
45 \*---------------------------------------------------------------------------*/
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 /*---------------------------------------------------------------------------*\
61 Class addSubtract Declaration
62 \*---------------------------------------------------------------------------*/
87 //- Name of base field (to addSubtract to)
90 //- Calc type as given by enumerations above
93 //- Name of field to add/subtract
94 word addSubtractFieldName_;
96 //- String representation of value to add/subtract
97 string addSubtractValueStr_;
99 //- Name of result field
102 //- Mode - addSubtract/subtract
106 // Private Member Functions
110 //- Calc and output field addSubtractitions
111 void writeAddSubtractFields
115 const IOobject& baseFieldHeader
118 //- Calc and output field and value addSubtractitions
119 void writeAddSubtractValues
123 const IOobject& baseFieldHeader
127 //- Disallow default bitwise copy construct
128 addSubtract(const addSubtract&);
130 //- Disallow default bitwise assignment
131 void operator=(const addSubtract&);
138 // Calculation routines
140 //- Initialise - typically setting static variables,
141 // e.g. command line arguments
144 //- Pre-time loop calculations
152 //- Time loop calculations
163 //- Write addSubtract field
165 void writeAddSubtractField
167 const IOobject& baseHeader,
168 const IOobject& addSubtractHeader,
173 //- Write addSubtract value
175 void writeAddSubtractValue
177 const IOobject& baseHeader,
178 const string& valueStr,
186 //- Runtime type information
187 TypeName("addSubtract");
198 virtual ~addSubtract();
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 } // End namespace calcTypes
205 } // End namespace Foam
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 # include "writeAddSubtractField.C"
211 # include "writeAddSubtractValue.C"
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 // ************************************************************************* //