How pass dimensionedScalar vector for a function made in C language?.
i'm just a new user of openfoam.
I am trying to implement a function. This function code was implemented in C language. Firstly, I initialize a list of dimensionedScalar, as can be seen below: Code:
// Code:
Code:
double fugacidade(double T, PtrList<dimensionedScalar> Tc, PtrList<dimensionedScalar> Pc, PtrList<dimensionedScalar> wc, double result1) Code:
/home/leonardo/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/PtrList.C: In instantiation of ‘Foam::PtrList<T>::PtrList(const Foam::PtrList<T>&) [with T = Foam::dimensioned<double>]’: |
Hi,
as in fact you don't need a copy of PtrList, you can pass constant reference to the function, i.e. Code:
double fugacidade(const double& T, const PtrList<dimensionedScalar>& Tc, const PtrList<dimensionedScalar>& Pc, const PtrList<dimensionedScalar>& wc, double& result1) |
Thanks for your attention, Alexey Matveichev,
My problem was solved. The function returns result1. |
Well,
if you return value from function, you don't need to pass return value as a parameter to the function. If you'd like to do it FORTRAN style, it's your choice. I mean instead of Code:
fugacidade(thermo1.T()[cellI],Tc,Pc,wc,fug[cellI]); Code:
fug[cellI] = fugacidade(thermo1.T()[cellI],Tc,Pc,wc); |
All times are GMT -4. The time now is 21:55. |