|
|
|
functionObject.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) 1991-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::functionObject 00027 00028 Description 00029 Abstract base-class for Time/database function objects. 00030 00031 See Also 00032 Foam::OutputFilterFunctionObject 00033 00034 SourceFiles 00035 functionObject.C 00036 00037 \*---------------------------------------------------------------------------*/ 00038 00039 #ifndef functionObject_H 00040 #define functionObject_H 00041 00042 #include "typeInfo.H" 00043 #include "autoPtr.H" 00044 #include "runTimeSelectionTables.H" 00045 00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00047 00048 namespace Foam 00049 { 00050 00051 // Forward declaration of classes 00052 class Time; 00053 00054 /*---------------------------------------------------------------------------*\ 00055 Class functionObject Declaration 00056 \*---------------------------------------------------------------------------*/ 00057 00058 class functionObject 00059 { 00060 // Private data 00061 00062 //- Name 00063 const word name_; 00064 00065 00066 // Private Member Functions 00067 00068 //- Disallow default bitwise copy construct 00069 functionObject(const functionObject&); 00070 00071 //- Disallow default bitwise assignment 00072 void operator=(const functionObject&); 00073 00074 00075 public: 00076 00077 //- Runtime type information 00078 virtual const word& type() const = 0; 00079 00080 static int debug; 00081 00082 00083 // Declare run-time constructor selection tables 00084 00085 declareRunTimeSelectionTable 00086 ( 00087 autoPtr, 00088 functionObject, 00089 dictionary, 00090 (const word& name, const Time& t, const dictionary& dict), 00091 (name, t, dict) 00092 ); 00093 00094 00095 // Constructors 00096 00097 //- Construct from components 00098 functionObject(const word& name); 00099 00100 //- Return clone 00101 autoPtr<functionObject> clone() const 00102 { 00103 notImplemented("functionObject::clone() const"); 00104 return autoPtr<functionObject>(NULL); 00105 } 00106 00107 //- Return a pointer to a new functionObject created on freestore 00108 // from Istream 00109 class iNew 00110 { 00111 const Time& time_; 00112 00113 public: 00114 00115 iNew(const Time& t) 00116 : 00117 time_(t) 00118 {} 00119 00120 autoPtr<functionObject> operator() 00121 ( 00122 const word& name, 00123 Istream& is 00124 ) const; 00125 }; 00126 00127 00128 // Selectors 00129 00130 //- Select from dictionary, based on its "type" entry 00131 static autoPtr<functionObject> New 00132 ( 00133 const word& name, 00134 const Time&, 00135 const dictionary& 00136 ); 00137 00138 00139 // Destructor 00140 00141 virtual ~functionObject(); 00142 00143 00144 // Member Functions 00145 00146 //- Name 00147 virtual const word& name() const; 00148 00149 //- Called at the start of the time-loop 00150 virtual bool start() = 0; 00151 00152 //- Called at each ++ or += of the time-loop 00153 virtual bool execute() = 0; 00154 00155 //- Called when Time::run() determines that the time-loop exits. 00156 // By default it simply calls execute(). 00157 virtual bool end(); 00158 00159 //- Read and set the function object if its data have changed 00160 virtual bool read(const dictionary&) = 0; 00161 }; 00162 00163 00164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00165 00166 } // End namespace Foam 00167 00168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00169 00170 #endif 00171 00172 // ************************************************************************* // |