Thyra Version of the Day
Loading...
Searching...
No Matches
Thyra_EpetraOperatorViewExtractorStd.cpp
1// @HEADER
2// *****************************************************************************
3// Thyra: Interfaces and Support for Abstract Numerical Algorithms
4//
5// Copyright 2004 NTESS and the Thyra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#include "Thyra_EpetraOperatorViewExtractorStd.hpp"
11#include "Thyra_EpetraLinearOpBase.hpp"
12#include "Thyra_ScaledAdjointLinearOpBase.hpp"
13
14class Epetra_Operator;
15
16
17namespace Thyra {
18
19
20// Overridden from EpetraOperatorViewExtractorBase
21
22
24{
25 double wrappedScalar = 0.0;
26 EOpTransp wrappedTransp = NOTRANS;
27 const LinearOpBase<double> *wrappedFwdOp = NULL;
28 ::Thyra::unwrap(fwdOp, &wrappedScalar, &wrappedTransp, &wrappedFwdOp);
29 const EpetraLinearOpBase *eFwdOp =
30 dynamic_cast<const EpetraLinearOpBase*>(wrappedFwdOp);
31 if (!eFwdOp) {
32 return false;
33 }
34 return true;
35}
36
37
39 const RCP<LinearOpBase<double> > &/* fwdOp */,
40 const Ptr<RCP<Epetra_Operator> > &/* epetraOp */,
41 const Ptr<EOpTransp> &/* epetraOpTransp */,
42 const Ptr<EApplyEpetraOpAs> &/* epetraOpApplyAs */,
43 const Ptr<EAdjointEpetraOp> &/* epetraOpAdjointSupport */,
44 const Ptr<double> &/* epetraOpScalar */
45 ) const
46{
48 // ToDo: Implement once this is needed by just copying what is below and
49 // removing the 'const' in the right places!
50}
51
52
54 const RCP<const LinearOpBase<double> > &fwdOp,
55 const Ptr<RCP<const Epetra_Operator> > &epetraOp,
56 const Ptr<EOpTransp> &epetraOpTransp,
57 const Ptr<EApplyEpetraOpAs> &epetraOpApplyAs,
58 const Ptr<EAdjointEpetraOp> &epetraOpAdjointSupport,
59 const Ptr<double> &epetraOpScalar
60 ) const
61{
62 using Teuchos::outArg;
63 double wrappedFwdOpScalar = 0.0;
64 EOpTransp wrappedFwdOpTransp = NOTRANS;
66 unwrap(fwdOp,&wrappedFwdOpScalar, &wrappedFwdOpTransp, &wrappedFwdOp);
69 EOpTransp epetra_epetraOpTransp;
70 epetraFwdOp->getEpetraOpView(epetraOp, outArg(epetra_epetraOpTransp),
71 epetraOpApplyAs, epetraOpAdjointSupport);
72 *epetraOpTransp = trans_trans(real_trans(epetra_epetraOpTransp), wrappedFwdOpTransp);
73 *epetraOpScalar = wrappedFwdOpScalar;
74}
75
76
77// ToDo: Refactor unwrap(...) to not use raw pointers!
78
79
80} // namespace Thyra
Abstract base class for all LinearOpBase objects that can return an Epetra_Operator view of themselve...
void getEpetraOpView(const RCP< const LinearOpBase< double > > &fwdOp, const Ptr< RCP< const Epetra_Operator > > &epetraOp, const Ptr< EOpTransp > &epetraOpTransp, const Ptr< EApplyEpetraOpAs > &epetraOpApplyAs, const Ptr< EAdjointEpetraOp > &epetraOpAdjointSupport, const Ptr< double > &epetraOpScalar) const
bool isCompatible(const LinearOpBase< double > &fwdOp) const
void getNonconstEpetraOpView(const RCP< LinearOpBase< double > > &fwdOp, const Ptr< RCP< Epetra_Operator > > &epetraOp, const Ptr< EOpTransp > &epetraOpTransp, const Ptr< EApplyEpetraOpAs > &epetraOpApplyAs, const Ptr< EAdjointEpetraOp > &epetraOpAdjointSupport, const Ptr< double > &epetraOpScalar) const
Base class for all linear operators.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
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.
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
EOpTransp real_trans(EOpTransp transp)
Return NOTRANS or TRANS for real scalar valued operators and this also is used for determining struct...
EOpTransp trans_trans(EOpTransp trans1, EOpTransp trans2)
Combine two transpose arguments.
@ NOTRANS
Use the non-transposed operator.
T_To & dyn_cast(T_From &from)