Commits

Peter Brune  committed a93ff8c

Mat: Added MatGetLayouts() which allows for access to row and column layouts.

  • Participants
  • Parent commits 255453a

Comments (0)

Files changed (2)

File include/petscmat.h

 PETSC_EXTERN PetscErrorCode MatSetLocalToGlobalMappingBlock(Mat,ISLocalToGlobalMapping,ISLocalToGlobalMapping);
 PETSC_EXTERN PetscErrorCode MatGetLocalToGlobalMapping(Mat,ISLocalToGlobalMapping*,ISLocalToGlobalMapping*);
 PETSC_EXTERN PetscErrorCode MatGetLocalToGlobalMappingBlock(Mat,ISLocalToGlobalMapping*,ISLocalToGlobalMapping*);
+PETSC_EXTERN PetscErrorCode MatGetLayouts(Mat,PetscLayout*,PetscLayout*);
 PETSC_EXTERN PetscErrorCode MatZeroRowsLocal(Mat,PetscInt,const PetscInt [],PetscScalar,Vec,Vec);
 PETSC_EXTERN PetscErrorCode MatZeroRowsLocalIS(Mat,IS,PetscScalar,Vec,Vec);
 PETSC_EXTERN PetscErrorCode MatZeroRowsColumnsLocal(Mat,PetscInt,const PetscInt [],PetscScalar,Vec,Vec);

File src/mat/interface/matrix.c

 }
 
 #undef __FUNCT__
+#define __FUNCT__ "MatGetLayouts"
+/*@
+   MatGetLayouts - Gets the PetscLayout objects for rows and columns
+
+   Not Collective
+
+   Input Parameters:
+.  A - the matrix
+
+   Output Parameters:
++ rmap - row layout
+- cmap - column layout
+
+   Level: advanced
+
+.seealso:  MatGetVecs(), MatGetLocalToGlobalMapping()
+@*/
+PetscErrorCode  MatGetLayouts(Mat A,PetscLayout *rmap,PetscLayout *cmap)
+{
+  PetscFunctionBegin;
+  PetscValidHeaderSpecific(A,MAT_CLASSID,1);
+  PetscValidType(A,1);
+  if (rmap) PetscValidPointer(rmap,2);
+  if (cmap) PetscValidPointer(cmap,3);
+  if (rmap) *rmap = A->rmap;
+  if (cmap) *cmap = A->cmap;
+  PetscFunctionReturn(0);
+}
+
+#undef __FUNCT__
 #define __FUNCT__ "MatSetValuesLocal"
 /*@
    MatSetValuesLocal - Inserts or adds values into certain locations of a matrix,