10 #ifndef THYRA_TPETRA_THYRA_WRAPPERS_HPP
11 #define THYRA_TPETRA_THYRA_WRAPPERS_HPP
24 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
27 const RCP<
const VectorSpaceBase<Scalar> > space,
28 const RCP<
const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > &tpetraMap
31 using Teuchos::rcp_dynamic_cast;
35 tpetraSpace = rcp_dynamic_cast<
const TpetraVectorSpace_t>(space,
true);
38 tpetraSpace = tpetraVectorSpace<Scalar>(tpetraMap);
44 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
47 const RCP<
const VectorSpaceBase<Scalar> > space,
52 using Teuchos::rcp_dynamic_cast;
56 tpetraSpace = rcp_dynamic_cast<
const TpetraVectorSpace_t>(space,
true);
59 tpetraSpace = tpetraVectorSpace<Scalar>(
60 Tpetra::createLocalMapWithNode<LocalOrdinal,GlobalOrdinal,Node>(
71 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
74 const RCP<
const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > &tpetraMap
77 return tpetraVectorSpace<Scalar>(tpetraMap);
81 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
84 const RCP<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVector_in,
85 const RCP<
const VectorSpaceBase<Scalar> > space_in
95 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
98 const RCP<
const Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVector_in,
99 const RCP<
const VectorSpaceBase<Scalar> > space
109 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
112 const RCP<Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraMultiVector_in,
113 const RCP<
const VectorSpaceBase<Scalar> > rangeSpace,
114 const RCP<
const VectorSpaceBase<Scalar> > domainSpace
119 getOrCreateLocallyReplicatedTpetraVectorSpace<Scalar, LocalOrdinal, GlobalOrdinal, Node>(
120 domainSpace, tpetraMultiVector_in->getMap()->getComm(),
121 tpetraMultiVector_in->getNumVectors()
128 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
131 const RCP<
const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraMultiVector_in,
132 const RCP<
const VectorSpaceBase<Scalar> > rangeSpace,
133 const RCP<
const VectorSpaceBase<Scalar> > domainSpace
138 getOrCreateLocallyReplicatedTpetraVectorSpace<Scalar, LocalOrdinal, GlobalOrdinal, Node>(
139 domainSpace, tpetraMultiVector_in->getMap()->getComm(),
140 tpetraMultiVector_in->getNumVectors()
147 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
150 const RCP<Tpetra::Operator<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraOperator_in,
151 const RCP<
const VectorSpaceBase<Scalar> > rangeSpace,
152 const RCP<
const VectorSpaceBase<Scalar> > domainSpace
158 return tpetraLinearOp<Scalar,LocalOrdinal,GlobalOrdinal,Node>(
166 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
169 const RCP<
const Tpetra::Operator<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraOperator_in,
170 const RCP<
const VectorSpaceBase<Scalar> > rangeSpace,
171 const RCP<
const VectorSpaceBase<Scalar> > domainSpace
176 return constTpetraLinearOp<Scalar,LocalOrdinal,GlobalOrdinal,Node>(
186 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
187 RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
192 return Teuchos::rcp_dynamic_cast<
const TpetraVectorSpace_t>(vs,
true)->getTpetraMap();
196 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
202 return Teuchos::rcp_dynamic_cast<TpetraVector_t>(v,
true)->getTpetraVector();
206 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
212 return Teuchos::rcp_dynamic_cast<
const TpetraVector_t>(v,
true)->getConstTpetraVector();
216 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
226 using Teuchos::rcp_dynamic_cast;
229 ThyraTpetraMultiVector_t;
231 rcp_dynamic_cast<ThyraTpetraMultiVector_t>(mv);
233 return tmv->getTpetraMultiVector();
239 rcp_dynamic_cast<ThyraTpetraVector_t>(mv);
241 return tv->getTpetraVector();
245 "Error, the input mv = " << mv->description() <<
" does not support the"
246 " Thyra::TpetraMultiVector or the Thyra::TpetraVector interfaces!");
253 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
263 using Teuchos::rcp_dynamic_cast;
266 ThyraTpetraMultiVector_t;
268 rcp_dynamic_cast<
const ThyraTpetraMultiVector_t>(mv);
270 return tmv->getConstTpetraMultiVector();
276 rcp_dynamic_cast<
const ThyraTpetraVector_t>(mv);
278 return tv->getConstTpetraVector();
282 "Error, the input mv = " << mv->description() <<
" does not support the"
283 " Thyra::TpetraMultiVector or the Thyra::TpetraVector interfaces!");
290 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
296 return Teuchos::rcp_dynamic_cast<TpetraLinearOp_t>(op,
true)->getTpetraOperator();
300 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
306 return Teuchos::rcp_dynamic_cast<
const TpetraLinearOp_t>(op,
true)->getConstTpetraOperator();
313 #endif // THYRA_TPETRA_THYRA_WRAPPERS_HPP
RCP< MultiVectorBase< Scalar > > createMultiVector(const RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraMultiVector, const RCP< const VectorSpaceBase< Scalar > > rangeSpace=Teuchos::null, const RCP< const VectorSpaceBase< Scalar > > domainSpace=Teuchos::null)
Concrete implementation of Thyra::MultiVector in terms of Tpetra::MultiVector.
Concrete implementation of an SPMD vector space for Tpetra.
Teuchos::RCP< const ScalarProdVectorSpaceBase< Scalar > > getOrCreateLocallyReplicatedTpetraVectorSpace(const RCP< const VectorSpaceBase< Scalar > > space, const RCP< const Teuchos::Comm< int > > &tpetraComm, const int numCols)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
RCP< TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > tpetraMultiVector(const RCP< const TpetraVectorSpace< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraVectorSpace, const RCP< const ScalarProdVectorSpaceBase< Scalar > > &domainSpace, const RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraMultiVector)
Nonmember constructor for non-const TpetraMultiVector.
RCP< const VectorBase< Scalar > > createConstVector(const RCP< const Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraVector, const RCP< const VectorSpaceBase< Scalar > > space=Teuchos::null)
RCP< const LinearOpBase< Scalar > > createConstLinearOp(const RCP< const Tpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraOperator, const RCP< const VectorSpaceBase< Scalar > > rangeSpace=Teuchos::null, const RCP< const VectorSpaceBase< Scalar > > domainSpace=Teuchos::null)
RCP< LinearOpBase< Scalar > > createLinearOp(const RCP< Tpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraOperator, const RCP< const VectorSpaceBase< Scalar > > rangeSpace=Teuchos::null, const RCP< const VectorSpaceBase< Scalar > > domainSpace=Teuchos::null)
RCP< VectorBase< Scalar > > createVector(const RCP< Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraVector, const RCP< const VectorSpaceBase< Scalar > > space=Teuchos::null)
RCP< const TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > constTpetraMultiVector(const RCP< const TpetraVectorSpace< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraVectorSpace, const RCP< const ScalarProdVectorSpaceBase< Scalar > > &domainSpace, const RCP< const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraMultiVector)
Nonmember constructor for const TpetraMultiVector.
RCP< const MultiVectorBase< Scalar > > createConstMultiVector(const RCP< const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraMultiVector, const RCP< const VectorSpaceBase< Scalar > > rangeSpace=Teuchos::null, const RCP< const VectorSpaceBase< Scalar > > domainSpace=Teuchos::null)
Teuchos::RCP< const TpetraVectorSpace< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getOrCreateTpetraVectorSpace(const RCP< const VectorSpaceBase< Scalar > > space, const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &tpetraMap)
Concrete Thyra::SpmdVectorBase using Tpetra::Vector.
RCP< TpetraVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > tpetraVector(const RCP< const TpetraVectorSpace< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraVectorSpace, const RCP< Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraVector)
Nonmember constructor for TpetraVector.
RCP< const TpetraVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > constTpetraVector(const RCP< const TpetraVectorSpace< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraVectorSpace, const RCP< const Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraVector)
Nonmember constructor for TpetraVector.
bool nonnull(const boost::shared_ptr< T > &p)
RCP< const VectorSpaceBase< Scalar > > createVectorSpace(const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &tpetraMap)
Create a Thyra::VectorSpaceBase object given a Tpetra::Map.
#define TEUCHOS_ASSERT(assertion_test)
Concrete Thyra::LinearOpBase subclass for Tpetra::Operator.
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)