|
[Sponsors] |
April 28, 2008, 01:27 |
Dear everyone
I made a simp
|
#1 |
Senior Member
|
Dear everyone
I made a simple test about the class scalar, the code are listed below #include "IOstreams.H" #include "scalar.H" using namespace Foam; int main() { scalar s=10; scalar ss=exp(s); #ifdef DP Info<<ss<<endl; #endif } but the compiler always complained with message below test.C:87: error: call of overloaded 'exp(Foam::scalar&)' is ambiguous /usr/include/bits/mathcalls.h:101: note: candidates are: double exp(double) /home/sujunwei/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/Scalar.H:179: note: Foam::doubleScalar Foam::exp(Foam::doubleScalar) /home/sujunwei/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/Scalar.H:179: note: Foam::floatScalar Foam::exp(Foam::floatScalar) anything wrong ? but code with scalar ss=expf(s); it passed ! it seems that the function macro #define transFunc(func) \ inline Scalar func(const Scalar s) \ { \ return ::func##f(s); \ } in floatScalar.H was activated by default ? compilation with double precision is default in OpenFOAM ? |
|
April 28, 2008, 04:59 |
Modify your code to make sure
|
#2 |
Senior Member
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26 |
Modify your code to make sure you select the Foam one:
scalar ss=Foam::exp(s); |
|
April 28, 2008, 06:02 |
Thank you!
|
#3 |
Senior Member
|
Thank you!
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Question about scalar transport | osimonsimon | OpenFOAM Running, Solving & CFD | 33 | August 21, 2020 11:45 |
User Defined Scalar (UDS) question (units) | D | FLUENT | 0 | March 1, 2006 21:04 |
Scalar problem | Dougal McQueen | CFX | 0 | November 21, 2003 08:23 |
scalar ? | pr | Main CFD Forum | 2 | September 1, 2003 01:26 |
user scalar | zhu | CFX | 0 | May 22, 2002 01:38 |