queso-0.53.0
Private Member Functions | Private Attributes | List of all members
QUESO::Map Class Reference

A class for partitioning vectors and matrices. More...

#include <Map.h>

Collaboration diagram for QUESO::Map:
Collaboration graph
[legend]

Public Member Functions

Constructor/Destructor methods
 Map (int numGlobalElements, int indexBase, const MpiComm &comm)
 Constructor for a uniform linear distribution of elements. More...
 
 Map (const Map &src)
 Copy constructor. More...
 
 ~Map ()
 Destructor. More...
 
Set methods
Mapoperator= (const Map &rhs)
 Assignment operator. More...
 
Size, dimension and local ID accessor methods
int NumGlobalElements () const
 Returns the total number of elements across all processors. More...
 
int IndexBase () const
 
int NumMyElements () const
 Returns the number of elements owned by the calling processor. More...
 
int MinMyGID () const
 The minimum global index value on the calling processor. More...
 
Miscellaneous methods
const MpiCommComm () const
 Access function for MpiComm communicator. More...
 

Private Member Functions

 Map ()
 Default constructor. Do not call this directly. More...
 
void copy (const Map &src)
 Copies the map. More...
 

Private Attributes

MpiComm m_MpiComm
 This communicator can be queried for processor rank and size information. More...
 
int m_numGlobalElements
 Total number of elements across all processors. More...
 
int m_indexBase
 Base integer value for indexed array references. More...
 
int m_numMyElements
 Number of elements owned by the calling processor. More...
 

Detailed Description

A class for partitioning vectors and matrices.

It is often the case that multiple matrix and vector objects have an identical distribution of elements on a parallel machine. The Map keeps information that describes this distribution for matrices and vectors. Inspired by Trilinos Epetra_Map class.

Definition at line 49 of file Map.h.

Constructor & Destructor Documentation

QUESO::Map::Map ( int  numGlobalElements,
int  indexBase,
const MpiComm comm 
)

Constructor for a uniform linear distribution of elements.

Definition at line 34 of file Map.C.

38  :
39  m_MpiComm (comm),
40 #ifdef QUESO_HAS_TRILINOS
41  m_epetraMap ( new Epetra_Map(numGlobalElements,0,comm.epetraMpiComm()) )
42 #else
43  m_numGlobalElements(numGlobalElements),
44  m_indexBase (indexBase),
45  m_numMyElements (numGlobalElements)
46 #endif
47 {
48 }
int m_numMyElements
Number of elements owned by the calling processor.
Definition: Map.h:122
int m_numGlobalElements
Total number of elements across all processors.
Definition: Map.h:116
MpiComm m_MpiComm
This communicator can be queried for processor rank and size information.
Definition: Map.h:109
int m_indexBase
Base integer value for indexed array references.
Definition: Map.h:119
QUESO::Map::Map ( const Map src)

Copy constructor.

Definition at line 51 of file Map.C.

References copy().

52  :
53  m_MpiComm(src.m_MpiComm)
54 #ifdef QUESO_HAS_TRILINOS
55  ,
56  m_epetraMap(NULL)
57 #endif
58 {
59  this->copy(src);
60 }
MpiComm m_MpiComm
This communicator can be queried for processor rank and size information.
Definition: Map.h:109
void copy(const Map &src)
Copies the map.
Definition: Map.C:146
QUESO::Map::~Map ( )

Destructor.

Definition at line 63 of file Map.C.

64 {
65 #ifdef QUESO_HAS_TRILINOS
66  delete m_epetraMap;
67  m_epetraMap = NULL;
68 #else
69  // Nothing to do
70 #endif
71 }
QUESO::Map::Map ( )
private

Default constructor. Do not call this directly.

Member Function Documentation

const MpiComm & QUESO::Map::Comm ( ) const

Access function for MpiComm communicator.

Definition at line 131 of file Map.C.

References m_MpiComm.

Referenced by QUESO::Matrix::numOfProcsForStorage(), and QUESO::Vector::numOfProcsForStorage().

132 {
133  return m_MpiComm;
134 }
MpiComm m_MpiComm
This communicator can be queried for processor rank and size information.
Definition: Map.h:109
void QUESO::Map::copy ( const Map src)
private

Copies the map.

Definition at line 146 of file Map.C.

References m_indexBase, m_MpiComm, m_numGlobalElements, and m_numMyElements.

Referenced by Map(), and operator=().

147 {
148  m_MpiComm = src.m_MpiComm;
149 #ifdef QUESO_HAS_TRILINOS
150  delete m_epetraMap;
151  m_epetraMap = new Epetra_Map(*src.m_epetraMap);
152 #else
153  m_numGlobalElements = src.m_numGlobalElements;
154  m_indexBase = src.m_indexBase;
155  m_numMyElements = src.m_numMyElements;
156 #endif
157 
158  return;
159 }
int m_numMyElements
Number of elements owned by the calling processor.
Definition: Map.h:122
int m_numGlobalElements
Total number of elements across all processors.
Definition: Map.h:116
MpiComm m_MpiComm
This communicator can be queried for processor rank and size information.
Definition: Map.h:109
int m_indexBase
Base integer value for indexed array references.
Definition: Map.h:119
int QUESO::Map::IndexBase ( ) const

Returns the base integer value for indexed array references. The first position in the global processor in my processors.

Definition at line 96 of file Map.C.

References m_indexBase.

97 {
98 #ifdef QUESO_HAS_TRILINOS
99  return m_epetraMap->IndexBase();
100 #else
101  return m_indexBase;
102 #endif
103 }
int m_indexBase
Base integer value for indexed array references.
Definition: Map.h:119
int QUESO::Map::MinMyGID ( ) const

The minimum global index value on the calling processor.

Definition at line 118 of file Map.C.

119 {
120 #ifdef QUESO_HAS_TRILINOS
121  return m_epetraMap->MinMyGID();
122 #else
123  return 0;
124 #endif
125 }
int QUESO::Map::NumGlobalElements ( ) const

Returns the total number of elements across all processors.

Definition at line 85 of file Map.C.

References m_numGlobalElements.

Referenced by QUESO::DistArray< T >::DistArray(), QUESO::GslVector::GslVector(), QUESO::GslVector::sizeGlobal(), and QUESO::VectorSpace< V, M >::VectorSpace().

86 {
87 #ifdef QUESO_HAS_TRILINOS
88  return m_epetraMap->NumGlobalElements();
89 #else
90  return m_numGlobalElements;
91 #endif
92 }
int m_numGlobalElements
Total number of elements across all processors.
Definition: Map.h:116
int QUESO::Map::NumMyElements ( ) const

Returns the number of elements owned by the calling processor.

Definition at line 107 of file Map.C.

References m_numMyElements.

Referenced by QUESO::GslVector::GslVector(), and QUESO::GslVector::sizeLocal().

108 {
109 #ifdef QUESO_HAS_TRILINOS
110  return m_epetraMap->NumMyElements();
111 #else
112  return m_numMyElements;
113 #endif
114 }
int m_numMyElements
Number of elements owned by the calling processor.
Definition: Map.h:122
Map & QUESO::Map::operator= ( const Map rhs)

Assignment operator.

Definition at line 76 of file Map.C.

References copy().

77 {
78  this->copy(rhs);
79  return *this;
80 }
void copy(const Map &src)
Copies the map.
Definition: Map.C:146

Member Data Documentation

int QUESO::Map::m_indexBase
private

Base integer value for indexed array references.

Definition at line 119 of file Map.h.

Referenced by copy(), and IndexBase().

MpiComm QUESO::Map::m_MpiComm
private

This communicator can be queried for processor rank and size information.

Definition at line 109 of file Map.h.

Referenced by Comm(), and copy().

int QUESO::Map::m_numGlobalElements
private

Total number of elements across all processors.

Definition at line 116 of file Map.h.

Referenced by copy(), and NumGlobalElements().

int QUESO::Map::m_numMyElements
private

Number of elements owned by the calling processor.

Definition at line 122 of file Map.h.

Referenced by copy(), and NumMyElements().


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

Generated on Thu Jun 11 2015 13:52:34 for queso-0.53.0 by  doxygen 1.8.5