mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
functionObjects: rewritten to all be derived from 'functionObject'
- Avoids the need for the 'OutputFilterFunctionObject' wrapper
- Time-control for execution and writing is now provided by the
'timeControlFunctionObject' which instantiates the processing
'functionObject' and controls its operation.
- Alternative time-control functionObjects can now be written and
selected at run-time without the need to compile wrapped version of
EVERY existing functionObject which would have been required in the
old structure.
- The separation of 'execute' and 'write' functions is now formalized in the
'functionObject' base-class and all derived classes implement the
two functions.
- Unnecessary implementations of functions with appropriate defaults
in the 'functionObject' base-class have been removed reducing
clutter and simplifying implementation of new functionObjects.
- The 'coded' 'functionObject' has also been updated, simplified and tested.
- Further simplification is now possible by creating some general
intermediate classes derived from 'functionObject'.
This commit is contained in:
145
src/OpenFOAM/db/functionObjects/writeFiles/writeFiles.H
Normal file
145
src/OpenFOAM/db/functionObjects/writeFiles/writeFiles.H
Normal file
@ -0,0 +1,145 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-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::functionObjects::writeFiles
|
||||
|
||||
Description
|
||||
functionObject base class for writing files
|
||||
|
||||
See Also
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
|
||||
SourceFiles
|
||||
functionObjectFiles.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjects_writeFiles_H
|
||||
#define functionObjects_writeFiles_H
|
||||
|
||||
#include "writeFile.H"
|
||||
#include "OFstream.H"
|
||||
#include "PtrList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class writeFiles Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class writeFiles
|
||||
:
|
||||
public writeFile
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- File names
|
||||
wordList names_;
|
||||
|
||||
//- File pointer
|
||||
PtrList<OFstream> filePtrs_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Create the output file
|
||||
virtual void createFiles();
|
||||
|
||||
//- Write function
|
||||
virtual void write();
|
||||
|
||||
//- Reset the list of names from a wordList
|
||||
virtual void resetNames(const wordList& names);
|
||||
|
||||
//- Reset the list of names to a single name entry
|
||||
virtual void resetName(const word& name);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
writeFiles(const writeFiles&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const writeFiles&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from name, Time, dictionary and prefix
|
||||
writeFiles
|
||||
(
|
||||
const word& name,
|
||||
const Time& time,
|
||||
const dictionary& dict,
|
||||
const word& prefix
|
||||
);
|
||||
|
||||
//- Construct from name, objectRegistry, dictionary and prefix
|
||||
writeFiles
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const word& prefix
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~writeFiles();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return const access to the names
|
||||
const wordList& names() const;
|
||||
|
||||
//- Return access to the file (if only 1)
|
||||
OFstream& file();
|
||||
|
||||
//- Return access to the files
|
||||
PtrList<OFstream>& files();
|
||||
|
||||
//- Return file 'i'
|
||||
OFstream& file(const label i);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user