Teko Version of the Day
Loading...
Searching...
No Matches
Teko_SmootherPreconditionerFactory.hpp
1// @HEADER
2// *****************************************************************************
3// Teko: A package for block and physics based preconditioning
4//
5// Copyright 2010 NTESS and the Teko contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef __Teko_SmootherPreconditionerFactory_hpp__
11#define __Teko_SmootherPreconditionerFactory_hpp__
12
13// Teko includes
14#include "Teko_PreconditionerFactory.hpp"
15#include "Teko_ImplicitLinearOp.hpp"
16#include "Teko_RequestHandlerContainer.hpp"
17
18namespace Teko {
19
24class SmootherLinearOp : public ImplicitLinearOp, public RequestHandlerContainer {
25 public:
26 SmootherLinearOp(const LinearOp &A, const LinearOp &invM, unsigned int applications,
27 bool useDestAsInitialGuess = false);
28 SmootherLinearOp(const LinearOp &A, const LinearOp &invM, unsigned int applications,
29 unsigned int block);
30
32 virtual VectorSpace range() const { return invM_->range(); }
33
35 virtual VectorSpace domain() const { return invM_->domain(); }
36
50 virtual void implicitApply(const MultiVector &x, MultiVector &y, const double alpha = 1.0,
51 const double beta = 0.0) const;
52
54 virtual void setRequestHandler(const Teuchos::RCP<RequestHandler> &rh);
55
57 virtual Teuchos::RCP<RequestHandler> getRequestHandler() const;
58
59 private:
60 // enum describing initial guess type
61 typedef enum {
62 Unspecified,
63 RequestInitialGuess,
64 DestAsInitialGuess,
65 NoInitialGuess
66 } InitialGuessType;
67
68 LinearOp A_; // forward operator
69 LinearOp invM_; // preconditioner
70 unsigned int applications_; // how much smoothing is required
71 InitialGuessType initialGuessType_; // type of initial guess to use
72
73 // for producing an initial guess
74 Teuchos::RCP<RequestMesg> requestMesg_;
75
76 // used by RequestHandlerContainer interface
77 Teuchos::RCP<RequestHandler> requestHandler_;
78
79 SmootherLinearOp(); // hide me
80 SmootherLinearOp(const SmootherLinearOp &); // hide me
81};
82
83LinearOp buildSmootherLinearOp(const LinearOp &A, const LinearOp &invM, unsigned int applications,
84 bool useDestAsInitialGuess = false);
85LinearOp buildSmootherLinearOp(const LinearOp &A, const LinearOp &invM, unsigned int applications,
86 unsigned int initialGuessBlock);
87
90class SmootherPreconditionerFactory : public virtual Teko::PreconditionerFactory {
91 public:
93 SmootherPreconditionerFactory();
94
108 virtual LinearOp buildPreconditionerOperator(LinearOp &lo, PreconditionerState &state) const;
109
111
112
123 virtual void initializeFromParameterList(const Teuchos::ParameterList &settings);
124
126
127 private:
128 // enum describing initial guess type
129 typedef enum {
130 Unspecified,
131 RequestInitialGuess,
132 DestAsInitialGuess,
133 NoInitialGuess
134 } InitialGuessType;
135
136 // parameters specifying behavior of smoother operator
137 unsigned int sweepCount_;
138 InitialGuessType initialGuessType_;
139 unsigned int initialGuessBlock_;
140
141 // prectionditioner to use as residual correction in smoother
142 Teuchos::RCP<Teko::InverseFactory> precFactory_;
143};
144
145} // end namespace Teko
146
147#endif
A virtual class that simplifies the construction of custom operators.
virtual VectorSpace range() const
Range space of this operator.
virtual void setRequestHandler(const Teuchos::RCP< RequestHandler > &rh)
Set the request handler with pointers to the appropriate callbacks.
virtual void implicitApply(const MultiVector &x, MultiVector &y, const double alpha=1.0, const double beta=0.0) const
Perform a matrix vector multiply with this implicitly defined blocked operator.
virtual VectorSpace domain() const
Domain space of this operator.
virtual Teuchos::RCP< RequestHandler > getRequestHandler() const
Get the request handler with pointers to the appropriate callbacks.