Thyra::LinearOpWithSolveFactoryBase< RangeScalar, DomainScalar > Class Template Reference

#include <Thyra_LinearOpWithSolveFactoryBase.hpp>

List of all members.

Preconditioner Factory Management

virtual bool acceptsPreconditionerFactory () const
 Determines if *this accepts external preconditioner factories.
virtual void setPreconditionerFactory (const Teuchos::RefCountPtr< PreconditionerFactoryBase< RangeScalar, DomainScalar > > &precFactory, const std::string &precFactoryName)
 Set a preconditioner factory object.
virtual Teuchos::RefCountPtr<
PreconditionerFactoryBase<
RangeScalar, DomainScalar > > 
getPreconditionerFactory () const
 Get a preconditioner factory object.
virtual void unsetPreconditionerFactory (Teuchos::RefCountPtr< PreconditionerFactoryBase< RangeScalar, DomainScalar > > *precFactory=NULL, std::string *precFactoryName=NULL)
 Unset the preconditioner factory (if one is set).

Creation/Initialization of basic LinearOpWithSolveBase objects

virtual bool isCompatible (const LinearOpSourceBase< RangeScalar, DomainScalar > &fwdOpSrc) const =0
 Check that a LinearOpBase object is compatible with *this factory object.
virtual Teuchos::RefCountPtr<
LinearOpWithSolveBase< RangeScalar,
DomainScalar > > 
createOp () const =0
 Create an (uninitialized) LinearOpWithSolveBase object to be initialized later in this->initializeOp().
virtual void initializeOp (const Teuchos::RefCountPtr< const LinearOpSourceBase< RangeScalar, DomainScalar > > &fwdOpSrc, LinearOpWithSolveBase< RangeScalar, DomainScalar > *Op, const ESupportSolveUse supportSolveUse=SUPPORT_SOLVE_UNSPECIFIED) const =0
 Initialize a pre-created LinearOpWithSolveBase object given a "compatible" LinearOpBase object.
virtual void initializeAndReuseOp (const Teuchos::RefCountPtr< const LinearOpSourceBase< RangeScalar, DomainScalar > > &fwdOpSrc, LinearOpWithSolveBase< RangeScalar, DomainScalar > *Op) const
 Initialize a pre-created LinearOpWithSolveBase object given a "compatible" LinearOpBase object but allow for reuse of any preprocessing that is in *Op..
virtual void uninitializeOp (LinearOpWithSolveBase< RangeScalar, DomainScalar > *Op, Teuchos::RefCountPtr< const LinearOpSourceBase< RangeScalar, DomainScalar > > *fwdOpSrc=NULL, Teuchos::RefCountPtr< const PreconditionerBase< RangeScalar, DomainScalar > > *prec=NULL, Teuchos::RefCountPtr< const LinearOpSourceBase< RangeScalar, DomainScalar > > *approxFwdOpSrc=NULL, ESupportSolveUse *supportSolveUse=NULL) const =0
 Uninitialize a LinearOpWithSolveBase object and return its remembered forward linear operator and potentially also its externally generated preconditioner.

Creation/Initialization of Preconditioned LinearOpWithSolveBase objects

virtual bool supportsPreconditionerInputType (const EPreconditionerInputType precOpType) const
 Determines if *this supports given preconditioner type.
virtual void initializePreconditionedOp (const Teuchos::RefCountPtr< const LinearOpSourceBase< RangeScalar, DomainScalar > > &fwdOpSrc, const Teuchos::RefCountPtr< const PreconditionerBase< RangeScalar, DomainScalar > > &prec, LinearOpWithSolveBase< RangeScalar, DomainScalar > *Op, const ESupportSolveUse supportSolveUse=SUPPORT_SOLVE_UNSPECIFIED) const
 Initialize a pre-created LinearOpWithSolveBase object given a "compatible" LinearOpBase object and an optional PreconditionerBase object.
virtual void initializeApproxPreconditionedOp (const Teuchos::RefCountPtr< const LinearOpSourceBase< RangeScalar, DomainScalar > > &fwdOpSrc, const Teuchos::RefCountPtr< const LinearOpSourceBase< RangeScalar, DomainScalar > > &approxFwdOpSrc, LinearOpWithSolveBase< RangeScalar, DomainScalar > *Op, const ESupportSolveUse supportSolveUse=SUPPORT_SOLVE_UNSPECIFIED) const
 Initialize a pre-created LinearOpWithSolveBase object given a "compatible" forward LinearOpBase object and an approximate forward LinearOpBase object.

template<class RangeScalar, class DomainScalar = RangeScalar>
class Thyra::LinearOpWithSolveFactoryBase< RangeScalar, DomainScalar >


Member Function Documentation

template<class RangeScalar, class DomainScalar>
bool Thyra::LinearOpWithSolveFactoryBase< RangeScalar, DomainScalar >::acceptsPreconditionerFactory  )  const [virtual]
 

Determines if *this accepts external preconditioner factories.

The default implementation returns false.

Definition at line 754 of file Thyra_LinearOpWithSolveFactoryBase.hpp.

template<class RangeScalar, class DomainScalar>
void Thyra::LinearOpWithSolveFactoryBase< RangeScalar, DomainScalar >::setPreconditionerFactory const Teuchos::RefCountPtr< PreconditionerFactoryBase< RangeScalar, DomainScalar > > &  precFactory,
const std::string &  precFactoryName
[virtual]
 

Set a preconditioner factory object.

Parameters:
precFactory [in] The preconditioner factory to be used internally to create preconditioners.
precFactoryName [in] The name to give to the preconditioner factory internally. This name is used when setting parameters in the parameter list.
Preconditions:
  • precFactory.get()!=NULL

Postconditions:

The default implementation thrown an exception which is consistent with acceptsPreconditionerFactory().

Definition at line 760 of file Thyra_LinearOpWithSolveFactoryBase.hpp.

template<class RangeScalar, class DomainScalar>
Teuchos::RefCountPtr< PreconditionerFactoryBase< RangeScalar, DomainScalar > > Thyra::LinearOpWithSolveFactoryBase< RangeScalar, DomainScalar >::getPreconditionerFactory  )  const [virtual]
 

Get a preconditioner factory object.

The default implementation returns Teuchos::null.

Definition at line 774 of file Thyra_LinearOpWithSolveFactoryBase.hpp.

template<class RangeScalar, class DomainScalar>
void Thyra::LinearOpWithSolveFactoryBase< RangeScalar, DomainScalar >::unsetPreconditionerFactory Teuchos::RefCountPtr< PreconditionerFactoryBase< RangeScalar, DomainScalar > > *  precFactory = NULL,
std::string *  precFactoryName = NULL
[virtual]
 

Unset the preconditioner factory (if one is set).

Postconditions:

The default implementation returns Teuchos::null.

Definition at line 780 of file Thyra_LinearOpWithSolveFactoryBase.hpp.

template<class RangeScalar, class DomainScalar = RangeScalar>
virtual bool Thyra::LinearOpWithSolveFactoryBase< RangeScalar, DomainScalar >::isCompatible const LinearOpSourceBase< RangeScalar, DomainScalar > &  fwdOpSrc  )  const [pure virtual]
 

Check that a LinearOpBase object is compatible with *this factory object.

template<class RangeScalar, class DomainScalar = RangeScalar>
virtual Teuchos::RefCountPtr<LinearOpWithSolveBase<RangeScalar,DomainScalar> > Thyra::LinearOpWithSolveFactoryBase< RangeScalar, DomainScalar >::createOp  )  const [pure virtual]
 

Create an (uninitialized) LinearOpWithSolveBase object to be initialized later in this->initializeOp().

Note that on output return->domain().get()==NULL may be true which means that the operator is not fully initialized. In fact, the output operator object is not guaranteed to be fully initialized until after it is passed through this->initializeOp().

template<class RangeScalar, class DomainScalar = RangeScalar>
virtual void Thyra::LinearOpWithSolveFactoryBase< RangeScalar, DomainScalar >::initializeOp const Teuchos::RefCountPtr< const LinearOpSourceBase< RangeScalar, DomainScalar > > &  fwdOpSrc,
LinearOpWithSolveBase< RangeScalar, DomainScalar > *  Op,
const ESupportSolveUse  supportSolveUse = SUPPORT_SOLVE_UNSPECIFIED
const [pure virtual]
 

Initialize a pre-created LinearOpWithSolveBase object given a "compatible" LinearOpBase object.

Parameters:
fwdOpSrc [in] The forward linear operator that will be used to create the output LinearOpWithSolveBase object. Note that this object is remembered by the *Op object on output.
Op [in/out] The output LinearOpWithSolveBase object. This object must have be created first by this->createOp(). The object may have also already been passed through this function several times. Note that subclasses should always first strip off the transpose and scaling by calling unwrap() before attempting to dynamic cast the object.
supportSolveUse [in] Determines if Op->solve(...) or Op->solveTranspose(...) will be called. This allows *this factory object to determine how to best initialize the *Op object. Default supportSolveUse=SUPPORT_SOLVE_UNSPECIFIED
Preconditions:
  • fwdOpSrc.get()!=NULL
  • this->isCompatible(*fwdOpSrc)==true
  • Op!=NULL
  • *Op must have been created by this->createOp() prior to calling this function.
  • [supportSolveUse==SUPPORT_SOLVE_FORWARD_ONLY] this->solveSupportsConj(conj)==true for any value of conj
  • [supportSolveUse==SUPPORT_SOLVE_TRANSPOSE_ONLY] this->solveTransposeSupportsConj(conj)==true for any value of conj
  • [supportSolveUse==SUPPORT_SOLVE_FORWARD_AND_TRANSPOSE] this->solveSupportsConj(conj)==true && this->solveTransposeSupportsConj(conj)==true for any value of conj

Postconditions:

  • Throws CatastrophicSolveFailure if the underlying linear solver could not be created successfully (e.g. due to a factorization failure or some other cause).
  • Op->range()->isCompatible(*fwdOpSrc->range())==true
  • Op->domain()->isCompatible(*fwdOpSrc->domain())==true
  • Op->apply() and Op->applyTranspose() must behave exactly the same as fwdOpSrc->apply() and fwdOpSrc->applyTranspose()
  • <t>Op->solveSupportsConj(conj)==this->solveSupportsConj(conj)
  • <t>Op->solveTransposeSupportsConj(conj)==this->solveTransposeSupportsConj(conj)
  • fwdOpSrc.count() after output is greater than fwdOpSrc.count() just before this call and therefore the client can assume that the *fwdOpSrc object will be remembered by the *Op object. The client must be careful not to modify the *fwdOpSrc object or else the *Op object may also be modified and become invalid.

template<class RangeScalar, class DomainScalar>
void Thyra::LinearOpWithSolveFactoryBase< RangeScalar, DomainScalar >::initializeAndReuseOp const Teuchos::RefCountPtr< const LinearOpSourceBase< RangeScalar, DomainScalar > > &  fwdOpSrc,
LinearOpWithSolveBase< RangeScalar, DomainScalar > *  Op
const [virtual]
 

Initialize a pre-created LinearOpWithSolveBase object given a "compatible" LinearOpBase object but allow for reuse of any preprocessing that is in *Op..

Parameters:
fwdOpSrc [in] The forward linear operator that will be used to create the output LinearOpWithSolveBase object.
Op [in/out] The output LinearOpWithSolveBase object. This object must have be created first by this->createOp() and may have already been through at least one previous set of calls to this->initializeOp() and this->uninitializeOp(). Note that subclasses should always first strip off the transpose and scaling by calling unwrap() before attempting to dynamic cast the object.
Preconditions:
  • fwdOpSrc.get()!=NULL
  • this->isCompatible(*fwdOpSrc)==true
  • Op!=NULL
  • *Op must have been created by this->createOp() prior to calling this function.

Postconditions:

  • Throws CatastrophicSolveFailure if the underlying linear solver could not be created successfully (e.g. due to a factorization failure or some other cause).
  • Op->range()->isCompatible(*fwdOpSrc->range())==true
  • Op->domain()->isCompatible(*fwdOpSrc->domain())==true
  • Op->apply() and Op->applyTranspose() must behave exactly the same as fwdOpSrc->apply() and fwdOpSrc->applyTranspose()
  • <t>Op->solveSupportsConj(conj)==this->solveSupportsConj(conj)
  • <t>Op->solveTransposeSupportsConj(conj)==this->solveTransposeSupportsConj(conj)
  • fwdOpSrc.count() after output is greater than fwdOpSrc.count() just before this call and therefore the client can assume that the *fwdOpSrc object will be remembered by the *Op object. The client must be careful not to modify the *fwdOpSrc object or else the *Op object may also be modified.

The purpose of this function is to allow the reuse of old factorizations and/or preconditioners that may go into the initialization of the *Op objects. Note that by calling this function, the performance Op->solve(...) may not be as good as when calling the function this->initializeOp(...,Op) to initialize *Op.

The default implementation of this function just calls this->initializeOp(fwdOpSrc,Op) which does the default implementation.

Definition at line 790 of file Thyra_LinearOpWithSolveFactoryBase.hpp.

template<class RangeScalar, class DomainScalar = RangeScalar>
virtual void Thyra::LinearOpWithSolveFactoryBase< RangeScalar, DomainScalar >::uninitializeOp LinearOpWithSolveBase< RangeScalar, DomainScalar > *  Op,
Teuchos::RefCountPtr< const LinearOpSourceBase< RangeScalar, DomainScalar > > *  fwdOpSrc = NULL,
Teuchos::RefCountPtr< const PreconditionerBase< RangeScalar, DomainScalar > > *  prec = NULL,
Teuchos::RefCountPtr< const LinearOpSourceBase< RangeScalar, DomainScalar > > *  approxFwdOpSrc = NULL,
ESupportSolveUse supportSolveUse = NULL
const [pure virtual]
 

Uninitialize a LinearOpWithSolveBase object and return its remembered forward linear operator and potentially also its externally generated preconditioner.

Parameters:
Op [in/out] On input, *Op is an initialized or uninitialized object and on output is uninitialized. Note that "uninitialized" does not mean that Op is completely stateless. It may still remember some aspect of the matrix fwdOpSrc that will allow for a more efficient initialization next time through this->initializeOp().
fwdOpSrc [in/out] If fwdOpSrc!=NULL on input, then on output this is set to the same forward operator passed into <tt>this->initializeOp().
prec [in/out] If prep!=NULL on input, then on output, this this is set to same preconditioner that was passed into this->initializePreconditionedOp().
approxFwdOpSrc [in/out] If approxFwdOpSrc!=NULL on input, then on output, this is set to same approximate forward operator that was passed into <tt>this->initializePreconditionedOp().
ESupportSolveUse [in/out] If fwdOpSrc!=NULL on input, then on output this is set to same option value passed to this->initializeOp().
Preconditions:

Postconditions:

  • If *Op on input was initialized through a call to this->initializeOp() and if fwdOpSrc!=NULL then (*fwdOpSrc).get()!=NULL.
  • If *Op was uninitialized on input and fwdOpSrc!=NULL then fwdOpSrc->get()==NULL out output.
  • On output, *Op can be considered to be uninitialized and it is safe to modify the forward operator object <tt>*(*fwdOpSrc) returned in fwdOpSrc. The default is fwdOpSrc==NULL in which case the forward operator will not be returned in *fwdOpSrc.

This function should be called before the forward operator passed in to this->initializeOp() is modified. Otherwise, *this could be left in an inconsistent state. However, this is not required.

template<class RangeScalar, class DomainScalar>
bool Thyra::LinearOpWithSolveFactoryBase< RangeScalar, DomainScalar >::supportsPreconditionerInputType const EPreconditionerInputType  precOpType  )  const [virtual]
 

Determines if *this supports given preconditioner type.

The default implementation returns false.

Definition at line 799 of file Thyra_LinearOpWithSolveFactoryBase.hpp.

template<class RangeScalar, class DomainScalar>
void Thyra::LinearOpWithSolveFactoryBase< RangeScalar, DomainScalar >::initializePreconditionedOp const Teuchos::RefCountPtr< const LinearOpSourceBase< RangeScalar, DomainScalar > > &  fwdOpSrc,
const Teuchos::RefCountPtr< const PreconditionerBase< RangeScalar, DomainScalar > > &  prec,
LinearOpWithSolveBase< RangeScalar, DomainScalar > *  Op,
const ESupportSolveUse  supportSolveUse = SUPPORT_SOLVE_UNSPECIFIED
const [virtual]
 

Initialize a pre-created LinearOpWithSolveBase object given a "compatible" LinearOpBase object and an optional PreconditionerBase object.

Parameters:
fwdOpSrc [in] The forward linear operator that will be used to create the output LinearOpWithSolveBase object.
prec [in] The preconditioner that will be used to create the output LinearOpWithSolveBase object if preconditioners are supported.
Op [in/out] The output LinearOpWithSolveBase object. This object must have be created first by this->createOp(). The object may have also already been passed through this function several times. Note that subclasses should always first strip off the transpose and scaling by calling unwrap() before attempting to dynamic cast the object.
supportSolveUse [in] Determines if Op->solve(...) or Op->solveTranspose(...) will be called. This allows *this factory object determine how to best initialize the *Op object. Default supportSolveUse=SUPPORT_SOLVE_UNSPECIFIED
Preconditions:
  • fwdOpSrc.get()!=NULL
  • prec.get()!=NULL
  • this->isCompatible(*fwdOpSrc)==true
  • Op!=NULL
  • *Op must have been created by this->createOp() prior to calling this function.
  • It is allowed for an implementation to throw an exception if this->supportsPreconditionerInputType(PRECONDITIONER_INPUT_TYPE_AS_OPERATOR)==false but this is not required.
  • [supportSolveUse==SUPPORT_SOLVE_FORWARD_ONLY] this->solveSupportsConj(conj)==true for any value of conj
  • [supportSolveUse==SUPPORT_SOLVE_TRANSPOSE_ONLY] this->solveTransposeSupportsConj(conj)==true for any value of conj
  • [supportSolveUse==SUPPORT_SOLVE_FORWARD_AND_TRANSPOSE] this->solveSupportsConj(conj)==true && this->solveTransposeSupportsConj(conj)==true for any value of conj

Postconditions:

  • Throws CatastrophicSolveFailure if the underlying linear solver could not be created successfully (e.g. due to a factorization failure or some other cause).
  • Op->range()->isCompatible(*fwdOpSrc->range())==true
  • Op->domain()->isCompatible(*fwdOpSrc->domain())==true
  • Op->apply() and Op->applyTranspose() must behave exactly the same as fwdOpSrc->apply() and fwdOpSrc->applyTranspose()
  • <t>Op->solveSupportsConj(conj)==this->solveSupportsConj(conj)
  • <t>Op->solveTransposeSupportsConj(conj)==this->solveTransposeSupportsConj(conj)
  • fwdOpSrc.count() after output is greater than fwdOpSrc.count() just before this call and therefore the client can assume that the *fwdOpSrc object will be remembered by the *Op object. The client must be careful not to modify the *fwdOpSrc object or else the *Op object may also be modified.
  • If this->supportsPreconditionerInputType(PRECONDITIONER_INPUT_TYPE_AS_OPERATOR)==true then
    • prec.count() after output is greater than prec.count() just before this call and therefore the client can assume that the *prec object will be remembered by the *Op object. The client must be careful not to modify the *prec object or else the *Op object may also be modified.
  • else if an exception is not thrown then
    • prec.count() after output is equal to prec.count() just before this call and therefore the *prec is ignored and is not remembered.

Warning! It is allowed for an implementation to throw an exception if this->supportsPreconditionerInputType(PRECONDITIONER_INPUT_TYPE_AS_OPERATOR)==false so therefore a client should not call this function if preconditioners are not supported! The mode of silently ignoring preconditioners is acceptable in some cases and is therefore allowed behavior.

The default implementation throws an exception which is consistent with the default implementation of this->supportsPreconditionerInputType() which assumes by default that preconditioners can not be supported..

Definition at line 807 of file Thyra_LinearOpWithSolveFactoryBase.hpp.

template<class RangeScalar, class DomainScalar>
void Thyra::LinearOpWithSolveFactoryBase< RangeScalar, DomainScalar >::initializeApproxPreconditionedOp const Teuchos::RefCountPtr< const LinearOpSourceBase< RangeScalar, DomainScalar > > &  fwdOpSrc,
const Teuchos::RefCountPtr< const LinearOpSourceBase< RangeScalar, DomainScalar > > &  approxFwdOpSrc,
LinearOpWithSolveBase< RangeScalar, DomainScalar > *  Op,
const ESupportSolveUse  supportSolveUse = SUPPORT_SOLVE_UNSPECIFIED
const [virtual]
 

Initialize a pre-created LinearOpWithSolveBase object given a "compatible" forward LinearOpBase object and an approximate forward LinearOpBase object.

Parameters:
fwdOpSrc [in] The forward linear operator that will be used to create the output LinearOpWithSolveBase object.
approxFwdOpSrc [in] Approximation to fwdOpSrc from which a preconditioner will be created for.
Op [in/out] The output LinearOpWithSolveBase object. This object must have be created first by this->createOp(). The object may have also already been passed through this function several times. Note that subclasses should always first strip off the transpose and scaling by calling unwrap() before attempting to dynamic cast the object.
supportSolveUse [in] Determines if Op->solve(...) or Op->solveTranspose(...) will be called. This allows *this factory object determine how to best initialize the *Op object. Default supportSolveUse=SUPPORT_SOLVE_UNSPECIFIED
ToDo: finish documentation!

Definition at line 822 of file Thyra_LinearOpWithSolveFactoryBase.hpp.


The documentation for this class was generated from the following file:
Generated on Thu Sep 18 12:33:11 2008 for Thyra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1