|
[Sponsors] |
November 30, 2020, 11:00 |
Accessing Pair<volScalarField>
|
#1 |
Senior Member
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 15 |
Hi All,
I have a function: Code:
Pair<volScalarField> f() const { Pair<volScalarField> myObj; // some modification of myObj return myObj; } result of f() with it in this way: Code:
volScalarField vsfObj; vsfObj = f()[0]; Code:
error: no match for ‘operator=’ (operand types are ‘Foam::volScalarField {aka Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}’ and ‘Foam::tmp<Foam::DimensionedField<double, Foam::volMesh> >’)
__________________
best regards pblasiak |
|
December 5, 2020, 04:33 |
|
#2 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40 |
Two things. Normally you'd want to construct the volScalarField with the argument instead of constructing empty and assigning after. But from you error message, it looks like your routine is not returning what it should. You need to check that.
For figuring these things if can be help to try assigning some thing really stupid, for example Code:
// with your "f()" generator std::string junk = f().first(); |
|
December 22, 2020, 09:23 |
|
#3 |
Senior Member
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 15 |
Hi Mark,
Thank you for your reply. You are right my two sides are different. To explain it better I give the line where error is and next the compiler error: Code:
mCond_ = mDotAlphal()[0]*mesh.V(); And here is the error: Code:
error: no match for ‘operator=’ (operand types are ‘Foam::volScalarField {aka Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}’ and ‘Foam::tmp<Foam::DimensionedField<double, Foam::volMesh> >’) mCond_ = mDotAlphal()[0]*mesh.V(); ^
__________________
best regards pblasiak |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM.com] Accessing the root account via Docker | garumple | OpenFOAM Installation | 7 | October 9, 2021 05:22 |
accessing solver data with UDF macros | Dushan | FLUENT | 1 | April 22, 2017 21:05 |
How to define a Macro accessing rad intensity | Grey | FLUENT | 0 | May 21, 2007 00:12 |
accessing gradient in boundary for define_proile | Asghari | FLUENT | 0 | September 19, 2006 02:23 |
UDF & Accessing Turbulence Properties | Dimal | FLUENT | 0 | March 5, 2002 13:14 |