OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

OutputFilterFunctionObject.H

Go 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::OutputFilterFunctionObject
00027 
00028 Description
00029     A functionObject wrapper around OutputFilter to allow them to be
00030     created via the functions list within controlDict.
00031 
00032 Note
00033     Since the timeIndex is used directly from Foam::Time, it is unaffected
00034     by user-time conversions. For example, Foam::engineTime might cause @a
00035     writeInterval to be degrees crank angle, but the functionObject
00036     execution @a interval would still be in timestep.
00037 
00038 SourceFiles
00039     OutputFilterFunctionObject.C
00040 
00041 \*---------------------------------------------------------------------------*/
00042 
00043 #ifndef OutputFilterFunctionObject_H
00044 #define OutputFilterFunctionObject_H
00045 
00046 #include "functionObject.H"
00047 #include "dictionary.H"
00048 #include "outputFilterOutputControl.H"
00049 
00050 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00051 
00052 namespace Foam
00053 {
00054 
00055 /*---------------------------------------------------------------------------*\
00056                  Class OutputFilterFunctionObject Declaration
00057 \*---------------------------------------------------------------------------*/
00058 
00059 template<class OutputFilter>
00060 class OutputFilterFunctionObject
00061 :
00062     public functionObject
00063 {
00064     // Private data
00065 
00066         //- Reference to the time database
00067         const Time& time_;
00068 
00069         //- Input dictionary
00070         dictionary dict_;
00071 
00072         //- Name of region
00073         word regionName_;
00074 
00075         //- Optional dictionary name to supply required inputs
00076         word dictName_;
00077 
00078         //- Switch for the execution of the functionObject
00079         bool enabled_;
00080 
00081         //- Output controls
00082         outputFilterOutputControl outputControl_;
00083 
00084         //- Pointer to the output filter
00085         autoPtr<OutputFilter> ptr_;
00086 
00087 
00088     // Private Member Functions
00089 
00090         //- Read relevant dictionary entries
00091         void readDict();
00092 
00093         //- Disallow default bitwise copy construct
00094         OutputFilterFunctionObject(const OutputFilterFunctionObject&);
00095 
00096         //- Disallow default bitwise assignment
00097         void operator=(const OutputFilterFunctionObject&);
00098 
00099 
00100 public:
00101 
00102     //- Runtime type information
00103     TypeName(OutputFilter::typeName_());
00104 
00105 
00106     // Constructors
00107 
00108         //- Construct from components
00109         OutputFilterFunctionObject
00110         (
00111             const word& name,
00112             const Time&,
00113             const dictionary&
00114         );
00115 
00116 
00117     // Member Functions
00118 
00119         // Access
00120 
00121             //- Return time database
00122             virtual const Time& time() const
00123             {
00124                 return time_;
00125             }
00126 
00127             //- Return the input dictionary
00128             virtual const dictionary& dict() const
00129             {
00130                 return dict_;
00131             }
00132 
00133             //- Return the region name
00134             virtual const word& regionName() const
00135             {
00136                 return regionName_;
00137             }
00138 
00139             //- Return the optional dictionary name
00140             virtual const word& dictName() const
00141             {
00142                 return dictName_;
00143             }
00144 
00145             //- Return the enabled flag
00146             virtual bool enabled() const
00147             {
00148                 return enabled_;
00149             }
00150 
00151             //- Return the output control object
00152             virtual const outputFilterOutputControl& outputControl() const
00153             {
00154                 return outputControl_;
00155             }
00156 
00157             //- Return the output filter
00158             virtual const OutputFilter& outputFilter() const
00159             {
00160                 return ptr_();
00161             }
00162 
00163 
00164         // Function object control
00165 
00166             //- Switch the function object on
00167             virtual void on();
00168 
00169             //- Switch the function object off
00170             virtual void off();
00171 
00172 
00173             //- Called at the start of the time-loop
00174             virtual bool start();
00175 
00176             //- Called at each ++ or += of the time-loop
00177             virtual bool execute();
00178 
00179             //- Called when Time::run() determines that the time-loop exits
00180             virtual bool end();
00181 
00182 
00183             //- Read and set the function object if its data have changed
00184             virtual bool read(const dictionary&);
00185 };
00186 
00187 
00188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00189 
00190 } // End namespace Foam
00191 
00192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00193 
00194 #ifdef NoRepository
00195 #   include "OutputFilterFunctionObject.C"
00196 #endif
00197 
00198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00199 
00200 #endif
00201 
00202 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd