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>(
100 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
101 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
105 const RCP<
const VectorSpaceBase<Scalar> > space,
112 <Scalar, LocalOrdinal, GlobalOrdinal, Node>
113 (space, tpetraComm, numCols);
120 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
123 const RCP<
const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > &tpetraMap
126 return tpetraVectorSpace<Scalar>(tpetraMap);
130 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
133 const RCP<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVector_in,
134 const RCP<
const VectorSpaceBase<Scalar> > space_in
144 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
147 const RCP<
const Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVector_in,
148 const RCP<
const VectorSpaceBase<Scalar> > space
158 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
161 const RCP<Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraMultiVector_in,
162 const RCP<
const VectorSpaceBase<Scalar> > rangeSpace,
163 const RCP<
const VectorSpaceBase<Scalar> > domainSpace
168 getOrCreateLocallyReplicatedTpetraVectorSpace<Scalar, LocalOrdinal, GlobalOrdinal, Node>(
169 domainSpace, tpetraMultiVector_in->getMap()->getComm(),
170 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
171 tpetraMultiVector_in->getMap()->getNode(),
172 #endif // TPETRA_ENABLE_DEPRECATED_CODE
173 tpetraMultiVector_in->getNumVectors()
180 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
183 const RCP<
const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraMultiVector_in,
184 const RCP<
const VectorSpaceBase<Scalar> > rangeSpace,
185 const RCP<
const VectorSpaceBase<Scalar> > domainSpace
190 getOrCreateLocallyReplicatedTpetraVectorSpace<Scalar, LocalOrdinal, GlobalOrdinal, Node>(
191 domainSpace, tpetraMultiVector_in->getMap()->getComm(),
192 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
193 tpetraMultiVector_in->getMap()->getNode(),
194 #endif // TPETRA_ENABLE_DEPRECATED_CODE
195 tpetraMultiVector_in->getNumVectors()
202 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
205 const RCP<Tpetra::Operator<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraOperator_in,
206 const RCP<
const VectorSpaceBase<Scalar> > rangeSpace,
207 const RCP<
const VectorSpaceBase<Scalar> > domainSpace
210 return tpetraLinearOp<Scalar,LocalOrdinal,GlobalOrdinal,Node>(
218 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
221 const RCP<
const Tpetra::Operator<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraOperator_in,
222 const RCP<
const VectorSpaceBase<Scalar> > rangeSpace,
223 const RCP<
const VectorSpaceBase<Scalar> > domainSpace
226 return constTpetraLinearOp<Scalar,LocalOrdinal,GlobalOrdinal,Node>(
236 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
237 RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
242 return Teuchos::rcp_dynamic_cast<
const TpetraVectorSpace_t>(vs,
true)->getTpetraMap();
246 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
252 return Teuchos::rcp_dynamic_cast<TpetraVector_t>(v,
true)->getTpetraVector();
256 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
262 return Teuchos::rcp_dynamic_cast<
const TpetraVector_t>(v,
true)->getConstTpetraVector();
266 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
276 using Teuchos::rcp_dynamic_cast;
279 ThyraTpetraMultiVector_t;
281 rcp_dynamic_cast<ThyraTpetraMultiVector_t>(mv);
283 return tmv->getTpetraMultiVector();
289 rcp_dynamic_cast<ThyraTpetraVector_t>(mv);
291 return tv->getTpetraVector();
295 "Error, the input mv = " << mv->description() <<
" does not support the"
296 " Thyra::TpetraMultiVector or the Thyra::TpetraVector interfaces!");
303 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
313 using Teuchos::rcp_dynamic_cast;
316 ThyraTpetraMultiVector_t;
318 rcp_dynamic_cast<
const ThyraTpetraMultiVector_t>(mv);
320 return tmv->getConstTpetraMultiVector();
326 rcp_dynamic_cast<
const ThyraTpetraVector_t>(mv);
328 return tv->getConstTpetraVector();
332 "Error, the input mv = " << mv->description() <<
" does not support the"
333 " Thyra::TpetraMultiVector or the Thyra::TpetraVector interfaces!");
340 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
346 return Teuchos::rcp_dynamic_cast<TpetraLinearOp_t>(op,
true)->getTpetraOperator();
350 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
356 return Teuchos::rcp_dynamic_cast<
const TpetraLinearOp_t>(op,
true)->getConstTpetraOperator();
363 #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)