1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Foam::functionObjectList
29 List of function objects with start(), execute() and end() functions
30 that is called for each object.
33 Foam::functionObject and Foam::OutputFilterFunctionObject
38 \*---------------------------------------------------------------------------*/
40 #ifndef functionObjectList_H
41 #define functionObjectList_H
44 #include "functionObject.H"
45 #include "SHA1Digest.H"
46 #include "HashTable.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 /*---------------------------------------------------------------------------*\
54 Class functionObjectList Declaration
55 \*---------------------------------------------------------------------------*/
57 class functionObjectList
59 private PtrList<functionObject>
63 //- A list of SHA1 digests for the function object dictionaries
64 List<SHA1Digest> digests_;
66 //- Quick lookup of the index into functions/digests
67 HashTable<label> indices_;
71 //- The parent dictionary containing a "functions" entry
72 // This entry can either be a list or a dictionary of
73 // functionObject specifications.
74 const dictionary& parentDict_;
76 //- Switch for the execution of the functionObjects
79 //- Tracks if read() was called while execution is on
83 // Private Member Functions
85 //- Remove and return the function object pointer by name,
86 // and returns the old index via the parameter.
87 // Returns a NULL pointer (and index -1) if it didn't exist.
88 functionObject* remove(const word&, label& oldIndex);
90 //- Disallow default bitwise copy construct
91 functionObjectList(const functionObjectList&);
93 //- Disallow default bitwise assignment
94 void operator=(const functionObjectList&);
101 //- Construct from Time and the execution setting
102 // The functionObject specifications are read from the controlDict
106 const bool execution=true
110 //- Construct from Time, a dictionary with "functions" entry
111 // and the execution setting.
112 // @param[in] parentDict - the parent dictionary containing
113 // a "functions" entry, which can either be a list or a dictionary
114 // of functionObject specifications.
118 const dictionary& parentDict,
119 const bool execution=true
125 virtual ~functionObjectList();
130 //- Return the number of elements in the List.
131 using PtrList<functionObject>::size;
133 //- Return true if the List is empty (ie, size() is zero).
134 using PtrList<functionObject>::empty;
136 //- Access to the functionObjects
137 using PtrList<functionObject>::operator[];
139 //- Clear the list of function objects
140 virtual void clear();
143 //- Switch the function objects on
146 //- Switch the function objects off
149 //- Return the execution status (on/off) of the function objects
150 virtual bool status() const;
153 //- Called at the start of the time-loop
154 virtual bool start();
156 //- Called at each ++ or += of the time-loop
157 virtual bool execute();
159 //- Called when Time::run() determines that the time-loop exits
162 //- Read and set the function objects if their data have changed
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 } // End namespace Foam
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 // ************************************************************************* //