43 #include "Thyra_EpetraExtAddTransformer.hpp"
44 #include "Thyra_AddedLinearOpBase.hpp"
45 #include "Thyra_ScaledAdjointLinearOpBase.hpp"
46 #include "Thyra_EpetraLinearOp.hpp"
47 #include "Thyra_get_Epetra_Operator.hpp"
49 #include "Thyra_DiagonalLinearOpBase.hpp"
50 #include "Thyra_DefaultDiagonalLinearOp.hpp"
51 #include "Thyra_IdentityLinearOpBase.hpp"
52 #include "Thyra_VectorStdOps.hpp"
53 #include "Epetra_Map.h"
54 #include "Epetra_LocalMap.h"
55 #include "Epetra_SerialComm.h"
56 #include "Epetra_Vector.h"
57 #include "Epetra_CrsMatrix.h"
58 #include "Teuchos_Assert.hpp"
59 #include "EpetraExt_ConfigDefs.h"
60 #include "EpetraExt_MatrixMatrix.h"
61 #include "EpetraExt_MMHelpers.h"
62 #include "EpetraExt_Transpose_RowMatrix.h"
65 #include "EpetraExt_RowMatrixOut.h"
85 return nonconstEpetraLinearOp();
94 using EpetraExt::MatrixMatrix;
96 using Teuchos::rcp_dynamic_cast;
113 double A_scalar = 0.0;
116 unwrap( op_A, &A_scalar, &A_transp, &A );
121 double B_scalar = 0.0;
124 unwrap( op_B, &B_scalar, &B_transp, &B );
134 Thyra::V_S( d.
ptr(), 1.0 );
135 A = Thyra::diagonal(d);
139 Thyra::V_S( d.
ptr(), 1.0 );
140 B = Thyra::diagonal(d);
153 if(dA==Teuchos::null)
155 if(dB==Teuchos::null)
162 if(epetra_A!=Teuchos::null && epetra_B!=Teuchos::null) {
174 const int add_epetra_B_err
175 = EpetraExt::MatrixMatrix::Add(*epetra_A,A_transp==
CONJTRANS,A_scalar,*epetra_B,B_transp==
CONJTRANS,B_scalar,epetra_op_raw);
176 if(epetra_op==Teuchos::null)
181 epetra_op->
FillComplete(epetra_A->DomainMap(),epetra_A->RangeMap());
186 else if((dA!=Teuchos::null && epetra_B!=Teuchos::null) ||
187 (dB!=Teuchos::null && epetra_A!=Teuchos::null)) {
191 double matScalar = (dA!=Teuchos::null) ? B_scalar : A_scalar;
193 double diagScalar = (dA!=Teuchos::null) ? A_scalar : B_scalar;
203 if(epetra_op==Teuchos::null)
206 *epetra_op = *crsMat;
212 epetra_op->
Scale(matScalar);
217 "Thyra::EpetraExtractAddTransformer::transform ExtractDiagonalCopy failed!");;
218 diagonal->Update(diagScalar,*v,1.0);
220 "Thyra::EpetraExtractAddTransformer::transform ReplaceDiagonalValues failed!");;
227 "Your case of adding Epetra operators is not yet implemented! Contact the Thyra developers.");
int ReplaceDiagonalValues(const Epetra_Vector &Diagonal)
Concrete LinearOpBase adapter subclass for Epetra_Operator object.
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
void unwrap(const LinearOpBase< Scalar > &Op, Scalar *scalar, EOpTransp *transp, const LinearOpBase< Scalar > **origOp)
Extract the overallScalar, overallTransp and const origOp from a const LinearOpBase object...
int ExtractDiagonalCopy(Epetra_Vector &Diagonal) const
Interface class for implicitly added linear operators.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Use the non-transposed operator.
T_To & dyn_cast(T_From &from)
Interface class for identity linear operators.
Use the transposed operator with complex-conjugate clements (same as TRANS for real scalar types)...
const Epetra_Map & OperatorDomainMap() const
virtual int numOps() const =0
Returns the number of constituent operators.
int FillComplete(bool OptimizeDataStorage=true)
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.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
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.
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
Teuchos::RCP< Epetra_Operator > get_Epetra_Operator(LinearOpBase< Scalar > &)
Get smart pointer to non-const Epetra_Operator object from reference to a non-const EpetraLinearOp ac...
virtual Teuchos::RCP< const LinearOpBase< Scalar > > getOp(const int k) const =0
Return the kth constant constituent operator.
#define TEUCHOS_ASSERT(assertion_test)
int Scale(double ScalarConstant)
#define TEUCHOS_ASSERT_EQUALITY(val1, val2)
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
Interface class for for diagonal linear operators.
RCP< Epetra_Operator > epetra_op()