[Trilinos-Users] Epetra_Map

Bertagna, Luca lbertag at emory.edu
Sat Dec 7 12:28:14 MST 2013

Hello Mike,

thanks for the quick reply. I understand what you said. I guess my point is that handling CrsGraph and CrsMatrix causes me some problem when I need to pass a map to the matrix taking it from the graph. I understand that the graph is used also by other types of matrices, which handle the case where ElementSize>1. I just thought that, if the only purpose of Epetra_Map is a safety check to make sure the size of each element is 1, then maybe it would have been easier to always use a BlockMap and, inside CrsMatrix, add a check on the ElementSize to make sure it's a valid map. This way the user would not have to bother with casting BlockMap to Map whenever he has to feed it to a CrsMatrix.

But that's just my personal opinion. =)

Thanks for your clarification!


Luca Bertagna
Math&CS, Emory University, Atlanta
From: Heroux, Mike <MHeroux at csbsju.edu>
Sent: Saturday, December 07, 2013 1:25 AM
To: Bertagna, Luca
Cc: trilinos-users at software.sandia.gov
Subject: Re: [Trilinos-Users] Epetra_Map


As you pointed out, Epetra_Map "isa" Epetra_BlockMap, with a block size of 1.  If you are only using a block size of 1, then you should just use Epetra_Map.  Doing this should make your code much simpler.  So when you are working with Epetra_CrsGraph, just use an Epetra_Map.

In general Epetra_Map (and Epetra_BlockMap, and similar classes in Tpetra and soon Kokkos) encodes a description of the dimensions and distribution of data objects.  By encoding this information into a separate class, we can create many data objects using the same map and know that they are compatible by construction.  We can also use maps to create redistributions of data objects, and a few other things.

In straightforward use cases, the map may seem like unnecessary overhead, but even in these cases, the maps are being used by underlying functionality to improve correct and efficient behavior.

Epetra_CrsGraph uses Epetra_BlockMap because it serves as the graph class for both Epetra_Map and Epetra_BlockMap based object.  For example, Epetra_CrsMatrix and Epetra_VbrMatrix both use Epetra_CrsGraph.

I hope this helps.


On Dec 7, 2013, at 1:20 AM, "Bertagna, Luca" <lbertag at emory.edu<mailto:lbertag at emory.edu>> wrote:


I've been using the epetra package for a while, but I still don't understand what's the point of Epetra_Map. I understand it's a map where the element size is equal to 1, but I don't get why Epetra_CrsMatrix uses it when Epetra_CrsGraph does not. Calling the method FillComplete in CrsMatrix is always a pain, cause I need to cast the BlockMap of the graph into a Map. I guess my question is, if the underlying graph does not use Epetra_Map but uses Epetra_BlockMap instead, why can't Epetra_CrsMatrix just use Epetra_BlockMap as well?


Luca Bertagna
Math&CS, Emory University, Atlanta
Trilinos-Users mailing list
Trilinos-Users at software.sandia.gov<mailto:Trilinos-Users at software.sandia.gov>

More information about the Trilinos-Users mailing list