Actual source code: pythonmat.c

petsc-3.5.1 2014-07-31
Report Typos and Errors
  1: #include <petsc-private/matimpl.h>          /*I "petscmat.h" I*/

  5: /*@C
  6:    MatPythonSetType - Initalize a Mat object implemented in Python.

  8:    Collective on Mat

 10:    Input Parameter:
 11: +  mat - the matrix (Mat) object.
 12: -  pyname - full dotted Python name [package].module[.{class|function}]

 14:    Options Database Key:
 15: .  -mat_python_type <pyname>

 17:    Level: intermediate

 19: .keywords: Mat, Python

 21: .seealso: MatCreate(), MatSetType(), MATPYTHON, PetscPythonInitialize()
 22: @*/
 23: PetscErrorCode  MatPythonSetType(Mat mat,const char pyname[])
 24: {

 30:   PetscTryMethod(mat,"MatPythonSetType_C",(Mat, const char[]),(mat,pyname));
 31:   return(0);
 32: }


 35: /*@C
 36:    MatPythonCreate - Create a Mat object implemented in Python.

 38:    Collective on Mat

 40:    Input Parameters:
 41: +  comm - MPI communicator
 42: .  m - number of local rows (or PETSC_DECIDE to have calculated if M is given)
 43: .  n - number of local columns (or PETSC_DECIDE to have calculated if N is given)
 44: .  M - number of global rows (or PETSC_DECIDE to have calculated if m is given)
 45: .  N - number of global columns (or PETSC_DECIDE to have calculated if n is given)
 46: -  pyname - full dotted Python name [package].module[.{class|function}]

 48:    Output Parameter:
 49: .  A - the matrix

 51:    Level: intermediate

 53: .keywords: Mat, Python

 55: .seealso: MATPYTHON, MatPythonSetType(), PetscPythonInitialize()

 57: @*/
 60: PetscErrorCode  MatPythonCreate(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const char pyname[],Mat *A)
 61: {

 67:   MatCreate(comm,A);
 68:   MatSetSizes(*A,m,n,M,N);
 69:   MatSetType(*A,MATPYTHON);
 70:   MatPythonSetType(*A,pyname);
 71:   return(0);
 72: }