Teko  Version of the Day
 All Classes Files Functions Variables Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Teko::LU2x2PreconditionerFactory Class Reference

Construct a preconditioner using a LDU dcomposition of a block 2x2 matrix. More...

#include <Teko_LU2x2PreconditionerFactory.hpp>

Inheritance diagram for Teko::LU2x2PreconditionerFactory:
Inheritance graph
[legend]

Public Member Functions

LinearOp buildPreconditionerOperator (BlockedLinearOp &blo, BlockPreconditionerState &state) const
 Create the LU 2x2 preconditioner operator. More...
 
virtual void initializeFromParameterList (const Teuchos::ParameterList &settings)
 This function builds the internals of the preconditioner factory from a parameter list. More...
 
virtual Teuchos::RCP
< Teuchos::ParameterList > 
getRequestedParameters () const
 Request the additional parameters this preconditioner factory needs. More...
 
virtual bool updateRequestedParameters (const Teuchos::ParameterList &pl)
 Update this object with the fields from a parameter list. More...
 
virtual bool useFullLDU () const
 Determine the type of inverse operator to build. More...
 
virtual void setFullLDU (bool value)
 Set the type of inverse operation to use. More...
 
Constructors.
 LU2x2PreconditionerFactory (LinearOp &invA00, LinearOp &invS)
 Build a simple static LU2x2 preconditioner. More...
 
 LU2x2PreconditionerFactory (LinearOp &hatInvA00, LinearOp &tildeInvA00, LinearOp &invS)
 Build a simple static LU2x2 preconditioner. More...
 
 LU2x2PreconditionerFactory (const Teuchos::RCP< LU2x2Strategy > &strategy)
 Constructor that permits the most generality in building $A_{00}^{-1}$ and $S^{-1}$. More...
 
 LU2x2PreconditionerFactory ()
 Default constructor for use with AutoClone. More...
 
- Public Member Functions inherited from Teko::BlockPreconditionerFactory
virtual RCP< PreconditionerStatebuildPreconditionerState () const
 Function that permits the construction of an arbitrary BlockPreconditionerState object. More...
 
RCP< BlockPreconditionerStatebuildBlockPreconditionerState () const
 Function that constructs a BlockPreconditionerState object. More...
 
virtual LinearOp buildPreconditionerOperator (LinearOp &blo, PreconditionerState &state) const
 Function that is called to build the preconditioner for the linear operator that is passed in. More...
 
bool isCompatible (const Thyra::LinearOpSourceBase< double > &fwdOpSrc) const
 is this operator compatiable with the preconditioner factory? More...
 
- Public Member Functions inherited from Teko::PreconditionerFactory
void setInverseLibrary (const Teuchos::RCP< const InverseLibrary > &il)
 Set the inverse library used by this preconditioner factory. More...
 
Teuchos::RCP< const
InverseLibrary > 
getInverseLibrary () const
 Get the inverse library used by this preconditioner factory. More...
 
void setRequestHandler (const Teuchos::RCP< RequestHandler > &rh)
 Set the request handler with pointers to the appropriate callbacks. More...
 
Teuchos::RCP< RequestHandlergetRequestHandler () const
 Get the request handler with pointers to the appropriate callbacks. More...
 
bool isCompatible (const Thyra::LinearOpSourceBase< double > &fwdOpSrc) const
 is this operator compatiable with the preconditioner factory? More...
 
Teuchos::RCP
< Thyra::PreconditionerBase
< double > > 
createPrec () const
 create an instance of the preconditioner More...
 
void initializePrec (const Teuchos::RCP< const Thyra::LinearOpSourceBase< double > > &fwdOpSrc, const Teuchos::RCP< const Thyra::MultiVectorBase< double > > &solnVec, Thyra::PreconditionerBase< double > *precOp, const Thyra::ESupportSolveUse supportSolveUse) const
 initialize a newly created preconditioner object More...
 
void initializePrec (const Teuchos::RCP< const Thyra::LinearOpSourceBase< double > > &fwdOpSrc, Thyra::PreconditionerBase< double > *precOp, const Thyra::ESupportSolveUse supportSolveUse) const
 initialize a newly created preconditioner object More...
 
void uninitializePrec (Thyra::PreconditionerBase< double > *prec, Teuchos::RCP< const Thyra::LinearOpSourceBase< double > > *fwdOpSrc, Thyra::ESupportSolveUse *supportSolveUse) const
 wipe clean a already initialized preconditioner object More...
 
void setParameterList (const Teuchos::RCP< Teuchos::ParameterList > &paramList)
 Set parameters from a parameter list and return with default values. More...
 
Teuchos::RCP
< Teuchos::ParameterList > 
getNonconstParameterList ()
 Get the parameter list that was set using setParameterList(). More...
 
Teuchos::RCP
< Teuchos::ParameterList > 
unsetParameterList ()
 Unset the parameter list that was set using setParameterList(). More...
 

Static Public Member Functions

static RCP< LU2x2StrategybuildStrategy (const std::string &name, const Teuchos::ParameterList &settings, const RCP< const InverseLibrary > &invLib, const RCP< RequestHandler > &rh)
 Builder function for creating strategies. More...
 
static void addStrategy (const std::string &name, const RCP< Cloneable > &clone)
 Add a strategy to the builder. This is done using the clone pattern. More...
 
- Static Public Member Functions inherited from Teko::PreconditionerFactory
static Teuchos::RCP
< PreconditionerFactory
buildPreconditionerFactory (const std::string &name, const Teuchos::ParameterList &settings, const Teuchos::RCP< const InverseLibrary > &invLib=Teuchos::null)
 Builder function for creating preconditioner factories (yes this is a factory factory). More...
 
static void addPreconditionerFactory (const std::string &name, const Teuchos::RCP< Cloneable > &clone)
 Add a preconditioner factory to the builder. This is done using the clone pattern. More...
 
static void getPreconditionerFactoryNames (std::vector< std::string > &names)
 Get the names of the block preconditioner factories. More...
 

Protected Attributes

Teuchos::RCP< LU2x2StrategyinvOpsStrategy_
 some members More...
 
bool useFullLDU_
 
- Protected Attributes inherited from Teko::PreconditionerFactory
Teuchos::RCP
< Teuchos::ParameterList > 
paramList_
 for ParameterListAcceptor More...
 
Teuchos::RCP< RequestHandlercallbackHandler_
 For handling requests and send requests back to the user. More...
 

Detailed Description

Construct a preconditioner using a LDU dcomposition of a block 2x2 matrix.

This produces a preconditioner using the block-LDU decomposition of the matrix. The general assumption made is that the matrix is 2x2 and the block factorization can be constructed (i.e. assumptions about the invertability of some blocks). The pattern used, and the one you should follow if you want to use this software is

$ A = \left[ \begin{array}{cc} A_{00} & A_{01} \\ A_{10} & A_{11} \end{array} \right] = \left[ \begin{array}{cc} I & 0 \\ A_{10} A_{00}^{-1} & I \end{array} \right] \left[ \begin{array}{cc} A_{00} & 0 \\ 0 & -S \end{array} \right] \left[ \begin{array}{cc} I & A_{00}^{-1} A_{01} \\ 0 & I \end{array} \right] $

where the Schur complement is $ S=-A_{11}+A_{10} A_{00}^{-1} A_{01} $ .

To use an LDU approximation 2 evaluations of $ A_{00}^{-1} $ and a single evalution of $ S^{-1} $ are needed. For increased flexibility both evaluations of $A_{00}^{-1}$ can be specified independently. For righthand side vector $[f, g]^T$ and solution vector $[u,v]^T$ the two inverses ( $A$-hat and $A$-tilde) are needed to evaluate

$\hat{A}_{00} u^* = f$,

$\tilde{A}_{00} v = A_{01} v$

where $u^*$ is an intermediate step.

In order to facilate using this class in a nonlinear solve (or for a time-dependent problem) the additional abstraction of a ``Strategy'' has been added. This strategy, abstractly represented as the LU2x2Strategy, provides the $A_{00}^{-1}$ and $S^{-1}$ operators. Typical usage for this class is to build a LU2x2Strategy and pass it into the primary constructor. Additional constructors are provided both for convenience and to ease adoption. Underneath the hood all these constructors do is invoke the corresponding strategy object.

For example, assume that you have the particularly nice case that your approximations of $A_{00}^{-1}$ and $S^{-1}$ are independent of the source operator. Then, one way to instantiate a LU2x2PreconditionerFactory is

RCP<LinearOpBase<double> > invA00 = buildInvA00(...);
RCP<LinearOpBase<double> > invS = buildInvS(...);
RCP<LU2x2PreconditionerFactory> precFact = rcp(new LU2x2PreconditionerFactory(invA00,invS));

Now using the strategy constructor, an entirely equivalent factory object can be constructed by

RCP<LinearOpBase<double> > invA00 = buildInvA00(...);
RCP<LinearOpBase<double> > invS = buildInvS(...);
RCP<LU2x2Strateghy> precStrat = rcp(new StaticLU2x2Strategy(invA00,invS));
RCP<LU2x2PreconditionerFactory> precFact = rcp(new LU2x2PreconditionerFactory(precStrat));

Notice that the StaticLU2x2Strategy takes the same objects as the original constructor, it acts as an intermediary to tell the LU2x2PreconditionerFactory what those operators are.

Definition at line 141 of file Teko_LU2x2PreconditionerFactory.hpp.

Constructor & Destructor Documentation

Teko::LU2x2PreconditionerFactory::LU2x2PreconditionerFactory ( LinearOp &  invA00,
LinearOp &  invS 
)

Build a simple static LU2x2 preconditioner.

Definition at line 63 of file Teko_LU2x2PreconditionerFactory.cpp.

Teko::LU2x2PreconditionerFactory::LU2x2PreconditionerFactory ( LinearOp &  hatInvA00,
LinearOp &  tildeInvA00,
LinearOp &  invS 
)

Build a simple static LU2x2 preconditioner.

Definition at line 68 of file Teko_LU2x2PreconditionerFactory.cpp.

Teko::LU2x2PreconditionerFactory::LU2x2PreconditionerFactory ( const Teuchos::RCP< LU2x2Strategy > &  strategy)

Constructor that permits the most generality in building $A_{00}^{-1}$ and $S^{-1}$.

Constructor that permits the most generality in building $A_{00}^{-1}$ and $S^{-1}$.

Parameters
[in]strategyStrategy object that takes a 2x2 block matrix and and constructs the $A_{00}^{-1}$ and $S^{-1}$ objects.
Teko::LU2x2PreconditionerFactory::LU2x2PreconditionerFactory ( )

Default constructor for use with AutoClone.

Default constructor for use with AutoClone

Definition at line 76 of file Teko_LU2x2PreconditionerFactory.cpp.

Member Function Documentation

LinearOp Teko::LU2x2PreconditionerFactory::buildPreconditionerOperator ( BlockedLinearOp &  blo,
BlockPreconditionerState state 
) const
virtual

Create the LU 2x2 preconditioner operator.

This method breaks apart the BlockLinearOp and builds a block LU preconditioner. This will require two applications of the inverse of the (0,0) block and one application of the inverse Schur complement.

Implements Teko::BlockPreconditionerFactory.

Definition at line 84 of file Teko_LU2x2PreconditionerFactory.cpp.

void Teko::LU2x2PreconditionerFactory::initializeFromParameterList ( const Teuchos::ParameterList &  settings)
virtual

This function builds the internals of the preconditioner factory from a parameter list.

This function builds the internals of the preconditioner factory from a parameter list. Furthermore, it allows a preconditioner factory developer to easily add a factory to the build system. This function is required for building a preconditioner from a parameter list.

Parameters
[in]settingsParmaeter list to use as the internal settings
Note
The default implementation does nothing.

Reimplemented from Teko::PreconditionerFactory.

Definition at line 114 of file Teko_LU2x2PreconditionerFactory.cpp.

Teuchos::RCP< Teuchos::ParameterList > Teko::LU2x2PreconditionerFactory::getRequestedParameters ( ) const
virtual

Request the additional parameters this preconditioner factory needs.

Request the additonal parameters needed by this preconditioner factory. The parameter list will have a set of fields that can be filled with the requested values. These fields include all requirements, even those of the sub-solvers if there are any. Once correctly filled the object can be updated by calling the updateRequestedParameters with the filled parameter list.

Returns
A parameter list with the requested parameters.
Note
The default implementation returns Teuchos::null.

Reimplemented from Teko::PreconditionerFactory.

Definition at line 144 of file Teko_LU2x2PreconditionerFactory.cpp.

bool Teko::LU2x2PreconditionerFactory::updateRequestedParameters ( const Teuchos::ParameterList &  pl)
virtual

Update this object with the fields from a parameter list.

Update the requested fields using a parameter list. This method is expected to pair with the getRequestedParameters method (i.e. the fields requested are going to be update using this method).

Parameters
[in]plParameter list containing the requested parameters.
Returns
If the method succeeded (found all its required parameters) this method returns true, otherwise it returns false.
Note
The default implementation returns true (it does nothing!).

Reimplemented from Teko::PreconditionerFactory.

Definition at line 163 of file Teko_LU2x2PreconditionerFactory.cpp.

virtual bool Teko::LU2x2PreconditionerFactory::useFullLDU ( ) const
inlinevirtual

Determine the type of inverse operator to build.

Determine the type of inverse operator to build. If true use the full LDU decomposition. If false only the upper triangular solve should be used. Motivation for doing this can be found in Murphy, Golub and Wathen, SISC 2000.

Returns
A boolean indicating the type of inverse operator to use.
Note
Default behavior for this class is to return true.

Definition at line 236 of file Teko_LU2x2PreconditionerFactory.hpp.

virtual void Teko::LU2x2PreconditionerFactory::setFullLDU ( bool  value)
inlinevirtual

Set the type of inverse operation to use.

Set the type of inverse operator to use. If true use the full LDU decomposition. If false only the upper triangular solve should be used. Motivation for doing this can be found in Murphy, Golub and Wathen, SISC 2000.

Parameters
[in]valueBoolean indicating type of inverse operator to build.

Definition at line 248 of file Teko_LU2x2PreconditionerFactory.hpp.

RCP< LU2x2Strategy > Teko::LU2x2PreconditionerFactory::buildStrategy ( const std::string &  name,
const Teuchos::ParameterList &  settings,
const RCP< const InverseLibrary > &  invLib,
const RCP< RequestHandler > &  rh 
)
static

Builder function for creating strategies.

Builder function for creating strategies.

Parameters
[in]nameString name of strategy to build
[in]settingsParameter list describing the parameters for the strategy to build
[in]invLibInverse library for the strategy to use.
Returns
If the name is associated with a strategy a pointer is returned, otherwise Teuchos::null is returned.

Definition at line 188 of file Teko_LU2x2PreconditionerFactory.cpp.

void Teko::LU2x2PreconditionerFactory::addStrategy ( const std::string &  name,
const RCP< Cloneable > &  clone 
)
static

Add a strategy to the builder. This is done using the clone pattern.

Add a strategy to the builder. This is done using the clone pattern. If your class does not support the Cloneable interface then you can use the AutoClone class to construct your object.

Note
If this method is called twice with the same string, the latter clone pointer will be used.
Parameters
[in]nameString to associate with this object
[in]clonePointer to Cloneable object

Definition at line 237 of file Teko_LU2x2PreconditionerFactory.cpp.

Member Data Documentation

Teuchos::RCP<LU2x2Strategy> Teko::LU2x2PreconditionerFactory::invOpsStrategy_
protected

some members

Definition at line 255 of file Teko_LU2x2PreconditionerFactory.hpp.

bool Teko::LU2x2PreconditionerFactory::useFullLDU_
protected

If true, use full LDU decomposition, otherwise use the Golub & Wathen style upper block. This is true by default.

Definition at line 261 of file Teko_LU2x2PreconditionerFactory.hpp.


The documentation for this class was generated from the following files: