Changeset 23220


Ignore:
Timestamp:
09/05/18 09:47:40 (7 years ago)
Author:
Mathieu Morlighem
Message:

CHG: added switch to MatCreateSubMatrix for PETSc 3.5+

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/solutionsequences/solutionsequence_schurcg.cpp

    r23212 r23220  
    4343    * [ B^T 0 ]
    4444         *         */
     45        #if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_>=8)
     46        MatCreateSubMatrix(Kff,isv,isv,MAT_INITIAL_MATRIX,&A);
     47        MatCreateSubMatrix(Kff,isv,isp,MAT_INITIAL_MATRIX,&B);
     48        MatCreateSubMatrix(Kff,isp,isv,MAT_INITIAL_MATRIX,&BT);
     49        #else
    4550        MatGetSubMatrix(Kff,isv,isv,MAT_INITIAL_MATRIX,&A);
    4651        MatGetSubMatrix(Kff,isv,isp,MAT_INITIAL_MATRIX,&B);
    4752        MatGetSubMatrix(Kff,isp,isv,MAT_INITIAL_MATRIX,&BT);
     53        #endif
    4854       
    4955        /* Extract preconditioner matrix on the pressure space*/
     56        #if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_>=8)
     57        MatCreateSubMatrix(Kff,isp,isp,MAT_INITIAL_MATRIX,&IP);
     58        #else
    5059        MatGetSubMatrix(Kff,isp,isp,MAT_INITIAL_MATRIX,&IP);
     60        #endif
    5161
    5262        /* Get number of velocity / pressure nodes */
     
    313323        * Kff =  |      |
    314324        *                       [B^T IP]
    315   /* To calculate the residual, only the necessary blocks need to be extracted */
     325   * To calculate the residual, only the necessary blocks need to be extracted */
    316326
    317327                /*Extract A, B, B^T */
     328                #if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_>=8)
     329                MatCreateSubMatrix(Kff->pmatrix->matrix,isv,isv,MAT_INITIAL_MATRIX,&A);
     330                MatCreateSubMatrix(Kff->pmatrix->matrix,isv,isp,MAT_INITIAL_MATRIX,&B);
     331                MatCreateSubMatrix(Kff->pmatrix->matrix,isp,isv,MAT_INITIAL_MATRIX,&BT);
     332                #else
    318333                MatGetSubMatrix(Kff->pmatrix->matrix,isv,isv,MAT_INITIAL_MATRIX,&A);
    319334                MatGetSubMatrix(Kff->pmatrix->matrix,isv,isp,MAT_INITIAL_MATRIX,&B);
    320335                MatGetSubMatrix(Kff->pmatrix->matrix,isp,isv,MAT_INITIAL_MATRIX,&BT);
     336                #endif
    321337       
    322338                /*no. of free nodes in velocity/pressure space*/
Note: See TracChangeset for help on using the changeset viewer.