11 #include "EpetraExt_BlockUtility.h"
32 coeff_map(coeff_map_),
33 product_comm(product_comm_),
34 product_map(Teuchos::
rcp(EpetraExt::BlockUtility::GenerateBlockMap(*coeff_map,*block_map, *product_comm))),
35 bv(Teuchos::
rcp(new EpetraExt::BlockVector(*coeff_map, *product_map)))
37 for (
int i=0; i<this->
size(); i++)
48 coeff_map(coeff_map_),
49 product_comm(product_comm_),
50 product_map(product_map_),
51 bv(Teuchos::
rcp(new EpetraExt::BlockVector(*coeff_map, *product_map)))
53 for (
int i=0; i<this->
size(); i++)
66 coeff_map(coeff_map_),
67 product_comm(product_comm_),
68 product_map(product_map_),
69 bv(Teuchos::
rcp(new EpetraExt::BlockVector(CV, *coeff_map, block_vector)))
71 for (
int i=0; i<this->
size(); i++)
78 coeff_map(v.coeff_map),
79 product_comm(v.product_comm),
80 product_map(v.product_map),
102 if (this->size() > 0) {
104 bv->Update(1.0, v, 0.0);
106 EpetraExt::BlockVector block_v(
View, *coeff_map, v);
107 for (
int i=0; i<this->size(); i++)
108 *(coeff_[i]) = *(block_v.GetBlock(i));
118 if (this->size() > 0) {
120 v.Update(1.0, *bv, 0.0);
122 EpetraExt::BlockVector block_v(
View, *coeff_map, v);
123 for (
int i=0; i<this->size(); i++)
124 *(block_v.GetBlock(i)) = *(coeff_[i]);
133 if (this->size() > 0) {
135 bv->Update(1.0, v, 0.0);
137 EpetraExt::BlockVector block_v(
View, *coeff_map, v);
138 for (
int i=0; i<this->size(); i++)
139 *(coeff_[i]) = *(block_v.GetBlock(i));
169 coeff_map = coeff_map_;
170 product_comm = product_comm_;
172 Teuchos::rcp(EpetraExt::BlockUtility::GenerateBlockMap(*coeff_map,
175 bv =
Teuchos::rcp(
new EpetraExt::BlockVector(*coeff_map, *product_map));
176 for (
int i=0; i<this->size(); i++)
177 this->setCoeffPtr(i, bv->GetBlock(i));
188 coeff_map = coeff_map_;
189 product_comm = product_comm_;
190 product_map = product_map_;
191 bv =
Teuchos::rcp(
new EpetraExt::BlockVector(*coeff_map, *product_map));
192 for (
int i=0; i<this->size(); i++)
193 this->setCoeffPtr(i, bv->GetBlock(i));
201 bv =
Teuchos::rcp(
new EpetraExt::BlockVector(CV, *coeff_map, block_vector));
202 for (
int i=0; i<this->size(); i++)
203 this->setCoeffPtr(i, bv->GetBlock(i));
225 for (
int i=0; i<this->size(); i++)
226 this->setCoeffPtr(i, bv->GetBlock(i));
234 int sz = this->size();
235 for (
int i=0; i<sz; i++) {
236 v.Scale(1.0, *(this->coeff_[i]));
237 this->map_->Comm().SumAll(v.Values(),
238 this->coeff_[i]->Values(),
239 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.