etc/codeTemplates/functionObject: Updated to correspond to the new functionObject structure

This commit is contained in:
Henry Weller
2016-05-15 21:47:18 +01:00
parent 248ab45998
commit ee0aff67ce
5 changed files with 55 additions and 99 deletions

View File

@ -42,8 +42,6 @@ Usage: $Script [-h | -help] <functionObjectName>
<functionObjectName> (dir) <functionObjectName> (dir)
- <functionObjectName>.H - <functionObjectName>.H
- <functionObjectName>.C - <functionObjectName>.C
- <functionObjectName>FunctionObject.H
- <functionObjectName>FunctionObject.C
- IO<functionObjectName>.H - IO<functionObjectName>.H
- Make (dir) - Make (dir)
- files - files

View File

@ -24,28 +24,39 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "FUNCTIONOBJECT.H" #include "FUNCTIONOBJECT.H"
#include "dictionary.H" #include "Time.H"
#include "fvMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{
namespace functionObjects
{ {
defineTypeNameAndDebug(FUNCTIONOBJECT, 0); defineTypeNameAndDebug(FUNCTIONOBJECT, 0);
addToRunTimeSelectionTable(functionObject, FUNCTIONOBJECT, dictionary);
}
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::FUNCTIONOBJECT::FUNCTIONOBJECT Foam::functionObjects::FUNCTIONOBJECT::FUNCTIONOBJECT
( (
const word& name, const word& name,
const objectRegistry& obr, const Time& runTime,
const dictionary& dict, const dictionary& dict
const bool loadFromFiles
) )
: :
name_(name), functionObject(name),
obr_(obr), obr_
(
runTime.lookupObject<objectRegistry>
(
dict.lookupOrDefault("region", polyMesh::defaultRegion)
)
),
wordData_(dict.lookupOrDefault<word>("wordData", "defaultWord")), wordData_(dict.lookupOrDefault<word>("wordData", "defaultWord")),
scalarData_(readScalar(dict.lookup("scalarData"))), scalarData_(readScalar(dict.lookup("scalarData"))),
labelData_(readLabel(dict.lookup("labelData"))) labelData_(readLabel(dict.lookup("labelData")))
@ -56,34 +67,44 @@ Foam::FUNCTIONOBJECT::FUNCTIONOBJECT
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::FUNCTIONOBJECT::~FUNCTIONOBJECT() Foam::functionObjects::FUNCTIONOBJECT::~FUNCTIONOBJECT()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::FUNCTIONOBJECT::read(const dictionary& dict) bool Foam::functionObjects::FUNCTIONOBJECT::read(const dictionary& dict)
{ {
dict.readIfPresent("wordData", wordData_); dict.readIfPresent("wordData", wordData_);
dict.lookup("scalarData") >> scalarData_; dict.lookup("scalarData") >> scalarData_;
dict.lookup("labelData") >> labelData_; dict.lookup("labelData") >> labelData_;
return true;
} }
void Foam::FUNCTIONOBJECT::execute() bool Foam::functionObjects::FUNCTIONOBJECT::execute(const bool postProcess)
{} {
return true;
}
void Foam::FUNCTIONOBJECT::end() bool Foam::functionObjects::FUNCTIONOBJECT::end()
{} {
return true;
}
void Foam::FUNCTIONOBJECT::timeSet() bool Foam::functionObjects::FUNCTIONOBJECT::timeSet()
{} {
return true;
}
void Foam::FUNCTIONOBJECT::write() bool Foam::functionObjects::FUNCTIONOBJECT::write(const bool postProcess)
{} {
return true;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::FUNCTIONOBJECT Foam::functionObjects::FUNCTIONOBJECT
Group Group
@ -59,7 +59,7 @@ SourceFiles
#ifndef FUNCTIONOBJECT_H #ifndef FUNCTIONOBJECT_H
#define FUNCTIONOBJECT_H #define FUNCTIONOBJECT_H
#include "runTimeSelectionTables.H" #include "functionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -68,22 +68,21 @@ namespace Foam
// Forward declaration of classes // Forward declaration of classes
class objectRegistry; class objectRegistry;
class dictionary;
class polyMesh; namespace functionObjects
class mapPolyMesh; {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class FUNCTIONOBJECT Declaration Class FUNCTIONOBJECT Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class FUNCTIONOBJECT class FUNCTIONOBJECT
:
public functionObject
{ {
// Private data // Private data
//- Name of this set of FUNCTIONOBJECT //- Refererence to the objectRegistry
word name_;
//- Refererence to Db
const objectRegistry& obr_; const objectRegistry& obr_;
// Read from dictionary // Read from dictionary
@ -116,14 +115,12 @@ public:
// Constructors // Constructors
//- Construct for given objectRegistry and dictionary. //- Construct from Time and dictionary
// Allow the possibility to load fields from files
FUNCTIONOBJECT FUNCTIONOBJECT
( (
const word& name, const word& name,
const objectRegistry&, const Time& runTime,
const dictionary&, const dictionary& dict
const bool loadFromFiles = false
); );
@ -133,39 +130,26 @@ public:
// Member Functions // Member Functions
//- Return name of the FUNCTIONOBJECT
const word& name() const
{
return name_;
}
//- Read the FUNCTIONOBJECT data //- Read the FUNCTIONOBJECT data
virtual void read(const dictionary&); virtual bool read(const dictionary&);
//- Execute, currently does nothing //- Execute, currently does nothing
virtual void execute(); virtual bool execute(const bool postProcess = false);
//- Execute at the final time-loop, currently does nothing //- Execute at the final time-loop, currently does nothing
virtual void end(); virtual bool end();
//- Called when time was set at the end of the Time::operator++ //- Called when time was set at the end of the Time::operator++
virtual void timeSet(); virtual bool timeSet();
//- Write the FUNCTIONOBJECT //- Write the FUNCTIONOBJECT
virtual void write(); virtual bool write(const bool postProcess = false);
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const polyMesh&)
{}
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,46 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 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/>.
\*---------------------------------------------------------------------------*/
#include "FUNCTIONOBJECTFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug
(
FUNCTIONOBJECTFunctionObject,
0
);
addToRunTimeSelectionTable
(
functionObject,
FUNCTIONOBJECTFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -1,4 +1,3 @@
FUNCTIONOBJECT.C FUNCTIONOBJECT.C
FUNCTIONOBJECTFunctionObject.C
LIB = $(FOAM_USER_LIBBIN)/libFUNCTIONOBJECTFunctionObject LIB = $(FOAM_USER_LIBBIN)/libFUNCTIONOBJECTFunctionObject