OpenFOAM-5.x/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H
Henry Weller 30e2f912e5 simpleFoam: Added experimental "-postProcess" option
Executes application functionObjects to post-process existing results.

    If the "dict" argument is specified the functionObjectList is constructed
    from that dictionary otherwise the functionObjectList is constructed from
    the "functions" sub-dictionary of "system/controlDict"

    Multiple time-steps may be processed and the standard utility time
    controls are provided.

This functionality is equivalent to execFlowFunctionObjects but in a
more efficient and general manner and will be included in all the
OpenFOAM solvers if it proves effective and maintainable.

The command-line options available with the "-postProcess" option may be
obtained by

simpleFoam -help -postProcess

Usage: simpleFoam [OPTIONS]
options:
  -case <dir>       specify alternate case directory, default is the cwd
  -constant         include the 'constant/' dir in the times list
  -dict <file>      read control dictionary from specified location
  -latestTime       select the latest time
  -newTimes         select the new times
  -noFunctionObjects
                    do not execute functionObjects
  -noZero           exclude the '0/' dir from the times list, has precedence
                    over the -withZero option
  -parallel         run in parallel
  -postProcess      Execute functionObjects only
  -region <name>    specify alternative mesh region
  -roots <(dir1 .. dirN)>
                    slave root directories for distributed running
  -time <ranges>    comma-separated time ranges - eg, ':10,20,40:70,1000:'
  -srcDoc           display source code in browser
  -doc              display application documentation in browser
  -help             print the usage

Henry G. Weller
CFD Direct Ltd.
2016-05-08 09:33:46 +01:00

207 lines
6.5 KiB
C++

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjectList
Description
List of function objects with start(), execute() and end() functions
that is called for each object.
See Also
Foam::functionObject and Foam::OutputFilterFunctionObject
SourceFiles
functionObjectList.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjectList_H
#define functionObjectList_H
#include "PtrList.H"
#include "functionObject.H"
#include "SHA1Digest.H"
#include "HashTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class mapPolyMesh;
class argList;
/*---------------------------------------------------------------------------*\
Class functionObjectList Declaration
\*---------------------------------------------------------------------------*/
class functionObjectList
:
private PtrList<functionObject>
{
// Private data
//- A list of SHA1 digests for the function object dictionaries
List<SHA1Digest> digests_;
//- Quick lookup of the index into functions/digests
HashTable<label> indices_;
const Time& time_;
//- The parent dictionary containing a "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 is on
bool updated_;
// Private Member Functions
//- Remove and return the function object pointer by name,
// and returns the old index via the parameter.
// Returns a NULL pointer (and index -1) if it didn't exist.
functionObject* remove(const word&, label& oldIndex);
//- 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, a dictionary with "functions" entry
// and the execution setting.
// \param[in] t - the other Time instance to construct from
// \param[in] parentDict - the parent dictionary containing
// a "functions" entry, which can either be a list or a dictionary
// of functionObject specifications.
// \param[in] execution - whether the function objects should execute
// or not. Default: true.
functionObjectList
(
const Time& t,
const dictionary& parentDict,
const bool execution=true
);
//- Construct and return a functionObjectList for an application.
//
// If the "dict" argument is specified the functionObjectList is
// constructed from that dictionary which is returned as
// functionObjectsDict otherwise the functionObjectList is constructed
// from the "functions" sub-dictionary of "system/controlDict"
static autoPtr<functionObjectList> New
(
const argList& args,
const Time& runTime,
dictionary& functionObjectsDict
);
//- Destructor
virtual ~functionObjectList();
// Member Functions
//- Return the number of elements in the List.
using PtrList<functionObject>::size;
//- Return true if the List is empty (ie, size() is zero).
using PtrList<functionObject>::empty;
//- Access to the functionObjects
using PtrList<functionObject>::operator[];
//- Clear the list of function objects
virtual void clear();
//- Find the ID of a given function object by name
virtual label findObjectID(const word& name) const;
//- Switch the function objects on
virtual void on();
//- Switch the function objects off
virtual void off();
//- Return the execution status (on/off) of the function objects
virtual bool status() const;
//- Called at the start of the time-loop
virtual bool start();
//- Called at each ++ or += of the time-loop. forceWrite overrides
// the usual outputControl behaviour and forces writing always
// (used in postprocessing mode)
virtual bool execute(const bool forceWrite = false);
//- Called when Time::run() determines that the time-loop exits
virtual bool end();
//- Called when time was set at the end of the Time::operator++
virtual bool timeSet();
//- Called at the end of Time::adjustDeltaT() if adjustTime is true
virtual bool adjustTimeStep();
//- Read and set the function objects if their data have changed
virtual bool read();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh& mpm);
//- Update for changes of mesh
virtual void movePoints(const polyMesh& mesh);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //