1 #include "Thyra_VectorBase.hpp" 2 #include "Thyra_DefaultProductVector.hpp" 3 #include "Thyra_DefaultProductVectorSpace.hpp" 13 : isInitialized_(false)
19 : isInitialized_(false)
27 const std::vector<Teuchos::RCP<ReadOnlyVector_GlobalEvaluationData> > & gedBlocks)
28 : isInitialized_(false)
30 initialize(ghostedSpace, ownedSpace, gedBlocks);
37 const std::vector<Teuchos::RCP<ReadOnlyVector_GlobalEvaluationData> >& gedBlocks)
39 using Teuchos::rcp_dynamic_cast;
42 for(std::size_t i=0;i<gedBlocks.size();i++) {
43 TEUCHOS_TEST_FOR_EXCEPTION(!gedBlocks[i]->
isInitialized(),std::logic_error,
44 "BlockedVector_ReadOnly_GlobalEvaluationData::initialize: GED block is " << i <<
" is not initialized.");
51 TEUCHOS_TEST_FOR_EXCEPTION(
ghostedSpace_==Teuchos::null,std::logic_error,
52 "BlockedVector_ReadOnly_GED::initialize: ghosted space must be a Thyra::DefaultProductVectorSpace");
62 "BlockedVector_ReadOnly_GED has not been initialized, cannot call \"globalToGhost\"!");
73 "BlockedVector_ReadOnly_GED has not been initialized, cannot call \"initializeData\"!");
85 Teuchos::RCP<const Thyra::ProductVectorBase<double> > blocks = Thyra::castOrCreateProductVectorBase(
ownedVector_);
87 TEUCHOS_TEST_FOR_EXCEPTION(blocks->productSpace()->numBlocks()!=Teuchos::as<int>(
gedBlocks_.size()),std::logic_error,
88 "BlockedVector_ReadOnly_GED owned vector as the wrong number of blocks!");
94 Teuchos::RCP<const Thyra::VectorBase<double> >
101 Teuchos::RCP<Thyra::VectorBase<double> >
106 "BlockedVector_ReadOnly_GED has not been initialized, cannot call \"getGhostedVector\"!");
109 std::vector<Teuchos::RCP<Thyra::VectorBase<double> > > blocks;
111 blocks.push_back(
gedBlocks_[i]->getGhostedVector());
114 const std::vector<Teuchos::RCP<Thyra::VectorBase<double> > > & blocks_c = blocks;
115 return Thyra::defaultProductVector(
ghostedSpace_,Teuchos::arrayViewFromVector(blocks_c));
Teuchos::RCP< const Thyra::VectorBase< double > > ownedVector_
virtual bool isInitialized() const
Is this object initialized.
BlockedVector_ReadOnly_GlobalEvaluationData()
virtual Teuchos::RCP< Thyra::VectorBase< double > > getGhostedVector() const
Get the ghosted vector.
virtual void setOwnedVector(const Teuchos::RCP< const Thyra::VectorBase< double > > &ownedVector)
Set the owned vector.
std::vector< Teuchos::RCP< ReadOnlyVector_GlobalEvaluationData > > gedBlocks_
PHX::MDField< ScalarT > vector
virtual void initializeData()
Initialize internal data for communication (clear the ghosted vector)
void initialize(const Teuchos::RCP< const Thyra::VectorSpaceBase< double > > &ghostedSpace, const Teuchos::RCP< const Thyra::VectorSpaceBase< double > > &ownedSpace, const std::vector< Teuchos::RCP< ReadOnlyVector_GlobalEvaluationData > > &gedBlocks)
virtual void globalToGhost(int mem)
Teuchos::RCP< const Thyra::DefaultProductVectorSpace< double > > ghostedSpace_
virtual Teuchos::RCP< const Thyra::VectorBase< double > > getOwnedVector() const
Get the owned vector.