/*@C MatCreateScatter - Creates a new matrix based on a VecScatter Collective on MPI_Comm Input Parameters: + comm - MPI communicator - scatter - a VecScatterContext Output Parameter: . A - the matrix Level: intermediate PETSc requires that matrices and vectors being used for certain operations are partitioned accordingly. For example, when creating a scatter matrix, A, that supports parallel matrix-vector products using MatMult(A,x,y) the user should set the number of local matrix rows to be the number of local elements of the corresponding result vector, y. Note that this is information is required for use of the matrix interface routines, even though the scatter matrix may not actually be physically partitioned. .keywords: matrix, scatter, create .seealso: MatScatterSetVecScatter(), MatScatterGetVecScatter(), MATSCATTER @*/ PetscErrorCode MatCreateScatter(MPI_Comm comm,VecScatter scatter,Mat *A) { PetscErrorCode ierr; PetscFunctionBegin; ierr = MatCreate(comm,A); CHKERRQ(ierr); ierr = MatSetSizes(*A,scatter->to_n,scatter->from_n,PETSC_DETERMINE,PETSC_DETERMINE); CHKERRQ(ierr); ierr = MatSetType(*A,MATSCATTER); CHKERRQ(ierr); ierr = MatScatterSetVecScatter(*A,scatter); CHKERRQ(ierr); ierr = MatSetUp(*A); CHKERRQ(ierr); PetscFunctionReturn(0); }
EXTERN_C_END #undef __FUNCT__ #define __FUNCT__ "MatCreateScatter" /*@C MatCreateScatter - Creates a new matrix based on a VecScatter Collective on MPI_Comm Input Parameters: + comm - MPI communicator - scatter - a VecScatterContext Output Parameter: . A - the matrix Level: intermediate PETSc requires that matrices and vectors being used for certain operations are partitioned accordingly. For example, when creating a scatter matrix, A, that supports parallel matrix-vector products using MatMult(A,x,y) the user should set the number of local matrix rows to be the number of local elements of the corresponding result vector, y. Note that this is information is required for use of the matrix interface routines, even though the scatter matrix may not actually be physically partitioned. For example, .keywords: matrix, scatter, create .seealso: MatScatterSetVecScatter(), MatScatterGetVecScatter(), MATSCATTER @*/ PetscErrorCode PETSCMAT_DLLEXPORT MatCreateScatter(MPI_Comm comm,VecScatter scatter,Mat *A) { PetscErrorCode ierr; PetscFunctionBegin; ierr = MatCreate(comm,A);CHKERRQ(ierr); ierr = MatSetSizes(*A,scatter->to_n,scatter->from_n,PETSC_DETERMINE,PETSC_DETERMINE);CHKERRQ(ierr); ierr = MatSetType(*A,MATSCATTER);CHKERRQ(ierr); ierr = MatScatterSetVecScatter(*A,scatter);CHKERRQ(ierr); PetscFunctionReturn(0); }
PETSC_EXTERN void PETSC_STDCALL matscattersetvecscatter_(Mat mat,VecScatter scatter, int *__ierr ){ *__ierr = MatScatterSetVecScatter( (Mat)PetscToPointer((mat) ), (VecScatter)PetscToPointer((scatter) )); }