LifeV
MapEpetra Class Reference

MapEpetra - Wrapper for Epetra_Map. More...

#include <MapEpetra.hpp>

+ Collaboration diagram for MapEpetra:

Private Attributes

mapPtr_Type M_repeatedMapEpetra
 
mapPtr_Type M_uniqueMapEpetra
 
exporterPtr_Type M_exporter
 
importerPtr_Type M_importer
 
commPtr_Type M_commPtr
 

Public Types

typedef Epetra_Map map_Type
 
typedef std::shared_ptr< map_TypemapPtr_Type
 
typedef MapEpetraData mapData_Type
 
typedef std::shared_ptr< std::shared_ptr< Epetra_Export > > exporterPtr_Type
 
typedef std::shared_ptr< std::shared_ptr< Epetra_Import > > importerPtr_Type
 
typedef Epetra_Comm comm_Type
 
typedef std::shared_ptr< comm_TypecommPtr_Type
 

Constructors & Destructor

 MapEpetra ()
 Empty Constructor. More...
 
 MapEpetra (Int numGlobalElements, Int numMyElements, Int *myGlobalElements, const commPtr_Type &commPtr)
 Constructor. More...
 
 MapEpetra (mapData_Type const &mapData, commPtr_Type const &commPtr)
 Constructor. More...
 
 MapEpetra (const Int numGlobalElements, const Int notUsed, const commPtr_Type &commPtr)
 Constructor. More...
 
 MapEpetra (const Int size, const commPtr_Type &commPtr)
 Constructor. More...
 
 MapEpetra (const MapEpetra &epetraMap)
 Copy constructor. More...
 
 MapEpetra (const Epetra_BlockMap &blockMap, const Int offset, const Int maxId)
 Constructor. More...
 
 ~MapEpetra ()
 Destructor. More...
 
 MapEpetra (const map_Type map)
 Constructor from raw Epetra_Map. More...
 

Operators

MapEpetraoperator= (const MapEpetra &epetraMap)
 Assignment operator. More...
 
MapEpetraoperator+= (const MapEpetra &epetraMap)
 Addition operator. More...
 
MapEpetraoperator+= (Int const size)
 Addition operator. More...
 

Methods

std::shared_ptr< MapEpetracreateRootMap (Int const root) const
 This method creates a pointer to a MapEpetra that has points only on processor root. More...
 
bool mapsAreSimilar (MapEpetra const &epetraMap) const
 This method return true if both the unique map and the repeated map are identical. More...
 
void exportToHDF5 (std::string const &fileName, std::string const &mapName="map", bool const truncate=true)
 Save the matrix into a HDF5 (.h5) file. More...
 
void importFromHDF5 (std::string const &fileName, std::string const &mapName="map")
 Read a matrix from a HDF5 (.h5) file. More...
 
void showMe (std::ostream &output=std::cout) const
 Show informations about the map. More...
 
UInt mapSize () const
 Getter for the global number of entries. More...
 
bool isOwned (const UInt globalId) const
 check if a global id is owned by the current partition More...
 

Get Methods

comm_Type const & comm () const
 Return the communicator. More...
 
commPtr_Type const & commPtr () const
 Return a shared pointer on the communicator. More...
 
commPtr_TypecommPtr ()
 
mapPtr_Type const & map (MapEpetraType mapType) const
 Return a shared pointer on the internal Epetra_Map. More...
 
Epetra_Export const & exporter ()
 Getter for the Epetra_Export. More...
 
Epetra_Import const & importer ()
 Getter for the Epetra_Import. More...
 

Set Methods

void setComm (commPtr_Type const &commPtr)
 Set the communicator. More...
 
void setMap (mapPtr_Type map, MapEpetraType mapType)
 set the internal Epetra_Maps More...
 

Private Methods

void createMap (Int numGlobalElements, Int numMyElements, Int *myGlobalElements, const comm_Type &comm)
 Create a map. More...
 
mapPtr_Type const & getRepeatedMap () const
 Getter for the repeated map. More...
 
mapPtr_Type const & getUniqueMap () const
 Getter for the unique map. More...
 
void uniqueMap ()
 Reset the internal unique map and recompute it using the repeated map. More...
 
void createImportExport ()
 Reset and rebuild the importer and exporter for the map. More...
 
void bubbleSort (Epetra_IntSerialDenseVector &elements)
 Sort the element given using a bubble sort algorithm. More...
 

Detailed Description

MapEpetra - Wrapper for Epetra_Map.

Author
Gilles Fourestey gille.nosp@m.s.fo.nosp@m.urest.nosp@m.ey@e.nosp@m.pfl.c.nosp@m.h
Simone Deparis simon.nosp@m.e.de.nosp@m.paris.nosp@m.@epf.nosp@m.l.ch
Gwenol Grandperrin gweno.nosp@m.l.gr.nosp@m.andpe.nosp@m.rrin.nosp@m.@epfl.nosp@m..ch

The MapEpetra class provides a general interface for the Epetra_Map class of Trilinos.

Visit http://trilinos.sandia.gov for more informations about Epetra_Map.

Definition at line 72 of file MapEpetra.hpp.

Member Typedef Documentation

◆ map_Type

typedef Epetra_Map map_Type

Definition at line 79 of file MapEpetra.hpp.

◆ mapPtr_Type

typedef std::shared_ptr<map_Type> mapPtr_Type

Definition at line 80 of file MapEpetra.hpp.

◆ mapData_Type

Definition at line 82 of file MapEpetra.hpp.

◆ exporterPtr_Type

typedef std::shared_ptr< std::shared_ptr<Epetra_Export> > exporterPtr_Type

Definition at line 89 of file MapEpetra.hpp.

◆ importerPtr_Type

typedef std::shared_ptr< std::shared_ptr<Epetra_Import> > importerPtr_Type

Definition at line 90 of file MapEpetra.hpp.

◆ comm_Type

typedef Epetra_Comm comm_Type

Definition at line 93 of file MapEpetra.hpp.

◆ commPtr_Type

typedef std::shared_ptr<comm_Type> commPtr_Type

Definition at line 94 of file MapEpetra.hpp.

Constructor & Destructor Documentation

◆ MapEpetra() [1/8]

MapEpetra ( )

Empty Constructor.

Definition at line 53 of file MapEpetra.cpp.

+ Here is the caller graph for this function:

◆ MapEpetra() [2/8]

MapEpetra ( Int  numGlobalElements,
Int  numMyElements,
Int myGlobalElements,
const commPtr_Type commPtr 
)

Constructor.

To define a linear map, set MyGlobalElements = 0

Parameters
numGlobalElementsNumber of global elements
numMyElementsNumber of local elements
myGlobalElementsArray of Id of the local element
commPtrPointer to the communicator

Definition at line 60 of file MapEpetra.cpp.

◆ MapEpetra() [3/8]

MapEpetra ( mapData_Type const &  mapData,
commPtr_Type const &  commPtr 
)

Constructor.

To define a linear map, set MyGlobalElements = 0

Parameters
mapDataStructure containing Ids for the local Unique and Repeated map
commPtrPointer to the communicator

Definition at line 74 of file MapEpetra.cpp.

+ Here is the caller graph for this function:

◆ MapEpetra() [4/8]

MapEpetra ( const Int  numGlobalElements,
const Int  notUsed,
const commPtr_Type commPtr 
)

Constructor.

Definition at line 93 of file MapEpetra.cpp.

+ Here is the caller graph for this function:

◆ MapEpetra() [5/8]

MapEpetra ( const Int  size,
const commPtr_Type commPtr 
)

Constructor.

Parameters
sizeSize of the map
commPtrPointer to the communicator

Definition at line 113 of file MapEpetra.cpp.

+ Here is the caller graph for this function:

◆ MapEpetra() [6/8]

MapEpetra ( const MapEpetra epetraMap)

Copy constructor.

Parameters
epetraMapAn MapEpetra object

Definition at line 429 of file MapEpetra.cpp.

+ Here is the caller graph for this function:

◆ MapEpetra() [7/8]

MapEpetra ( const Epetra_BlockMap &  blockMap,
const Int  offset,
const Int  maxId 
)

Constructor.

Builds a submap of map _epetraMap with a given positive offset and the maximum id to consider

e.g:

  1. offset = 2,
  2. maxid = 6
  3. epetraMap = [ 0 2 5 7 8 10 1 ]
  4. this = [ 0 3 5 6 ]
Parameters
blockMapEpetra_BlockMap
offsetOffset to be used to build the map
maxIdMaximum Id

Definition at line 154 of file MapEpetra.cpp.

+ Here is the caller graph for this function:

◆ MapEpetra() [8/8]

MapEpetra ( const map_Type  map)
private

Constructor from raw Epetra_Map.

This constructor should be used only inside this class, therefore it is private

Parameters
mapunderlying Epetra_Map

Definition at line 147 of file MapEpetra.cpp.

+ Here is the caller graph for this function:

◆ ~MapEpetra()

~MapEpetra ( )
inline

Destructor.

Definition at line 183 of file MapEpetra.hpp.

Member Function Documentation

◆ operator=()

MapEpetra & operator= ( const MapEpetra epetraMap)

Assignment operator.

The assignment operator will copy the pointers of the maps, exporter and importer

Parameters
epetraMapMapEpetra to be assigned to the current matrix

Definition at line 184 of file MapEpetra.cpp.

+ Here is the caller graph for this function:

◆ operator+=() [1/2]

MapEpetra & operator+= ( const MapEpetra epetraMap)

Addition operator.

The addition operator combines two map together

Parameters
epetraMapMapEpetra to be combined with the current map

Definition at line 198 of file MapEpetra.cpp.

+ Here is the caller graph for this function:

◆ operator+=() [2/2]

MapEpetra & operator+= ( Int const  size)

Addition operator.

The addition operator create a map of size "size" and add it to the current map to create a new map

Parameters
sizeSize of the map to be added to the current map

Definition at line 258 of file MapEpetra.cpp.

+ Here is the caller graph for this function:

◆ createRootMap()

std::shared_ptr< MapEpetra > createRootMap ( Int const  root) const

This method creates a pointer to a MapEpetra that has points only on processor root.

Parameters
rootprocessor on which to export all the points

Definition at line 272 of file MapEpetra.cpp.

◆ mapsAreSimilar()

bool mapsAreSimilar ( MapEpetra const &  epetraMap) const

This method return true if both the unique map and the repeated map are identical.

Definition at line 278 of file MapEpetra.cpp.

◆ exportToHDF5()

void exportToHDF5 ( std::string const &  fileName,
std::string const &  mapName = "map",
bool const  truncate = true 
)

Save the matrix into a HDF5 (.h5) file.

Parameters
fileNameName of the file where the map will be saved, without extension (.h5)
mapNameName of the map in the HDF5 file
truncateTrue if the file has to be truncated; False if the file already exist and should not be truncated

Definition at line 291 of file MapEpetra.cpp.

◆ importFromHDF5()

void importFromHDF5 ( std::string const &  fileName,
std::string const &  mapName = "map" 
)

Read a matrix from a HDF5 (.h5) file.

Parameters
fileNameName of the file where the map will be saved, without extension (.h5)
matrixNameName of the map in the HDF5 file

Definition at line 325 of file MapEpetra.cpp.

◆ showMe()

void showMe ( std::ostream &  output = std::cout) const

Show informations about the map.

Definition at line 361 of file MapEpetra.cpp.

◆ mapSize()

UInt mapSize ( ) const
inline

Getter for the global number of entries.

Definition at line 247 of file MapEpetra.hpp.

◆ isOwned()

bool isOwned ( const UInt  globalId) const
inline

check if a global id is owned by the current partition

Definition at line 253 of file MapEpetra.hpp.

◆ comm()

comm_Type const& comm ( ) const
inline

Return the communicator.

Definition at line 264 of file MapEpetra.hpp.

◆ commPtr() [1/2]

commPtr_Type const& commPtr ( ) const
inline

Return a shared pointer on the communicator.

Definition at line 270 of file MapEpetra.hpp.

◆ commPtr() [2/2]

commPtr_Type& commPtr ( )
inline

Definition at line 274 of file MapEpetra.hpp.

+ Here is the caller graph for this function:

◆ map()

const MapEpetra::mapPtr_Type & map ( MapEpetraType  mapType) const

Return a shared pointer on the internal Epetra_Map.

Definition at line 373 of file MapEpetra.cpp.

◆ exporter()

const Epetra_Export & exporter ( )

Getter for the Epetra_Export.

Definition at line 385 of file MapEpetra.cpp.

◆ importer()

const Epetra_Import & importer ( )

Getter for the Epetra_Import.

Definition at line 394 of file MapEpetra.cpp.

+ Here is the caller graph for this function:

◆ setComm()

void setComm ( commPtr_Type const &  commPtr)

Set the communicator.

Definition at line 407 of file MapEpetra.cpp.

+ Here is the caller graph for this function:

◆ setMap()

void setMap ( mapPtr_Type  map,
MapEpetraType  mapType 
)

set the internal Epetra_Maps

Definition at line 414 of file MapEpetra.cpp.

+ Here is the caller graph for this function:

◆ createMap()

void createMap ( Int  numGlobalElements,
Int  numMyElements,
Int myGlobalElements,
const comm_Type comm 
)
private

Create a map.

Note: createMap does not call createImportExport

Parameters
numGlobalElementsNumber of global elements of the map
numMyElementsnumber of local element
myGlobalElementsArray of Id of the global elements of the map
commCommunicator

Definition at line 434 of file MapEpetra.cpp.

◆ getRepeatedMap()

mapPtr_Type const& getRepeatedMap ( ) const
inlineprivate

Getter for the repeated map.

Definition at line 319 of file MapEpetra.hpp.

+ Here is the caller graph for this function:

◆ getUniqueMap()

mapPtr_Type const& getUniqueMap ( ) const
inlineprivate

Getter for the unique map.

Definition at line 325 of file MapEpetra.hpp.

+ Here is the caller graph for this function:

◆ uniqueMap()

void uniqueMap ( )
private

Reset the internal unique map and recompute it using the repeated map.

Definition at line 454 of file MapEpetra.cpp.

+ Here is the caller graph for this function:

◆ createImportExport()

void createImportExport ( )
private

Reset and rebuild the importer and exporter for the map.

Definition at line 462 of file MapEpetra.cpp.

+ Here is the caller graph for this function:

◆ bubbleSort()

void bubbleSort ( Epetra_IntSerialDenseVector &  elements)
private

Sort the element given using a bubble sort algorithm.

Parameters
elementsEpetra_IntSerialDenseVector vector to be sorted

Definition at line 481 of file MapEpetra.cpp.

Field Documentation

◆ M_repeatedMapEpetra

mapPtr_Type M_repeatedMapEpetra
private

Definition at line 344 of file MapEpetra.hpp.

◆ M_uniqueMapEpetra

mapPtr_Type M_uniqueMapEpetra
private

Definition at line 345 of file MapEpetra.hpp.

◆ M_exporter

exporterPtr_Type M_exporter
private

Definition at line 346 of file MapEpetra.hpp.

◆ M_importer

importerPtr_Type M_importer
private

Definition at line 347 of file MapEpetra.hpp.

◆ M_commPtr

commPtr_Type M_commPtr
private

Definition at line 348 of file MapEpetra.hpp.


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