diff --git a/ReleaseNotes-dev b/ReleaseNotes-dev index 4872df9a47..81161c42d7 100644 --- a/ReleaseNotes-dev +++ b/ReleaseNotes-dev @@ -289,7 +289,7 @@ redirectType average; code #{ - const volScalarField& p = obr().lookupObject("p"); + const volScalarField& p = mesh().lookupObject("p"); Info<<"p avg:" << average(p) << endl; #}; } diff --git a/doc/changes/dynamicCode.org b/doc/changes/dynamicCode.org index f51c47b317..16c0b39143 100644 --- a/doc/changes/dynamicCode.org +++ b/doc/changes/dynamicCode.org @@ -113,7 +113,7 @@ outputControl outputTime; code #{ - const volScalarField& p = obr().lookupObject("p"); + const volScalarField& p = mesh().lookupObject("p"); Info<<"p avg:" << average(p) << endl; #}; } @@ -229,3 +229,11 @@ - parallel running not tested a lot. What about distributed data (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= diff --git a/etc/codeTemplates/dynamicCode/functionObjectTemplate.C b/etc/codeTemplates/dynamicCode/functionObjectTemplate.C index 4ccefccde2..f454940bf5 100644 --- a/etc/codeTemplates/dynamicCode/functionObjectTemplate.C +++ b/etc/codeTemplates/dynamicCode/functionObjectTemplate.C @@ -48,6 +48,20 @@ ${localCode} //}}} end localCode +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +const objectRegistry& ${typeName}FunctionObject::obr() const +{ + return obr_; +} + + +const fvMesh& ${typeName}FunctionObject::mesh() const +{ + return refCast(obr_); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // ${typeName}FunctionObject::${typeName}FunctionObject diff --git a/etc/codeTemplates/dynamicCode/functionObjectTemplate.H b/etc/codeTemplates/dynamicCode/functionObjectTemplate.H index 5d90699b30..f2f87a8781 100644 --- a/etc/codeTemplates/dynamicCode/functionObjectTemplate.H +++ b/etc/codeTemplates/dynamicCode/functionObjectTemplate.H @@ -45,6 +45,7 @@ namespace Foam class objectRegistry; class dictionary; class mapPolyMesh; +class fvMesh; /*---------------------------------------------------------------------------*\ A templated functionObject @@ -67,10 +68,9 @@ class ${typeName}FunctionObject // Private Member Functions - const objectRegistry& obr() const - { - return obr_; - } + const objectRegistry& obr() const; + + const fvMesh& mesh() const; //- Disallow default bitwise copy construct ${typeName}FunctionObject(const ${typeName}FunctionObject&);