queso-0.51.1
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 ()
 Default constructor. Do not call this directly. More...
 
 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

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 ( )

Default constructor. Do not call this directly.

Definition at line 34 of file Map.C.

References UQ_FATAL_TEST_MACRO, and QUESO::UQ_UNAVAILABLE_RANK.

35  :
36  m_MpiComm() // *(new MpiComm()) )
37 {
40  "Map::constructor()",
41  "should not be called");
42 }
const int UQ_UNAVAILABLE_RANK
Definition: Defines.h:74
MpiComm m_MpiComm
This communicator can be queried for processor rank and size information.
Definition: Map.h:109
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
QUESO::Map::Map ( int  numGlobalElements,
int  indexBase,
const MpiComm comm 
)

Constructor for a uniform linear distribution of elements.

Definition at line 45 of file Map.C.

49  :
50  m_MpiComm (comm),
51 #ifdef QUESO_HAS_TRILINOS
52  m_epetraMap ( new Epetra_Map(numGlobalElements,0,comm.epetraMpiComm()) )
53 #else
54  m_numGlobalElements(numGlobalElements),
55  m_indexBase (indexBase),
56  m_numMyElements (numGlobalElements)
57 #endif
58 {
59 }
int m_indexBase
Base integer value for indexed array references.
Definition: Map.h:119
int m_numMyElements
Number of elements owned by the calling processor.
Definition: Map.h:122
MpiComm m_MpiComm
This communicator can be queried for processor rank and size information.
Definition: Map.h:109
int m_numGlobalElements
Total number of elements across all processors.
Definition: Map.h:116
QUESO::Map::Map ( const Map src)

Copy constructor.

Definition at line 62 of file Map.C.

References copy().

63  :
64  m_MpiComm(src.m_MpiComm)
65 #ifdef QUESO_HAS_TRILINOS
66  ,
67  m_epetraMap(NULL)
68 #endif
69 {
70  this->copy(src);
71 }
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:157
QUESO::Map::~Map ( )

Destructor.

Definition at line 74 of file Map.C.

75 {
76 #ifdef QUESO_HAS_TRILINOS
77  delete m_epetraMap;
78  m_epetraMap = NULL;
79 #else
80  // Nothing to do
81 #endif
82 }

Member Function Documentation

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

Access function for MpiComm communicator.

Definition at line 142 of file Map.C.

References m_MpiComm.

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

143 {
144  return m_MpiComm;
145 }
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 157 of file Map.C.

References m_indexBase, m_MpiComm, m_numGlobalElements, and m_numMyElements.

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

158 {
159  m_MpiComm = src.m_MpiComm;
160 #ifdef QUESO_HAS_TRILINOS
161  delete m_epetraMap;
162  m_epetraMap = new Epetra_Map(*src.m_epetraMap);
163 #else
164  m_numGlobalElements = src.m_numGlobalElements;
165  m_indexBase = src.m_indexBase;
166  m_numMyElements = src.m_numMyElements;
167 #endif
168 
169  return;
170 }
int m_indexBase
Base integer value for indexed array references.
Definition: Map.h:119
int m_numMyElements
Number of elements owned by the calling processor.
Definition: Map.h:122
MpiComm m_MpiComm
This communicator can be queried for processor rank and size information.
Definition: Map.h:109
int m_numGlobalElements
Total number of elements across all processors.
Definition: Map.h:116
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 107 of file Map.C.

References m_indexBase.

108 {
109 #ifdef QUESO_HAS_TRILINOS
110  return m_epetraMap->IndexBase();
111 #else
112  return m_indexBase;
113 #endif
114 }
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 129 of file Map.C.

130 {
131 #ifdef QUESO_HAS_TRILINOS
132  return m_epetraMap->MinMyGID();
133 #else
134  return 0;
135 #endif
136 }
int QUESO::Map::NumGlobalElements ( ) const

Returns the total number of elements across all processors.

Definition at line 96 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().

97 {
98 #ifdef QUESO_HAS_TRILINOS
99  return m_epetraMap->NumGlobalElements();
100 #else
101  return m_numGlobalElements;
102 #endif
103 }
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 118 of file Map.C.

References m_numMyElements.

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

119 {
120 #ifdef QUESO_HAS_TRILINOS
121  return m_epetraMap->NumMyElements();
122 #else
123  return m_numMyElements;
124 #endif
125 }
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 87 of file Map.C.

References copy().

88 {
89  this->copy(rhs);
90  return *this;
91 }
void copy(const Map &src)
Copies the map.
Definition: Map.C:157

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 Apr 23 2015 19:26:16 for queso-0.51.1 by  doxygen 1.8.5