42 #ifndef THYRA_TPETRA_THYRA_WRAPPERS_HPP
43 #define THYRA_TPETRA_THYRA_WRAPPERS_HPP
56 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
59 const RCP<
const VectorSpaceBase<Scalar> > space,
60 const RCP<
const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > &tpetraMap
63 using Teuchos::rcp_dynamic_cast;
67 tpetraSpace = rcp_dynamic_cast<
const TpetraVectorSpace_t>(space,
true);
70 tpetraSpace = tpetraVectorSpace<Scalar>(tpetraMap);
76 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
79 const RCP<
const VectorSpaceBase<Scalar> > space,
84 using Teuchos::rcp_dynamic_cast;
88 tpetraSpace = rcp_dynamic_cast<
const TpetraVectorSpace_t>(space,
true);
91 tpetraSpace = tpetraVectorSpace<Scalar>(
92 Tpetra::createLocalMapWithNode<LocalOrdinal,GlobalOrdinal,Node>(
103 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
106 const RCP<
const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > &tpetraMap
109 return tpetraVectorSpace<Scalar>(tpetraMap);
113 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
116 const RCP<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVector_in,
117 const RCP<
const VectorSpaceBase<Scalar> > space_in
127 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
130 const RCP<
const Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVector_in,
131 const RCP<
const VectorSpaceBase<Scalar> > space
141 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
144 const RCP<Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraMultiVector_in,
145 const RCP<
const VectorSpaceBase<Scalar> > rangeSpace,
146 const RCP<
const VectorSpaceBase<Scalar> > domainSpace
151 getOrCreateLocallyReplicatedTpetraVectorSpace<Scalar, LocalOrdinal, GlobalOrdinal, Node>(
152 domainSpace, tpetraMultiVector_in->getMap()->getComm(),
153 tpetraMultiVector_in->getNumVectors()
160 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
163 const RCP<
const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraMultiVector_in,
164 const RCP<
const VectorSpaceBase<Scalar> > rangeSpace,
165 const RCP<
const VectorSpaceBase<Scalar> > domainSpace
170 getOrCreateLocallyReplicatedTpetraVectorSpace<Scalar, LocalOrdinal, GlobalOrdinal, Node>(
171 domainSpace, tpetraMultiVector_in->getMap()->getComm(),
172 tpetraMultiVector_in->getNumVectors()
179 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
182 const RCP<Tpetra::Operator<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraOperator_in,
183 const RCP<
const VectorSpaceBase<Scalar> > rangeSpace,
184 const RCP<
const VectorSpaceBase<Scalar> > domainSpace
187 return tpetraLinearOp<Scalar,LocalOrdinal,GlobalOrdinal,Node>(
195 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
198 const RCP<
const Tpetra::Operator<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraOperator_in,
199 const RCP<
const VectorSpaceBase<Scalar> > rangeSpace,
200 const RCP<
const VectorSpaceBase<Scalar> > domainSpace
203 return constTpetraLinearOp<Scalar,LocalOrdinal,GlobalOrdinal,Node>(
213 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
214 RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
219 return Teuchos::rcp_dynamic_cast<
const TpetraVectorSpace_t>(vs,
true)->getTpetraMap();
223 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
229 return Teuchos::rcp_dynamic_cast<TpetraVector_t>(v,
true)->getTpetraVector();
233 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
239 return Teuchos::rcp_dynamic_cast<
const TpetraVector_t>(v,
true)->getConstTpetraVector();
243 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
253 using Teuchos::rcp_dynamic_cast;
256 ThyraTpetraMultiVector_t;
258 rcp_dynamic_cast<ThyraTpetraMultiVector_t>(mv);
260 return tmv->getTpetraMultiVector();
266 rcp_dynamic_cast<ThyraTpetraVector_t>(mv);
268 return tv->getTpetraVector();
272 "Error, the input mv = " << mv->description() <<
" does not support the"
273 " Thyra::TpetraMultiVector or the Thyra::TpetraVector interfaces!");
280 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
290 using Teuchos::rcp_dynamic_cast;
293 ThyraTpetraMultiVector_t;
295 rcp_dynamic_cast<
const ThyraTpetraMultiVector_t>(mv);
297 return tmv->getConstTpetraMultiVector();
303 rcp_dynamic_cast<
const ThyraTpetraVector_t>(mv);
305 return tv->getConstTpetraVector();
309 "Error, the input mv = " << mv->description() <<
" does not support the"
310 " Thyra::TpetraMultiVector or the Thyra::TpetraVector interfaces!");
317 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
323 return Teuchos::rcp_dynamic_cast<TpetraLinearOp_t>(op,
true)->getTpetraOperator();
327 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
333 return Teuchos::rcp_dynamic_cast<
const TpetraLinearOp_t>(op,
true)->getConstTpetraOperator();
340 #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 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 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)