Teko  Version of the Day
 All Classes Files Functions Variables Pages
Teko_BlockPreconditionerFactory.cpp
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 #include "Teko_BlockPreconditionerFactory.hpp"
11 
12 #include "Teko_Preconditioner.hpp"
13 #include "Teko_InverseLibrary.hpp"
14 
15 #include "Thyra_DefaultPreconditioner.hpp"
16 
17 using namespace Thyra;
18 
19 namespace Teko {
20 
22 
23 LinearOp BlockPreconditionerFactory::buildPreconditionerOperator(LinearOp &lo,
24  PreconditionerState &state) const {
25  // get the blocked linear operator
26  RCP<LinearOpBase<double> > loA = Teuchos::rcp_const_cast<Thyra::LinearOpBase<double> >(lo);
27  BlockedLinearOp A = Teuchos::rcp_dynamic_cast<Thyra::PhysicallyBlockedLinearOpBase<double> >(loA);
28 
29  state.setInitialized(false);
30 
31  return buildPreconditionerOperator(A, dynamic_cast<BlockPreconditionerState &>(state));
32 }
33 
35 bool BlockPreconditionerFactory::isCompatible(
36  const Thyra::LinearOpSourceBase<double> &fwdOpSrc) const {
37  RCP<const Thyra::PhysicallyBlockedLinearOpBase<double> > A =
38  Teuchos::rcp_dynamic_cast<const Thyra::PhysicallyBlockedLinearOpBase<double> >(
39  fwdOpSrc.getOp());
40  return A != Teuchos::null;
41 }
42 
43 } // end namespace Teko
An implementation of a state object preconditioners.
virtual void setInitialized(bool init=true)