/usr/include/trilinos/Teko_StratimikosFactory.hpp is in libtrilinos-teko-dev 12.12.1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | #ifndef __Teko_StratimikosFactory_hpp__
#define __Teko_StratimikosFactory_hpp__
#include <vector>
#include "Thyra_PreconditionerFactoryBase.hpp"
#include "Thyra_EpetraOperatorViewExtractorBase.hpp"
#include "Teuchos_StandardCompositionMacros.hpp"
#include "Teko_RequestHandler.hpp"
#include "Teko_InverseLibrary.hpp"
#include "Teko_InverseFactory.hpp"
#include "Epetra_Operator.h"
namespace Teko {
/** \brief Concrete preconditioner factory subclass based on ML.
*
* ToDo: Finish documentation!
*/
class StratimikosFactory : public Thyra::PreconditionerFactoryBase<double> {
public:
/** @name Constructors/initializers/accessors */
//@{
/** \brief . */
StratimikosFactory();
StratimikosFactory(const Teuchos::RCP<Teko::RequestHandler> & rh);
StratimikosFactory(const Teuchos::RCP<Stratimikos::DefaultLinearSolverBuilder> & builder,
const Teuchos::RCP<Teko::RequestHandler> & rh);
/** \brief Set the strategy object used to extract an
* <tt>Epetra_Operator</tt> view of an input forward operator.
*
* This view will then be dynamically casted to <tt>Epetra_RowMatrix</tt>
* before it is used.
*
* The default implementation used is <tt>EpetraOperatorViewExtractorBase</tt>.
*/
STANDARD_COMPOSITION_MEMBERS(
Thyra::EpetraOperatorViewExtractorBase, epetraFwdOpViewExtractor );
//@}
/** @name Overridden from PreconditionerFactoryBase */
//@{
/** \brief . */
bool isCompatible( const Thyra::LinearOpSourceBase<double> &fwdOp ) const;
/** \brief . */
bool applySupportsConj(Thyra::EConj conj) const;
/** \brief . */
bool applyTransposeSupportsConj(Thyra::EConj conj) const;
/** \brief . */
Teuchos::RCP<Thyra::PreconditionerBase<double> > createPrec() const;
/** \brief . */
void initializePrec(
const Teuchos::RCP<const Thyra::LinearOpSourceBase<double> > &fwdOp,
Thyra::PreconditionerBase<double> *prec,
const Thyra::ESupportSolveUse supportSolveUse
) const;
/** \brief . */
void uninitializePrec(
Thyra::PreconditionerBase<double> *prec
,Teuchos::RCP<const Thyra::LinearOpSourceBase<double> > *fwdOp
,Thyra::ESupportSolveUse *supportSolveUse
) const;
//@}
/** @name Overridden from Teuchos::ParameterListAcceptor */
//@{
/** \brief . */
void setParameterList(
Teuchos::RCP<Teuchos::ParameterList> const& paramList);
/** \brief . */
Teuchos::RCP<Teuchos::ParameterList> getNonconstParameterList();
/** \brief . */
Teuchos::RCP<Teuchos::ParameterList> unsetParameterList();
/** \brief . */
Teuchos::RCP<const Teuchos::ParameterList> getParameterList() const;
/** \brief . */
Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const;
//@}
/** \name Public functions overridden from Describable. */
//@{
/** \brief . */
std::string description() const;
// ToDo: Add an override of describe(...) to give more detail!
//@}
/** Setup an thyra preconditioner (most likely blocked)
*/
void initializePrec_Thyra(
const Teuchos::RCP<const Thyra::LinearOpSourceBase<double> > &fwdOp,
Thyra::PreconditionerBase<double> *prec,
const Thyra::ESupportSolveUse supportSolveUse
) const;
/** Setup an epetra preconditioner.
*/
void initializePrec_Epetra(
const Teuchos::RCP<const Thyra::LinearOpSourceBase<double> > &fwdOp,
Thyra::PreconditionerBase<double> *prec,
const Thyra::ESupportSolveUse supportSolveUse
) const;
/** Access to the application communication request handling mechnism
*/
void setRequestHandler(const Teuchos::RCP<Teko::RequestHandler> & rh)
{ reqHandler_ = rh; }
/** Access to the application communication request handling mechnism
*/
Teuchos::RCP<Teko::RequestHandler> getRequestHandler() const
{ return reqHandler_; }
//! Get the decomposition vector in use by this factory
const std::vector<int> & getDecomposition() const
{ return decomp_; }
private:
/** Build the segragated jacobian operator according to
* the input parameter list.
*
* \param[in] Jac Epetra_CrsMatrix (assumed) to be decomposed.
* \param[in] wrapInput RCP to an Epetra operator that was either previously
* wrapped, or it is <code>Teuchos::null</code>
* \param[in] out Stream for use when reporting testing results
*
* \returns Blocked operator that was requested, if <code>wrapInput</code> is not
* null, then the returned pointer will match (i.e. wrapInput will be over-
* written).
*/
Teuchos::RCP<Epetra_Operator> buildWrappedEpetraOperator(
const Teuchos::RCP<const Epetra_Operator> & Jac,
const Teuchos::RCP<Epetra_Operator> & wrapInput,
std::ostream & out) const;
/** Build strided vectors using the operator range map and
* the decomposition vectors.
*
* \param[in] Jac Epetra_CrsMatrix (assumed) to be decomposed.
* \param[in] decomp Decomposition vector.
* \param[in,out] vars Vector of vectors of global ids specifying
* how the operator is to be blocked.
*/
void buildStridedVectors(const Epetra_Operator & Jac,
const std::vector<int> & decomp,
std::vector<std::vector<int> > & vars) const;
Teuchos::RCP<Teuchos::ParameterList> paramList_;
mutable Teuchos::RCP<Teko::InverseLibrary> invLib_;
mutable Teuchos::RCP<Teko::InverseFactory> invFactory_;
Teuchos::RCP<Teko::RequestHandler> reqHandler_;
mutable std::vector<int> decomp_;
Teuchos::RCP<Stratimikos::DefaultLinearSolverBuilder> builder_; // builder to use for default solvers
};
/** Inject Teko into a solver builder with a specified name. Note that the builder
* is used to define the default solvers in Teko. Therefore any dynamically specified
* solver/preconditioner, will be inherited by Teko. This relationship does not persist,
* so no solvers added to the builder after the call to addTekoToStratimikosBuilder will
* be inherited. Finally, to avoid circular references Teko will not include itself in
* that list of solvers/precondtioners.
*/
void addTekoToStratimikosBuilder(Stratimikos::DefaultLinearSolverBuilder & builder,
const std::string & stratName="Teko");
/** Inject Teko into a solver builder with a specified name. Note that the builder
* is used to define the default solvers in Teko. Therefore any dynamically specified
* solver/preconditioner, will be inherited by Teko. This relationship does not persist,
* so no solvers added to the builder after the call to addTekoToStratimikosBuilder will
* be inherited. Finally, to avoid circular references Teko will not include itself in
* that list of solvers/precondtioners.
*/
void addTekoToStratimikosBuilder(Stratimikos::DefaultLinearSolverBuilder & builder,
const Teuchos::RCP<Teko::RequestHandler> & rh,
const std::string & stratName="Teko");
} // namespace Teko
#endif
|