| Line 6... |
Line 6... |
|
|
#include "src/st/stimpl.h"
|
#include "src/st/stimpl.h"
|
|
|
#undef __FUNCT__
|
#undef __FUNCT__
|
#define __FUNCT__ "STMatShellMult"
|
#define __FUNCT__ "STMatShellMult"
|
static int STMatShellMult(Mat A,Vec x,Vec y)
|
PetscErrorCode STMatShellMult(Mat A,Vec x,Vec y)
|
{
|
{
|
int ierr;
|
PetscErrorCode ierr;
|
ST ctx;
|
ST ctx;
|
PetscScalar alpha;
|
PetscScalar alpha;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr);
|
ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr);
|
|
|
ierr = MatMult(ctx->A,x,y);CHKERRQ(ierr);
|
ierr = MatMult(ctx->A,x,y);CHKERRQ(ierr);
|
| Line 31... |
Line 31... |
PetscFunctionReturn(0);
|
PetscFunctionReturn(0);
|
}
|
}
|
|
|
#undef __FUNCT__
|
#undef __FUNCT__
|
#define __FUNCT__ "STMatShellGetDiagonal"
|
#define __FUNCT__ "STMatShellGetDiagonal"
|
static int STMatShellGetDiagonal(Mat A,Vec diag)
|
PetscErrorCode STMatShellGetDiagonal(Mat A,Vec diag)
|
{
|
{
|
int ierr;
|
PetscErrorCode ierr;
|
ST ctx;
|
ST ctx;
|
PetscScalar alpha;
|
PetscScalar alpha;
|
Vec diagb;
|
Vec diagb;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr);
|
ierr = MatShellGetContext(A,(void**)&ctx);CHKERRQ(ierr);
|
|
|
ierr = MatGetDiagonal(ctx->A,diag);CHKERRQ(ierr);
|
ierr = MatGetDiagonal(ctx->A,diag);CHKERRQ(ierr);
|
| Line 59... |
Line 59... |
PetscFunctionReturn(0);
|
PetscFunctionReturn(0);
|
}
|
}
|
|
|
#undef __FUNCT__
|
#undef __FUNCT__
|
#define __FUNCT__ "STMatShellCreate"
|
#define __FUNCT__ "STMatShellCreate"
|
int STMatShellCreate(ST st,Mat *mat)
|
PetscErrorCode STMatShellCreate(ST st,Mat *mat)
|
{
|
{
|
int n, m, N, M, ierr;
|
PetscErrorCode ierr;
|
PetscTruth hasA, hasB;
|
int n, m, N, M;
|
|
PetscTruth hasA, hasB;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
ierr = MatGetSize(st->A,&M,&N);CHKERRQ(ierr);
|
ierr = MatGetSize(st->A,&M,&N);CHKERRQ(ierr);
|
ierr = MatGetLocalSize(st->A,&m,&n);CHKERRQ(ierr);
|
ierr = MatGetLocalSize(st->A,&m,&n);CHKERRQ(ierr);
|
ierr = MatCreateShell(st->comm,m,n,M,N,(void*)st,mat);CHKERRQ(ierr);
|
ierr = MatCreateShell(st->comm,m,n,M,N,(void*)st,mat);CHKERRQ(ierr);
|