Vector Declaration
Hi,
I'm trying to declare a vector list inside a for loop while reading vectors from another list. Here is the for loop. I'm getting an error on the vector delcaration. for(int c=0; c<turbNum ;c++) { List<List<vector> > nacHubGrd[c,0]=nacLocation[c]; Info<<nacHubGrd<<endl; } Apparently I need to declare the size of the List. I'm not sure how to do this. I appreciate any help! Thanks! |
Hi Tony,
you have to declare and initialize your field before accessing single columns. A vectorListList of size nxm can be declared and initialized zero as follows: Code:
List<List<vector> > nacHubGrd (n, List<vector>(m, vector::zero)) Code:
nacHubGrad[i][j] //one single vector Stefan |
Thanks a lot Stefan, that worked perfectly!
ok, now it's getting a little bit more complicated and I need to do another list. Im trying: List<List<List<vector> > > bladePoints (turbNum,bladeNum, List<vector>(3, vector::zero)); but its not working, Any suggestions? Thanks! |
It's proof by induction! Actually, it is just a simple extension of Stefan's example, but maybe formatting it a little differently will help you to understand:
Code:
label l(2),m(3),n(4); |
Thanks David!
|
All times are GMT -4. The time now is 12:39. |