15#ifndef dealii_mg_coarse_h
16#define dealii_mg_coarse_h
38template <
typename VectorType = Vector<
double>>
70 const VectorType &src)
const override;
89template <
typename VectorType,
92 typename PreconditionerType>
107 const PreconditionerType &precondition);
116 const PreconditionerType &precondition);
131 const VectorType &src)
const override;
175template <
typename number =
double,
typename VectorType = Vector<number>>
193 const VectorType &src)
const override;
208template <
typename number =
double,
typename VectorType = Vector<number>>
226 const VectorType &src)
const;
245template <
typename VectorType>
247 : coarse_smooth(nullptr)
250template <
typename VectorType>
253 : coarse_smooth(nullptr)
259template <
typename VectorType>
267 typeid(*this).name());
271template <
typename VectorType>
275 coarse_smooth =
nullptr;
279template <
typename VectorType>
283 const VectorType &src)
const
285 coarse_smooth->apply(
level, dst, src);
290template <
typename VectorType,
293 typename PreconditionerType>
298 : solver(0, typeid(*this).name())
299 ,
matrix(0, typeid(*this).name())
300 , preconditioner(0, typeid(*this).name())
305template <
typename VectorType,
308 typename PreconditionerType>
312 PreconditionerType>::
313 MGCoarseGridIterativeSolver(SolverType &solver,
314 const MatrixType &matrix,
315 const PreconditionerType &preconditioner)
316 : solver(&solver, typeid(*this).name())
318 , preconditioner(&preconditioner, typeid(*this).name())
323template <
typename VectorType,
326 typename PreconditionerType>
332 PreconditionerType>::initialize(SolverType &solver_,
333 const MatrixType &matrix_,
334 const PreconditionerType &preconditioner_)
338 preconditioner = &preconditioner_;
343template <
typename VectorType,
346 typename PreconditionerType>
351 PreconditionerType>::clear()
364 template <
typename VectorType,
367 typename PreconditionerType,
369 std::is_same_v<VectorType, typename SolverType::vector_type>,
370 VectorType> * =
nullptr>
372 solve(SolverType &solver,
373 const MatrixType &matrix,
374 const PreconditionerType &preconditioner,
376 const VectorType &src)
378 solver.solve(matrix, dst, src, preconditioner);
381 template <
typename VectorType,
384 typename PreconditionerType,
386 !std::is_same_v<VectorType, typename SolverType::vector_type>,
387 VectorType> * =
nullptr>
389 solve(SolverType &solver,
390 const MatrixType &matrix,
391 const PreconditionerType &preconditioner,
393 const VectorType &src)
395 typename SolverType::vector_type src_;
396 typename SolverType::vector_type dst_;
401 solver.solve(matrix, dst_, src_, preconditioner);
410template <
typename VectorType,
413 typename PreconditionerType>
419 PreconditionerType>::operator()(
const unsigned int ,
421 const VectorType &src)
const
428 internal::MGCoarseGridIterativeSolver::solve(
429 *solver, *matrix, *preconditioner, dst, src);
436template <
typename number,
typename VectorType>
441 householder.initialize(*A);
446template <
typename number,
typename VectorType>
451 householder.initialize(A);
456template <
typename number,
typename VectorType>
461 const VectorType &src)
const
463 householder.least_squares(dst, src);
470template <
typename number,
typename VectorType>
475 matrix.reinit(A.n_rows(), A.n_cols());
477 matrix.compute_inverse_svd(threshold);
481template <
typename number,
typename VectorType>
485 const VectorType &src)
const
491template <
typename number,
typename VectorType>
497 for (
unsigned int i = 0; i < n; ++i)
MGCoarseGridApplySmoother()
void initialize(const MGSmootherBase< VectorType > &coarse_smooth)
void operator()(const unsigned int level, VectorType &dst, const VectorType &src) const override
SmartPointer< const MGSmootherBase< VectorType >, MGCoarseGridApplySmoother< VectorType > > coarse_smooth
MGCoarseGridApplySmoother(const MGSmootherBase< VectorType > &coarse_smooth)
void initialize(const FullMatrix< number > &A)
Householder< number > householder
MGCoarseGridHouseholder(const FullMatrix< number > *A=nullptr)
void operator()(const unsigned int level, VectorType &dst, const VectorType &src) const override
SmartPointer< const MatrixType, MGCoarseGridIterativeSolver< VectorType, SolverType, MatrixType, PreconditionerType > > matrix
SmartPointer< SolverType, MGCoarseGridIterativeSolver< VectorType, SolverType, MatrixType, PreconditionerType > > solver
MGCoarseGridIterativeSolver()
SmartPointer< const PreconditionerType, MGCoarseGridIterativeSolver< VectorType, SolverType, MatrixType, PreconditionerType > > preconditioner
void initialize(SolverType &solver, const MatrixType &matrix, const PreconditionerType &precondition)
virtual void operator()(const unsigned int level, VectorType &dst, const VectorType &src) const override
MGCoarseGridIterativeSolver(SolverType &solver, const MatrixType &matrix, const PreconditionerType &precondition)
MGCoarseGridSVD()=default
LAPACKFullMatrix< number > matrix
void operator()(const unsigned int level, VectorType &dst, const VectorType &src) const
void initialize(const FullMatrix< number > &A, const double threshold=0)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcNotInitialized()
@ matrix
Contents is actually a matrix.
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)