1b45d2f2cSJed Brown #include <petsc-private/matimpl.h> /*I "petscmat.h" I*/ 2c4aff060SBarry Smith 3c4aff060SBarry Smith #undef __FUNCT__ 4c4aff060SBarry Smith #define __FUNCT__ "MatPythonSetType" 5c4aff060SBarry Smith /*@C 6c4aff060SBarry Smith MatPythonSetType - Initalize a Mat object implemented in Python. 7c4aff060SBarry Smith 8c4aff060SBarry Smith Collective on Mat 9c4aff060SBarry Smith 10c4aff060SBarry Smith Input Parameter: 11c4aff060SBarry Smith + mat - the matrix (Mat) object. 12c4aff060SBarry Smith - pyname - full dotted Python name [package].module[.{class|function}] 13c4aff060SBarry Smith 14c4aff060SBarry Smith Options Database Key: 15c4aff060SBarry Smith . -mat_python_type <pyname> 16c4aff060SBarry Smith 17c4aff060SBarry Smith Level: intermediate 18c4aff060SBarry Smith 19c4aff060SBarry Smith .keywords: Mat, Python 20c4aff060SBarry Smith 21186e87acSLisandro Dalcin .seealso: MatCreate(), MatSetType(), MATPYTHON, PetscPythonInitialize() 22c4aff060SBarry Smith @*/ 237087cfbeSBarry Smith PetscErrorCode MatPythonSetType(Mat mat,const char pyname[]) 24c4aff060SBarry Smith { 25c4aff060SBarry Smith PetscErrorCode ierr; 26*5fd66863SKarl Rupp 27c4aff060SBarry Smith PetscFunctionBegin; 280700a824SBarry Smith PetscValidHeaderSpecific(mat,MAT_CLASSID,1); 29c4aff060SBarry Smith PetscValidCharPointer(pyname,2); 304ac538c5SBarry Smith ierr = PetscTryMethod(mat,"MatPythonSetType_C",(Mat, const char[]),(mat,pyname));CHKERRQ(ierr); 31c4aff060SBarry Smith PetscFunctionReturn(0); 32c4aff060SBarry Smith } 33c4aff060SBarry Smith 34c4aff060SBarry Smith 35c4aff060SBarry Smith /*@C 36c4aff060SBarry Smith MatPythonCreate - Create a Mat object implemented in Python. 37c4aff060SBarry Smith 38c4aff060SBarry Smith Collective on Mat 39c4aff060SBarry Smith 40c4aff060SBarry Smith Input Parameters: 41c4aff060SBarry Smith + comm - MPI communicator 42c4aff060SBarry Smith . m - number of local rows (or PETSC_DECIDE to have calculated if M is given) 43c4aff060SBarry Smith . n - number of local columns (or PETSC_DECIDE to have calculated if N is given) 44c4aff060SBarry Smith . M - number of global rows (or PETSC_DECIDE to have calculated if m is given) 45c4aff060SBarry Smith . N - number of global columns (or PETSC_DECIDE to have calculated if n is given) 46c4aff060SBarry Smith - pyname - full dotted Python name [package].module[.{class|function}] 47c4aff060SBarry Smith 48c4aff060SBarry Smith Output Parameter: 49c4aff060SBarry Smith . A - the matrix 50c4aff060SBarry Smith 51c4aff060SBarry Smith Level: intermediate 52c4aff060SBarry Smith 53c4aff060SBarry Smith .keywords: Mat, Python 54c4aff060SBarry Smith 55c4aff060SBarry Smith .seealso: MATPYTHON, MatPythonSetType(), PetscPythonInitialize() 56c4aff060SBarry Smith 57c4aff060SBarry Smith @*/ 58c4aff060SBarry Smith #undef __FUNCT__ 59c4aff060SBarry Smith #define __FUNCT__ "MatPythonCreate" 607087cfbeSBarry Smith PetscErrorCode MatPythonCreate(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const char pyname[],Mat *A) 61c4aff060SBarry Smith { 62c4aff060SBarry Smith PetscErrorCode ierr; 63*5fd66863SKarl Rupp 64c4aff060SBarry Smith PetscFunctionBegin; 65c4aff060SBarry Smith PetscValidCharPointer(pyname,6); 66c4aff060SBarry Smith PetscValidPointer(A,6); 67c4aff060SBarry Smith ierr = MatCreate(comm,A);CHKERRQ(ierr); 68c4aff060SBarry Smith ierr = MatSetSizes(*A,m,n,M,N);CHKERRQ(ierr); 69c4aff060SBarry Smith ierr = MatSetType(*A,MATPYTHON);CHKERRQ(ierr); 70c4aff060SBarry Smith ierr = MatPythonSetType(*A,pyname);CHKERRQ(ierr); 71c4aff060SBarry Smith PetscFunctionReturn(0); 72c4aff060SBarry Smith } 73