CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   compilation error with setSize (http://www.cfd-online.com/Forums/openfoam-programming-development/112532-compilation-error-setsize.html)

Pascal_doran January 30, 2013 11:56

compilation error with setSize
 
Hi everyone,

I try to introduce a new list (named vorticityMode0_x ) in my solver, but I can't compile the code. The list has to handle parallel calculation. Here's what I wrote :


Code:

List<scalar> vorticityMode0_x(Pstream::nProcs());

vorticityMode0_x[Pstream::myProcNo()].setSize(nLim); // Problem seems from this line

vorticityMode0_x[Pstream::myProcNo()][nxyI] = inX[0]/nz;

Pstream::gatherList(vorticityMode0_x);

Here's the error message :
Code:

Making dependency list for source file vortexCar_FFT.C
SOURCE=vortexCar_FFT.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/ag74290/OpenFOAM/OpenFOAM-2.1.0/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/ag74290/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude -I/home/ag74290/OpenFOAM/OpenFOAM-2.1.0/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/vortexCar_FFT.o
In file included from vortexCar_FFT.C:37:0:
caracterisation.H: In function ‘int caracterisationMain(Foam::vector&, Foam::vector&, Foam::vector&, Foam::vector&, Foam::volVectorField&, int, int, int, int, int, double, double, double, Foam::instantList, int, int)’:
caracterisation.H:75:43: error: request for member ‘setSize’ in ‘vorticityMode0_x.Foam::List<double>::<anonymous>.Foam::UList<T>::operator[] [with T = double, Foam::label = int](Foam::UPstream::myProcNo())’, which is of non-class type ‘double’
caracterisation.H:77:43: error: request for member ‘setSize’ in ‘vorticityMode0_y.Foam::List<double>::<anonymous>.Foam::UList<T>::operator[] [with T = double, Foam::label = int](Foam::UPstream::myProcNo())’, which is of non-class type ‘double’
caracterisation.H:79:43: error: request for member ‘setSize’ in ‘vorticityMode0_z.Foam::List<double>::<anonymous>.Foam::UList<T>::operator[] [with T = double, Foam::label = int](Foam::UPstream::myProcNo())’, which is of non-class type ‘double’
caracterisation.H:118:51: error: invalid types ‘double[int]’ for array subscript
caracterisation.H:118:108: error: invalid types ‘double[int]’ for array subscript
caracterisation.H:118:165: error: invalid types ‘double[int]’ for array subscript
caracterisation.H:123:52: error: invalid types ‘double[int]’ for array subscript
caracterisation.H:123:110: error: invalid types ‘double[int]’ for array subscript
caracterisation.H:123:165: error: invalid types ‘double[int]’ for array subscript
caracterisation.H:123:220: error: invalid types ‘double[int]’ for array subscript
/home/ag74290/OpenFOAM/OpenFOAM-2.1.0/src/finiteVolume/lnInclude/readPISOControls.H: In function ‘int main(int, char**)’:
/home/ag74290/OpenFOAM/OpenFOAM-2.1.0/src/finiteVolume/lnInclude/readPISOControls.H:3:15: warning: unused variable ‘nOuterCorr’ [-Wunused-variable]
/home/ag74290/OpenFOAM/OpenFOAM-2.1.0/src/finiteVolume/lnInclude/readPISOControls.H:12:16: warning: unused variable ‘momentumPredictor’ [-Wunused-variable]
/home/ag74290/OpenFOAM/OpenFOAM-2.1.0/src/finiteVolume/lnInclude/readPISOControls.H:15:16: warning: unused variable ‘transonic’ [-Wunused-variable]
/home/ag74290/OpenFOAM/OpenFOAM-2.1.0/src/finiteVolume/lnInclude/readTimeControls.H:38:8: warning: unused variable ‘maxDeltaT’ [-Wunused-variable]
make: *** [Make/linux64GccDPOpt/vortexCar_FFT.o] Error 1

Thank you very much for your help,
Pascal

wyldckat January 30, 2013 17:48

Greetings Pascal,

I might be wrong, but I think what you want is this:
Code:

List< List<scalar> > vorticityMode0_x(Pstream::nProcs());
At least that's the idea you're giving with the remaining code!

Best regards,
Bruno

Pascal_doran February 5, 2013 19:58

oups... Thank you Bruno!

I was wondering if you knew what is the simple way to merge all the lists from every CPUs into a single list readable by the master CPU?

I though gatherList() was doing it but it seems that it only make all the lists visible from the master CPU.

Thank you
Pascal


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