1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2009-2011 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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
25 Foam::functionObjectList
28 List of function objects with start(), execute() and end() functions
29 that is called for each object.
32 Foam::functionObject and Foam::OutputFilterFunctionObject
37 \*---------------------------------------------------------------------------*/
39 #ifndef functionObjectList_H
40 #define functionObjectList_H
43 #include "functionObject.H"
44 #include "SHA1Digest.H"
45 #include "HashTable.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 /*---------------------------------------------------------------------------*\
53 Class functionObjectList Declaration
54 \*---------------------------------------------------------------------------*/
56 class functionObjectList
58 private PtrList<functionObject>
62 //- A list of SHA1 digests for the function object dictionaries
63 List<SHA1Digest> digests_;
65 //- Quick lookup of the index into functions/digests
66 HashTable<label> indices_;
70 //- The parent dictionary containing a "functions" entry
71 // This entry can either be a list or a dictionary of
72 // functionObject specifications.
73 const dictionary& parentDict_;
75 //- Switch for the execution of the functionObjects
78 //- Tracks if read() was called while execution is on
82 // Private Member Functions
84 //- Remove and return the function object pointer by name,
85 // and returns the old index via the parameter.
86 // Returns a NULL pointer (and index -1) if it didn't exist.
87 functionObject* remove(const word&, label& oldIndex);
89 //- Disallow default bitwise copy construct
90 functionObjectList(const functionObjectList&);
92 //- Disallow default bitwise assignment
93 void operator=(const functionObjectList&);
100 //- Construct from Time and the execution setting
101 // The functionObject specifications are read from the controlDict
105 const bool execution=true
109 //- Construct from Time, a dictionary with "functions" entry
110 // and the execution setting.
111 // \param[in] parentDict - the parent dictionary containing
112 // a "functions" entry, which can either be a list or a dictionary
113 // of functionObject specifications.
117 const dictionary& parentDict,
118 const bool execution=true
123 virtual ~functionObjectList();
128 //- Return the number of elements in the List.
129 using PtrList<functionObject>::size;
131 //- Return true if the List is empty (ie, size() is zero).
132 using PtrList<functionObject>::empty;
134 //- Access to the functionObjects
135 using PtrList<functionObject>::operator[];
137 //- Clear the list of function objects
138 virtual void clear();
140 //- Find the ID of a given function object by name
141 virtual label findObjectID(const word& name) const;
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. forceWrite overrides
157 // the usual outputControl behaviour and forces writing always
158 // (used in postprocessing mode)
159 virtual bool execute(const bool forceWrite = false);
161 //- Called when Time::run() determines that the time-loop exits
164 //- Read and set the function objects if their data have changed
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 } // End namespace Foam
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 // ************************************************************************* //