16 #ifndef dealii_mg_coarse_h
17 #define dealii_mg_coarse_h
39 template <
typename VectorType = Vector<
double>>
71 const VectorType &src)
const override;
90 template <
typename VectorType,
93 typename PreconditionerType>
108 const PreconditionerType &precondition);
117 const PreconditionerType &precondition);
132 const VectorType &src)
const override;
176 template <
typename number =
double,
typename VectorType = Vector<number>>
194 const VectorType &src)
const override;
209 template <
typename number =
double,
typename VectorType = Vector<number>>
227 const VectorType &src)
const;
246 template <
typename VectorType>
248 : coarse_smooth(nullptr)
251 template <
typename VectorType>
254 : coarse_smooth(nullptr)
260 template <
typename VectorType>
268 typeid(*this).name());
272 template <
typename VectorType>
276 coarse_smooth =
nullptr;
280 template <
typename VectorType>
284 const VectorType &src)
const
286 coarse_smooth->apply(
level, dst, src);
291 template <
typename VectorType,
294 typename PreconditionerType>
299 : solver(0, typeid(*this).name())
300 ,
matrix(0, typeid(*this).name())
301 , preconditioner(0, typeid(*this).name())
306 template <
typename VectorType,
309 typename PreconditionerType>
313 PreconditionerType>::
314 MGCoarseGridIterativeSolver(SolverType &solver,
316 const PreconditionerType &preconditioner)
317 : solver(&solver, typeid(*this).name())
319 , preconditioner(&preconditioner, typeid(*this).name())
324 template <
typename VectorType,
327 typename PreconditionerType>
333 PreconditionerType>::initialize(SolverType &solver_,
334 const MatrixType &matrix_,
335 const PreconditionerType &preconditioner_)
339 preconditioner = &preconditioner_;
344 template <
typename VectorType,
347 typename PreconditionerType>
352 PreconditionerType>::clear()
365 template <
typename VectorType,
368 typename PreconditionerType,
370 std::is_same_v<VectorType, typename SolverType::vector_type>,
371 VectorType> * =
nullptr>
373 solve(SolverType &solver,
375 const PreconditionerType &preconditioner,
377 const VectorType &src)
379 solver.solve(
matrix, dst, src, preconditioner);
382 template <
typename VectorType,
385 typename PreconditionerType,
387 !std::is_same_v<VectorType, typename SolverType::vector_type>,
388 VectorType> * =
nullptr>
390 solve(SolverType &solver,
392 const PreconditionerType &preconditioner,
394 const VectorType &src)
396 typename SolverType::vector_type src_;
397 typename SolverType::vector_type dst_;
402 solver.solve(
matrix, dst_, src_, preconditioner);
411 template <
typename VectorType,
414 typename PreconditionerType>
420 PreconditionerType>::operator()(
const unsigned int ,
422 const VectorType &src)
const
429 internal::MGCoarseGridIterativeSolver::solve(
430 *solver, *
matrix, *preconditioner, dst, src);
437 template <
typename number,
typename VectorType>
442 householder.initialize(*
A);
447 template <
typename number,
typename VectorType>
452 householder.initialize(
A);
457 template <
typename number,
typename VectorType>
462 const VectorType &src)
const
464 householder.least_squares(dst, src);
471 template <
typename number,
typename VectorType>
476 matrix.reinit(
A.n_rows(),
A.n_cols());
478 matrix.compute_inverse_svd(threshold);
482 template <
typename number,
typename VectorType>
486 const VectorType &src)
const
492 template <
typename number,
typename VectorType>
498 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
static ::ExceptionBase & ExcNotInitialized()
#define Assert(cond, exc)
@ matrix
Contents is actually a matrix.