From 38b9b80a3538b261350addd1d859652d91c47c5c Mon Sep 17 00:00:00 2001 From: boufaras Date: Thu, 12 May 2011 14:03:01 +0000 Subject: [PATCH] implement size setter git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2228 331e1502-861f-0410-8da2-ba01fb791d7f --- .../src/GPUType/moGPURealVector.h | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/branches/ParadisEO-GPU/src/GPUType/moGPURealVector.h b/branches/ParadisEO-GPU/src/GPUType/moGPURealVector.h index b9004a645..786ea60aa 100644 --- a/branches/ParadisEO-GPU/src/GPUType/moGPURealVector.h +++ b/branches/ParadisEO-GPU/src/GPUType/moGPURealVector.h @@ -70,15 +70,6 @@ public: create(); } - /** - *Assignment operator - *@param _vector The vector passed to the function to fix the new content. - *@return a new vector. - */ - - moGPURealVector& operator=(const moGPURealVector & _vector) { - moGPUVector::operator=(_vector); - } /** *Initializer of random real vector. @@ -88,6 +79,31 @@ public: vect[i] = (float) rng.rand() / RAND_MAX; } + /** + *Function inline to set the size of vector, called from host. + *@param _size the vector size + */ + + virtual inline __host__ void setSize(unsigned _size) { + + if(_size tmp_vect(_size); + for (unsigned i = 0; i < tmp_vect.N; i++) + tmp_vect.vect[i]= vect[i]; + (tmp_vect).invalidate(); + (*this)=tmp_vect; + } + else if(_size>N) { + moGPURealVector tmp_vect(_size); + for (unsigned i = 0; i