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>
266 &coarse_smooth_,
typeid(*this).name());
270template <
typename VectorType>
274 coarse_smooth =
nullptr;
278template <
typename VectorType>
282 const VectorType &src)
const
284 coarse_smooth->apply(
level, dst, src);
292 typename PreconditionerType>
297 : solver(0, typeid(*this).name())
298 ,
matrix(0, typeid(*this).name())
299 , preconditioner(0, typeid(*this).name())
307 typename PreconditionerType>
311 PreconditionerType>::
312 MGCoarseGridIterativeSolver(SolverType &solver,
313 const MatrixType &matrix,
314 const PreconditionerType &preconditioner)
315 : solver(&solver, typeid(*this).name())
317 , preconditioner(&preconditioner, typeid(*this).name())
325 typename PreconditionerType>
331 PreconditionerType>::initialize(SolverType &solver_,
332 const MatrixType &matrix_,
333 const PreconditionerType &preconditioner_)
337 preconditioner = &preconditioner_;
345 typename PreconditionerType>
350 PreconditionerType>::clear()
366 typename PreconditionerType,
368 std::is_same_v<VectorType, typename SolverType::vector_type>,
371 solve(SolverType &solver,
372 const MatrixType &matrix,
373 const PreconditionerType &preconditioner,
375 const VectorType &src)
377 solver.solve(matrix, dst, src, preconditioner);
383 typename PreconditionerType,
385 !std::is_same_v<VectorType, typename SolverType::vector_type>,
388 solve(SolverType &solver,
389 const MatrixType &matrix,
390 const PreconditionerType &preconditioner,
392 const VectorType &src)
394 typename SolverType::vector_type src_;
395 typename SolverType::vector_type dst_;
400 solver.solve(matrix, dst_, src_, preconditioner);
412 typename PreconditionerType>
418 PreconditionerType>::operator()(
const unsigned int ,
427 internal::MGCoarseGridIterativeSolver::solve(
428 *solver, *matrix, *preconditioner, dst, src);
435template <
typename number,
typename VectorType>
440 householder.initialize(*A);
445template <
typename number,
typename VectorType>
450 householder.initialize(A);
455template <
typename number,
typename VectorType>
460 const VectorType &src)
const
462 householder.least_squares(dst, src);
469template <
typename number,
typename VectorType>
474 matrix.reinit(A.n_rows(), A.n_cols());
476 matrix.compute_inverse_svd(threshold);
480template <
typename number,
typename VectorType>
484 const VectorType &src)
const
490template <
typename number,
typename VectorType>
496 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
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 > &)