44 #include "Epetra_Map.h"
45 #include "Epetra_Comm.h"
52 const Epetra_BlockMap & BaseMap,
53 const Epetra_BlockMap & GlobalMap)
54 : Epetra_Vector( GlobalMap ),
64 const Epetra_BlockMap & BaseMap,
65 const Epetra_Vector & BlockVec)
66 : Epetra_Vector( CV, BlockVec, 0 ),
75 : Epetra_Vector( dynamic_cast<const Epetra_Vector &>(Source) ),
76 BaseMap_( Source.BaseMap_ ),
77 Offset_( Source.Offset_ )
89 int IndexOffset = GlobalBlockRow *
Offset_;
94 for (
int i=0; i<
BaseMap_.NumMyElements(); i++) {
95 localIndex = this->Map().LID((IndexOffset +
BaseMap_.GID(i)));
97 cout <<
"Error in BlockVector::GetBlock: " << i <<
" "
98 << IndexOffset <<
" " <<
BaseMap_.GID(i) << endl;
101 BaseVector[i] = Values_[localIndex];
110 int IndexOffset = GlobalBlockRow *
Offset_;
115 for (
int i=0; i<
BaseMap_.NumMyElements(); i++) {
116 localIndex = this->Map().LID((IndexOffset +
BaseMap_.GID(i)));
117 if (localIndex==-1) {
118 cout <<
"Error in BlockVector::GetBlock: " << i <<
" "
119 << IndexOffset <<
" " <<
BaseMap_.GID(i) << endl;
122 (*this)[localIndex] = BaseVector[i];
129 int* Indices,
int GlobalBlockRow)
131 int IndexOffset = GlobalBlockRow *
Offset_;
136 for (
int i=0; i<NumIndices; i++) {
137 localIndex = this->Map().LID((IndexOffset + Indices[i]));
138 if (localIndex==-1) {
139 cout <<
"Error in BlockVector::BlockSumIntoGlobalValues: " << i
140 <<
" " << IndexOffset <<
" " << Indices[i] << endl;
143 (*this)[localIndex] += Values[i];
150 int* Indices,
int GlobalBlockRow)
152 int IndexOffset = GlobalBlockRow *
Offset_;
157 for (
int i=0; i<NumIndices; i++) {
158 localIndex = this->Map().LID((IndexOffset + Indices[i]));
159 if (localIndex==-1) {
160 cout <<
"Error in BlockVector::BlockReplaceGlobalValues: " << i
161 <<
" " << IndexOffset <<
" " << Indices[i] << endl;
164 (*this)[localIndex] = Values[i];
171 Teuchos::RCP<const Epetra_Vector>
174 int offset = GlobalBlockRow *
BaseMap_.NumMyElements();
175 return Teuchos::rcp(
new Epetra_Vector(View,
BaseMap_, Values_+offset));
179 Teuchos::RCP<Epetra_Vector>
182 int offset = GlobalBlockRow *
BaseMap_.NumMyElements();
183 return Teuchos::rcp(
new Epetra_Vector(View,
BaseMap_, Values_+offset));
187 const Epetra_BlockMap&
Teuchos::RCP< const Epetra_Vector > GetBlock(int BlockRow) const
Return Epetra_Vector for given block row.
int BlockSumIntoGlobalValues(int NumIndices, double *Values, int *Indices, int BlockRow)
Load entries into BlockVector with base vector indices offset by BlockRow.
int BlockReplaceGlobalValues(int NumIndices, double *Values, int *Indices, int BlockRow)
Load entries into BlockVector with base vector indices offset by BlockRow.
virtual ~BlockVector()
Destructor.
int ExtractBlockValues(Epetra_Vector &BaseVec, int BlockRow) const
Extract a single block from a Block Vector: block row is global, not a stencil value.
int LoadBlockValues(const Epetra_Vector &BaseVec, int BlockRow)
Load a single block into a Block Vector: block row is global, not a stencil value.
BlockVector(const Epetra_BlockMap &BaseMap, const Epetra_BlockMap &GlobalMap)
BlockVector constuctor with one block row per processor.
const Epetra_BlockMap & GetBaseMap() const
Return base map.