CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Error search (

linch May 30, 2011 10:20

Error search
Hello all,

on one hand I have following fields (in createFields:H):

    int xN2Points;
    int hPoints;
    Field <scalar> xN2Table(xN2Points,scalar(0.0));
    Field <scalar> hTable(hPoints,scalar(0.0));
    Field <scalarField> rhoTable(hPoints,scalarField(xN2Points,scalar(0.0)));
    volScalarField xN2;
    volScalarField h;
    volScalarField rho;

on the other hand I have a following function (in interpolationLookUp.H).

void bilinInterp(Field<scalar> &X1, Field<scalar> &X2, Field<scalarField> &Y, volScalarField& X1i, volScalarField& X2i, volScalarField& Yi)
As I try to put them together (in createFields.H),

bilinInterp(&xN2Table, &hTable, &rhoTable,  &xN2, &h, &rho);
I get a type missmatch error for createFields:H:

createFields.H:213: error: invalid initialization of non-const reference of type ‘Foam::Field<double>&’ from a temporary of type ‘Foam::Field<double>*’
and for interpolationLookUp.H:

interpolationLookUp.H:1: error: in passing argument 1 of ‘void bilinInterp(Foam::Field<double>&, Foam::Field<double>&, Foam::Field<Foam::Field<double> >&, Foam::volScalarField&, Foam::volScalarField&, Foam::volScalarField&)’
Could somebody please help me to find out what I am doing wrong?

marupio May 30, 2011 12:53

You are passing by reference. Try getting rid of the "&" characters in the function call... but leave them in the prototype.


bilinInterp(xN2Table, hTable, rhoTable,  xN2, h, rho);

linch June 1, 2011 06:53

Thanks David.

All times are GMT -4. The time now is 22:40.