17 #include <deal.II/lac/petsc_matrix_free.h> 19 #ifdef DEAL_II_WITH_PETSC 21 #include <deal.II/lac/exceptions.h> 22 #include <deal.II/lac/petsc_compatibility.h> 24 DEAL_II_NAMESPACE_OPEN
29 : communicator (PETSC_COMM_SELF)
40 const unsigned int local_rows,
41 const unsigned int local_columns)
42 : communicator (communicator)
52 const std::vector<unsigned int> &local_rows_per_process,
53 const std::vector<unsigned int> &local_columns_per_process,
54 const unsigned int this_process)
55 : communicator (communicator)
57 Assert (local_rows_per_process.size() == local_columns_per_process.size(),
59 local_columns_per_process.size()));
60 Assert (this_process < local_rows_per_process.size(),
64 local_rows_per_process[this_process],
65 local_columns_per_process[this_process]);
72 const unsigned int local_rows,
73 const unsigned int local_columns)
74 : communicator (MPI_COMM_WORLD)
83 const std::vector<unsigned int> &local_rows_per_process,
84 const std::vector<unsigned int> &local_columns_per_process,
85 const unsigned int this_process)
86 : communicator (MPI_COMM_WORLD)
88 Assert (local_rows_per_process.size() == local_columns_per_process.size(),
90 local_columns_per_process.size()));
91 Assert (this_process < local_rows_per_process.size(),
95 local_rows_per_process[this_process],
96 local_columns_per_process[this_process]);
102 const unsigned int m,
103 const unsigned int n,
104 const unsigned int local_rows,
105 const unsigned int local_columns)
119 const unsigned int m,
120 const unsigned int n,
121 const std::vector<unsigned int> &local_rows_per_process,
122 const std::vector<unsigned int> &local_columns_per_process,
123 const unsigned int this_process)
125 Assert (local_rows_per_process.size() == local_columns_per_process.size(),
127 local_columns_per_process.size()));
128 Assert (this_process < local_rows_per_process.size(),
136 local_rows_per_process[this_process],
137 local_columns_per_process[this_process]);
143 const unsigned int n,
144 const unsigned int local_rows,
145 const unsigned int local_columns)
147 reinit (MPI_COMM_WORLD,
m,
n, local_rows, local_columns);
153 const unsigned int n,
154 const std::vector<unsigned int> &local_rows_per_process,
155 const std::vector<unsigned int> &local_columns_per_process,
156 const unsigned int this_process)
158 reinit (MPI_COMM_WORLD,
m,
n, local_rows_per_process, local_columns_per_process, this_process);
193 const PetscErrorCode ierr = MatShellGetContext (A, &this_object);
205 const unsigned int n,
206 const unsigned int local_rows,
207 const unsigned int local_columns)
215 PetscErrorCode ierr = MatCreateShell(
communicator, local_rows, local_columns,
220 ierr = MatShellSetOperation (
matrix, MATOP_MULT,
224 ierr = MatSetFromOptions (
matrix);
230 DEAL_II_NAMESPACE_CLOSE
232 #endif // DEAL_II_WITH_PETSC PetscErrorCode destroy_matrix(Mat &matrix)
virtual void vmult(VectorBase &dst, const VectorBase &src) const =0
#define AssertThrow(cond, exc)
#define Assert(cond, exc)
void reinit(const MPI_Comm &communicator, const unsigned int m, const unsigned int n, const unsigned int local_rows, const unsigned int local_columns)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static int matrix_free_mult(Mat A, Vec src, Vec dst)
void do_reinit(const unsigned int m, const unsigned int n, const unsigned int local_rows, const unsigned int local_columns)
static ::ExceptionBase & ExcInternalError()