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)
50 const MPI_Comm & communicator,
53 const std::vector<unsigned int> &local_rows_per_process,
54 const std::vector<unsigned int> &local_columns_per_process,
55 const unsigned int this_process)
56 : communicator(communicator)
58 Assert(local_rows_per_process.size() == local_columns_per_process.size(),
60 local_columns_per_process.size()));
65 local_rows_per_process[this_process],
66 local_columns_per_process[this_process]);
73 const unsigned int local_rows,
74 const unsigned int local_columns)
75 : communicator(MPI_COMM_WORLD)
85 const std::vector<unsigned int> &local_rows_per_process,
86 const std::vector<unsigned int> &local_columns_per_process,
87 const unsigned int this_process)
88 : communicator(MPI_COMM_WORLD)
90 Assert(local_rows_per_process.size() == local_columns_per_process.size(),
92 local_columns_per_process.size()));
97 local_rows_per_process[this_process],
98 local_columns_per_process[this_process]);
105 const unsigned int m,
106 const unsigned int n,
107 const unsigned int local_rows,
108 const unsigned int local_columns)
123 const unsigned int m,
124 const unsigned int n,
125 const std::vector<unsigned int> &local_rows_per_process,
126 const std::vector<unsigned int> &local_columns_per_process,
127 const unsigned int this_process)
129 Assert(local_rows_per_process.size() == local_columns_per_process.size(),
131 local_columns_per_process.size()));
140 local_rows_per_process[this_process],
141 local_columns_per_process[this_process]);
148 const unsigned int n,
149 const unsigned int local_rows,
150 const unsigned int local_columns)
152 reinit(MPI_COMM_WORLD,
m,
n, local_rows, local_columns);
159 const unsigned int n,
160 const std::vector<unsigned int> &local_rows_per_process,
161 const std::vector<unsigned int> &local_columns_per_process,
162 const unsigned int this_process)
167 local_rows_per_process,
168 local_columns_per_process,
207 const PetscErrorCode ierr = MatShellGetContext(A, &this_object);
220 const unsigned int n,
221 const unsigned int local_rows,
222 const unsigned int local_columns)
235 static_cast<void *>(
this),
240 ierr = MatShellSetOperation(
243 reinterpret_cast<void (*)()
>(
247 ierr = MatSetFromOptions(
matrix);
253 DEAL_II_NAMESPACE_CLOSE
255 #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()