44#ifndef EPETRAEXT_DISTARRAY_H
45#define EPETRAEXT_DISTARRAY_H
47#if defined(EpetraExt_SHOW_DEPRECATED_WARNINGS)
49#warning "The EpetraExt package is deprecated"
55#include "Epetra_Map.h"
56#include "Epetra_DistObject.h"
103 "Map.MaxElementSize() != 1"));
106 "Map.ConstantElementSize() != true"));
112 values_.resize(MyLength_ * RowSize_);
127 return(GlobalLength_);
139 assert (ID <= RowSize_);
140 return(values_[LEID * RowSize_ + ID]);
143 inline T&
operator()(
const int GEID,
const int ID,
const bool isLocal)
145 int LEID =
Map().
LID(GEID);
147 assert (ID <= RowSize_);
148 return(values_[LEID * RowSize_ + ID]);
154 os <<
"DistArray object, label = " << this->
Label() << std::endl;
159 for (
int iproc=0; iproc <
Comm().
NumProc(); iproc++)
164 for (
int i = 0; i <
RowSize(); ++i) os <<
"V\t";
172 os <<
Map().
GID(i) <<
'\t';
173 for (
int j = 0; j < RowSize_; ++j)
174 os << values_[i * RowSize_ + j] <<
'\t';
185 if (count_ <
Map().NumMyElements())
186 return(
Map().GID(count_));
194 return(
Map().GID(0));
228 int * PermuteFromLIDs,
232 const DistArray& S =
dynamic_cast<const DistArray&
>(Source);
233 const std::vector<T>& From = S.ExtractView();
235 std::vector<T>& To = values_;
245 NumSameEntries = NumSameIDs;
248 if (To==From) NumSameEntries = 0;
253 for (j=0; j<NumSameEntries * RowSize_; j++)
260 if (NumPermuteIDs>0) {
262 for (j=0; j<NumPermuteIDs * RowSize_; j++)
263 To[PermuteToLIDs[j]] = From[PermuteFromLIDs[j]];
281 const std::vector<T>& From = S.ExtractView();
283 std::vector<T> To = values_;
288 SizeOfPacket = RowSize_ *
sizeof(T);
290 if(NumExportIDs*SizeOfPacket>LenExports) {
291 if (LenExports>0)
delete [] Exports;
292 LenExports = NumExportIDs*SizeOfPacket;
293 Exports =
new char[LenExports];
298 if (NumExportIDs>0) {
302 for (
int j=0; j<NumExportIDs; j++)
303 for (
int k = 0; k < RowSize_ ; ++k)
304 *ptr++ = From[ExportLIDs[j] * RowSize_ + k];
322 if (CombineMode != Insert)
325 std::cout << NumImportIDs << std::endl;
326 if (NumImportIDs<=0)
return(0);
337 for (j=0; j<NumImportIDs; j++)
338 for (
int k = 0; k < RowSize_ ; ++k)
339 To[ImportLIDs[j] * RowSize_ + k] = *ptr++;
348 std::vector<T> values_;
DistArray<T>: A class to store row-oriented multivectors of type T.
int MyLength() const
Returns the length of the locally owned array.
T * Values()
Returns a pointer to the internally stored data (non-const version).
T & operator()(const int GEID, const int ID, const bool isLocal)
int RowSize() const
Returns the row size, that is, the amount of data associated with each element.
int GlobalLength() const
Returns the global length of the array.
const T * Values() const
Returns a pointer to the internally stored data (const version).
void Print(std::ostream &os) const
Prints the array on the specified stream.
DistArray(const Epetra_Map &Map, const int RowSize)
Constructor for a given Map and RowSize.
T & operator()(const int LEID, const int ID)
Returns a reference to the ID component of the LEID local element.
const std::vector< T > & ExtractView() const
Extracts a view of the array.
int MaxElementSize() const
int NumGlobalElements() const
bool ConstantElementSize() const
int NumMyElements() const
virtual int NumProc() const=0
virtual int MyPID() const=0
const Epetra_BlockMap & Map() const
const Epetra_Comm & Comm() const
virtual const char * Label() const
EpetraExt::BlockCrsMatrix: A class for constructing a distributed block matrix.