|October 3, 2005, 04:26||
Hello, I'm trying to expand
Fabian Peng Karrholm
Join Date: Mar 2009
Posts: 61Rep Power: 8
I'm trying to expand the Matrix class to incorporate some standard functions like matrix multiplication. So I want to overload the operator* by including multiplication between two matrices of my new matrix class (which is a subclass to the ordinary Matrix<t> class).
In my superMatrix.H file, I have:
superMatrix<t> operator*(const superMatrix<t>& b);
and then in my .C file:
superMatrix<t> superMatrix<t>::operator*(const superMatrix<t>& b)
When I compile, I get this:
superMatrix/superMatrix.C:77: error: redefinition of 'Foam::superMatrix<t> Foam::superMatrix<t>::operator*(const Foam::superMatrix<t>&)'
superMatrix/superMatrix.C:77: error: 'Foam::superMatrix<t> Foam::superMatrix<t>::operator*(const Foam::superMatrix<t>&)' previously declared here
However, if I include the class in a program, I can use the class to correctly compute the matrix product of two matrices. Anyway, If I remove my added definition of matrix product, and still try to multiply two of my new matrices, I get:
testProg.C:58: error: no match for 'operator*' in 'transponatet * reell'
/users/tfd/f98faka/OpenFOAM/OpenFOAM-1.2/src/OpenFOAM/lnInclude/complexI.H:266: note: candidates are:
'a long list, the only one including matrices is:'
/users/tfd/f98faka/OpenFOAM/OpenFOAM-1.2/src/OpenFOAM/lnInclude/Matrix.C:387: note: Foam::Matrix<t> Foam::operator*(Foam::scalar, const Foam::Matrix<t>&) [with T = Foam::scalar]
So, when I define it, it says I already defined it, but if I don't define it, it says I haven't defined it. I don't have any forward class definitions BTW, or friend things, since I thought I didn't need to define the product as a non-member function.
|Thread||Thread Starter||Forum||Replies||Last Post|
|Cylindrical combustion chamber expanding mesh||Neil||FLUENT||0||October 19, 2006 08:34|
|expanding cylinder surface plots to a plane||klarke||CFX||3||October 7, 2006 19:43|
|Expanding Tube||BALIK||FLUENT||2||October 30, 2003 05:01|
|Expanding meshes||Prashant||Main CFD Forum||4||September 6, 2001 06:17|