Commit ee0aff67 authored by Henry Weller's avatar Henry Weller
Browse files

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

parent 248ab459
......@@ -42,8 +42,6 @@ Usage: $Script [-h | -help] <functionObjectName>
<functionObjectName> (dir)
- <functionObjectName>.H
- <functionObjectName>.C
- <functionObjectName>FunctionObject.H
- <functionObjectName>FunctionObject.C
- IO<functionObjectName>.H
- Make (dir)
- files
......
......@@ -24,28 +24,39 @@ License
\*---------------------------------------------------------------------------*/
#include "FUNCTIONOBJECT.H"
#include "dictionary.H"
#include "Time.H"
#include "fvMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(FUNCTIONOBJECT, 0);
addToRunTimeSelectionTable(functionObject, FUNCTIONOBJECT, dictionary);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::FUNCTIONOBJECT::FUNCTIONOBJECT
Foam::functionObjects::FUNCTIONOBJECT::FUNCTIONOBJECT
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
const Time& runTime,
const dictionary& dict
)
:
name_(name),
obr_(obr),
functionObject(name),
obr_
(
runTime.lookupObject<objectRegistry>
(
dict.lookupOrDefault("region", polyMesh::defaultRegion)
)
),
wordData_(dict.lookupOrDefault<word>("wordData", "defaultWord")),
scalarData_(readScalar(dict.lookup("scalarData"))),
labelData_(readLabel(dict.lookup("labelData")))
......@@ -56,34 +67,44 @@ Foam::FUNCTIONOBJECT::FUNCTIONOBJECT
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::FUNCTIONOBJECT::~FUNCTIONOBJECT()
Foam::functionObjects::FUNCTIONOBJECT::~FUNCTIONOBJECT()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::FUNCTIONOBJECT::read(const dictionary& dict)
bool Foam::functionObjects::FUNCTIONOBJECT::read(const dictionary& dict)
{
dict.readIfPresent("wordData", wordData_);
dict.lookup("scalarData") >> scalarData_;
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;
}
// ************************************************************************* //
......@@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::FUNCTIONOBJECT
Foam::functionObjects::FUNCTIONOBJECT
Group
......@@ -59,7 +59,7 @@ SourceFiles
#ifndef FUNCTIONOBJECT_H
#define FUNCTIONOBJECT_H
#include "runTimeSelectionTables.H"
#include "functionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -68,22 +68,21 @@ namespace Foam
// Forward declaration of classes
class objectRegistry;
class dictionary;
class polyMesh;
class mapPolyMesh;
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class FUNCTIONOBJECT Declaration
\*---------------------------------------------------------------------------*/
class FUNCTIONOBJECT
:
public functionObject
{
// Private data
//- Name of this set of FUNCTIONOBJECT
word name_;
//- Refererence to Db
//- Refererence to the objectRegistry
const objectRegistry& obr_;
// Read from dictionary
......@@ -116,14 +115,12 @@ public:
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
FUNCTIONOBJECT
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary& dict
);
......@@ -133,39 +130,26 @@ public:
// Member Functions
//- Return name of the FUNCTIONOBJECT
const word& name() const
{
return name_;
}
//- Read the FUNCTIONOBJECT data
virtual void read(const dictionary&);
virtual bool read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
virtual bool execute(const bool postProcess = false);
//- 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++
virtual void timeSet();
virtual bool timeSet();
//- Write the FUNCTIONOBJECT
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const polyMesh&)
{}
virtual bool write(const bool postProcess = false);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
);
}
// ************************************************************************* //
FUNCTIONOBJECT.C
FUNCTIONOBJECTFunctionObject.C
LIB = $(FOAM_USER_LIBBIN)/libFUNCTIONOBJECTFunctionObject
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment