15#ifndef dealii_mg_coarse_h
16#define dealii_mg_coarse_h
40template <
typename VectorType = Vector<
double>>
72 const VectorType &src)
const override;
89template <
class VectorType,
class MatrixType>
121 const VectorType &src)
const override;
140template <
typename VectorType,
143 typename PreconditionerType>
158 const PreconditionerType &precondition);
167 const PreconditionerType &precondition);
182 const VectorType &src)
const override;
226template <
typename number =
double,
typename VectorType = Vector<number>>
244 const VectorType &src)
const override;
259template <
typename number =
double,
typename VectorType = Vector<number>>
277 const VectorType &src)
const;
296template <
typename VectorType>
298 : coarse_smooth(nullptr)
301template <
typename VectorType>
304 : coarse_smooth(nullptr)
310template <
typename VectorType>
317 &coarse_smooth_,
typeid(*this).name());
321template <
typename VectorType>
325 coarse_smooth =
nullptr;
329template <
typename VectorType>
333 const VectorType &src)
const
335 coarse_smooth->apply(
level, dst, src);
340template <
class VectorType,
class PreconditionerType>
343 :
matrix(0, typeid(*this).name())
348template <
class VectorType,
class PreconditionerType>
356template <
class VectorType,
class PreconditionerType>
359 const PreconditionerType &matrix_)
366template <
class VectorType,
class PreconditionerType>
374template <
class VectorType,
class PreconditionerType>
379 const VectorType &src)
const
391 typename PreconditionerType>
396 : solver(0, typeid(*this).name())
397 ,
matrix(0, typeid(*this).name())
398 , preconditioner(0, typeid(*this).name())
406 typename PreconditionerType>
410 PreconditionerType>::
411 MGCoarseGridIterativeSolver(SolverType &solver,
412 const MatrixType &matrix,
413 const PreconditionerType &preconditioner)
414 : solver(&solver, typeid(*this).name())
416 , preconditioner(&preconditioner, typeid(*this).name())
424 typename PreconditionerType>
430 PreconditionerType>::initialize(SolverType &solver_,
431 const MatrixType &matrix_,
432 const PreconditionerType &preconditioner_)
436 preconditioner = &preconditioner_;
444 typename PreconditionerType>
449 PreconditionerType>::clear()
461 typename PreconditionerType>
467 PreconditionerType>::operator()(
const unsigned int ,
477 if constexpr (std::is_same_v<VectorType, typename SolverType::vector_type>)
479 solver->solve(*matrix, dst, src, *preconditioner);
483 typename SolverType::vector_type src_;
484 typename SolverType::vector_type dst_;
489 solver->solve(*matrix, dst_, src_, *preconditioner);
499template <
typename number,
typename VectorType>
504 householder.initialize(*A);
509template <
typename number,
typename VectorType>
514 householder.initialize(A);
519template <
typename number,
typename VectorType>
524 const VectorType &src)
const
526 householder.least_squares(dst, src);
533template <
typename number,
typename VectorType>
538 matrix.reinit(
A.n_rows(),
A.n_cols());
540 matrix.compute_inverse_svd(threshold);
544template <
typename number,
typename VectorType>
548 const VectorType &src)
const
554template <
typename number,
typename VectorType>
560 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 > &)