Changeset 5895


Ignore:
Timestamp:
09/20/10 07:39:10 (15 years ago)
Author:
Eric.Larour
Message:

Applied NewMat prototype

Location:
issm/trunk/src/c
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/Reduceloadfromgtofx/Reduceloadfromgtofx.cpp

    r5787 r5895  
    2525        int verbose;
    2626        bool kffpartition=false;
     27        bool fromlocalsize=true;
    2728
    2829        parameters->FindParam(&verbose,VerboseEnum);
     
    4748                                /*pf = pf - Kfs * y_s;*/
    4849                                MatGetLocalSize(Kfs,&Kfsm,&Kfsn);
    49                                 Kfsy_s=NewVecFromLocalSize(Kfsm);
     50                                Kfsy_s=NewVec(Kfsm,fromlocalsize);
    5051                                if (flag_ys0){
    5152
  • issm/trunk/src/c/modules/Reduceloadx/Reduceloadx.cpp

    r5772 r5895  
    1818        int Kfsm,Kfsn;
    1919        PetscScalar a;
     20        bool fromlocalsize=true;
    2021       
    2122        if(pf){
     
    2324                /*pf = pf - Kfs * y_s;*/
    2425                MatGetLocalSize(Kfs,&Kfsm,&Kfsn);
    25                 Kfsy_s=NewVecFromLocalSize(Kfsm);
     26                Kfsy_s=NewVec(Kfsm,fromlocalsize);
    2627                if (flag_ys0){
    2728
  • issm/trunk/src/c/modules/SystemMatricesx/SystemMatricesx.cpp

    r5782 r5895  
    5353        if(kflag){
    5454
    55                 if(!buildkff)Kgg=NewMat(gsize,gsize,NULL,&connectivity,&numberofdofspernode);
     55                if(!buildkff)Kgg=NewMat(gsize,gsize,connectivity,numberofdofspernode);
    5656                else{
    57                         Kff=NewMat(fsize,fsize,NULL,&connectivity,&numberofdofspernode);
    58                         Kfs=NewMat(fsize,ssize,NULL,&connectivity,&numberofdofspernode);
     57                        Kff=NewMat(fsize,fsize,connectivity,numberofdofspernode);
     58                        Kfs=NewMat(fsize,ssize,connectivity,numberofdofspernode);
    5959                }
    6060
  • issm/trunk/src/c/objects/Params/PetscMatParam.cpp

    r5103 r5895  
    149149                serial_mat=(double*)xmalloc(M*N*sizeof(double));
    150150                memcpy(serial_mat,marshalled_dataset,M*N*sizeof(double));marshalled_dataset+=(M*N*sizeof(double));
    151                 value=NewMat(M,N,&sparsity,NULL,NULL);
     151                value=NewMat(M,N,sparsity);
    152152                idxm=(int*)xmalloc(M*sizeof(int));
    153153                idxn=(int*)xmalloc(N*sizeof(int));
  • issm/trunk/src/c/toolkits/petsc/patches/MatInvert.cpp

    r3775 r5895  
    3232
    3333        /*Create identitiy matrix: */
    34         identity=NewMat(M,N,&sparsity,NULL,NULL);
     34        identity=NewMat(M,N,sparsity);
    3535        diagonal=NewVec(M);
    3636        VecSet(diagonal,1.0);
  • issm/trunk/src/c/toolkits/petsc/patches/NewMat.cpp

    r5890 r5895  
    7777        int    d_nz,o_nz;
    7878        int    nnz;
     79        MatType type;
     80
    7981
    8082        /*Determine local sizes: */
     
    8688        o_nz=(int)connectivity*numberofdofspernode/2;
    8789
    88         MatCreateMPIAIJ(MPI_COMM_WORLD,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix);
     90        MatCreate(MPI_COMM_WORLD,&outmatrix);
     91        MatSetSizes(outmatrix,m,n,M,N);
     92        MatSetFromOptions(outmatrix);
     93
     94        /*preallocation  according to type: */
     95        MatGetType(outmatrix,&type);
     96        if(strcmp(type,"mpiaij")==0){
     97                MatMPIAIJSetPreallocation(outmatrix,d_nz,NULL,o_nz,NULL);
     98        }
    8999
    90100        return outmatrix;
  • issm/trunk/src/c/toolkits/petsc/patches/petscpatches.h

    r5890 r5895  
    2222
    2323int PetscDetermineLocalSize(int global_size);
    24 Vec NewVec(int size,bool fromlocalsize);
     24Vec NewVec(int size,bool fromlocalsize=false);
    2525Mat NewMat(int M,int N);
    2626Mat NewMat(int M,int N,double sparsity);
Note: See TracChangeset for help on using the changeset viewer.