CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to transpose a list of scalar list? (https://www.cfd-online.com/Forums/openfoam-programming-development/111732-how-transpose-list-scalar-list.html)

atoof January 14, 2013 09:12

How to transpose a list of scalar list?
 
Dear Foamers,

I am developing a new code for a reacting flow and using OF2.1.x.
I should read a list of list (which contains scalars) and then transpose it. I did the first step but I can not do the other. The part of the code contains these step is in the following:
Code:

  List<List<scalar> > Y_(dict.lookup("Tin"));
.
.
.
    wordList speciesNames
    (
      dict.lookup("species")
    );
  RectangularMatrix<doubleScalar> Ys(ns, Y_.size());
  forAll(speciesNames, s)
    {
        List<List<scalar> > Ys[s][Y_.size()];
        forAll(Y_,i)
        {
            Ys(s,i) = Y_[i][s];
        }
    }

where dict is dictionary includes list of species and "Tin" has format of:

Tin
(
( 1 2 3 ... )
( 4 5 6 ... )
. . .
)
)

After compiling, I encounter the following errors:
error: ‘RectangularMatrix’ was not declared in this scope
error: expected primary-expression before ‘>’ token
error: ‘Ys’ was not declared in this scope

Mohammad

alundilong January 14, 2013 15:43

Quote:

Originally Posted by atoof (Post 401746)
Dear Foamers,

I am developing a new code for a reacting flow and using OF2.1.x.
I should read a list of list (which contains scalars) and then transpose it. I did the first step but I can not do the other. The part of the code contains these step is in the following:
Code:

  List<List<scalar> > Y_(dict.lookup("Tin"));
.
.
.
    wordList speciesNames
    (
      dict.lookup("species")
    );
  RectangularMatrix<doubleScalar> Ys(ns, Y_.size());
  forAll(speciesNames, s)
    {
        List<List<scalar> > Ys[s][Y_.size()];
        forAll(Y_,i)
        {
            Ys(s,i) = Y_[i][s];
        }
    }

where dict is dictionary includes list of species and "Tin" has format of:

Tin
(
( 1 2 3 ... )
( 4 5 6 ... )
. . .
)
)

After compiling, I encounter the following errors:
error: ‘RectangularMatrix’ was not declared in this scope
error: expected primary-expression before ‘>’ token
error: ‘Ys’ was not declared in this scope

Mohammad

did you include header file defined RectangularMatrix Class?

mturcios777 January 14, 2013 16:56

Edward's answer is correct. To further clarify, the compiler doesn't know how to build template objects RectangularMatrix of the type doubleScalar without information that is contained in the header file for that template class.


All times are GMT -4. The time now is 04:58.