FreeFOAM The Cross-Platform CFD Toolkit
fieldMinMax.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) 2008-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 Class
25  Foam::fieldMinMax
26 
27 Description
28  Calculates scalar minimim and maximum field values.
29 
30  For variables with rank > 0, computes the magnitude of the min/max
31  values.
32 
33  Data written to the file <timeDir>/fieldMinMax.dat
34 
35 
36 SourceFiles
37  fieldMinMax.C
38  IOfieldMinMax.H
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef fieldMinMax_H
43 #define fieldMinMax_H
44 
47 #include <OpenFOAM/HashSet.H>
48 #include <OpenFOAM/OFstream.H>
49 #include <OpenFOAM/Switch.H>
50 #include <OpenFOAM/pointFieldFwd.H>
51 #include <OpenFOAM/NamedEnum.H>
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 // Forward declaration of classes
59 class objectRegistry;
60 class dictionary;
61 class mapPolyMesh;
62 
63 /*---------------------------------------------------------------------------*\
64  Class fieldMinMax Declaration
65 \*---------------------------------------------------------------------------*/
66 
68 {
69 public:
70 
71  enum modeType
72  {
75  };
76 
77 
78 protected:
79 
80  // Protected data
81 
82  //- Name of this set of field min/max.
83  // Also used as the name of the output directory.
85 
87 
88  //- on/off switch
89  bool active_;
90 
91  //- Switch to send output to Info as well as to file
93 
94  //- Mode type names
96 
97  //- Mode for min/max - only applicable for ranks > 0
99 
100  //- Fields to assess min/max
102 
103 
104  //- Min/max file ptr
106 
107 
108  // Private Member Functions
109 
110  //- If the output file has not been created create it
111  void makeFile();
112 
113  //- Disallow default bitwise copy construct
114  fieldMinMax(const fieldMinMax&);
115 
116  //- Disallow default bitwise assignment
117  void operator=(const fieldMinMax&);
118 
119  //- Output file header information
120  virtual void writeFileHeader();
121 
122 
123 public:
124 
125  //- Runtime type information
126  TypeName("fieldMinMax");
127 
128 
129  // Constructors
130 
131  //- Construct for given objectRegistry and dictionary.
132  // Allow the possibility to load fields from files
134  (
135  const word& name,
136  const objectRegistry&,
137  const dictionary&,
138  const bool loadFromFiles = false
139  );
140 
141 
142  // Destructor
143 
144  virtual ~fieldMinMax();
145 
146 
147  // Member Functions
148 
149  //- Return name of the set of field min/max
150  virtual const word& name() const
151  {
152  return name_;
153  }
154 
155  //- Read the field min/max data
156  virtual void read(const dictionary&);
157 
158  //- Execute, currently does nothing
159  virtual void execute();
160 
161  //- Execute at the final time-loop, currently does nothing
162  virtual void end();
163 
164  //- Calculate the field min/max
165  template<class Type>
166  void calcMinMaxFields(const word& fieldName);
167 
168  //- Write the fieldMinMax
169  virtual void write();
170 
171  //- Update for changes of mesh
172  virtual void updateMesh(const mapPolyMesh&)
173  {}
174 
175  //- Update for changes of mesh
176  virtual void movePoints(const pointField&)
177  {}
178 };
179 
180 
181 // Template specialisation for scalar fields
182 template<>
183 void fieldMinMax::calcMinMaxFields<scalar>(const word& fieldName);
184 
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 } // End namespace Foam
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #ifdef NoRepository
193 # include "fieldMinMaxTemplates.C"
194 #endif
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #endif
199 
200 // ************************ vim: set sw=4 sts=4 et: ************************ //