CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Bugs (
-   -   OpenFOAM-1.5-dev svn revision 1438: libOpenFOAM does not compile in SP (

4xF October 14, 2009 12:02

OpenFOAM-1.5-dev svn revision 1438: libOpenFOAM does not compile in SP
Hi all!

I came across this showstopper yesterday while trying to compile the svn rev. #1438 of the OpenFoam-1.5-dev repository. While compile in DP works fine, compiling in SP (single precision) produces the following output:

wmake libso OpenFoam
interpolations/RBFInterpolation/RBFFunctions/W2/W2.C: In member function ‘virtual Foam::tmp<Foam::Field<float> > Foam::W2::weights(const Foam::vectorField&, const Foam::vector&) const’:
interpolations/RBFInterpolation/RBFFunctions/W2/W2.C:68: error: no matching function for call to ‘max(Foam::tmp<Foam::Field<float> >, double)’
lnInclude/label.H:190: note: candidates are: char Foam::max(char, char)
lnInclude/label.H:191: note: short int Foam::max(short int, short int)
lnInclude/label.H:192: note: int Foam::max(int, int)
lnInclude/label.H:193: note: long int Foam::max(long int, long int)
lnInclude/label.H:194: note: long long int Foam::max(long long int, long long int)
lnInclude/label.H:196: note: unsigned char Foam::max(unsigned char, unsigned char)
lnInclude/label.H:197: note: short unsigned int Foam::max(short unsigned int, short unsigned int)
lnInclude/label.H:198: note: unsigned int Foam::max(unsigned int, unsigned int)
lnInclude/label.H:199: note: long unsigned int Foam::max(long unsigned int, long unsigned int)
lnInclude/label.H:200: note: long long unsigned int Foam::max(long long unsigned int, long long unsigned int)
lnInclude/label.H:202: note: long int Foam::max(int, long int)
lnInclude/label.H:203: note: long long int Foam::max(int, long long int)
lnInclude/label.H:204: note: long long int Foam::max(long long int, int)
lnInclude/doubleFloat.H:92: note: double Foam::max(double, double)
lnInclude/doubleFloat.H:93: note: double Foam::max(double, float)
lnInclude/doubleFloat.H:94: note: double Foam::max(float, double)
lnInclude/doubleFloat.H:95: note: float Foam::max(float, float)
lnInclude/doubleFloat.H:96: note: double Foam::max(double, int)
lnInclude/doubleFloat.H:97: note: double Foam::max(int, double)
lnInclude/doubleFloat.H:98: note: double Foam::max(double, long int)
lnInclude/doubleFloat.H:99: note: double Foam::max(long int, double)
lnInclude/doubleFloat.H:100: note: float Foam::max(float, int)
lnInclude/doubleFloat.H:101: note: float Foam::max(int, float)
lnInclude/doubleFloat.H:102: note: float Foam::max(float, long int)
lnInclude/doubleFloat.H:103: note: float Foam::max(long int, float)
make: *** [Make/linux64GccSPOpt/W2.o] Error 1
make: *** Waiting for unfinished jobs....

Culprit is obviously src/OpenFOAM/interpolations/RBFInterpolation/RBFFunctions/W2/W2.C using a Foam::max function for a single precision scalar field which has not been declared. I would fix it by myself, but I have no idea where to start.

Anyone want to try? Enlighten me...

4xF October 14, 2009 12:20

This is an issue raised by Henry in this thread:

So the fix is to replace on line #68 in the file
src/OpenFOAM/interpolations/RBFInterpolation/RBFFunctions/W2/W2.C :

Foam::max(pow4(1 - (dist/radius_)), 0.0)
Foam::max(pow4(1 - (dist/radius_)), scalar(0.0))

Can anyone commit the fix to the svn repo?


4xF October 15, 2009 06:15

Additional source files to be modified
In 1.5-dev, the following source files need to be also modified in order to be able to compile in single precision:

  • applications/solvers/newStressAnalysis/newContactStressFoam/contactPatchPair.C
  • applications/solvers/multiphase/barotropicCavitatingFoam/rhoEqn.H
  • src/finiteArea/finiteArea/fam/famSup.C
In all these files min([...],0.0) and max([...],0.0) need to be replaced by:
min([...], scalar(0.0)) and max([...], scalar(0.0)) respectively.

hjasak October 16, 2009 05:35

My fault: thank you, I'll check it in now.


All times are GMT -4. The time now is 08:47.