FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

fieldMinMax.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 2008-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::fieldMinMax
00026 
00027 Description
00028     Calculates scalar minimim and maximum field values.
00029 
00030     For variables with rank > 0, computes the magnitude of the min/max
00031     values.
00032 
00033     Data written to the file <timeDir>/fieldMinMax.dat
00034 
00035 
00036 SourceFiles
00037     fieldMinMax.C
00038     IOfieldMinMax.H
00039 
00040 \*---------------------------------------------------------------------------*/
00041 
00042 #ifndef fieldMinMax_H
00043 #define fieldMinMax_H
00044 
00045 #include <OpenFOAM/primitiveFieldsFwd.H>
00046 #include <finiteVolume/volFieldsFwd.H>
00047 #include <OpenFOAM/HashSet.H>
00048 #include <OpenFOAM/OFstream.H>
00049 #include <OpenFOAM/Switch.H>
00050 #include <OpenFOAM/pointFieldFwd.H>
00051 #include <OpenFOAM/NamedEnum.H>
00052 
00053 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00054 
00055 namespace Foam
00056 {
00057 
00058 // Forward declaration of classes
00059 class objectRegistry;
00060 class dictionary;
00061 class mapPolyMesh;
00062 
00063 /*---------------------------------------------------------------------------*\
00064                        Class fieldMinMax Declaration
00065 \*---------------------------------------------------------------------------*/
00066 
00067 class fieldMinMax
00068 {
00069 public:
00070 
00071     enum modeType
00072     {
00073         mdMag,
00074         mdCmpt
00075     };
00076 
00077 
00078 protected:
00079 
00080     // Protected data
00081 
00082         //- Name of this set of field min/max.
00083         //  Also used as the name of the output directory.
00084         word name_;
00085 
00086         const objectRegistry& obr_;
00087 
00088         //- on/off switch
00089         bool active_;
00090 
00091         //- Switch to send output to Info as well as to file
00092         Switch log_;
00093 
00094         //- Mode type names
00095         static const NamedEnum<modeType, 2> modeTypeNames_;
00096 
00097         //- Mode for min/max - only applicable for ranks > 0
00098         modeType mode_;
00099 
00100         //- Fields to assess min/max
00101         wordList fieldSet_;
00102 
00103 
00104         //- Min/max file ptr
00105         autoPtr<OFstream> fieldMinMaxFilePtr_;
00106 
00107 
00108     // Private Member Functions
00109 
00110         //- If the output file has not been created create it
00111         void makeFile();
00112 
00113         //- Disallow default bitwise copy construct
00114         fieldMinMax(const fieldMinMax&);
00115 
00116         //- Disallow default bitwise assignment
00117         void operator=(const fieldMinMax&);
00118 
00119         //- Output file header information
00120         virtual void writeFileHeader();
00121 
00122 
00123 public:
00124 
00125     //- Runtime type information
00126     TypeName("fieldMinMax");
00127 
00128 
00129     // Constructors
00130 
00131         //- Construct for given objectRegistry and dictionary.
00132         //  Allow the possibility to load fields from files
00133         fieldMinMax
00134         (
00135             const word& name,
00136             const objectRegistry&,
00137             const dictionary&,
00138             const bool loadFromFiles = false
00139         );
00140 
00141 
00142     // Destructor
00143 
00144         virtual ~fieldMinMax();
00145 
00146 
00147     // Member Functions
00148 
00149         //- Return name of the set of field min/max
00150         virtual const word& name() const
00151         {
00152             return name_;
00153         }
00154 
00155         //- Read the field min/max data
00156         virtual void read(const dictionary&);
00157 
00158         //- Execute, currently does nothing
00159         virtual void execute();
00160 
00161         //- Execute at the final time-loop, currently does nothing
00162         virtual void end();
00163 
00164         //- Calculate the field min/max
00165         template<class Type>
00166         void calcMinMaxFields(const word& fieldName);
00167 
00168         //- Write the fieldMinMax
00169         virtual void write();
00170 
00171         //- Update for changes of mesh
00172         virtual void updateMesh(const mapPolyMesh&)
00173         {}
00174 
00175         //- Update for changes of mesh
00176         virtual void movePoints(const pointField&)
00177         {}
00178 };
00179 
00180 
00181 // Template specialisation for scalar fields
00182 template<>
00183 void fieldMinMax::calcMinMaxFields<scalar>(const word& fieldName);
00184 
00185 
00186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00187 
00188 } // End namespace Foam
00189 
00190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00191 
00192 #ifdef NoRepository
00193 #   include "fieldMinMaxTemplates.C"
00194 #endif
00195 
00196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00197 
00198 #endif
00199 
00200 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines