10 #ifndef THYRA_TPETRA_THYRA_WRAPPERS_HPP
11 #define THYRA_TPETRA_THYRA_WRAPPERS_HPP
14 #include "Thyra_TpetraThyraWrappers.hpp"
15 #include "Thyra_TpetraVectorSpace.hpp"
16 #include "Thyra_TpetraVector.hpp"
17 #include "Thyra_TpetraMultiVector.hpp"
18 #include "Thyra_TpetraLinearOp.hpp"
24 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
26 getOrCreateTpetraVectorSpace(
27 const RCP<
const VectorSpaceBase<Scalar> > space,
31 using Teuchos::rcp_dynamic_cast;
32 typedef TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> TpetraVectorSpace_t;
33 RCP<const TpetraVectorSpace_t> tpetraSpace;
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>
46 getOrCreateLocallyReplicatedTpetraVectorSpace(
47 const RCP<
const VectorSpaceBase<Scalar> > space,
52 using Teuchos::rcp_dynamic_cast;
53 typedef TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> TpetraVectorSpace_t;
54 RCP<const TpetraVectorSpace_t> tpetraSpace;
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>
77 return tpetraVectorSpace<Scalar>(tpetraMap);
81 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
85 const RCP<
const VectorSpaceBase<Scalar> > space_in
89 getOrCreateTpetraVectorSpace(space_in, tpetraVector_in->getMap()),
95 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
99 const RCP<
const VectorSpaceBase<Scalar> > space
103 getOrCreateTpetraVectorSpace(space, tpetraVector_in->getMap()),
109 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
113 const RCP<
const VectorSpaceBase<Scalar> > rangeSpace,
114 const RCP<
const VectorSpaceBase<Scalar> > domainSpace
118 getOrCreateTpetraVectorSpace(rangeSpace, tpetraMultiVector_in->getMap()),
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>
132 const RCP<
const VectorSpaceBase<Scalar> > rangeSpace,
133 const RCP<
const VectorSpaceBase<Scalar> > domainSpace
137 getOrCreateTpetraVectorSpace(rangeSpace, tpetraMultiVector_in->getMap()),
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>
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>
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
Concrete implementation of Thyra::MultiVector in terms of Tpetra::MultiVector.
Concrete implementation of an SPMD vector space for Tpetra.
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)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
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)
RCP< const VectorBase< Scalar > > createConstVector(const RCP< const Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraVector, const RCP< const VectorSpaceBase< Scalar > > space=Teuchos::null)
Abstract interface for objects that represent a space for vectors.
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 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)
Interface for a collection of column vectors called a multi-vector.
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< VectorBase< Scalar > > createVector(const RCP< Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraVector, const RCP< const VectorSpaceBase< Scalar > > space=Teuchos::null)
Abstract interface for finite-dimensional dense vectors.
RCP< const VectorSpaceBase< Scalar > > createVectorSpace(const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &tpetraMap)
Create a Thyra::VectorSpaceBase object given a Tpetra::Map.
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.
Base class for all linear operators.
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)
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
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)
#define TEUCHOS_ASSERT(assertion_test)
Concrete Thyra::LinearOpBase subclass for Tpetra::Operator.