47 #include "Teko_GaussSeidelPreconditionerFactory.hpp"
49 #include "Teko_BlockUpperTriInverseOp.hpp"
50 #include "Teko_BlockLowerTriInverseOp.hpp"
62 : invOpsStrategy_(strategy), solveType_(solveType)
66 : solveType_(GS_UseLowerTriangle)
71 int rows = blockRowCount(blo);
72 int cols = blockColCount(blo);
74 TEUCHOS_ASSERT(rows==cols);
77 std::vector<LinearOp> invDiag;
79 TEUCHOS_ASSERT(rows==(
int) invDiag.size());
81 if(solveType_==GS_UseUpperTriangle) {
83 BlockedLinearOp U = getUpperTriBlocks(blo);
85 return createBlockUpperTriInverseOp(U,invDiag,
"Gauss Seidel");
87 else if(solveType_==GS_UseLowerTriangle) {
89 BlockedLinearOp L = getLowerTriBlocks(blo);
91 return createBlockLowerTriInverseOp(L,invDiag,
"Gauss Seidel");
94 TEUCHOS_ASSERT(
false);
100 Teko_DEBUG_SCOPE(
"GaussSeidelPreconditionerFactory::initializeFromParameterList",10);
101 Teko_DEBUG_MSG_BEGIN(9);
102 DEBUG_STREAM <<
"Parameter list: " << std::endl;
103 pl.print(DEBUG_STREAM);
104 Teko_DEBUG_MSG_END();
106 const std::string inverse_type =
"Inverse Type";
107 std::vector<RCP<InverseFactory> > inverses;
112 std::string invStr =
"Amesos";
113 if(pl.isParameter(inverse_type))
114 invStr = pl.get<std::string>(inverse_type);
115 if(pl.isParameter(
"Use Upper Triangle"))
116 solveType_ = pl.get<
bool>(
"Use Upper Triangle") ? GS_UseUpperTriangle : GS_UseLowerTriangle;
118 Teko_DEBUG_MSG(
"GSPrecFact: Building default inverse \"" << invStr <<
"\"",5);
119 RCP<InverseFactory> defaultInverse = invLib->getInverseFactory(invStr);
122 Teuchos::ParameterList::ConstIterator itr;
123 for(itr=pl.begin();itr!=pl.end();++itr) {
124 std::string fieldName = itr->first;
125 Teko_DEBUG_MSG(
"GSPrecFact: checking fieldName = \"" << fieldName <<
"\"",9);
128 if(fieldName.compare(0,inverse_type.length(),inverse_type)==0 && fieldName!=inverse_type) {
130 std::string inverse,type;
133 std::stringstream ss(fieldName);
134 ss >> inverse >> type >> position;
137 Teko_DEBUG_MSG(
"Gauss-Seidel \"Inverse Type\" must be a (strictly) positive integer",1);
141 std::string invStr = pl.get<std::string>(fieldName);
142 Teko_DEBUG_MSG(
"GSPrecFact: Building inverse " << position <<
" \"" << invStr <<
"\"",5);
143 if(position>(
int) inverses.size()) {
144 inverses.resize(position,defaultInverse);
145 inverses[position-1] = invLib->getInverseFactory(invStr);
148 inverses[position-1] = invLib->getInverseFactory(invStr);
153 if(inverses.size()==0)
154 inverses.push_back(defaultInverse);
An implementation of a state object for block preconditioners.
Teuchos::RCP< const BlockInvDiagonalStrategy > invOpsStrategy_
some members
LinearOp buildPreconditionerOperator(BlockedLinearOp &blo, BlockPreconditionerState &state) const
Create the Gauss-Seidel preconditioner operator.
GaussSeidelPreconditionerFactory()
Teuchos::RCP< const InverseLibrary > getInverseLibrary() const
Get the inverse library used by this preconditioner factory.
virtual void initializeFromParameterList(const Teuchos::ParameterList &pl)
Initialize from a parameter list.