error: invalid use of non-static member function

I keep getting the compile error:

vclPCG.C: In member function ‘virtual Foam::solverPerformance Foam::vclPCG::solve(Foam::scalarField&, const scalarField&, Foam::direction) const’:
vclPCG.C:173:33: error: invalid use of non-static member function
ldu2vcl(matrix, ublas_matrix);

for this function:

void ldu2vcl
(
const Foam::lduMatrix & matrix,
boost::numeric::ublas::compressed_matrix<scalar>& ublas_matrix
)
{
uint n = matrix.diag().size(); // matrix size (n x n)
uint nnz = matrix.lower().size() + matrix.upper().size() + matrix.diag().size(); // number of nonzero values (nnz)

// allocat memory for original sparse matrix
uint * r = (uint *)calloc(nnz, sizeof(uint)); // rows
uint * c = (uint *)calloc(nnz, sizeof(uint)); // columns
scalar * v = (scalar *)calloc(nnz, sizeof(scalar)); // values

ldu2org(matrix,r,c,v); // row, column, value is the default order when adding values to an ublas_matrix

for (uint i=0; i < nnz; i++)
{
ublas_matrix(r[i],c[i]) = v[i];
}

// free and release the matrix memory
free(v); free(r); free(c); //colloc()
}

I'm quite new to C++ and I can't find the cause of the problem. Maybe someone has an explanation and a hint to fix it.
¿is that openFoam? ¿what part is your code?

I need to see more context. ¿how is ldu2vcl() declared? ¿is it a member function? ¿of what class? ¿how is being called by Foam::vclPCG::solve()?
(my guess is that `ldu2vcl()' should be a free function, you may simply declare it outside any class or make it static, as you aren''t used the object state)
Topic archived. No new replies allowed.