[Trilinos-Users] tpetra::crsmatrix -> xpetra::matrix

Bartlett, Roscoe A. bartlettra at ornl.gov
Thu Oct 29 07:09:04 EDT 2015


As these are “persisting relationships”, they have to be managed with RCP.  For an explanation and detail, see Section 4.2  “Non-persisting versus persisting and semi-persisting associations” in:


If you have any questions about this, please let me know.  Basically if we were programming in Python or Java, we would not need to use RCPs.  But we are not, so that is what you have to do for safe memory management for all use cases.


From: Trilinos-Users [mailto:trilinos-users-bounces at trilinos.org] On Behalf Of Nico Schlömer
Sent: Wednesday, October 28, 2015 8:53 PM
To: trilinos-users at trilinos.org
Subject: [Trilinos-Users] tpetra::crsmatrix -> xpetra::matrix

Can anyone please assist me with converting a `const Tpetra::CrsMatrix` into something that I can stuff into this
H->GetLevel(0)->Set("A", something);
I played around for two hours now and ended up with
  Teuchos::RCP<const Tpetra::CrsMatrix<double,int,int>> ATpetra =
  auto tmp = Xpetra::TpetraCrsMatrix<double,int,int>(ATpetra);
  auto AXpetra = Teuchos::rcpFromRef(tmp);
  auto AXpetraWrap = Teuchos::rcp(new Xpetra::CrsMatrixWrap(AXpetra));
which isn't working at all. Yikes, this is really complex.

As a side node, I would really appreciate const-reference interfaces. I find myself doing the `Teuchos::rcpFromRef()` dance all the time, only to dereference the objects later again.


PS: I would have written to the MueLu users' list, but I couldn't find it anywhere.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20151029/1f379874/attachment.html>

More information about the Trilinos-Users mailing list