CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (http://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   Possible bug with tensor2D (http://www.cfd-online.com/Forums/openfoam-bugs/70842-possible-bug-tensor2d.html)

deepsterblue December 7, 2009 20:49

Possible bug with tensor2D
 
The following source fails to compile:

Code:

#include "tensor2D.H"
#include "IOstreams.H"

using namespace Foam;

int main()
{
    tensor2D t1(1, 2, 3, 4);
    tensor2D t2(1, 2, 3, 1);

    tensor2D tt2 = (t1 & t2);

    Info << tt2 << endl;

    return(0);
}

It returns the following error:
Code:

tensor2DTest.C: In function ‘int main()’:
tensor2DTest.C:11: error: conversion from ‘Foam::Tensor<double>’ to non-scalar type ‘Foam::tensor2D’ requested
/home/smenon/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude/Tensor2DI.H: In function ‘typename Foam::innerProduct<Foam::Tensor2D<Cmpt>, Foam::Tensor2D<Cmpt> >::type Foam::operator&(const Foam::Tensor2D<Cmpt>&, const Foam::Tensor2D<Cmpt>&) [with Cmpt = double]’:
tensor2DTest.C:11:  instantiated from here
/home/smenon/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude/Tensor2DI.H:187: error: conversion from ‘Foam::Tensor2D<double>’ to non-scalar type ‘Foam::Tensor<double>’ requested
make: *** [Make/linux64GccDPOpt/tensor2DTest.o] Error 1

This seems odd, since the operator overload is clearly defined in Tensor2DI.H, and I'm not performing any conversions from tensor2D to tensor. Any ideas?

olesen December 8, 2009 03:17

Quote:

Originally Posted by deepsterblue (Post 239039)
The following source fails to compile:
...
/home/smenon/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude/Tensor2DI.H: In function typename Foam::innerProduct... :

This seems odd, since the operator overload is clearly defined in Tensor2DI.H, and I'm not performing any conversions from tensor2D to tensor. Any ideas?

Did you look at 1.6.x first?
If you do, you'll see that this has been fixed. And you'll also see why was previously failing.
Specifically, take a look at commit d8d420a364ddc2b368063f994ca589bccf17a2ed

deepsterblue December 10, 2009 16:01

Mark,
Thanks for pointing me in the right direction...
Call me a git-noob, but is there some way that I can browse the repository (in a web-browser perhaps) to look at a specific revision / commit? I'm looking to avoid downloading the entire thing...

deepsterblue December 10, 2009 16:08

Oops... Never mind.
For those interested... The link is:
http://repo.or.cz/w/OpenFOAM-1.6.x.git/shortlog


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