43 #include "EpetraExt_BlockUtility.h"
60 const Teuchos::RCP<const Epetra_BlockMap>& block_map,
61 const Teuchos::RCP<const Epetra_BlockMap>& coeff_map_,
62 const Teuchos::RCP<const EpetraExt::MultiComm>& product_comm_) :
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++)
75 const Teuchos::RCP<const Epetra_BlockMap>& block_map,
76 const Teuchos::RCP<const Epetra_BlockMap>& coeff_map_,
77 const Teuchos::RCP<const Epetra_BlockMap>& product_map_,
78 const Teuchos::RCP<const EpetraExt::MultiComm>& product_comm_) :
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++)
91 const Teuchos::RCP<const Epetra_BlockMap>& block_map,
92 const Teuchos::RCP<const Epetra_BlockMap>& coeff_map_,
93 const Teuchos::RCP<const Epetra_BlockMap>& product_map_,
94 const Teuchos::RCP<const EpetraExt::MultiComm>& product_comm_,
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) {
135 if (bv != Teuchos::null)
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) {
151 if (bv != Teuchos::null)
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) {
166 if (bv != Teuchos::null)
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));
176 Teuchos::RCP<const Epetra_BlockMap>
182 Teuchos::RCP<const Epetra_BlockMap>
188 Teuchos::RCP<const EpetraExt::MultiComm>
196 reset(
const Teuchos::RCP<const Epetra_BlockMap>& block_map,
197 const Teuchos::RCP<const Epetra_BlockMap>& coeff_map_,
198 const Teuchos::RCP<const EpetraExt::MultiComm>& product_comm_)
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));
214 reset(
const Teuchos::RCP<const Epetra_BlockMap>& block_map,
215 const Teuchos::RCP<const Epetra_BlockMap>& coeff_map_,
216 const Teuchos::RCP<const Epetra_BlockMap>& product_map_,
217 const Teuchos::RCP<const EpetraExt::MultiComm>& product_comm_)
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));
238 Teuchos::RCP<EpetraExt::BlockVector>
245 Teuchos::RCP<const EpetraExt::BlockVector>
254 setBlockVector(
const Teuchos::RCP<EpetraExt::BlockVector>& block_vec)
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());