43 #include "EpetraExt_BlockUtility.h"
64 coeff_map(coeff_map_),
65 product_comm(product_comm_),
66 product_map(Teuchos::
rcp(EpetraExt::BlockUtility::GenerateBlockMap(*coeff_map,*block_map, *product_comm))),
67 bv(Teuchos::
rcp(new EpetraExt::BlockVector(*coeff_map, *product_map)))
69 for (
int i=0; i<this->
size(); i++)
80 coeff_map(coeff_map_),
81 product_comm(product_comm_),
82 product_map(product_map_),
83 bv(Teuchos::
rcp(new EpetraExt::BlockVector(*coeff_map, *product_map)))
85 for (
int i=0; i<this->
size(); i++)
98 coeff_map(coeff_map_),
99 product_comm(product_comm_),
100 product_map(product_map_),
101 bv(Teuchos::
rcp(new EpetraExt::BlockVector(CV, *coeff_map, block_vector)))
103 for (
int i=0; i<this->
size(); i++)
110 coeff_map(v.coeff_map),
111 product_comm(v.product_comm),
112 product_map(v.product_map),
134 if (this->size() > 0) {
136 bv->Update(1.0, v, 0.0);
138 EpetraExt::BlockVector block_v(
View, *coeff_map, v);
139 for (
int i=0; i<this->size(); i++)
140 *(coeff_[i]) = *(block_v.GetBlock(i));
150 if (this->size() > 0) {
152 v.Update(1.0, *bv, 0.0);
154 EpetraExt::BlockVector block_v(
View, *coeff_map, v);
155 for (
int i=0; i<this->size(); i++)
156 *(block_v.GetBlock(i)) = *(coeff_[i]);
165 if (this->size() > 0) {
167 bv->Update(1.0, v, 0.0);
169 EpetraExt::BlockVector block_v(
View, *coeff_map, v);
170 for (
int i=0; i<this->size(); i++)
171 *(coeff_[i]) = *(block_v.GetBlock(i));
201 coeff_map = coeff_map_;
202 product_comm = product_comm_;
204 Teuchos::rcp(EpetraExt::BlockUtility::GenerateBlockMap(*coeff_map,
207 bv =
Teuchos::rcp(
new EpetraExt::BlockVector(*coeff_map, *product_map));
208 for (
int i=0; i<this->size(); i++)
209 this->setCoeffPtr(i, bv->GetBlock(i));
220 coeff_map = coeff_map_;
221 product_comm = product_comm_;
222 product_map = product_map_;
223 bv =
Teuchos::rcp(
new EpetraExt::BlockVector(*coeff_map, *product_map));
224 for (
int i=0; i<this->size(); i++)
225 this->setCoeffPtr(i, bv->GetBlock(i));
233 bv =
Teuchos::rcp(
new EpetraExt::BlockVector(CV, *coeff_map, block_vector));
234 for (
int i=0; i<this->size(); i++)
235 this->setCoeffPtr(i, bv->GetBlock(i));
257 for (
int i=0; i<this->size(); i++)
258 this->setCoeffPtr(i, bv->GetBlock(i));
266 int sz = this->size();
267 for (
int i=0; i<sz; i++) {
268 v.Scale(1.0, *(this->coeff_[i]));
269 this->map_->Comm().SumAll(v.Values(),
270 this->coeff_[i]->Values(),
271 this->coeff_[i]->MyLength());
virtual ~ProductEpetraVector()
Destructor.
void setCoeffPtr(ordinal_type i, const Teuchos::RCP< Epetra_Vector > &c)
Set coefficient i to c.
ProductContainer & operator=(const ProductContainer &)
Assignment.
Teuchos::RCP< const Epetra_BlockMap > productMap() const
Get product map.
Teuchos::RCP< EpetraExt::BlockVector > getBlockVector()
Get block vector.
void reset(const Teuchos::RCP< const Epetra_BlockMap > &block_map, const Teuchos::RCP< const Epetra_BlockMap > &coeff_map, const Teuchos::RCP< const EpetraExt::MultiComm > &product_comm)
Reset to a new size.
Teuchos::RCP< EpetraExt::BlockVector > bv
Block vector storing coefficients.
Teuchos::RCP< const Epetra_BlockMap > product_map
Product map of block vector.
Teuchos::RCP< const EpetraExt::MultiComm > productComm() const
Get product comm.
void assignToBlockVector(Epetra_Vector &v) const
Assignment.
void reset(const Teuchos::RCP< const Epetra_BlockMap > &map)
Resize to new map map.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void setBlockVector(const Teuchos::RCP< EpetraExt::BlockVector > &block_vec)
Set block vector.
ProductEpetraVector & operator=(const ProductEpetraVector &v)
Assignment.
Teuchos::RCP< const EpetraExt::MultiComm > product_comm
Product multi-level communicator.
A container class for products of Epetra_Vector's.
void resetCoefficients(Epetra_DataAccess CV, const Epetra_Vector &block_vector)
Reset vector cofficients.
A product (in the mathematical sense) container class whose coefficients are vectors, operators, or in general any type that would have an expensive copy constructor.
Teuchos::RCP< const Epetra_BlockMap > coeff_map
Product map of block vector.
ProductEpetraVector()
Default constructor.
Teuchos::RCP< const Epetra_BlockMap > coefficientMap() const
Get coefficient map.
void assignFromBlockVector(const Epetra_Vector &v)
Assignment.
ordinal_type size() const
Return size.
void sumAll()
Sum coefficients across processors, storing result in this.