BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / postProcessing / foamCalcFunctions / basic / addSubtract / addSubtract.H
blobf9152e4e05e1070e3812fa13677db0f2ef202dea
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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.
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.
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/>.
24 Class
25     Foam::calcTypes::addSubtract
27 Description
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
36     Example usage:
37         addSubtract p add -value 100000 -resultName pAbs
38         addSubtract U subtract -field U0
40 SourceFiles
41     addSubtract.C
42     writeaddSubtractField.C
43     writeaddSubtractValue.C
45 \*---------------------------------------------------------------------------*/
47 #ifndef addSubtract_H
48 #define addSubtract_H
50 #include "calcType.H"
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 namespace Foam
57 namespace calcTypes
60 /*---------------------------------------------------------------------------*\
61                           Class addSubtract Declaration
62 \*---------------------------------------------------------------------------*/
64 class addSubtract
66     public calcType
68 public:
70     enum calcTypes
71     {
72         FIELD,
73         VALUE
74     };
76     enum calcModes
77     {
78         ADD,
79         SUBTRACT
80     };
83 private:
85     // Private data
87         //- Name of base field (to addSubtract to)
88         word baseFieldName_;
90         //- Calc type as given by enumerations above
91         calcTypes calcType_;
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
100         word resultName_;
102         //- Mode - addSubtract/subtract
103         calcModes calcMode_;
106     // Private Member Functions
108         // Output
110             //- Calc and output field addSubtractitions
111             void writeAddSubtractFields
112             (
113                 const Time& runTime,
114                 const fvMesh& mesh,
115                 const IOobject& baseFieldHeader
116             );
118             //- Calc and output field and value addSubtractitions
119             void writeAddSubtractValues
120             (
121                 const Time& runTime,
122                 const fvMesh& mesh,
123                 const IOobject& baseFieldHeader
124             );
127         //- Disallow default bitwise copy construct
128         addSubtract(const addSubtract&);
130         //- Disallow default bitwise assignment
131         void operator=(const addSubtract&);
134 protected:
136     // Member Functions
138         // Calculation routines
140             //- Initialise - typically setting static variables,
141             //  e.g. command line arguments
142             virtual void init();
144             //- Pre-time loop calculations
145             virtual void preCalc
146             (
147                 const argList& args,
148                 const Time& runTime,
149                 const fvMesh& mesh
150             );
152             //- Time loop calculations
153             virtual void calc
154             (
155                 const argList& args,
156                 const Time& runTime,
157                 const fvMesh& mesh
158             );
161         // I-O
163             //- Write addSubtract field
164             template<class Type>
165             void writeAddSubtractField
166             (
167                 const IOobject& baseHeader,
168                 const IOobject& addSubtractHeader,
169                 const fvMesh& mesh,
170                 bool& processed
171             );
173             //- Write addSubtract value
174             template<class Type>
175             void writeAddSubtractValue
176             (
177                 const IOobject& baseHeader,
178                 const string& valueStr,
179                 const fvMesh& mesh,
180                 bool& processed
181             );
184 public:
186     //- Runtime type information
187     TypeName("addSubtract");
190     // Constructors
192         //- Construct null
193         addSubtract();
196     //- Destructor
197     virtual ~addSubtract();
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 } // End namespace calcTypes
204 } // End namespace Foam
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 #ifdef NoRepository
209 #   include "writeAddSubtractField.C"
210 #   include "writeAddSubtractValue.C"
211 #endif
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 #endif
217 // ************************************************************************* //