ENH: coded functionObject: added mesh()

This commit is contained in:
mattijs 2011-03-23 09:34:51 +00:00
parent 889b0a0488
commit b60866d98c
4 changed files with 28 additions and 6 deletions

View File

@ -289,7 +289,7 @@
redirectType average; redirectType average;
code code
#{ #{
const volScalarField& p = obr().lookupObject<volScalarField>("p"); const volScalarField& p = mesh().lookupObject<volScalarField>("p");
Info<<"p avg:" << average(p) << endl; Info<<"p avg:" << average(p) << endl;
#}; #};
} }

View File

@ -113,7 +113,7 @@
outputControl outputTime; outputControl outputTime;
code code
#{ #{
const volScalarField& p = obr().lookupObject<volScalarField>("p"); const volScalarField& p = mesh().lookupObject<volScalarField>("p");
Info<<"p avg:" << average(p) << endl; Info<<"p avg:" << average(p) << endl;
#}; #};
} }
@ -229,3 +229,11 @@
- parallel running not tested a lot. What about distributed data - parallel running not tested a lot. What about distributed data
(i.e. non-=NFS=) parallel? (i.e. non-=NFS=) parallel?
- codedFixedValue could be extended to provide local data however
in terms of complexity this is not really worthwhile.
- all templates come from
=etc/codeTemplates/dynamicCode=
=~/.OpenFOAM/dev/codeTemplates/dynamicCode=
=FOAM_TEMPLATE_DIR=

View File

@ -48,6 +48,20 @@ ${localCode}
//}}} end localCode //}}} end localCode
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
const objectRegistry& ${typeName}FunctionObject::obr() const
{
return obr_;
}
const fvMesh& ${typeName}FunctionObject::mesh() const
{
return refCast<const fvMesh>(obr_);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
${typeName}FunctionObject::${typeName}FunctionObject ${typeName}FunctionObject::${typeName}FunctionObject

View File

@ -45,6 +45,7 @@ namespace Foam
class objectRegistry; class objectRegistry;
class dictionary; class dictionary;
class mapPolyMesh; class mapPolyMesh;
class fvMesh;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
A templated functionObject A templated functionObject
@ -67,10 +68,9 @@ class ${typeName}FunctionObject
// Private Member Functions // Private Member Functions
const objectRegistry& obr() const const objectRegistry& obr() const;
{
return obr_; const fvMesh& mesh() const;
}
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
${typeName}FunctionObject(const ${typeName}FunctionObject&); ${typeName}FunctionObject(const ${typeName}FunctionObject&);