|
[Sponsors] |
Why Do I Need This Workaround? (Custom functionObject) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 12, 2020, 15:07 |
Why Do I Need This Workaround? (Custom functionObject)
|
#1 |
Member
Conor Crickmore
Join Date: Jan 2020
Location: Leicestershire, United Kingdom
Posts: 36
Rep Power: 6 |
Hey!
As always, I hope everyone is keeping well at the moment! I'm still stumbling my way through self-teaching C++ and basic OpenFOAM editing/development but without the time available to properly devote to learning C++ explicitly, I'm basically building my knowledge one error at a time. Last week I implemented a new functionObject bringing the DESModelRegions functionality from OpenFOAM v2.3 to OpenFOAM v7 with a little help from wyldckat's own implementation but using a slightly different structure as a practice exercise. The function itself works but I've had to implement a small workaround to overcome a compilation error. The problem section is as follows: Code:
{ const icoDESmodel& DES = dynamic_cast<const icoDESmodel&>(turbModel); tmp<volScalarField> tDESfield(DES.LESRegion()); volScalarField &DESmodelRegions = tDESfield.ref(); word result("DESmodelRegions"); return store ( result, DESmodelRegions / dimensionedScalar(dimless, 1) ); } Code:
error: no matching function for call to ‘Foam::functionObjects::DESmodelRegions::store(Foam::word&, Foam::volScalarField&)’ ‘Foam::volScalarField {aka Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}’ is not derived from ‘const Foam::tmp<T>’ Obviously the current implementation works but is far from elegant and I'd like to understand how to avoid it in the future, so if anyone could point out my error I'd be very grateful as always!
__________________
Conor Crickmore PhD Researcher in Automotive Aerodynamics Aeronautical and Automotive Engineering Loughborough University LE11 3TU |
|
October 31, 2020, 15:47 |
|
#2 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
Quote:
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Making my custom functionObject run in parallel | sippanspojk | OpenFOAM Programming & Development | 21 | February 25, 2020 14:13 |
OF-4.x: Multiple Inheritance of a functionObject | A_Pete | OpenFOAM Programming & Development | 1 | September 21, 2016 11:01 |
Problem in sampling data of custom field function in ANSYS FLUENT v14 | apek_great | ANSYS | 1 | February 26, 2014 06:10 |
Create registered object at runtime using a functionObject | CedricVH | OpenFOAM Programming & Development | 21 | November 28, 2012 06:04 |
defining custom convetive terms | CFD user | CFX | 1 | February 22, 2009 23:40 |