Epetra Package Browser (Single Doxygen Collection) Development
Loading...
Searching...
No Matches
List of all members
Epetra_IntVector Class Reference

Epetra_IntVector: A class for constructing and using dense integer vectors on a parallel computer. More...

#include <Epetra_IntVector.h>

Inheritance diagram for Epetra_IntVector:
Inheritance graph
[legend]

I/O methods

int * Values_
 
bool UserAllocated_
 
bool Allocated_
 
virtual void Print (std::ostream &os) const
 Print method.
 
int AllocateForCopy ()
 
int DoCopy (int *V)
 
int AllocateForView ()
 
int DoView (int *V)
 
int CheckSizes (const Epetra_SrcDistObject &A)
 Allows the source and target (this) objects to be compared for compatibility, return nonzero if not.
 
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 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().
 
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().
 

Constructors/destructors

 Epetra_IntVector (const Epetra_BlockMap &Map, bool zeroOut=true)
 Basic Epetra_IntVector constuctor.
 
 Epetra_IntVector (const Epetra_IntVector &Source)
 Epetra_IntVector copy constructor.
 
 Epetra_IntVector (Epetra_DataAccess CV, const Epetra_BlockMap &Map, int *V)
 Set vector values from user array.
 
virtual ~Epetra_IntVector ()
 Epetra_IntVector destructor.
 

Post-construction modification methods

int PutValue (int Value)
 Set all elements of the vector to Value.
 

Extraction methods

int ExtractCopy (int *V) const
 Put vector values into user-provided array.
 
int ExtractView (int **V) const
 Set user-provided address of V.
 

Mathematical methods

int MaxValue ()
 Find maximum value.
 
int MinValue ()
 Find minimum value.
 

Overloaded operators

Epetra_IntVectoroperator= (const Epetra_IntVector &Source)
 = Operator.
 
int & operator[] (int index)
 Element access function.
 
const int & operator[] (int index) const
 Element access function.
 

Attribute access functions

int * Values () const
 Returns a pointer to an array containing the values of this vector.
 
int MyLength () const
 Returns the local vector length on the calling processor of vectors in the multi-vector.
 
int GlobalLength () const
 Returns the global vector length of vectors in the multi-vector.
 
long long GlobalLength64 () const
 

Additional Inherited Members

- Public Member Functions inherited from Epetra_DistObject
 Epetra_DistObject (const Epetra_BlockMap &Map)
 Basic Epetra_DistObject constuctor.
 
 Epetra_DistObject (const Epetra_BlockMap &Map, const char *const Label)
 
 Epetra_DistObject (const Epetra_DistObject &Source)
 Epetra_DistObject copy constructor.
 
virtual ~Epetra_DistObject ()
 Epetra_DistObject destructor.
 
int Import (const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
 Imports an Epetra_DistObject using the Epetra_Import object.
 
int Import (const Epetra_SrcDistObject &A, const Epetra_Export &Exporter, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
 Imports an Epetra_DistObject using the Epetra_Export object.
 
int Export (const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
 Exports an Epetra_DistObject using the Epetra_Import object.
 
int Export (const Epetra_SrcDistObject &A, const Epetra_Export &Exporter, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
 Exports an Epetra_DistObject using the Epetra_Export object.
 
const Epetra_BlockMapMap () const
 Returns the address of the Epetra_BlockMap for this multi-vector.
 
const Epetra_CommComm () const
 Returns the address of the Epetra_Comm for this multi-vector.
 
bool DistributedGlobal () const
 Returns true if this multi-vector is distributed global, i.e., not local replicated.
 
- Public Member Functions inherited from Epetra_Object
virtual int ReportError (const std::string Message, int ErrorCode) const
 Error reporting method.
 
 Epetra_Object (int TracebackModeIn=-1, bool set_label=true)
 Epetra_Object Constructor.
 
 Epetra_Object (const char *const Label, int TracebackModeIn=-1)
 Epetra_Object Constructor.
 
 Epetra_Object (const Epetra_Object &Object)
 Epetra_Object Copy Constructor.
 
virtual ~Epetra_Object ()
 Epetra_Object Destructor.
 
virtual void SetLabel (const char *const Label)
 Epetra_Object Label definition using char *.
 
virtual const char * Label () const
 Epetra_Object Label access funtion.
 
- Public Member Functions inherited from Epetra_SrcDistObject
virtual ~Epetra_SrcDistObject ()
 Epetra_SrcDistObject destructor.
 
- Static Public Member Functions inherited from Epetra_Object
static void SetTracebackMode (int TracebackModeValue)
 Set the value of the Epetra_Object error traceback report mode.
 
static int GetTracebackMode ()
 Get the value of the Epetra_Object error report mode.
 
static std::ostream & GetTracebackStream ()
 Get the output stream for error reporting.
 
- Static Public Attributes inherited from Epetra_Object
static int TracebackMode
 
- Protected Member Functions inherited from Epetra_DistObject
virtual int DoTransfer (const Epetra_SrcDistObject &A, Epetra_CombineMode CombineMode, int NumSameIDs, int NumPermuteIDs, int NumRemoteIDs, int NumExportIDs, int *PermuteToLIDs, int *PermuteFromLIDs, int *RemoteLIDs, int *ExportLIDs, int &LenExports, char *&Exports, int &LenImports, char *&Imports, Epetra_Distributor &Distor, bool DoReverse, const Epetra_OffsetIndex *Indexor)
 Perform actual transfer (redistribution) of data across memory images, using Epetra_Distributor object.
 
- Protected Member Functions inherited from Epetra_Object
std::string toString (const int &x) const
 
std::string toString (const long long &x) const
 
std::string toString (const double &x) const
 
- Protected Attributes inherited from Epetra_DistObject
Epetra_BlockMap Map_
 
const Epetra_CommComm_
 
char * Exports_
 
char * Imports_
 
int LenExports_
 
int LenImports_
 
int * Sizes_
 

Detailed Description

Epetra_IntVector: A class for constructing and using dense integer vectors on a parallel computer.

The Epetra_IntVector class enables the construction and use of integer dense vectors in a distributed memory environment. The distribution of the dense vector is determined in part by a Epetra_Comm object and a Epetra_Map (or Epetra_LocalMap or Epetra_BlockMap).

Distributed Global vs. Replicated Local

Constructing Epetra_IntVectors

There are four Epetra_IntVector constructors. The first is a basic constructor that allocates space and sets all values to zero, the second is a copy constructor. The third and fourth constructors work with user data. These constructors have two data access modes:

  1. Copy mode - Allocates memory and makes a copy of the user-provided data. In this case, the user data is not needed after construction.
  2. View mode - Creates a "view" of the user data. In this case, the user data is required to remain intact for the life of the vector.
Warning
View mode is extremely dangerous from a data hiding perspective. Therefore, we strongly encourage users to develop code using Copy mode first and only use the View mode in a secondary optimization phase.

All Epetra_IntVector constructors require a map argument that describes the layout of elements on the parallel machine. Specifically, map is a Epetra_Map, Epetra_LocalMap or Epetra_BlockMap object describing the desired memory layout for the vector.

There are four different Epetra_IntVector constructors:

Extracting Data from Epetra_IntVectors

Once a Epetra_IntVector is constructed, it is possible to extract a copy of the values or create a view of them.

Warning
ExtractView functions are extremely dangerous from a data hiding perspective. For both ExtractView fuctions, there is a corresponding ExtractCopy function. We strongly encourage users to develop code using ExtractCopy functions first and only use the ExtractView functions in a secondary optimization phase.

There are two Extract functions:

Warning
A Epetra_Map, Epetra_LocalMap or Epetra_BlockMap object is required for all Epetra_IntVector constructors.

Definition at line 124 of file Epetra_IntVector.h.

Constructor & Destructor Documentation

◆ Epetra_IntVector() [1/3]

Epetra_IntVector::Epetra_IntVector ( const Epetra_BlockMap Map,
bool  zeroOut = true 
)

Basic Epetra_IntVector constuctor.

Creates a Epetra_IntVector object and, by default, fills with zero values.

Parameters
InMap - A Epetra_LocalMap, Epetra_Map or Epetra_BlockMap.
Warning
Note that, because Epetra_LocalMap derives from Epetra_Map and Epetra_Map derives from Epetra_BlockMap, this constructor works for all three types of Epetra map classes.
Parameters
InzeroOut - If true then the allocated memory will be zeroed out initialy. If false then this memory will not be touched which can be significantly faster.
Returns
Pointer to a Epetra_IntVector.

Definition at line 49 of file Epetra_IntVector.cpp.

◆ Epetra_IntVector() [2/3]

Epetra_IntVector::Epetra_IntVector ( const Epetra_IntVector Source)

Epetra_IntVector copy constructor.

Definition at line 59 of file Epetra_IntVector.cpp.

◆ Epetra_IntVector() [3/3]

Epetra_IntVector::Epetra_IntVector ( Epetra_DataAccess  CV,
const Epetra_BlockMap Map,
int *  V 
)

Set vector values from user array.

Parameters
InEpetra_DataAccess - Enumerated type set to Copy or View.
InMap - A Epetra_LocalMap, Epetra_Map or Epetra_BlockMap.
InV - Pointer to an array of integer numbers..
Returns
Integer error code, set to 0 if successful.

See Detailed Description section for further discussion.

Definition at line 69 of file Epetra_IntVector.cpp.

◆ ~Epetra_IntVector()

Epetra_IntVector::~Epetra_IntVector ( )
virtual

Epetra_IntVector destructor.

Definition at line 85 of file Epetra_IntVector.cpp.

Member Function Documentation

◆ PutValue()

int Epetra_IntVector::PutValue ( int  Value)

Set all elements of the vector to Value.

Definition at line 150 of file Epetra_IntVector.cpp.

◆ ExtractCopy()

int Epetra_IntVector::ExtractCopy ( int *  V) const

Put vector values into user-provided array.

Parameters
OutV - Pointer to memory space that will contain the vector values.
Returns
Integer error code, set to 0 if successful.

Definition at line 135 of file Epetra_IntVector.cpp.

◆ ExtractView()

int Epetra_IntVector::ExtractView ( int **  V) const

Set user-provided address of V.

Parameters
OutV - Address of a pointer to that will be set to point to the values of the vector.
Returns
Integer error code, set to 0 if successful.

Definition at line 143 of file Epetra_IntVector.cpp.

◆ MaxValue()

int Epetra_IntVector::MaxValue ( )

Find maximum value.

Returns
Maximum value across all processors.

Definition at line 156 of file Epetra_IntVector.cpp.

◆ MinValue()

int Epetra_IntVector::MinValue ( )

Find minimum value.

Returns
Minimum value across all processors.

Definition at line 167 of file Epetra_IntVector.cpp.

◆ operator=()

Epetra_IntVector & Epetra_IntVector::operator= ( const Epetra_IntVector Source)

= Operator.

Parameters
InA - Epetra_IntVector to copy.
Returns
Epetra_IntVector.

Definition at line 178 of file Epetra_IntVector.cpp.

◆ operator[]() [1/2]

int & Epetra_IntVector::operator[] ( int  index)
inline

Element access function.

Returns
V[Index].

Definition at line 235 of file Epetra_IntVector.h.

◆ operator[]() [2/2]

const int & Epetra_IntVector::operator[] ( int  index) const
inline

Element access function.

Returns
V[Index].

Definition at line 240 of file Epetra_IntVector.h.

◆ Values()

int * Epetra_IntVector::Values ( ) const
inline

Returns a pointer to an array containing the values of this vector.

Definition at line 247 of file Epetra_IntVector.h.

◆ MyLength()

int Epetra_IntVector::MyLength ( ) const
inline

Returns the local vector length on the calling processor of vectors in the multi-vector.

Definition at line 250 of file Epetra_IntVector.h.

◆ GlobalLength()

int Epetra_IntVector::GlobalLength ( ) const
inline

Returns the global vector length of vectors in the multi-vector.

Definition at line 254 of file Epetra_IntVector.h.

◆ GlobalLength64()

long long Epetra_IntVector::GlobalLength64 ( ) const
inline

Definition at line 257 of file Epetra_IntVector.h.

◆ Print()

void Epetra_IntVector::Print ( std::ostream &  os) const
virtual

Print method.

Reimplemented from Epetra_DistObject.

Definition at line 190 of file Epetra_IntVector.cpp.

◆ AllocateForCopy()

int Epetra_IntVector::AllocateForCopy ( )
private

Definition at line 92 of file Epetra_IntVector.cpp.

◆ DoCopy()

int Epetra_IntVector::DoCopy ( int *  V)
private

Definition at line 109 of file Epetra_IntVector.cpp.

◆ AllocateForView()

int Epetra_IntVector::AllocateForView ( )
private

Definition at line 117 of file Epetra_IntVector.cpp.

◆ DoView()

int Epetra_IntVector::DoView ( int *  V)
private

Definition at line 127 of file Epetra_IntVector.cpp.

◆ CheckSizes()

int Epetra_IntVector::CheckSizes ( const Epetra_SrcDistObject Source)
privatevirtual

Allows the source and target (this) objects to be compared for compatibility, return nonzero if not.

Implements Epetra_DistObject.

Definition at line 265 of file Epetra_IntVector.cpp.

◆ CopyAndPermute()

int Epetra_IntVector::CopyAndPermute ( const Epetra_SrcDistObject Source,
int  NumSameIDs,
int  NumPermuteIDs,
int *  PermuteToLIDs,
int *  PermuteFromLIDs,
const Epetra_OffsetIndex Indexor,
Epetra_CombineMode  CombineMode = Zero 
)
privatevirtual

Perform ID copies and permutations that are on processor.

Implements Epetra_DistObject.

Definition at line 272 of file Epetra_IntVector.cpp.

◆ PackAndPrepare()

int Epetra_IntVector::PackAndPrepare ( const Epetra_SrcDistObject Source,
int  NumExportIDs,
int *  ExportLIDs,
int &  LenExports,
char *&  Exports,
int &  SizeOfPacket,
int *  Sizes,
bool &  VarSizes,
Epetra_Distributor Distor 
)
privatevirtual

Perform any packing or preparation required for call to DoTransfer().

Implements Epetra_DistObject.

Definition at line 385 of file Epetra_IntVector.cpp.

◆ UnpackAndCombine()

int Epetra_IntVector::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 
)
privatevirtual

Perform any unpacking and combining after call to DoTransfer().

Implements Epetra_DistObject.

Definition at line 459 of file Epetra_IntVector.cpp.

Member Data Documentation

◆ Values_

int* Epetra_IntVector::Values_
private

Definition at line 304 of file Epetra_IntVector.h.

◆ UserAllocated_

bool Epetra_IntVector::UserAllocated_
private

Definition at line 305 of file Epetra_IntVector.h.

◆ Allocated_

bool Epetra_IntVector::Allocated_
private

Definition at line 306 of file Epetra_IntVector.h.


The documentation for this class was generated from the following files: