44 #ifndef EPETRAEXT_DISTARRAY_H 45 #define EPETRAEXT_DISTARRAY_H 49 #include "Epetra_Map.h" 50 #include "Epetra_DistObject.h" 92 Epetra_DistObject(Map)
95 if (Map.MaxElementSize() != 1)
97 "Map.MaxElementSize() != 1"));
98 if (!Map.ConstantElementSize())
100 "Map.ConstantElementSize() != true"));
137 inline T&
operator()(
const int GEID,
const int ID,
const bool isLocal)
139 int LEID = Map().LID(GEID);
148 os <<
"DistArray object, label = " << this->Label() << std::endl;
149 os <<
"Number of local elements = " << Map().NumMyElements() << std::endl;
150 os <<
"Number of global elements = " << Map().NumGlobalElements() << std::endl;
153 for (
int iproc=0; iproc < Comm().NumProc(); iproc++)
158 for (
int i = 0; i <
RowSize(); ++i) os <<
"V\t";
162 if (Comm().MyPID() == iproc)
164 for (
int i = 0; i < Map().NumMyElements(); ++i)
166 os << Map().GID(i) <<
'\t';
179 if (
count_ < Map().NumMyElements())
180 return(Map().GID(
count_));
188 return(Map().GID(0));
222 int * PermuteFromLIDs,
223 const Epetra_OffsetIndex * Indexor,
224 Epetra_CombineMode CombineMode = Zero)
239 NumSameEntries = NumSameIDs;
242 if (To==From) NumSameEntries = 0;
247 for (j=0; j<NumSameEntries *
RowSize_; j++)
254 if (NumPermuteIDs>0) {
256 for (j=0; j<NumPermuteIDs *
RowSize_; j++)
257 To[PermuteToLIDs[j]] = From[PermuteFromLIDs[j]];
272 Epetra_Distributor& Distor)
282 SizeOfPacket =
RowSize_ *
sizeof(T);
284 if(NumExportIDs*SizeOfPacket>LenExports) {
285 if (LenExports>0)
delete [] Exports;
286 LenExports = NumExportIDs*SizeOfPacket;
287 Exports =
new char[LenExports];
292 if (NumExportIDs>0) {
296 for (
int j=0; j<NumExportIDs; j++)
298 *ptr++ = From[ExportLIDs[j] *
RowSize_ + k];
310 Epetra_Distributor& Distor,
311 Epetra_CombineMode CombineMode,
312 const Epetra_OffsetIndex * Indexor)
316 if (CombineMode != Insert)
319 std::cout << NumImportIDs << std::endl;
320 if (NumImportIDs<=0)
return(0);
331 for (j=0; j<NumImportIDs; j++)
333 To[ImportLIDs[j] *
RowSize_ + k] = *ptr++;
int MyLength_
Length of the locally owned array.
virtual int CopyAndPermute(const Epetra_SrcDistObject &Source, int NumSameIDs, int NumPermuteIDs, int *PermuteToLIDs, int *PermuteFromLIDs, const Epetra_OffsetIndex *Indexor, Epetra_CombineMode CombineMode=Zero)
int RowSize_
Amount of data associated with each element.
virtual int CheckSizes(const Epetra_SrcDistObject &Source)
EpetraExt::BlockCrsMatrix: A class for constructing a distributed block matrix.
DistArray(const Epetra_Map &Map, const int RowSize)
Constructor for a given Map and RowSize.
virtual int UnpackAndCombine(const Epetra_SrcDistObject &Source, int NumImportIDs, int *ImportLIDs, int LenImports, char *Imports, int &SizeOfPacket, Epetra_Distributor &Distor, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor)
T * Values()
Returns a pointer to the internally stored data (non-const version).
int RowSize() const
Returns the row size, that is, the amount of data associated with each element.
std::vector< T > values_
Container of local data.
virtual int PackAndPrepare(const Epetra_SrcDistObject &Source, int NumExportIDs, int *ExportLIDs, int &LenExports, char *&Exports, int &SizeOfPacket, int *Sizes, bool &VarSizes, Epetra_Distributor &Distor)
int GlobalLength() const
Returns the global length of the array.
void Print(std::ostream &os) const
Prints the array on the specified stream.
int GlobalLength_
Length of the global array.
const T * Values() const
Returns a pointer to the internally stored data (const version).
T & operator()(const int GEID, const int ID, const bool isLocal)
int MyLength() const
Returns the length of the locally owned array.
const std::vector< T > & ExtractView() const
Extracts a view of the array.
T & operator()(const int LEID, const int ID)
Returns a reference to the ID component of the LEID local element.
DistArray<T>: A class to store row-oriented multivectors of type T.