15#ifndef dealii_mg_coarse_h
16#define dealii_mg_coarse_h
38template <
typename VectorType = Vector<
double>>
70 const VectorType &src)
const override;
87template <
class VectorType,
class MatrixType>
119 const VectorType &src)
const override;
138template <
typename VectorType,
141 typename PreconditionerType>
156 const PreconditionerType &precondition);
165 const PreconditionerType &precondition);
180 const VectorType &src)
const override;
224template <
typename number =
double,
typename VectorType = Vector<number>>
242 const VectorType &src)
const override;
257template <
typename number =
double,
typename VectorType = Vector<number>>
275 const VectorType &src)
const;
294template <
typename VectorType>
296 : coarse_smooth(nullptr)
299template <
typename VectorType>
302 : coarse_smooth(nullptr)
308template <
typename VectorType>
315 &coarse_smooth_,
typeid(*this).name());
319template <
typename VectorType>
323 coarse_smooth =
nullptr;
327template <
typename VectorType>
331 const VectorType &src)
const
333 coarse_smooth->apply(
level, dst, src);
338template <
class VectorType,
class PreconditionerType>
341 :
matrix(0, typeid(*this).name())
346template <
class VectorType,
class PreconditionerType>
354template <
class VectorType,
class PreconditionerType>
357 const PreconditionerType &matrix_)
364template <
class VectorType,
class PreconditionerType>
372template <
class VectorType,
class PreconditionerType>
377 const VectorType &src)
const
389 typename PreconditionerType>
394 : solver(0, typeid(*this).name())
395 ,
matrix(0, typeid(*this).name())
396 , preconditioner(0, typeid(*this).name())
404 typename PreconditionerType>
408 PreconditionerType>::
409 MGCoarseGridIterativeSolver(SolverType &solver,
410 const MatrixType &matrix,
411 const PreconditionerType &preconditioner)
412 : solver(&solver, typeid(*this).name())
414 , preconditioner(&preconditioner, typeid(*this).name())
422 typename PreconditionerType>
428 PreconditionerType>::initialize(SolverType &solver_,
429 const MatrixType &matrix_,
430 const PreconditionerType &preconditioner_)
434 preconditioner = &preconditioner_;
442 typename PreconditionerType>
447 PreconditionerType>::clear()
459 typename PreconditionerType>
465 PreconditionerType>::operator()(
const unsigned int ,
475 if constexpr (std::is_same_v<VectorType, typename SolverType::vector_type>)
477 solver->solve(*matrix, dst, src, *preconditioner);
481 typename SolverType::vector_type src_;
482 typename SolverType::vector_type dst_;
487 solver->solve(*matrix, dst_, src_, *preconditioner);
497template <
typename number,
typename VectorType>
502 householder.initialize(*A);
507template <
typename number,
typename VectorType>
512 householder.initialize(A);
517template <
typename number,
typename VectorType>
522 const VectorType &src)
const
524 householder.least_squares(dst, src);
531template <
typename number,
typename VectorType>
536 matrix.reinit(A.n_rows(), A.n_cols());
538 matrix.compute_inverse_svd(threshold);
542template <
typename number,
typename VectorType>
546 const VectorType &src)
const
552template <
typename number,
typename VectorType>
558 for (
unsigned int i = 0; i < n; ++i)
void initialize(const MatrixType &matrix)
virtual void operator()(const unsigned int level, VectorType &dst, const VectorType &src) const override
ObserverPointer< const MatrixType, MGCoarseGridApplyOperator< VectorType, MatrixType > > matrix
MGCoarseGridApplyOperator(const MatrixType &matrix)
MGCoarseGridApplyOperator()
MGCoarseGridApplySmoother()
void initialize(const MGSmootherBase< VectorType > &coarse_smooth)
void operator()(const unsigned int level, VectorType &dst, const VectorType &src) const override
MGCoarseGridApplySmoother(const MGSmootherBase< VectorType > &coarse_smooth)
ObserverPointer< const MGSmootherBase< VectorType >, MGCoarseGridApplySmoother< 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
MGCoarseGridIterativeSolver()
ObserverPointer< const MatrixType, MGCoarseGridIterativeSolver< VectorType, SolverType, MatrixType, PreconditionerType > > matrix
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)
ObserverPointer< SolverType, MGCoarseGridIterativeSolver< VectorType, SolverType, MatrixType, PreconditionerType > > solver
ObserverPointer< const PreconditionerType, MGCoarseGridIterativeSolver< VectorType, SolverType, MatrixType, PreconditionerType > > preconditioner
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.
Tpetra::Vector< Number, LO, GO, NodeType< MemorySpace > > VectorType
Tpetra::CrsMatrix< Number, LO, GO, NodeType< MemorySpace > > MatrixType
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)