Files
openfoam/src/OpenFOAM/db/functionObjectList/functionObjectList.H
Mark Olesen 79e9a90c0e reworked functionObjectList to use PtrList
- This was originally plan 'B', but it is actually probably more efficient
  than using PtrDictionary anyhow.
- straightened out the return value logic, but it wasn't being used anywhere
  anyhow.
- new 'updated_' data member avoids inadvertent execution in the read()
  method when execution is turned off.
2008-12-19 09:29:58 +01:00

151 lines
4.3 KiB
C++

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::functionObjectList
Description
List of function objects with execute() function that is called for each
object.
See Also
Foam::functionObject and Foam::OutputFilterFunctionObject
SourceFiles
functionObjectList.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjectList_H
#define functionObjectList_H
#include "functionObject.H"
#include "HashTable.H"
#include "PtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class functionObjectList Declaration
\*---------------------------------------------------------------------------*/
class functionObjectList
{
// Private data
//- A list of function objects
// Avoid 'is-a' relationship for protection
PtrList<functionObject> functions_;
//- Quick lookup of the index into the PtrList<functionObject>
// Currently only used to manage rereading/deletion
HashTable<label> indices_;
const Time& time_;
//- Dictionary containing the "functions" entry
// This entry can either be a list or a dictionary of
// functionObject specifications.
const dictionary& parentDict_;
//- Switch for the execution of the functionObjects
bool execution_;
//- Tracks if read() was called while execution was turned off
bool updated_;
// Private Member Functions
//- Remove and return the function object pointer by name.
// Return NULL if it didn't exist.
functionObject* remove(const word&);
//- Disallow default bitwise copy construct
functionObjectList(const functionObjectList&);
//- Disallow default bitwise assignment
void operator=(const functionObjectList&);
public:
// Constructors
//- Construct from Time and the execution setting
// The functionObject specifications are read from the controlDict
functionObjectList
(
const Time&,
const bool execution=true
);
//- Construct from Time, dictionary with "functions" entry
// and the execution setting
functionObjectList
(
const Time&,
const dictionary& parentDict,
const bool execution=true
);
// Destructor
virtual ~functionObjectList();
// Member Functions
//- Start is called at the start of the time-loop
virtual bool start();
//- Execute is called at each ++ or += of the time-loop
virtual bool execute();
//- Switch the function objects on
virtual void on();
//- Switch the function objects off
virtual void off();
//- Read and set the function objects if their data have changed
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //