[Trilinos-Users] Xpetra wrappers around existing Tpetra objects

Martin Vymazal martin.vymazal at vki.ac.be
Fri Jun 3 11:10:56 EDT 2016


Hello,

  I have an RCP pointer to Tpetra::CrsMatrix called A and I would like to 
pass this to MueLu Hierarchy object. It seems that the only option is to 
wrap A, the right-hand side vector and the vector of unknows in Xpetra 
RCP pointers. The following compiles (I found a similar code in the 
MueLU tutorial):

   Teuchos::RCP<Xpetra::CrsMatrix<>> exA = Teuchos::rcp(new 
Xpetra::TpetraCrsMatrix<>(A));
   Teuchos::RCP<Xpetra::CrsMatrixWrap<>> exAWrap = Teuchos::rcp(new 
Xpetra::CrsMatrixWrap<>(exA));
   RCP<Xpetra::Matrix<>> xpetra_A = 
Teuchos::rcp_dynamic_cast<Xpetra::Matrix<>>(exAWrap);

   MueLu::Hierarchy<Scalar, LocalOrdinal, GlobalOrdinal> H(xpetra_A);
   H.SetDefaultVerbLevel(MueLu::Medium);

Could you please confirm that the first line only creates a shallow copy 
of A? Is there any easier/more correct/more elegant way of constructing 
xpetra_A? I'm also stuck at this point, because now I need Xpetra-style 
pointers to the map that was used to construct (Tpetra) A in order to 
construct Xpetra-style right-hand side multivector (or pointer to it). 
How do I get Xpetra vectors from Tpetra vectors, given the fact that the 
map of A is a Tpetra map?

Thank you for your help.

  Martin

P. S. MueLu looks interesting, but the documentation (especially the 
Xpetra part) could be a bit more extensive ... It looks like there's a 
lot of attention paid to users who migrate from Epetra to Tpetra, but 
what about those, who already have codebase which is exclusively 
Tpetra-based? Are they supposed to move everything to Xpetra in order to 
be able to use MueLu?


More information about the Trilinos-Users mailing list