← Back to team overview

dolfin team mailing list archive

Re: [Question #97399]: cannot convert 'dolfin::real' to 'double' for argument '1' to 'double cos(double)

 


Murtazo Nazarov wrote:
> New question #97399 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/97399
> 
> 
> In example in /demo/ode/stiff/cpp/Timedependent1.h I tried to change function f(u,t) into
> 
> 
>   void f(const real* u, real t, real* y)
>   {
>     y[0] = -1000.0 * u[0] + cos(t);
>   }
> 
> But I get a compilation error:
> 
> In file included from main.cpp:12:
> TestProblem1.h: In member function 'virtual void TestProblem1::f(const dolfin::real*, dolfin::real, dolfin::real*)':
> TestProblem1.h:27: error: cannot convert 'dolfin::real' to 'double' for argument '1' to 'double cos(double)'
> scons: *** [main.o] Error 1
> 
> It seems dolfin::real is not double by default for the latest dolfin. Is it bug or I can fix it easily in my code?
> Any suggestion? 
> 

Use 'double'.

Garth

> Thanks,
> Murtazo
> 
> 





Follow ups

References