[Trilinos-Users] Handling of ghosts in distributed vectors

Bartlett, Roscoe A. bartlettra at ornl.gov
Fri Apr 19 16:07:55 MDT 2013


Bart,


[1] http://trilinos.sandia.gov/packages/docs/r11.2/packages/thyra/doc/html/group__Epetra__Thyra__Op__Vec__adapters__grp.html#ga1f3b0bf703c3b35237bac513b3ff5e21

Thank you very much for your very extensive and clear answer! I do have one more question about converting to Thyra:
The docs for Thyra::create_Vector [1]  state that a copy is created, but looking at the code and running some tests suggests this is not the case, and it is just a view.
[Bartlett, Roscoe A.] Sorry about that.  The documentation says "The returned RCP object contains a copy of the input RCP<Epetra_Vector> wrapped Epetra_Vector object".  It does copy the RCP which does *not* copy the Epetra_Vector object (it just increments the reference count).  While technically correct, this is misleading.  I will fix this.
The docs also mention that modifications are not guaranteed to propagate until the Thyra copy is destroyed, but this also appears to be unnecessary.
[Bartlett, Roscoe A.] That statement is meant to allow flexibility in future implementations consistent with the "Generalized View Design Pattern".  This idiom is explained in Section 5.13.4  in:
    http://www.ornl.gov/~8vt/TeuchosMemoryManagementSAND.pdf
However, it is hard to see why the implementation would ever create a copy of contiguous vector data when you don't have to.  The documentation should point to this reference (which was written years after this code and documentation was written).
Thanks for reading the documentation!
Note that in your use-case of creating an Epetra_Vector view of an std::vector's data, if you dynamically allocate the std::vector, you can attach it to the RCP for the Epetra_Vector and make it memory safe to all use cases.  Details are in the above document in sections 5.9.4 and 5.9.5.  This would allow you to "carry" the std::vector along with the associated Epetra_Vector view object so that you would not have to keep track of it, just grab it when you need it.  Just a suggestion.
Cheers,
-Ross

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20130419/3eb7ee60/attachment.html 


More information about the Trilinos-Users mailing list