|
|
|
fieldMinMax.HGo 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-2009 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 the 00013 Free Software Foundation; either version 2 of the License, or (at your 00014 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, write to the Free Software Foundation, 00023 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 Class 00026 Foam::fieldMinMax 00027 00028 Description 00029 Calculates scalar minimim and maximum field values. 00030 00031 For variables with rank > 0, computes the magnitude of the min/max 00032 values. 00033 00034 Data written to the file <timeDir>/fieldMinMax.dat 00035 00036 00037 SourceFiles 00038 fieldMinMax.C 00039 IOfieldMinMax.H 00040 00041 \*---------------------------------------------------------------------------*/ 00042 00043 #ifndef fieldMinMax_H 00044 #define fieldMinMax_H 00045 00046 #include "primitiveFieldsFwd.H" 00047 #include "volFieldsFwd.H" 00048 #include "HashSet.H" 00049 #include "OFstream.H" 00050 #include "Switch.H" 00051 #include "pointFieldFwd.H" 00052 #include "NamedEnum.H" 00053 00054 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00055 00056 namespace Foam 00057 { 00058 00059 // Forward declaration of classes 00060 class objectRegistry; 00061 class dictionary; 00062 class mapPolyMesh; 00063 00064 /*---------------------------------------------------------------------------*\ 00065 Class fieldMinMax Declaration 00066 \*---------------------------------------------------------------------------*/ 00067 00068 class fieldMinMax 00069 { 00070 public: 00071 00072 enum modeType 00073 { 00074 mdMag, 00075 mdCmpt 00076 }; 00077 00078 00079 protected: 00080 00081 // Protected data 00082 00083 //- Name of this set of field min/max. 00084 // Also used as the name of the output directory. 00085 word name_; 00086 00087 const objectRegistry& obr_; 00088 00089 //- on/off switch 00090 bool active_; 00091 00092 //- Switch to send output to Info as well as to file 00093 Switch log_; 00094 00095 //- Mode type names 00096 static const NamedEnum<modeType, 2> modeTypeNames_; 00097 00098 //- Mode for min/max - only applicable for ranks > 0 00099 modeType mode_; 00100 00101 //- Fields to assess min/max 00102 wordList fieldSet_; 00103 00104 00105 //- Min/max file ptr 00106 autoPtr<OFstream> fieldMinMaxFilePtr_; 00107 00108 00109 // Private Member Functions 00110 00111 //- If the output file has not been created create it 00112 void makeFile(); 00113 00114 //- Disallow default bitwise copy construct 00115 fieldMinMax(const fieldMinMax&); 00116 00117 //- Disallow default bitwise assignment 00118 void operator=(const fieldMinMax&); 00119 00120 //- Output file header information 00121 virtual void writeFileHeader(); 00122 00123 00124 public: 00125 00126 //- Runtime type information 00127 TypeName("fieldMinMax"); 00128 00129 00130 // Constructors 00131 00132 //- Construct for given objectRegistry and dictionary. 00133 // Allow the possibility to load fields from files 00134 fieldMinMax 00135 ( 00136 const word& name, 00137 const objectRegistry&, 00138 const dictionary&, 00139 const bool loadFromFiles = false 00140 ); 00141 00142 00143 // Destructor 00144 00145 virtual ~fieldMinMax(); 00146 00147 00148 // Member Functions 00149 00150 //- Return name of the set of field min/max 00151 virtual const word& name() const 00152 { 00153 return name_; 00154 } 00155 00156 //- Read the field min/max data 00157 virtual void read(const dictionary&); 00158 00159 //- Execute, currently does nothing 00160 virtual void execute(); 00161 00162 //- Execute at the final time-loop, currently does nothing 00163 virtual void end(); 00164 00165 //- Calculate the field min/max 00166 template<class Type> 00167 void calcMinMaxFields(const word& fieldName); 00168 00169 //- Write the fieldMinMax 00170 virtual void write(); 00171 00172 //- Update for changes of mesh 00173 virtual void updateMesh(const mapPolyMesh&) 00174 {} 00175 00176 //- Update for changes of mesh 00177 virtual void movePoints(const pointField&) 00178 {} 00179 }; 00180 00181 00182 // Template specialisation for scalar fields 00183 template<> 00184 void fieldMinMax::calcMinMaxFields<scalar>(const word& fieldName); 00185 00186 00187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00188 00189 } // End namespace Foam 00190 00191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00192 00193 #ifdef NoRepository 00194 # include "fieldMinMaxTemplates.C" 00195 #endif 00196 00197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00198 00199 #endif 00200 00201 // ************************************************************************* // |