54 #include "Thyra_DefaultProductVector.hpp" 55 #include "Thyra_DefaultProductVectorSpace.hpp" 56 #include "Thyra_VectorBase.hpp" 67 : isInitialized_(false)
94 const std::vector<Teuchos::RCP<WriteVector_GlobalEvaluationData>>&
99 initialize(ghostedSpace, ownedSpace, gedBlocks);
112 const std::vector<Teuchos::RCP<WriteVector_GlobalEvaluationData>>&
115 using std::logic_error;
117 using Teuchos::rcp_dynamic_cast;
121 for (
size_t i(0); i < gedBlocks.size(); ++i)
122 TEUCHOS_TEST_FOR_EXCEPTION(not gedBlocks[i]->
isInitialized(),
123 logic_error,
"BlockedVector_Write_GlobalEvaluationData::" \
124 "initialize: GED block " << i <<
" is not initialized.")
127 rcp_dynamic_cast<
const DefaultProductVectorSpace<double>>(ghostedSpace);
128 TEUCHOS_TEST_FOR_EXCEPTION(
ghostedSpace_.is_null(), logic_error,
129 "BlockedVector_Write_GlobalEvaluationData::initialize(): Ghosted " \
130 "space must be a Thyra::DefaultProductVectorSpace");
144 using std::logic_error;
147 "BlockedVector_Write_GlobalEvaluationData has not been " \
148 "initialized; cannot call \"ghostToGlobal()\"!");
162 using std::logic_error;
165 "BlockedVector_Write_GlobalEvaluationData has not been " \
166 "initialized; cannot call \"initializeData()\"!");
181 using std::logic_error;
185 using Thyra::castOrCreateNonconstProductVectorBase;
188 RCP<ProductVectorBase<double>> blocks =
190 TEUCHOS_TEST_FOR_EXCEPTION(blocks->productSpace()->numBlocks() !=
192 "BlockedVector_Write_GlobalEvaluationData owned vector has the " \
193 "wrong number of blocks!");
203 Teuchos::RCP<Thyra::VectorBase<double>>
215 Teuchos::RCP<Thyra::VectorBase<double>>
219 using std::logic_error;
222 using Teuchos::arrayViewFromVector;
224 using Thyra::defaultProductVector;
227 "BlockedVector_Write_GlobalEvaluationData has not been " \
228 "initialized; cannot call \"getGhostedVector()\"!");
229 vector<RCP<VectorBase<double>>> blocks;
231 blocks.push_back(
gedBlocks_[i]->getGhostedVector());
232 const vector<RCP<VectorBase<double>>>& constBlocks = blocks;
234 arrayViewFromVector(constBlocks));
std::vector< Teuchos::RCP< WriteVector_GlobalEvaluationData > > gedBlocks_
A vector of the GlobalEvaluationData blocks.
void initialize(const Teuchos::RCP< const Thyra::VectorSpaceBase< double >> &ghostedSpace, const Teuchos::RCP< const Thyra::VectorSpaceBase< double >> &ownedSpace, const std::vector< Teuchos::RCP< WriteVector_GlobalEvaluationData >> &gedBlocks)
Initialize this object using the sub-GlobalEvaluationData objects.
This class encapsulates the needs of a gather operation to do a // halo exchange for blocked vector...
virtual void ghostToGlobal(int mem)
Communicate the ghosted data to the owned vector.
virtual Teuchos::RCP< Thyra::VectorBase< double > > getOwnedVector() const
Get the owned vector.
BlockedVector_Write_GlobalEvaluationData()
Default Constructor.
virtual void setOwnedVector(const Teuchos::RCP< Thyra::VectorBase< double >> &ownedVector)
Set the owned vector.
virtual Teuchos::RCP< Thyra::VectorBase< double > > getGhostedVector() const
Get the ghosted vector.
Teuchos::RCP< Thyra::VectorBase< double > > ownedVector_
The owned vector.
virtual void initializeData()
Initialize internal data for communication.
Teuchos::RCP< const Thyra::DefaultProductVectorSpace< double > > ghostedSpace_
The vector space corresponding to the ghosted vector.
virtual bool isInitialized() const
Is this object initialized?
bool isInitialized_
A flag indicating whether or not the object has been initialized.