10#include "Thyra_EpetraOperatorWrapper.hpp"
12#include "Thyra_DetachedSpmdVectorView.hpp"
13#include "Thyra_DefaultProductVector.hpp"
14#include "Thyra_ProductVectorSpaceBase.hpp"
15#include "Thyra_SpmdVectorBase.hpp"
16#include "Thyra_EpetraLinearOp.hpp"
19# include "Epetra_MpiComm.h"
21#include "Epetra_SerialComm.h"
22#include "Epetra_Vector.h"
27#include "Teuchos_DefaultSerialComm.hpp"
39 : useTranspose_(false),
41 range_(thyraOp->range()),
42 domain_(thyraOp->domain()),
43 comm_(getEpetraComm(*thyraOp)),
46 label_(thyraOp->description())
54 using Teuchos::rcpFromPtr;
55 using Teuchos::rcp_dynamic_cast;
60 "epetraToThyra does not work with MV dimension != 1");
71 const int numBlocks = prodThyraVec->productSpace()->numBlocks();
72 for (
int b = 0; b < numBlocks; ++b) {
75 rcp_dynamic_cast<const SpmdVectorSpaceBase<double> >(vec_b->space(),
true);
78 const int localNumElems = spmd_vs_b->localSubDim();
79 for (
int i=0; i < localNumElems; ++i) {
80 thyraData[i] = epetraData[i+offset];
82 offset += localNumElems;
92 using Teuchos::rcpFromRef;
93 using Teuchos::rcp_dynamic_cast;
98 "epetraToThyra does not work with MV dimension != 1");
107 const int numBlocks = prodThyraVec->productSpace()->numBlocks();
108 for (
int b = 0; b < numBlocks; ++b) {
111 rcp_dynamic_cast<const SpmdVectorSpaceBase<double> >(vec_b->space(),
true);
114 const int localNumElems = spmd_vs_b->localSubDim();
115 for (
int i=0; i < localNumElems; ++i) {
116 epetraData[i+offset] = thyraData[i];
118 offset += localNumElems;
132 opRange = ( !useTranspose_ ? range_ : domain_ ),
133 opDomain = ( !useTranspose_ ? domain_ : range_ );
153 "EpetraOperatorWrapper::ApplyInverse not implemented");
161 "EpetraOperatorWrapper::NormInf not implemated");
174 using Teuchos::rcp_dynamic_cast;
177 using Teuchos::MpiComm;
183 rcp_dynamic_cast<const ProductVectorSpaceBase<double> >(vs);
185 if (nonnull(prod_vs))
186 vs = prod_vs->getBlock(0);
189 rcp_dynamic_cast<const SpmdVectorSpaceBase<double> >(vs,
true);
int NumMyElements() const
const Epetra_BlockMap & Map() const
const ArrayRCP< const Scalar > values() const
const ArrayRCP< Scalar > values() const
Create an explicit detached non-mutable (const) view of all of the local elements on this process of ...
const RTOpPack::ConstSubVectorView< Scalar > & sv() const
RCP< const ProductVectorBase< Scalar > > castOrCreateProductVectorBase(const RCP< const VectorBase< Scalar > > v)
Return a casted const ProductVectorBase object or create a new DefaultProductVector object with one c...
RCP< ProductVectorBase< Scalar > > castOrCreateNonconstProductVectorBase(const RCP< VectorBase< Scalar > > v)
Return a casted non-const ProductVectorBase object or create a new DefaultProductVector object with o...
Create an explicit detached mutable (non-const) view of all of the local elements on this process of ...
const RTOpPack::SubVectorView< Scalar > & sv() const
RCP< const EpetraLinearOp > epetraLinearOp(const RCP< const 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)
Dynamically allocate a nonconst EpetraLinearOp to wrap a const Epetra_Operator object.
void copyEpetraIntoThyra(const Epetra_MultiVector &x, const Ptr< VectorBase< double > > &thyraVec) const
int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
RCP< const LinearOpBase< double > > makeEpetraWrapper(const RCP< const LinearOpBase< double > > &thyraOp)
Wrap a Thyra operator in the Epetra_Operator interface, and then wrap it again in a Thyra operator in...
EpetraOperatorWrapper(const RCP< const LinearOpBase< double > > &thyraOp)
void copyThyraIntoEpetra(const VectorBase< double > &thyraVec, Epetra_MultiVector &x) const
int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Base class for all linear operators.
void apply(const LinearOpBase< Scalar > &M, const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha=static_cast< Scalar >(1.0), const Scalar beta=static_cast< Scalar >(0.0))
Non-member function call for M.apply(...).
virtual RCP< const VectorSpaceBase< Scalar > > range() const =0
Return a smart pointer for the range space for this operator.
Abstract interface for finite-dimensional dense vectors.
RCP< VectorBase< Scalar > > createMember(const RCP< const VectorSpaceBase< Scalar > > &vs, const std::string &label="")
Create a vector member from the vector space.
RCP< const Epetra_Comm > get_Epetra_Comm(const Teuchos::Comm< Ordinal > &comm)
Get (or create) and Epetra_Comm given a Teuchos::Comm object.
RCP< const Epetra_Map > get_Epetra_Map(const VectorSpaceBase< double > &vs, const RCP< const Epetra_Comm > &comm)
Get (or create) an Epetra_Map object given an VectorSpaceBase object an optionally an extra Epetra_Co...
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
NOTRANS
Type for the dimension of a vector space. `**/ typedef Teuchos::Ordinal Ordinal;.
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)