52 UserAllocated_(false),
62 UserAllocated_(false),
72 UserAllocated_(false),
112 for (
int i=0; i<iend; i++)
Values_[i] = V[i];
138 for (
int i=0; i<iend; i++) V[i] =
Values_[i];
152 for (
int i=0; i<iend; i++)
Values_[i] = Value;
158 int result = -2000000000;
160 if (iend>0) result =
Values_[0];
163 this->
Comm().
MaxAll(&result, &globalResult, 1);
164 return(globalResult);
169 int result = 2000000000;
171 if (iend>0) result =
Values_[0];
174 this->
Comm().
MinAll(&result, &globalResult, 1);
175 return(globalResult);
186 for (
int i=0; i<iend; i++)
Values_[i] =V[i];
194 for (
int iproc=0; iproc < NumProc; iproc++) {
196 int NumMyElements1 =
Map(). NumMyElements();
198 int * MyGlobalElements1_int = 0;
199 long long * MyGlobalElements1_LL = 0;
200 if(
Map().GlobalIndicesInt()) {
201#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
204 throw ReportError(
"Epetra_IntVector::Print: Global indices int but no API for it.",-1);
207 else if(
Map().GlobalIndicesLongLong()) {
208#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
211 throw ReportError(
"Epetra_IntVector::Print: Global indices long long but no API for it.",-1);
214 int * FirstPointInElementList1=0;
219 os <<
" MyPID"; os <<
" ";
221 if (MaxElementSize1==1)
229 for (
int i=0; i < NumMyElements1; i++) {
233 os << MyPID; os <<
" ";
235 if (MaxElementSize1==1) {
236 if(MyGlobalElements1_int)
237 os << MyGlobalElements1_int[i] <<
" ";
238 if(MyGlobalElements1_LL)
239 os << MyGlobalElements1_LL[i] <<
" ";
243 if(MyGlobalElements1_int)
244 os << MyGlobalElements1_int[i]<<
"/" << ii <<
" ";
245 if(MyGlobalElements1_LL)
246 os << MyGlobalElements1_LL[i]<<
"/" << ii <<
" ";
247 iii = FirstPointInElementList1[i]+ii;
276 int *PermuteFromLIDs,
287 int * ToFirstPointInElementList = 0;
288 int * FromFirstPointInElementList = 0;
289 int * FromElementSizeList = 0;
293 if (!ConstantElementSize) {
306 if (MaxElementSize==1) {
308 NumSameEntries = NumSameIDs;
310 else if (ConstantElementSize) {
312 NumSameEntries = NumSameIDs * MaxElementSize;
316 NumSameEntries = FromFirstPointInElementList[NumSameIDs];
320 if (To==From) NumSameEntries = 0;
326 for (j=0; j<NumSameEntries; j++) To[j] += From[j];
328 for (j=0; j<NumSameEntries; j++) To[j] = From[j];
331 if (NumPermuteIDs>0) {
337 for (j=0; j<NumPermuteIDs; j++) To[PermuteToLIDs[j]] += From[PermuteFromLIDs[j]];
339 for (j=0; j<NumPermuteIDs; j++) To[PermuteToLIDs[j]] = From[PermuteFromLIDs[j]];
345 for (j=0; j<NumPermuteIDs; j++) {
346 jj = MaxElementSize*PermuteToLIDs[j];
347 jjj = MaxElementSize*PermuteFromLIDs[j];
348 for (k=0; k<MaxElementSize; k++)
349 To[jj+k] += From[jjj+k];
352 for (j=0; j<NumPermuteIDs; j++) {
353 jj = MaxElementSize*PermuteToLIDs[j];
354 jjj = MaxElementSize*PermuteFromLIDs[j];
355 for (k=0; k<MaxElementSize; k++)
356 To[jj+k] = From[jjj+k];
364 for (j=0; j<NumPermuteIDs; j++) {
365 jj = ToFirstPointInElementList[PermuteToLIDs[j]];
366 jjj = FromFirstPointInElementList[PermuteFromLIDs[j]];
367 int ElementSize = FromElementSizeList[PermuteFromLIDs[j]];
368 for (k=0; k<ElementSize; k++)
369 To[jj+k] += From[jjj+k];
372 for (j=0; j<NumPermuteIDs; j++) {
373 jj = ToFirstPointInElementList[PermuteToLIDs[j]];
374 jjj = FromFirstPointInElementList[PermuteFromLIDs[j]];
375 int ElementSize = FromElementSizeList[PermuteFromLIDs[j]];
376 for (k=0; k<ElementSize; k++)
377 To[jj+k] = From[jjj+k];
407 int * FromFirstPointInElementList = 0;
408 int * FromElementSizeList = 0;
410 if (!ConstantElementSize) {
415 SizeOfPacket = MaxElementSize * (int)
sizeof(
int);
417 if(NumExportIDs*SizeOfPacket>LenExports) {
418 if (LenExports>0)
delete [] Exports;
419 LenExports = NumExportIDs*SizeOfPacket;
420 Exports =
new char[LenExports];
425 if (NumExportIDs>0) {
426 ptr = (
int *) Exports;
429 if (MaxElementSize==1)
for (j=0; j<NumExportIDs; j++) *ptr++ = From[ExportLIDs[j]];
432 else if (ConstantElementSize) {
434 for (j=0; j<NumExportIDs; j++) {
435 jj = MaxElementSize*ExportLIDs[j];
436 for (k=0; k<MaxElementSize; k++)
444 int thisSizeOfPacket = MaxElementSize;
445 for (j=0; j<NumExportIDs; j++) {
446 ptr = (
int *) Exports + j*thisSizeOfPacket;
447 jj = FromFirstPointInElementList[ExportLIDs[j]];
448 int ElementSize = FromElementSizeList[ExportLIDs[j]];
449 for (k=0; k<ElementSize; k++)
476 if( CombineMode !=
Add
477 && CombineMode !=
Zero
480 && CombineMode !=
AbsMax )
483 if (NumImportIDs<=0)
return(0);
489 int * ToFirstPointInElementList = 0;
490 int * ToElementSizeList = 0;
492 if (!ConstantElementSize) {
500 ptr = (
int *) Imports;
503 if (MaxElementSize==1) {
505 if (CombineMode==
Add)
506 for (j=0; j<NumImportIDs; j++) To[ImportLIDs[j]] += *ptr++;
507 else if(CombineMode==
Insert)
508 for (j=0; j<NumImportIDs; j++) To[ImportLIDs[j]] = *ptr++;
509 else if(CombineMode==
AbsMax)
510 for (j=0; j<NumImportIDs; j++) {
511 To[ImportLIDs[j]] =
EPETRA_MAX( To[ImportLIDs[j]],std::abs(*ptr));
517 for (j=0; j<NumImportIDs; j++) {To[ImportLIDs[j]] += *ptr++; To[ImportLIDs[j]] /= 2;}
522 else if (ConstantElementSize) {
524 if (CombineMode==
Add) {
525 for (j=0; j<NumImportIDs; j++) {
526 jj = MaxElementSize*ImportLIDs[j];
527 for (k=0; k<MaxElementSize; k++)
531 else if(CombineMode==
Insert) {
532 for (j=0; j<NumImportIDs; j++) {
533 jj = MaxElementSize*ImportLIDs[j];
534 for (k=0; k<MaxElementSize; k++)
538 else if(CombineMode==
AbsMax) {
539 for (j=0; j<NumImportIDs; j++) {
540 jj = MaxElementSize*ImportLIDs[j];
541 for (k=0; k<MaxElementSize; k++) {
542 To[jj+k] =
EPETRA_MAX( To[jj+k], std::abs(*ptr));
549 else if(CombineMode==
Average) {
550 for (j=0; j<NumImportIDs; j++) {
551 jj = MaxElementSize*ImportLIDs[j];
552 for (k=0; k<MaxElementSize; k++)
553 { To[jj+k] += *ptr++; To[jj+k] /= 2;}
562 int thisSizeOfPacket = MaxElementSize;
564 if (CombineMode==
Add) {
565 for (j=0; j<NumImportIDs; j++) {
566 ptr = (
int *) Imports + j*thisSizeOfPacket;
567 jj = ToFirstPointInElementList[ImportLIDs[j]];
568 int ElementSize = ToElementSizeList[ImportLIDs[j]];
569 for (k=0; k<ElementSize; k++)
573 else if(CombineMode==
Insert){
574 for (j=0; j<NumImportIDs; j++) {
575 ptr = (
int *) Imports + j*thisSizeOfPacket;
576 jj = ToFirstPointInElementList[ImportLIDs[j]];
577 int ElementSize = ToElementSizeList[ImportLIDs[j]];
578 for (k=0; k<ElementSize; k++)
582 else if(CombineMode==
AbsMax){
583 for (j=0; j<NumImportIDs; j++) {
584 ptr = (
int *) Imports + j*thisSizeOfPacket;
585 jj = ToFirstPointInElementList[ImportLIDs[j]];
586 int ElementSize = ToElementSizeList[ImportLIDs[j]];
587 for (k=0; k<ElementSize; k++) {
588 To[jj+k] =
EPETRA_MAX( To[jj+k], std::abs(*ptr));
595 else if(CombineMode==
Average) {
596 for (j=0; j<NumImportIDs; j++) {
597 ptr = (
int *) Imports + j*thisSizeOfPacket;
598 jj = ToFirstPointInElementList[ImportLIDs[j]];
599 int ElementSize = ToElementSizeList[ImportLIDs[j]];
600 for (k=0; k<ElementSize; k++)
601 { To[jj+k] += *ptr++; To[jj+k] /= 2;}
#define EPETRA_CHK_ERR(a)
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
int MaxElementSize() const
Maximum element size across all processors.
int MyGlobalElements(int *MyGlobalElementList) const
Puts list of global elements on this processor into the user-provided array.
long long * MyGlobalElements64() const
int * ElementSizeList() const
List of the element sizes corresponding to the array MyGlobalElements().
int ElementSize() const
Returns the size of elements in the map; only valid if map has constant element size.
int * FirstPointInElementList() const
Pointer to internal array containing a mapping between the local elements and the first local point n...
const Epetra_Comm & Comm() const
Access function for Epetra_Comm communicator.
bool ConstantElementSize() const
Returns true if map has constant element size.
virtual int MaxAll(double *PartialMaxs, double *GlobalMaxs, int Count) const =0
Epetra_Comm Global Max function.
virtual int NumProc() const =0
Returns total number of processes.
virtual int MinAll(double *PartialMins, double *GlobalMins, int Count) const =0
Epetra_Comm Global Min function.
virtual int MyPID() const =0
Return my process ID.
virtual void Barrier() const =0
Epetra_Comm Barrier function.
Epetra_DistObject: A class for constructing and using dense multi-vectors, vectors and matrices in pa...
const Epetra_BlockMap & Map() const
Returns the address of the Epetra_BlockMap for this multi-vector.
const Epetra_Comm & Comm() const
Returns the address of the Epetra_Comm for this multi-vector.
Epetra_Distributor: The Epetra Gather/Scatter Setup Base Class.
Epetra_IntVector: A class for constructing and using dense integer vectors on a parallel computer.
int ExtractView(int **V) const
Set user-provided address of V.
int CheckSizes(const Epetra_SrcDistObject &A)
Allows the source and target (this) objects to be compared for compatibility, return nonzero if not.
Epetra_IntVector(const Epetra_BlockMap &Map, bool zeroOut=true)
Basic Epetra_IntVector constuctor.
int MaxValue()
Find maximum value.
virtual void Print(std::ostream &os) const
Print method.
int PutValue(int Value)
Set all elements of the vector to Value.
int MyLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
int ExtractCopy(int *V) const
Put vector values into user-provided array.
virtual ~Epetra_IntVector()
Epetra_IntVector destructor.
int MinValue()
Find minimum value.
int PackAndPrepare(const Epetra_SrcDistObject &Source, int NumExportIDs, int *ExportLIDs, int &LenExports, char *&Exports, int &SizeOfPacket, int *Sizes, bool &VarSizes, Epetra_Distributor &Distor)
Perform any packing or preparation required for call to DoTransfer().
Epetra_IntVector & operator=(const Epetra_IntVector &Source)
= Operator.
int CopyAndPermute(const Epetra_SrcDistObject &Source, int NumSameIDs, int NumPermuteIDs, int *PermuteToLIDs, int *PermuteFromLIDs, const Epetra_OffsetIndex *Indexor, Epetra_CombineMode CombineMode=Zero)
Perform ID copies and permutations that are on processor.
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)
Perform any unpacking and combining after call to DoTransfer().
virtual int ReportError(const std::string Message, int ErrorCode) const
Error reporting method.
std::string toString(const int &x) const
Epetra_OffsetIndex: This class builds index for efficient mapping of data from one Epetra_CrsGraph ba...
Epetra_SrcDistObject: A class for supporting flexible source distributed objects for import/export op...