4 #include "fastCommBuffer.h" 5 #include "fddStorage.h" 10 localData =
new T[allocSize];
20 localData =
new T[allocSize];
35 return localData[ref];
69 lineSizes =
new size_t[s];
79 setData( data, lineSizes, s);
87 if (lineSizes != NULL){
100 for (
size_t i = 0; i < s; ++i){
101 this->localData[i] = data[i];
109 #pragma omp parallel for 110 for (
size_t i = 0; i < s; ++i){
111 lineSizes[i] = ls[i];
113 this->localData[i] =
new T [lineSizes[i]];
114 for (
size_t j = 0; j < lineSizes[i]; ++j){
115 this->localData[i][j] = data[i][j];
122 fastCommBuffer buffer(0);
126 buffer.setBuffer(data, s);
129 for (
size_t i = 0; i < this->size; ++i){
131 buffer >> this->localData[i];
137 fastCommBuffer buffer(0);
139 buffer.setBuffer(data, s);
141 for (
size_t i = 0; i < s; ++i){
142 lineSizes[i] = ls[i];
144 this->localData[i] =
new T [lineSizes[i]];
146 buffer.read(this->localData[i], ls[i]*
sizeof(T));
163 if ( this->size == this->allocSize )
164 grow( std::max(this->size + 1,
size_t(this->allocSize*1.5) ) );
165 this->localData[this->size++] = std::move(item);
170 if ( this->size == this->allocSize )
171 grow( std::max(this->size + 1,
size_t(this->allocSize*1.5) ) );
172 lineSizes[this->size] = s;
173 this->localData[this->size++] = item;
192 if (this->allocSize < toSize){
193 if ((this->allocSize * 2) > toSize){
194 toSize = this->allocSize * 2;
197 T * newStorage =
new T [toSize];
200 std::move(this->localData, this->localData + this->size, newStorage);
203 delete [] this->localData;
205 this->localData = newStorage;
206 this->allocSize = toSize;
211 if (this->allocSize < toSize){
212 if ((this->allocSize * 2) > toSize){
213 toSize = this->allocSize * 2;
216 size_t * newLineSizes =
new size_t [toSize];
217 T ** newStorage =
new T* [toSize];
220 std::move(this->localData, this->localData + this->size, newStorage);
221 std::move(this->lineSizes, this->lineSizes + this->size, newLineSizes);
226 delete [] this->localData;
229 this->localData = newStorage;
230 lineSizes = newLineSizes;
231 this->allocSize = toSize;
243 if ( (this->size > 0) && (this->allocSize > this->size) ){
244 T * newStorage =
new T [this->size];
246 std::move(this->localData, this->localData + this->size, newStorage);
248 delete [] this->localData;
250 this->localData = newStorage;
251 this->allocSize = this->size;
256 if ( (this->size > 0) && (this->allocSize > this->size) ){
257 T ** newStorage =
new T* [this->size];
258 size_t * newLineSizes =
new size_t[this->size];
260 std::move(this->localData, this->localData + this->size, newStorage);
261 std::move(this->lineSizes, this->lineSizes + this->size, newLineSizes);
264 delete [] this->localData;
267 this->localData = newStorage;
268 lineSizes = newLineSizes;
269 this->allocSize = this->size;