Ignore:
Timestamp:
05/03/13 15:56:49 (12 years ago)
Author:
Eric.Larour
Message:

CHG: new NORM_FROBENIUS for matrices.
Also fixed a lot of bugs in the norm routines of vectors and matrices in our issm toolkit.
Took out the Assemble2, along with Bucket.h iSend and Recv routiens.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/objects/Bucket.h

    r14868 r14875  
    151151                };
    152152                /*}}}*/
    153                 void SetLocalMatrixValues(double* local_matrix,int lower_row,int global_N){ /*{{{*/
    154 
    155                         int i,j;
    156                         for(i=0;i<m;i++){
    157                                 for(j=0;j<n;j++){
    158                                         *(local_matrix+global_N*(idxm[i]-lower_row)+idxn[j])=*(values+n*i+j);
    159                                 }
    160                         }
    161 
    162                 };
    163                 /*}}}*/
    164                 void SetLocalVectorValues(double* local_vector,int lower_row){ /*{{{*/
    165 
    166                         int i;
    167                         for(i=0;i<m;i++){
    168                                 local_vector[idxm[i]-lower_row]=values[i];
    169                         }
    170                 };
    171                 /*}}}*/
    172153                int BucketType(void){ /*{{{*/
    173154
     
    205186
    206187                        /*increment buffer for next Bucket who will marshall his data: */
    207                         row_indices_forcpu+=m*n;
    208                         col_indices_forcpu+=m*n;
    209                         values_forcpu+=m*n;
    210                         modes_forcpu+=m*n;
     188                        row_indices_forcpu+=(m*n);
     189                        col_indices_forcpu+=(m*n);
     190                        values_forcpu+=(m*n);
     191                        modes_forcpu+=(m*n);
    211192
    212193                        /*output modified buffers: */
     
    221202                        /*intermediary: */
    222203                        int         i;
    223                         int         j;
    224204
    225205                        /*buffers: */
     
    262242                };
    263243                /*}}}*/
    264 #ifdef _HAVE_MPI_
    265                         void Isend(int receiver_rank,MPI_Request* requests,int* pcount,MPI_Comm comm){ /*{{{*/
    266                         int count=0;
    267                         int int_mode;
    268 
    269                         /*Recover pointer: */
    270                         count=*pcount;
    271 
    272                         /*Send all the information required: */
    273                         MPI_Isend(&type,1,MPI_INT,receiver_rank,2,comm,requests+count); count++;
    274                         MPI_Isend(&m,1,MPI_INT,receiver_rank,3,comm,requests+count); count++;
    275                         if(m){ MPI_Isend(idxm,m,MPI_INT,receiver_rank,4,comm,requests+count); count++; }
    276                         if(type==MATRIX_BUCKET){
    277                                 MPI_Isend(&n,1,MPI_INT,receiver_rank,5,comm,requests+count); count++;
    278                                 if(n){ MPI_Isend(idxn,n,MPI_INT,receiver_rank,6,comm,requests+count); count++; }
    279                                 if(m*n){ MPI_Isend(values,m*n,MPI_DOUBLE,receiver_rank,7,comm,requests+count); count++; }
    280                         }
    281                         else{
    282                                 if(m){ MPI_Isend(values,m,MPI_DOUBLE,receiver_rank,7,comm,requests+count); count++; }
    283                         }
    284                         int_mode=(int)mode;
    285                         MPI_Isend(&int_mode,1,MPI_INT,receiver_rank,8,comm,requests+count); count++;
    286 
    287                         /*Allocate pointers: */
    288                         *pcount=count;
    289 
    290                 } /*}}}*/
    291                 void Recv(int sender_rank, MPI_Comm comm){ /*{{{*/
    292 
    293                         MPI_Status status;
    294                         int int_mode;
    295 
    296                         MPI_Recv(&type,1, MPI_INT,sender_rank,2, comm, &status);
    297                         MPI_Recv(&m,1, MPI_INT,sender_rank,3, comm, &status);
    298                         if(m){
    299                                 idxm=new int[m];
    300                                 MPI_Recv(idxm,m, MPI_INT,sender_rank,4, comm, &status);
    301                         }
    302                         if(type==MATRIX_BUCKET){
    303                                 MPI_Recv(&n,1, MPI_INT,sender_rank,5, comm, &status);
    304                                 if(n){
    305                                         idxn=new int[n];
    306                                         MPI_Recv(idxn,n, MPI_INT,sender_rank,6, comm, &status);
    307                                 }
    308                                 if(m*n){
    309                                         values=new doubletype[m*n];
    310                                         MPI_Recv(values,m*n, MPI_DOUBLE,sender_rank,7, comm, &status);
    311                                 }
    312                         }
    313                         else{
    314                                 if(m){
    315                                         values=new doubletype[m];
    316                                         MPI_Recv(values,m, MPI_DOUBLE,sender_rank,7, comm, &status);
    317                                 }
    318                         }
    319                         MPI_Recv(&int_mode,1, MPI_INT,sender_rank,8, comm, &status);
    320                         mode=(InsMode)int_mode;
    321 
    322                 } /*}}}*/
    323 #endif
    324244};
    325245
Note: See TracChangeset for help on using the changeset viewer.