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