00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-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::functionObjectList 00026 00027 Description 00028 List of function objects with start(), execute() and end() functions 00029 that is called for each object. 00030 00031 See Also 00032 Foam::functionObject and Foam::OutputFilterFunctionObject 00033 00034 SourceFiles 00035 functionObjectList.C 00036 00037 \*---------------------------------------------------------------------------*/ 00038 00039 #ifndef functionObjectList_H 00040 #define functionObjectList_H 00041 00042 #include <OpenFOAM/PtrList.H> 00043 #include <OpenFOAM/functionObject.H> 00044 #include <OpenFOAM/SHA1Digest.H> 00045 #include <OpenFOAM/HashTable.H> 00046 00047 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00048 00049 namespace Foam 00050 { 00051 00052 /*---------------------------------------------------------------------------*\ 00053 Class functionObjectList Declaration 00054 \*---------------------------------------------------------------------------*/ 00055 00056 class functionObjectList 00057 : 00058 private PtrList<functionObject> 00059 { 00060 // Private data 00061 00062 //- A list of SHA1 digests for the function object dictionaries 00063 List<SHA1Digest> digests_; 00064 00065 //- Quick lookup of the index into functions/digests 00066 HashTable<label> indices_; 00067 00068 const Time& time_; 00069 00070 //- The parent dictionary containing a "functions" entry 00071 // This entry can either be a list or a dictionary of 00072 // functionObject specifications. 00073 const dictionary& parentDict_; 00074 00075 //- Switch for the execution of the functionObjects 00076 bool execution_; 00077 00078 //- Tracks if read() was called while execution is on 00079 bool updated_; 00080 00081 00082 // Private Member Functions 00083 00084 //- Remove and return the function object pointer by name, 00085 // and returns the old index via the parameter. 00086 // Returns a NULL pointer (and index -1) if it didn't exist. 00087 functionObject* remove(const word&, label& oldIndex); 00088 00089 //- Disallow default bitwise copy construct 00090 functionObjectList(const functionObjectList&); 00091 00092 //- Disallow default bitwise assignment 00093 void operator=(const functionObjectList&); 00094 00095 00096 public: 00097 00098 // Constructors 00099 00100 //- Construct from Time and the execution setting 00101 // The functionObject specifications are read from the controlDict 00102 functionObjectList 00103 ( 00104 const Time&, 00105 const bool execution=true 00106 ); 00107 00108 00109 //- Construct from Time, a dictionary with "functions" entry 00110 // and the execution setting. 00111 // @param[in] parentDict - the parent dictionary containing 00112 // a "functions" entry, which can either be a list or a dictionary 00113 // of functionObject specifications. 00114 functionObjectList 00115 ( 00116 const Time&, 00117 const dictionary& parentDict, 00118 const bool execution=true 00119 ); 00120 00121 00122 // Destructor 00123 00124 virtual ~functionObjectList(); 00125 00126 00127 // Member Functions 00128 00129 //- Return the number of elements in the List. 00130 using PtrList<functionObject>::size; 00131 00132 //- Return true if the List is empty (ie, size() is zero). 00133 using PtrList<functionObject>::empty; 00134 00135 //- Access to the functionObjects 00136 using PtrList<functionObject>::operator[]; 00137 00138 //- Clear the list of function objects 00139 virtual void clear(); 00140 00141 00142 //- Switch the function objects on 00143 virtual void on(); 00144 00145 //- Switch the function objects off 00146 virtual void off(); 00147 00148 //- Return the execution status (on/off) of the function objects 00149 virtual bool status() const; 00150 00151 00152 //- Called at the start of the time-loop 00153 virtual bool start(); 00154 00155 //- Called at each ++ or += of the time-loop 00156 virtual bool execute(); 00157 00158 //- Called when Time::run() determines that the time-loop exits 00159 virtual bool end(); 00160 00161 //- Read and set the function objects if their data have changed 00162 virtual bool read(); 00163 00164 }; 00165 00166 00167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00168 00169 } // End namespace Foam 00170 00171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00172 00173 #endif 00174 00175 // ************************ vim: set sw=4 sts=4 et: ************************ //