10 #include "Teko_TpetraReorderedMappingStrategy.hpp"
12 #include "Teko_BlockedReordering.hpp"
16 using Teuchos::rcp_dynamic_cast;
17 using Teuchos::rcpFromRef;
20 namespace TpetraHelpers {
22 TpetraReorderedMappingStrategy::TpetraReorderedMappingStrategy(
23 const BlockReorderManager& brm,
const Teuchos::RCP<const MappingStrategy>& map)
24 : reorderManager_(brm), mapStrategy_(map) {
25 rangeMap_ = mapStrategy_->rangeMap();
26 domainMap_ = mapStrategy_->domainMap();
29 void TpetraReorderedMappingStrategy::copyTpetraIntoThyra(
30 const Tpetra::MultiVector<ST, LO, GO, NT>& X,
31 const Teuchos::Ptr<Thyra::MultiVectorBase<ST> >& thyra_X)
const {
32 using Teuchos::ptr_const_cast;
33 using Teuchos::rcp_const_cast;
36 RCP<Thyra::ProductMultiVectorBase<ST> > prod_X =
37 rcp_dynamic_cast<Thyra::ProductMultiVectorBase<ST> >(rcpFromRef(*thyra_X));
38 RCP<Thyra::MultiVectorBase<ST> > flat_X = buildFlatMultiVector(reorderManager_, prod_X);
41 mapStrategy_->copyTpetraIntoThyra(X, flat_X.ptr());
44 void TpetraReorderedMappingStrategy::copyThyraIntoTpetra(
45 const RCP<
const Thyra::MultiVectorBase<ST> >& thyra_Y,
46 Tpetra::MultiVector<ST, LO, GO, NT>& Y)
const {
48 RCP<const Thyra::ProductMultiVectorBase<ST> > prod_Y =
49 rcp_dynamic_cast<
const Thyra::ProductMultiVectorBase<ST> >(rcpFromRef(*thyra_Y));
50 RCP<const Thyra::MultiVectorBase<ST> > flat_Y = buildFlatMultiVector(reorderManager_, prod_Y);
53 mapStrategy_->copyThyraIntoTpetra(flat_Y, Y);