64 if(initTimer_==Teuchos::null)
65 initTimer_ = TimeMonitor::getNewTimer(
"PCDStrategy::initializePrec");
67 if(invSTimer_==Teuchos::null)
68 invSTimer_ = TimeMonitor::getNewTimer(
"PCDStrategy::initializePrec invS");
70 if(invFTimer_==Teuchos::null)
71 invFTimer_ = TimeMonitor::getNewTimer(
"PCDStrategy::initializePrec invF");
73 if(opsTimer_==Teuchos::null)
74 opsTimer_ = TimeMonitor::getNewTimer(
"PCDStrategy::initializePrec buildOps");
90 const Teuchos::RCP<InverseFactory> & invS)
91 : invFactoryF_(invFA), invFactoryS_(invS), massInverseType_(
Diagonal), schurCompOrdering_(false)
93 pcdParams_ = Teuchos::rcp(
new Teuchos::ParameterList);
94 lapParams_ = Teuchos::rcp(
new Teuchos::ParameterList);
96 lapParams_->set(
"Name",getPressureLaplaceString());
97 pcdParams_->set(
"Name",getPCDString());
131 Teko_DEBUG_SCOPE(
"PCDStrategy::initializeState",10);
134 std::string pcdStr = getPCDString();
135 std::string presLapStr = getPressureLaplaceString();
136 std::string presMassStr = getPressureMassString();
139 if(state.isInitialized())
142 Teuchos::TimeMonitor timer(*initTimer_,
true);
151 TEUCHOS_ASSERT(Qp!=Teuchos::null);
156 if(massInverseType_==
NotDiag) {
157 ModifiableLinearOp & invMass = state.getModifiableOp(
"invMass");
158 Teko_DEBUG_SCOPE(
"Building inv(Mass)",10);
160 if(invMass==Teuchos::null)
168 Teko_DEBUG_MSG(
"Building inverse mass of type \"" << Teko::getDiagonalName(massInverseType_) <<
"\"",10);
169 iQp = getInvDiagonalOp(Qp,massInverseType_);
174 ModifiableLinearOp & invLaplace = state.getModifiableOp(
"invLaplace");
176 Teuchos::TimeMonitor timerInvS(*invSTimer_,
true);
179 LinearOp laplace =
getRequestHandler()->request<Teko::LinearOp>(RequestMesg(lapParams_));
180 TEUCHOS_ASSERT(laplace!=Teuchos::null);
181 if(invLaplace==Teuchos::null)
190 Teko_DEBUG_SCOPE(
"Building S",10);
191 Teuchos::TimeMonitor timerS(*opsTimer_,
true);
195 LinearOp pcd =
getRequestHandler()->request<Teko::LinearOp>(RequestMesg(pcdParams_));
196 TEUCHOS_ASSERT(pcd!=Teuchos::null);
197 LinearOp invL = invLaplace;
200 if(schurCompOrdering_==
false)
201 invS = multiply(iQp,pcd,invL);
203 invS = multiply(invL,pcd,iQp);
205 state.addLinearOp(
"invS",invS);
211 Teko_DEBUG_SCOPE(
"Building inv(F)",10);
212 Teuchos::TimeMonitor timerInvF(*invFTimer_,
true);
214 ModifiableLinearOp & invF = state.getModifiableOp(
"invF");
215 if(invF==Teuchos::null)
222 state.setInitialized(
true);
237 const InverseLibrary & invLib)
239 Teko_DEBUG_SCOPE(
"PCDStrategy::initializeFromParameterList",10);
241 std::string invStr=
"Amesos", invFStr=
"", invSStr=
"";
245 if(pl.isParameter(
"Inverse Type"))
246 invStr = pl.get<std::string>(
"Inverse Type");
247 if(pl.isParameter(
"Inverse F Type"))
248 invFStr = pl.get<std::string>(
"Inverse F Type");
249 if(pl.isParameter(
"Inverse Laplace Type"))
250 invSStr = pl.get<std::string>(
"Inverse Laplace Type");
251 if(pl.isParameter(
"Inverse Mass Type")) {
252 std::string massInverseStr = pl.get<std::string>(
"Inverse Mass Type");
255 massInverseType_ = getDiagonalType(massInverseStr);
257 if(pl.isParameter(
"Flip Schur Complement Ordering"))
258 schurCompOrdering_ = pl.get<
bool>(
"Flip Schur Complement Ordering");
261 if(invFStr==
"") invFStr = invStr;
262 if(invSStr==
"") invSStr = invStr;
265 if(pl.isSublist(
"Pressure Laplace Parameters"))
266 lapParams_ = Teuchos::rcp(
new Teuchos::ParameterList(pl.sublist(
"Pressure Laplace Parameters")));
268 lapParams_ = Teuchos::rcp(
new Teuchos::ParameterList);
271 if(pl.isSublist(
"Pressure Convection Diffusion Parameters"))
272 pcdParams_ = Teuchos::rcp(
new Teuchos::ParameterList(pl.sublist(
"Pressure Convection Diffusion Parameters")));
274 pcdParams_ = Teuchos::rcp(
new Teuchos::ParameterList);
277 TEUCHOS_TEST_FOR_EXCEPTION(lapParams_->isParameter(
"Name"),std::logic_error,
278 "Teko: Parameter \"Name\" is not allowed in the sublist \""+lapParams_->name()+
"\"");
279 TEUCHOS_TEST_FOR_EXCEPTION(lapParams_->isParameter(
"Tag"),std::logic_error,
280 "Teko: Parameter \"Tag\" is not allowed in the sublist \""+lapParams_->name()+
"\"");
281 TEUCHOS_TEST_FOR_EXCEPTION(pcdParams_->isParameter(
"Name"),std::logic_error,
282 "Teko: Parameter \"Name\" is not allowed in the sublist \""+pcdParams_->name()+
"\"");
283 TEUCHOS_TEST_FOR_EXCEPTION(pcdParams_->isParameter(
"Tag"),std::logic_error,
284 "Teko: Parameter \"Tag\" is not allowed in the sublist \""+pcdParams_->name()+
"\"");
286 Teko_DEBUG_MSG_BEGIN(5)
287 DEBUG_STREAM <<
"PCD Strategy Parameters: " << std::endl;
288 DEBUG_STREAM <<
" inv type = \"" << invStr <<
"\"" << std::endl;
289 DEBUG_STREAM <<
" inv F type = \"" << invFStr <<
"\"" << std::endl;
290 DEBUG_STREAM <<
" inv Laplace type = \"" << invSStr <<
"\"" << std::endl;
291 DEBUG_STREAM <<
" inv Mass type = \"" << Teko::getDiagonalName(massInverseType_) <<
"\"" << std::endl;
292 DEBUG_STREAM <<
"PCD Strategy Parameter list: " << std::endl;
293 pl.print(DEBUG_STREAM);
297 invFactoryF_ = invLib.getInverseFactory(invFStr);
300 invFactoryS_ = invFactoryF_;
302 invFactoryS_ = invLib.getInverseFactory(invSStr);
304 lapParams_->set(
"Name",getPressureLaplaceString());
305 pcdParams_->set(
"Name",getPCDString());