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