44#include "Thyra_SpmdMultiVectorBase.hpp"
45#include "Thyra_MultiVectorStdOps.hpp"
46#include "Thyra_AssertOp.hpp"
53#include "Epetra_Map.h"
54#include "Epetra_Vector.h"
55#include "Epetra_Operator.h"
56#include "Epetra_CrsMatrix.h"
66 :isFullyInitialized_(
false),
83 using Teuchos::rcp_dynamic_cast;
89 "Thyra::EpetraLinearOp::initialize(...): Error!" );
130 using Teuchos::rcp_dynamic_cast;
136 "Thyra::EpetraLinearOp::partiallyInitialize(...): Error!" );
138 "Thyra::EpetraLinearOp::partiallyInitialize(...): Error!" );
140 "Thyra::EpetraLinearOp::partiallyInitialize(...): Error!" );
277 return Teuchos::null;
286 std::ostringstream
oss;
289 oss <<
"op=\'"<<typeName(*
op_)<<
"\'";
290 oss <<
",rangeDim="<<this->
range()->dim();
291 oss <<
",domainDim="<<this->
domain()->dim();
308 using Teuchos::rcp_dynamic_cast;
310 using Teuchos::describe;
319 <<
"rangeDim=" << this->
range()->dim()
320 <<
",domainDim=" << this->
domain()->dim()
328 out <<
"op="<<typeName(*
op_)<<
"\n";
340 out <<
"op=NULL"<<
"\n";
381 Exceptions::OpNotSupported,
382 "EpetraLinearOp::apply(...): *this was informed that adjoints "
383 "are not supported when initialized."
402 "Thyra::EpetraLinearOp::euclideanApply: Convert MultiVectors",
MultiVectors);
422 op_->SetUseTranspose(
430 "Thyra::EpetraLinearOp::euclideanApply: Apply", Apply);
435 "Thyra::EpetraLinearOp::euclideanApply: Apply(beta==0): Apply",
437 op_->Apply( *
X, *
Y );
441 "Thyra::EpetraLinearOp::euclideanApply: Apply(beta==0): ApplyInverse",
443 op_->ApplyInverse( *
X, *
Y );
453 "Thyra::EpetraLinearOp::euclideanApply: Apply(beta==0): Scale Y",
462 "Thyra::EpetraLinearOp::euclideanApply: Apply(beta!=0): Scale Y",
468 "Thyra::EpetraLinearOp::euclideanApply: Apply(beta!=0): Y=0",
479 "Thyra::EpetraLinearOp::euclideanApply: Apply(beta!=0): Apply",
485 "Thyra::EpetraLinearOp::euclideanApply: Apply(beta!=0): ApplyInverse",
487 op_->ApplyInverse( *
X,
T );
497 "Thyra::EpetraLinearOp::euclideanApply: Apply(beta!=0): Update Y",
538 using Teuchos::rcpFromRef;
547 using Teuchos::rcpFromRef;
558 const RowStatLinearOpBaseUtils::ERowStat
rowStat)
const
564 case RowStatLinearOpBaseUtils::ROW_STAT_INV_ROW_SUM:
565 case RowStatLinearOpBaseUtils::ROW_STAT_ROW_SUM:
575 const RowStatLinearOpBaseUtils::ERowStat
rowStat,
579 using Teuchos::rcpFromPtr;
583 case RowStatLinearOpBaseUtils::ROW_STAT_INV_ROW_SUM:
586 case RowStatLinearOpBaseUtils::ROW_STAT_ROW_SUM:
630 ?
op_->OperatorRangeMap() :
op_->OperatorDomainMap() );
638 ?
op_->OperatorDomainMap() :
op_->OperatorRangeMap() );
650 Exceptions::OpNotSupported,
651 "EpetraLinearOp::computeAbsRowSum(...): wrapped matrix must be of type "
652 "Epetra_CrsMatrix for this method. Other operator types are not supported."
662 std::invalid_argument,
663 "EpetraLinearOp::computeAbsRowSum(...): Epetra_CrsMatrix must be filled"
668 double *
xp = (
double*)x.Values();
671 x_tmp.PutScalar(0.0);
681 else if (
crsMatrix->Graph().RowMap().SameAs(x.Map())) {
703Thyra::nonconstEpetraLinearOp()
710Thyra::partialNonconstEpetraLinearOp(
711 const RCP<
const VectorSpaceBase<double> > &range,
712 const RCP<
const VectorSpaceBase<double> > &domain,
713 const RCP<Epetra_Operator> &op,
715 EApplyEpetraOpAs applyAs,
716 EAdjointEpetraOp adjointSupport
719 RCP<EpetraLinearOp> thyraEpetraOp =
Teuchos::rcp(
new EpetraLinearOp());
720 thyraEpetraOp->partiallyInitialize(
721 range, domain,op,opTrans, applyAs, adjointSupport
723 return thyraEpetraOp;
728Thyra::nonconstEpetraLinearOp(
729 const RCP<Epetra_Operator> &op,
731 EApplyEpetraOpAs applyAs,
732 EAdjointEpetraOp adjointSupport,
733 const RCP<
const VectorSpaceBase<double> > &range,
734 const RCP<
const VectorSpaceBase<double> > &domain
737 RCP<EpetraLinearOp> thyraEpetraOp =
Teuchos::rcp(
new EpetraLinearOp());
738 thyraEpetraOp->initialize(
739 op,opTrans, applyAs, adjointSupport, range, domain
741 return thyraEpetraOp;
746Thyra::epetraLinearOp(
747 const RCP<const Epetra_Operator> &op,
749 EApplyEpetraOpAs applyAs,
750 EAdjointEpetraOp adjointSupport,
751 const RCP<
const VectorSpaceBase<double> > &range,
752 const RCP<
const VectorSpaceBase<double> > &domain
755 RCP<EpetraLinearOp> thyraEpetraOp =
Teuchos::rcp(
new EpetraLinearOp());
756 thyraEpetraOp->initialize(
758 opTrans, applyAs, adjointSupport, range, domain
760 return thyraEpetraOp;
765Thyra::nonconstEpetraLinearOp(
766 const RCP<Epetra_Operator> &op,
767 const std::string &label,
769 EApplyEpetraOpAs applyAs,
770 EAdjointEpetraOp adjointSupport,
771 const RCP<
const VectorSpaceBase<double> > &range,
772 const RCP<
const VectorSpaceBase<double> > &domain
775 RCP<EpetraLinearOp> thyraEpetraOp =
Teuchos::rcp(
new EpetraLinearOp());
776 thyraEpetraOp->initialize(
777 op,opTrans, applyAs, adjointSupport, range, domain
779 thyraEpetraOp->setObjectLabel(label);
780 return thyraEpetraOp;
785Thyra::epetraLinearOp(
786 const RCP<const Epetra_Operator> &op,
787 const std::string &label,
789 EApplyEpetraOpAs applyAs,
790 EAdjointEpetraOp adjointSupport,
791 const RCP<
const SpmdVectorSpaceBase<double> > &range,
792 const RCP<
const SpmdVectorSpaceBase<double> > &domain
795 RCP<EpetraLinearOp> thyraEpetraOp =
Teuchos::rcp(
new EpetraLinearOp());
796 thyraEpetraOp->initialize(
798 opTrans, applyAs, adjointSupport, range, domain
800 thyraEpetraOp->setObjectLabel(label);
801 return thyraEpetraOp;
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
virtual std::string description() const
RCP< const SpmdVectorSpaceBase< double > > spmdDomain() const
Return a smart pointer to the SpmdVectorSpaceBase object for the domain.
std::string description() const
virtual void scaleLeftImpl(const VectorBase< double > &row_scaling)
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< double > &X, const Ptr< MultiVectorBase< double > > &Y, const double alpha, const double beta) const
EApplyEpetraOpAs applyAs_
virtual void scaleRightImpl(const VectorBase< double > &col_scaling)
RCP< Epetra_Operator > op_
EAdjointEpetraOp adjointSupport_
void getNonconstEpetraOpView(const Ptr< RCP< Epetra_Operator > > &epetraOp, const Ptr< EOpTransp > &epetraOpTransp, const Ptr< EApplyEpetraOpAs > &epetraOpApplyAs, const Ptr< EAdjointEpetraOp > &epetraOpAdjointSupport)
void getEpetraOpView(const Ptr< RCP< const Epetra_Operator > > &epetraOp, const Ptr< EOpTransp > &epetraOpTransp, const Ptr< EApplyEpetraOpAs > &epetraOpApplyAs, const Ptr< EAdjointEpetraOp > &epetraOpAdjointSupport) const
RCP< Epetra_RowMatrix > rowMatrix_
void uninitialize(RCP< Epetra_Operator > *op=NULL, EOpTransp *opTrans=NULL, EApplyEpetraOpAs *applyAs=NULL, EAdjointEpetraOp *adjointSupport=NULL, RCP< const VectorSpaceBase< double > > *range=NULL, RCP< const VectorSpaceBase< double > > *domain=NULL)
Set to uninitialized and optionally return the current state.
EpetraLinearOp()
Construct to uninitialized.
virtual bool supportsScaleRightImpl() const
void computeAbsRowSum(Epetra_Vector &rowStatVec_in) const
Compute the absolute row sum for this matrix.
RCP< const SpmdVectorSpaceBase< double > > domain_
void setFullyInitialized(bool isFullyInitialized=true)
Set to fully initialized.
const Epetra_Map & getDomainMap() const
virtual void getRowStatImpl(const RowStatLinearOpBaseUtils::ERowStat rowStat, const Ptr< VectorBase< double > > &rowStatVec) const
void describe(FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
virtual RCP< const SpmdVectorSpaceBase< double > > allocateRange(const RCP< Epetra_Operator > &op, EOpTransp op_trans) const
Allocate the range space of the operator.
void initialize(const RCP< Epetra_Operator > &op, EOpTransp opTrans=NOTRANS, EApplyEpetraOpAs applyAs=EPETRA_OP_APPLY_APPLY, EAdjointEpetraOp adjointSupport=EPETRA_OP_ADJOINT_SUPPORTED, const RCP< const VectorSpaceBase< double > > &range=Teuchos::null, const RCP< const VectorSpaceBase< double > > &domain=Teuchos::null)
Fully initialize.
RCP< const LinearOpBase< double > > clone() const
void partiallyInitialize(const RCP< const VectorSpaceBase< double > > &range, const RCP< const VectorSpaceBase< double > > &domain, const RCP< Epetra_Operator > &op, EOpTransp opTrans=NOTRANS, EApplyEpetraOpAs applyAs=EPETRA_OP_APPLY_APPLY, EAdjointEpetraOp adjointSupport=EPETRA_OP_ADJOINT_SUPPORTED)
Partially initialize.
RCP< const SpmdVectorSpaceBase< double > > spmdRange() const
Return a smart pointer to the SpmdVectorSpaceBase object for the range.
virtual bool rowStatIsSupportedImpl(const RowStatLinearOpBaseUtils::ERowStat rowStat) const
RCP< Epetra_Operator > epetra_op()
virtual RCP< const SpmdVectorSpaceBase< double > > allocateDomain(const RCP< Epetra_Operator > &op, EOpTransp op_trans) const
Allocate the domain space of the operator.
bool opSupportedImpl(EOpTransp M_trans) const
RCP< const VectorSpaceBase< double > > range() const
const Epetra_Map & getRangeMap() const
RCP< const SpmdVectorSpaceBase< double > > range_
virtual bool supportsScaleLeftImpl() const
RCP< const VectorSpaceBase< double > > domain() const
EApplyEpetraOpAs
Determine how the apply an Epetra_Operator as a linear operator.
RCP< MultiVectorBase< double > > create_MultiVector(const RCP< Epetra_MultiVector > &epetra_mv, const RCP< const VectorSpaceBase< double > > &range=Teuchos::null, const RCP< const VectorSpaceBase< double > > &domain=Teuchos::null)
Create a non-const MultiVectorBase object from a non-const Epetra_MultiVector object.
RCP< const VectorSpaceBase< double > > create_VectorSpace(const RCP< const Epetra_Map > &epetra_map)
Create an VectorSpaceBase object given an Epetra_Map object.
const std::string toString(const EAdjointEpetraOp adjointEpetraOp)
RCP< Epetra_Vector > get_Epetra_Vector(const Epetra_Map &map, const RCP< VectorBase< double > > &v)
Get a non-const Epetra_Vector view from a non-const VectorBase object if possible.
RCP< Epetra_MultiVector > get_Epetra_MultiVector(const Epetra_Map &map, const RCP< MultiVectorBase< double > > &mv)
Get a non-const Epetra_MultiVector view from a non-const MultiVectorBase object if possible.
EAdjointEpetraOp
Determine if adjoints are supported on Epetra_Opeator or not.
@ EPETRA_OP_APPLY_APPLY
Apply using Epetra_Operator::Apply(...)
@ EPETRA_OP_APPLY_APPLY_INVERSE
Apply using Epetra_Operator::ApplyInverse(...)
@ EPETRA_OP_ADJOINT_UNSUPPORTED
Adjoint not supported.
@ EPETRA_OP_ADJOINT_SUPPORTED
Adjoint supported.
#define TEUCHOS_ASSERT(assertion_test)
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
TypeTo as(const TypeFrom &t)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
TEUCHOSCORE_LIB_DLL_EXPORT bool includesVerbLevel(const EVerbosityLevel verbLevel, const EVerbosityLevel requestedVerbLevel, const bool isDefaultLevel=false)