Actual source code: mhas.c

      1: #define PETSCMAT_DLL

     3:  #include src/mat/matimpl.h
      4:
      7: /*@
      8:     MatHasOperation - Determines whether the given matrix supports the particular
      9:     operation.

     11:    Collective on Mat

     13:    Input Parameters:
     14: +  mat - the matrix
     15: -  op - the operation, for example, MATOP_GET_DIAGONAL

     17:    Output Parameter:
     18: .  has - either PETSC_TRUE or PETSC_FALSE

     20:    Level: advanced

     22:    Notes:
     23:    See the file include/petscmat.h for a complete list of matrix
     24:    operations, which all have the form MATOP_<OPERATION>, where
     25:    <OPERATION> is the name (in all capital letters) of the
     26:    user-level routine.  E.g., MatNorm() -> MATOP_NORM.

     28: .keywords: matrix, has, operation

     30: .seealso: MatCreateShell()
     31: @*/
     32: PetscErrorCode PETSCMAT_DLLEXPORT MatHasOperation(Mat mat,MatOperation op,PetscTruth *has)
     33: {
     35:
     39:   MatPreallocated(mat);
     41:   if (((void **)mat->ops)[op]) {*has =  PETSC_TRUE;}
     42:   else {*has = PETSC_FALSE;}
     43:   return(0);
     44: }