154 int *row_indices_forcpu = NULL;
155 int *modes_forcpu = NULL;
156 doubletype *values_forcpu = NULL;
157 int *numvalues_forcpu = NULL;
158 DataSet **bucketsforcpu = NULL;
160 int **row_indices_fromcpu = NULL;
161 int **col_indices_fromcpu = NULL;
162 int **modes_fromcpu = NULL;
163 doubletype **values_fromcpu = NULL;
164 int *numvalues_fromcpu = NULL;
168 int* sendcnts = NULL;
180 bucketsforcpu=xNew<DataSet*>(num_procs);
182 for(i=0;i<num_procs;i++){
188 bucketsforcpu[i]=bucketsofcpu_i;
200 numvalues_fromcpu = xNew<int>(num_procs);
201 for(i=0;i<num_procs;i++){
205 row_indices_fromcpu=xNew<int*>(num_procs);
206 values_fromcpu=xNew<doubletype*>(num_procs);
207 modes_fromcpu=xNew<int*>(num_procs);
208 for(i=0;i<num_procs;i++){
209 int size=numvalues_fromcpu[i];
211 row_indices_fromcpu[i]=xNew<int>(size);
215 values_fromcpu[i]=xNew<doubletype>(size,
"t");
217 values_fromcpu[i]=xNew<doubletype>(size);
220 modes_fromcpu[i]=xNew<int>(size);
223 row_indices_fromcpu[i]=NULL;
224 values_fromcpu[i]=NULL;
225 modes_fromcpu[i]=NULL;
234 sendcnts=xNew<int>(num_procs);
235 displs=xNew<int>(num_procs);
237 for(i=0;i<num_procs;i++){
238 sendcnts[i]=numvalues_forcpu[i];
240 count+=numvalues_forcpu[i];
243 for(i=0;i<num_procs;i++){
245 ISSM_MPI_Scatterv( values_forcpu, sendcnts, displs, TypeToMPIType<doubletype>(), values_fromcpu[i], numvalues_fromcpu[i], TypeToMPIType<doubletype>(), i, comm);
252 for(i=0;i<num_procs;i++){
253 int numvalues=numvalues_fromcpu[i];
254 int* rows=row_indices_fromcpu[i];
255 doubletype* values=values_fromcpu[i];
256 int* mods=modes_fromcpu[i];
258 for(j=0;j<numvalues;j++){
259 if(mods[j]==
ADD_VAL) *(
vector+(rows[j]-lower_row))+=values[j];
260 else *(
vector+(rows[j]-lower_row))=values[j];
266 xDelete<int>(RowRank);
267 xDelete<int>(row_indices_forcpu);
268 xDelete<int>(modes_forcpu);
269 xDelete<doubletype>(values_forcpu);
270 xDelete<int>(numvalues_forcpu);
272 for(i=0;i<num_procs;i++){
273 DataSet* bucketsn=bucketsforcpu[i];
276 xDelete<DataSet*>(bucketsforcpu);
278 for(i=0;i<num_procs;i++){
279 int* rows=row_indices_fromcpu[i];
280 int* modes=modes_fromcpu[i];
281 doubletype* values=values_fromcpu[i];
285 xDelete<doubletype>(values);
287 xDelete<int*>(row_indices_fromcpu);
288 xDelete<int*>(modes_fromcpu);
289 xDelete<doubletype*>(values_fromcpu);
290 xDelete<int>(numvalues_fromcpu);
292 xDelete<int>(sendcnts);
293 xDelete<int>(displs);