[Trilinos-Users] Epetra_Vector conversion

Bartlett, Roscoe A. bartlettra at ornl.gov
Fri Oct 3 03:29:33 MDT 2014


> Thank you for your answer, we have extracted the RCP<Epetra_Vector>
> from
> the RCP<Epetra_MultiVector>, but we did not find a way to convert the
> RCP<Epetra_Vector> into a simple Epetra_Vector.
> How can we do this?

Do you need a copy or just a reference?  What are you going to do with the "simple Epetra_Vector"?

I think it might help to work through the RCP beginners guide [1] and get comfortable with the basics of using a C++ smart pointer class and how it interacts with the C++ type system.   Basically, there are objects, raw pointers, raw references, and smart pointers.  There is value semantics (i.e. deep copy), reference semantics (i.e. shallow copy), persisting relationships (i.e. Teuchos::RCP), and non-persisting relationships (i.e. raw references and Teuchos::Ptr).  One has to be comfortable with what all of this means and how the various language elements interact and how smart pointers are like raw pointers but with some key differences ([2] goes into *all* the details about how a smart pointer is different than a raw pointer in C++ and how that affects the C++ type system).  I think things will go much more smoothly once you go through the beginner guide and are comfortable with that material.



[1]  http://web.ornl.gov/~8vt/RefCountPtrBeginnersGuideSAND.pdf
[2] http://web.ornl.gov/~8vt/TeuchosMemoryManagementSAND.pdf

More information about the Trilinos-Users mailing list