00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 2009-2011 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::fieldValue 00026 00027 Description 00028 Base class for field value -based function objects. 00029 00030 SourceFiles 00031 fieldValue.C 00032 00033 \*---------------------------------------------------------------------------*/ 00034 00035 #ifndef fieldValue_H 00036 #define fieldValue_H 00037 00038 #include <OpenFOAM/Switch.H> 00039 #include <OpenFOAM/pointFieldFwd.H> 00040 #include <OpenFOAM/OFstream.H> 00041 00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00043 00044 namespace Foam 00045 { 00046 00047 // Forward declaration of classes 00048 class dictionary; 00049 class objectRegistry; 00050 class fvMesh; 00051 class mapPolyMesh; 00052 00053 /*---------------------------------------------------------------------------*\ 00054 Class fieldValue Declaration 00055 \*---------------------------------------------------------------------------*/ 00056 00057 class fieldValue 00058 { 00059 00060 protected: 00061 00062 // Protected data 00063 00064 //- Name of this fieldValue object 00065 word name_; 00066 00067 //- Database this class is registered to 00068 const objectRegistry& obr_; 00069 00070 //- Active flag 00071 bool active_; 00072 00073 //- Switch to send output to Info as well as to file 00074 Switch log_; 00075 00076 //- Name of source object 00077 word sourceName_; 00078 00079 //- List of field names to operate on 00080 wordList fields_; 00081 00082 //- Output field values flag 00083 Switch valueOutput_; 00084 00085 //- Output file pointer 00086 autoPtr<OFstream> outputFilePtr_; 00087 00088 00089 // Functions to be over-ridden from IOoutputFilter class 00090 00091 //- Make the output file 00092 virtual void makeFile(); 00093 00094 //- Write the output file header 00095 virtual void writeFileHeader() = 0; 00096 00097 //- Update mesh 00098 virtual void updateMesh(const mapPolyMesh&); 00099 00100 //- Move points 00101 virtual void movePoints(const Field<point>&); 00102 00103 00104 public: 00105 00106 //- Run-time type information 00107 TypeName("fieldValue"); 00108 00109 00110 //- Construct from components 00111 fieldValue 00112 ( 00113 const word& name, 00114 const objectRegistry& obr, 00115 const dictionary& dict, 00116 const bool loadFromFiles = false 00117 ); 00118 00119 00120 //- Destructor 00121 virtual ~fieldValue(); 00122 00123 00124 // Public member functions 00125 00126 // Access 00127 00128 //- Return the name of the geometric source 00129 inline const word& name() const; 00130 00131 //- Return the reference to the object registry 00132 inline const objectRegistry& obr() const; 00133 00134 //- Return the active flag 00135 inline bool active() const; 00136 00137 //- Return the switch to send output to Info as well as to file 00138 inline const Switch& log() const; 00139 00140 //- Return the source name 00141 inline const word& sourceName() const; 00142 00143 //- Return the list of field names 00144 inline const wordList& fields() const; 00145 00146 //- Return the output field values flag 00147 inline const Switch& valueOutput() const; 00148 00149 //- Helper function to return the reference to the mesh 00150 inline const fvMesh& mesh() const; 00151 00152 00153 // Function object functions 00154 00155 //- Read from dictionary 00156 virtual void read(const dictionary& dict); 00157 00158 //- Write to screen/file 00159 virtual void write(); 00160 00161 //- Execute 00162 virtual void execute(); 00163 00164 //- Execute the at the final time-loop, currently does nothing 00165 virtual void end(); 00166 00167 //- Comnbine fields from all processor domains into single field 00168 template<class Type> 00169 tmp<Field<Type> > combineFields 00170 ( 00171 const Field<Type>& field 00172 ) const; 00173 }; 00174 00175 00176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00177 00178 } // End namespace Foam 00179 00180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00181 00182 #include "fieldValueI.H" 00183 00184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00185 00186 #ifdef NoRepository 00187 #include "fieldValueTemplates.C" 00188 #endif 00189 00190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00191 00192 #endif 00193 00194 // ************************ vim: set sw=4 sts=4 et: ************************ //