petsc_linear_solver.h File Reference

Go to the source code of this file.

Classes

class  libMesh::PetscMatrix< T >
 
class  libMesh::PetscLinearSolver< T >
 

Namespaces

 libMesh
 

Constant Groups

 libMesh
 

Typedefs

typedef int PetscInt
 

Functions

PetscErrorCode __libmesh_petsc_preconditioner_setup (void *ctx)
 
PetscErrorCode __libmesh_petsc_preconditioner_apply (void *ctx, Vec x, Vec y)
 
PetscErrorCode __libmesh_petsc_preconditioner_setup (PC)
 
PetscErrorCode __libmesh_petsc_preconditioner_apply (PC, Vec x, Vec y)
 

Variables

EXTERN_C_FOR_PETSC_BEGIN
EXTERN_C_FOR_PETSC_END typedef
int 
PetscErrorCode
 

Typedef Documentation

typedef int PetscInt

Definition at line 61 of file petsc_linear_solver.h.

Function Documentation

PetscErrorCode __libmesh_petsc_preconditioner_apply ( void *  ctx,
Vec  x,
Vec  y 
)

This function is called by PETSc to acctually apply the preconditioner. ctx will hold the Preconditioner.

Definition at line 63 of file petsc_linear_solver.C.

Referenced by libMesh::PetscNonlinearSolver< T >::init(), and libMesh::PetscLinearSolver< T >::init().

64  {
65  Preconditioner<Number> * preconditioner = static_cast<Preconditioner<Number>*>(ctx);
66 
67  PetscVector<Number> x_vec(x, preconditioner->comm());
68  PetscVector<Number> y_vec(y, preconditioner->comm());
69 
70  preconditioner->apply(x_vec,y_vec);
71 
72  return 0;
73  }
PetscErrorCode __libmesh_petsc_preconditioner_apply ( PC  ,
Vec  x,
Vec  y 
)

Definition at line 92 of file petsc_linear_solver.C.

References CHKERRQ(), and libMesh::ierr.

93  {
94  void *ctx;
95  PetscErrorCode ierr = PCShellGetContext(pc,&ctx);CHKERRQ(ierr);
96  Preconditioner<Number> * preconditioner = static_cast<Preconditioner<Number>*>(ctx);
97 
98  PetscVector<Number> x_vec(x, preconditioner->comm());
99  PetscVector<Number> y_vec(y, preconditioner->comm());
100 
101  preconditioner->apply(x_vec,y_vec);
102 
103  return 0;
104  }
PetscErrorCode __libmesh_petsc_preconditioner_setup ( void *  ctx)

This function is called by PETSc to initialize the preconditioner. ctx will hold the Preconditioner.

Definition at line 47 of file petsc_linear_solver.C.

References libMesh::err.

Referenced by libMesh::PetscNonlinearSolver< T >::init(), and libMesh::PetscLinearSolver< T >::init().

48  {
49  Preconditioner<Number> * preconditioner = static_cast<Preconditioner<Number>*>(ctx);
50 
51  if(!preconditioner->initialized())
52  {
53  err<<"Preconditioner not initialized! Make sure you call init() before solve!"<<std::endl;
54  libmesh_error();
55  }
56 
57  preconditioner->setup();
58 
59  return 0;
60  }
PetscErrorCode __libmesh_petsc_preconditioner_setup ( PC  )

Definition at line 75 of file petsc_linear_solver.C.

References CHKERRQ(), libMesh::err, and libMesh::ierr.

76  {
77  void *ctx;
78  PetscErrorCode ierr = PCShellGetContext(pc,&ctx);CHKERRQ(ierr);
79  Preconditioner<Number> * preconditioner = static_cast<Preconditioner<Number>*>(ctx);
80 
81  if(!preconditioner->initialized())
82  {
83  err<<"Preconditioner not initialized! Make sure you call init() before solve!"<<std::endl;
84  libmesh_error();
85  }
86 
87  preconditioner->setup();
88 
89  return 0;
90  }

Variable Documentation

EXTERN_C_FOR_PETSC_BEGIN EXTERN_C_FOR_PETSC_END typedef int PetscErrorCode

Petsc include files.

Definition at line 60 of file petsc_linear_solver.h.


Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:07 UTC

Hosted By:
SourceForge.net Logo