calcType.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 | Copyright (C) 2011 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 Namespace
25  Foam::calcTypes
26 
27 Description
28  Namespace for post-processing calculation functions
29 
30 
31 Class
32  Foam::calcType
33 
34 Description
35  Base class for post-processing calculation functions
36 
37 SourceFiles
38  calcType.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef calcType_H
43 #define calcType_H
44 
45 #include "autoPtr.H"
46 #include "runTimeSelectionTables.H"
47 
48 #include "fvCFD.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class calcType Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class calcType
60 {
61  // Private Member Functions
62 
63  //- Disallow default bitwise copy construct
64  calcType(const calcType&);
65 
66  //- Disallow default bitwise assignment
67  void operator=(const calcType&);
68 
69 
70 protected:
71 
72  // Protected Member Functions
73 
74  // Calculation routines
75 
76  //- Initialise - typically setting static variables,
77  // e.g. command line arguments
78  virtual void init();
79 
80  //- Pre-time loop calculations
81  virtual void preCalc
82  (
83  const argList& args,
84  const Time& runTime,
85  const fvMesh& mesh
86  );
87 
88  //- Time loop calculations
89  virtual void calc
90  (
91  const argList& args,
92  const Time& runTime,
93  const fvMesh& mesh
94  );
95 
96  //- Post-time loop calculations
97  virtual void postCalc
98  (
99  const argList& args,
100  const Time& runTime,
101  const fvMesh& mesh
102  );
103 
104 
105 public:
106 
107  //- Runtime type information
108  TypeName("calcType");
109 
110 
111  // Declare runtime constructor selection table
112 
114  (
115  autoPtr,
116  calcType,
117  dictionary,
118  (),
119  ()
120  );
121 
122 
123  // Constructors
124 
125  //- Construct null
126  calcType();
127 
128 
129  // Selectors
130 
131  static autoPtr<calcType> New(const word& calcTypeName);
132 
133 
134  //- Destructor
135  virtual ~calcType();
136 
137 
138  // Member Functions
139 
140  // Calculation routines - wrapped by exception handling loop
141 
142  //- Initialise - typically setting static variables,
143  // e.g. command line arguments
144  void tryInit();
145 
146  //- Pre-time loop calculations
147  void tryPreCalc
148  (
149  const argList& args,
150  const Time& runTime,
151  const fvMesh& mesh
152  );
153 
154  //- Time loop calculations
155  void tryCalc
156  (
157  const argList& args,
158  const Time& runTime,
159  const fvMesh& mesh
160  );
161 
162  //- Post-time loop calculations
163  void tryPostCalc
164  (
165  const argList& args,
166  const Time& runTime,
167  const fvMesh& mesh
168  );
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
Foam::calcType::operator=
void operator=(const calcType &)
Disallow default bitwise assignment.
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::calcType::New
static autoPtr< calcType > New(const word &calcTypeName)
Definition: calcTypeNew.C:31
Foam::calcType::tryInit
void tryInit()
Initialise - typically setting static variables,.
Definition: calcType.C:90
Foam::calcType::TypeName
TypeName("calcType")
Runtime type information.
Foam::calcType::calc
virtual void calc(const argList &args, const Time &runTime, const fvMesh &mesh)
Time loop calculations.
Definition: calcType.C:67
Foam::argList
Extract command arguments and options from the supplied argc and argv parameters.
Definition: argList.H:97
Foam::calcType::postCalc
virtual void postCalc(const argList &args, const Time &runTime, const fvMesh &mesh)
Post-time loop calculations.
Definition: calcType.C:78
Foam::calcType::calcType
calcType()
Construct null.
Definition: calcType.C:37
Foam::calcType::~calcType
virtual ~calcType()
Destructor.
Definition: calcType.C:43
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::calcType::preCalc
virtual void preCalc(const argList &args, const Time &runTime, const fvMesh &mesh)
Pre-time loop calculations.
Definition: calcType.C:56
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
fvCFD.H
Foam::calcType::tryCalc
void tryCalc(const argList &args, const Time &runTime, const fvMesh &mesh)
Time loop calculations.
Definition: calcType.C:126
Foam::calcType::init
virtual void init()
Initialise - typically setting static variables,.
Definition: calcType.C:49
args
Foam::argList args(argc, argv)
Foam::calcType
Base class for post-processing calculation functions.
Definition: calcType.H:58
Foam::calcType::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, calcType, dictionary,(),())
Foam::calcType::tryPostCalc
void tryPostCalc(const argList &args, const Time &runTime, const fvMesh &mesh)
Post-time loop calculations.
Definition: calcType.C:146
Foam::calcType::tryPreCalc
void tryPreCalc(const argList &args, const Time &runTime, const fvMesh &mesh)
Pre-time loop calculations.
Definition: calcType.C:106
autoPtr.H