FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 <OpenFOAM/autoPtr.H>
47 
48 #include <finiteVolume/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 
136  virtual ~calcType();
137 
138 
139  // Member Functions
140 
141  // Calculation routines - wrapped by exception handling loop
142 
143  //- Initialise - typically setting static variables,
144  // e.g. command line arguments
145  void tryInit();
146 
147  //- Pre-time loop calculations
148  void tryPreCalc
149  (
150  const argList& args,
151  const Time& runTime,
152  const fvMesh& mesh
153  );
154 
155  //- Time loop calculations
156  void tryCalc
157  (
158  const argList& args,
159  const Time& runTime,
160  const fvMesh& mesh
161  );
162 
163  //- Post-time loop calculations
164  void tryPostCalc
165  (
166  const argList& args,
167  const Time& runTime,
168  const fvMesh& mesh
169  );
170 };
171 
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 } // End namespace Foam
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************ vim: set sw=4 sts=4 et: ************************ //