Changeset 6852


Ignore:
Timestamp:
12/29/10 18:16:08 (14 years ago)
Author:
Eric.Larour
Message:

Adjustments to Petsc version 3

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

Legend:

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

    r6412 r6852  
    3131        bool       fromlocalsize    = true;
    3232
     33        #if _PETSC_VERSION_ == 3
     34        const MatType type;
     35        #endif
     36
    3337
    3438        /*Display message*/
     
    4044                *puf=NULL; return;
    4145        }
     46
     47        /*Now, check that we are not getting an initial guess to the solver, if we are running a direct solver: */
     48        #if _PETSC_VERSION_ == 3
     49        MatGetType(Kff,&type);
     50        if (strcmp(type,"mpidense")==0)uf0=NULL;
     51        #endif
    4252       
    4353
  • issm/trunk/src/c/modules/SystemMatricesx/SystemMatricesx.cpp

    r6412 r6852  
    3030        /*Display message*/
    3131        _printf_(VerboseModule(),"   Generating matrices\n");
     32
     33
    3234
    3335        /*retrive parameters: */
     
    7476                        MatAssemblyBegin(Kgg,MAT_FINAL_ASSEMBLY);
    7577                        MatAssemblyEnd(Kgg,MAT_FINAL_ASSEMBLY);
     78                        #if _PETSC_VERSION_ == 2
    7679                        MatCompress(Kgg);
     80                        #endif
    7781                }
    7882                else{
    7983                        MatAssemblyBegin(Kff,MAT_FINAL_ASSEMBLY);
    8084                        MatAssemblyEnd(Kff,MAT_FINAL_ASSEMBLY);
     85                        #if _PETSC_VERSION_ == 2
    8186                        MatCompress(Kff);
     87                        #endif
    8288
    8389                        MatAssemblyBegin(Kfs,MAT_FINAL_ASSEMBLY);
    8490                        MatAssemblyEnd(Kfs,MAT_FINAL_ASSEMBLY);
     91                        #if _PETSC_VERSION_ == 2
    8592                        MatCompress(Kfs);
     93                        #endif
    8694                }
    8795        }
    88         if(pflag){
     96if(pflag){
    8997
    9098                if(!buildkff)pg=NewVec(gsize);
     
    130138                        MatAssemblyBegin(Kgg,MAT_FINAL_ASSEMBLY);
    131139                        MatAssemblyEnd(Kgg,MAT_FINAL_ASSEMBLY);
     140                        #if _PETSC_VERSION_ == 2
    132141                        MatCompress(Kgg);
     142                        #endif
    133143                }
    134144                else{
    135145                        MatAssemblyBegin(Kff,MAT_FINAL_ASSEMBLY);
    136146                        MatAssemblyEnd(Kff,MAT_FINAL_ASSEMBLY);
     147                        #if _PETSC_VERSION_ == 2
    137148                        MatCompress(Kff);
     149                        #endif
    138150
    139151                        MatAssemblyBegin(Kfs,MAT_FINAL_ASSEMBLY);
    140152                        MatAssemblyEnd(Kfs,MAT_FINAL_ASSEMBLY);
     153                        #if _PETSC_VERSION_ == 2
    141154                        MatCompress(Kfs);
     155                        #endif
    142156                }
    143157        }
    144         if(penalty_pflag){
     158if(penalty_pflag){
    145159
    146160                /*Fill right hand side vector, from loads: */
  • issm/trunk/src/c/shared/Numerics/PetscOptionsFromAnalysis.cpp

    r6412 r6852  
    6565        /*now, reset the options database with this string. Taken from petsc/install/src/sys/objects/pinit.c. This
    6666         *capability is not covered by Petsc!: */
     67
     68        #if _PETSC_VERSION_ == 2
    6769        PetscOptionsDestroy();
    6870        PetscOptionsCreate();
     
    7173        PetscOptionsSetFromOptions();
    7274        PetscOptionsInsertMultipleString(string); //our patch
     75        #else
     76        PetscOptionsSetFromOptions();
     77        PetscOptionsClear();
     78        //PetscOptionsSetFromOptions();
     79        PetscOptionsInsertMultipleString(string); //our patch
     80        #endif
     81
    7382
    7483        /*Free ressources:{{{1*/
  • issm/trunk/src/c/toolkits/petsc/patches/MatPartition.cpp

    r3595 r6852  
    9191                csize=PetscDetermineLocalSize(col_partition_vector_size);
    9292                if(col_partition_vector_size==row_partition_vector_size){
     93                        #if _PETSC_VERSION_ == 3
     94                        MatGetSubMatrix(matrixA,row_index,col_index,MAT_INITIAL_MATRIX,&outmatrix);
     95                        #else
    9396                        MatGetSubMatrix(matrixA,row_index,col_index,count,MAT_INITIAL_MATRIX,&outmatrix);
     97                        #endif
    9498                }
    9599                else{
     100                        #if _PETSC_VERSION_ == 3
     101                        MatGetSubMatrix(matrixA,row_index,col_index,MAT_INITIAL_MATRIX,&outmatrix);
     102                        #else
    96103                        MatGetSubMatrix(matrixA,row_index,col_index,csize,MAT_INITIAL_MATRIX,&outmatrix);
     104                        #endif
    97105                }
    98106
  • issm/trunk/src/c/toolkits/petsc/patches/NewMat.cpp

    r6006 r6852  
    7777        int    d_nz,o_nz;
    7878        int    nnz;
     79
     80        #if _PETSC_VERSION_ == 3
     81        const MatType type;
     82        #else
    7983        MatType type;
     84        #endif
     85
    8086
    8187
     
    8389        m=PetscDetermineLocalSize(M);
    8490        n=PetscDetermineLocalSize(N);
    85        
     91
    8692        /*Figure out number of non zeros per row: */
    8793        d_nz=(int)connectivity*numberofdofspernode/2;
     
    9298        MatSetFromOptions(outmatrix);
    9399
     100       
     101
    94102        /*preallocation  according to type: */
    95103        MatGetType(outmatrix,&type);
     104       
     105        #if _PETSC_VERSION_ == 2
    96106        if((strcmp(type,"mpiaij")==0) || (strcmp(type,"aijmumps")==0)){
    97107                MatMPIAIJSetPreallocation(outmatrix,d_nz,NULL,o_nz,NULL);
    98108        }
     109        #else
     110        if((strcmp(type,"mpiaij")==0) || (strcmp(type,"mpidense")==0)){
     111                MatMPIAIJSetPreallocation(outmatrix,d_nz,NULL,o_nz,NULL);
     112        }
     113        #endif
    99114
    100115        return outmatrix;
Note: See TracChangeset for help on using the changeset viewer.