22 #include "Thyra_DefaultProductVector.hpp"
23 #include "Thyra_DefaultProductVectorSpace.hpp"
24 #include "Thyra_VectorBase.hpp"
35 : isInitialized_(false)
67 initialize(ghostedSpace, ownedSpace, gedBlocks);
83 using std::logic_error;
85 using Teuchos::rcp_dynamic_cast;
89 for (
size_t i(0); i < gedBlocks.size(); ++i)
91 logic_error,
"BlockedVector_ReadOnly_GlobalEvaluationData::" \
92 "initialize: GED block " << i <<
" is not initialized.")
95 rcp_dynamic_cast<
const DefaultProductVectorSpace<double>>(ghostedSpace);
97 "BlockedVector_ReadOnly_GlobalEvaluationData::initialize(): Ghosted " \
98 "space must be a Thyra::DefaultProductVectorSpace");
112 using std::logic_error;
115 "BlockedVector_ReadOnly_GlobalEvaluationData has not been " \
116 "initialized; cannot call \"globalToGhost()\"!");
130 using std::logic_error;
133 "BlockedVector_ReadOnly_GlobalEvaluationData has not been " \
134 "initialized; cannot call \"initializeData()\"!");
149 using std::logic_error;
153 using Thyra::castOrCreateProductVectorBase;
160 "BlockedVector_ReadOnly_GlobalEvaluationData owned vector has the " \
161 "wrong number of blocks!");
187 using std::logic_error;
190 using Teuchos::arrayViewFromVector;
192 using Thyra::defaultProductVector;
195 "BlockedVector_ReadOnly_GlobalEvaluationData has not been " \
196 "initialized; cannot call \"getGhostedVector()\"!");
197 vector<RCP<VectorBase<double>>> blocks;
199 blocks.push_back(
gedBlocks_[i]->getGhostedVector());
200 const vector<RCP<VectorBase<double>>>& constBlocks = blocks;
202 arrayViewFromVector(constBlocks));
Teuchos::RCP< const Thyra::VectorBase< double > > ownedVector_
The owned vector.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
BlockedVector_ReadOnly_GlobalEvaluationData()
Default Constructor.
std::vector< Teuchos::RCP< ReadOnlyVector_GlobalEvaluationData > > gedBlocks_
A vector of the GlobalEvaluationData blocks.
virtual void initializeData()
Initialize internal data for communication.
This class encapsulates the needs of a gather operation to do a halo exchange for blocked vectors...
virtual void globalToGhost(int mem)
Communicate the owned data to the ghosted vector.
virtual Teuchos::RCP< Thyra::VectorBase< double > > getGhostedVector() const
Get the ghosted vector.
Teuchos::RCP< const Thyra::DefaultProductVectorSpace< double > > ghostedSpace_
The vector space corresponding to the ghosted vector.
virtual Teuchos::RCP< const Thyra::VectorBase< double > > getOwnedVector() const
Get the owned vector.
virtual void setOwnedVector(const Teuchos::RCP< const Thyra::VectorBase< double >> &ownedVector)
Set the owned vector.
TypeTo as(const TypeFrom &t)
bool isInitialized_
A flag indicating whether or not the object has been initialized.
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)
Initialize this object using the sub-GlobalEvaluationData objects.
virtual bool isInitialized() const
Is this object initialized?