Changeset 16424
- Timestamp:
- 10/16/13 08:36:27 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/toolkits/issm/IssmMpiSparseMat.h
r16419 r16424 192 192 int* this_row_mods = NULL; 193 193 doubletype* this_row_values = NULL; 194 int* numvalues_perrow = NULL; 194 195 int row; 195 196 … … 274 275 /*Plug values into global matrix. To do so, we are going to first figure out how many overall values each sparse row is going to get, then we fill up these values, and give it to each sparse row: {{{*/ 275 276 GetOwnershipBoundariesFromRange(&lower_row,&upper_row,m,comm); 277 278 /*Figure out how many values each row is going to get: */ 279 numvalues_perrow=xNewZeroInit<int>(this->m); 280 for(i=0;i<num_procs;i++){ 281 int numvalues=numvalues_fromcpu[i]; 282 int* rows=row_indices_fromcpu[i]; 283 for(j=0;j<numvalues;j++)numvalues_perrow[rows[j]-lower_row]++; 284 } 285 276 286 277 287 /*Deal with sparse row one at a time: */ 278 288 for(row=0;row<this->m;row++){ 279 289 280 /*figure out how many values this row is going to get: */281 count=0;282 for(i=0;i<num_procs;i++){283 int numvalues=numvalues_fromcpu[i];284 int* rows=row_indices_fromcpu[i];285 for(j=0;j<numvalues;j++)if((rows[j]-lower_row)==row)count++;286 }287 288 290 /*Allocate: */ 289 this_row_numvalues= count;291 this_row_numvalues=numvalues_perrow[row]; 290 292 this_row_cols=xNew<int>(this_row_numvalues); 291 293 this_row_values=xNew<doubletype>(this_row_numvalues); … … 323 325 324 326 /*Free ressources:{{{*/ 327 xDelete<int>(numvalues_perrow); 325 328 xDelete<int>(RowRank); 326 329 xDelete<int>(row_indices_forcpu);
Note:
See TracChangeset
for help on using the changeset viewer.